flat assembler
Message board for the users of flat assembler.

Index > Windows > equivalent fasm code

Author
Thread Post new topic Reply to topic
ISP



Joined: 13 Jan 2014
Posts: 1
ISP 13 Jan 2014, 20:07
hello every body, how can i edit following very simple assembly example
that run with fasm and work in windows 8.1 without dosBox.('Shocked')

PAGE 110,100
TITLE 'EXAMPLE1.ASM' add two ASCII
;-----------------------------------------------
; Defining segment of program
; ---------------------------
CODESG SEGMENT
ASSUME SS:CODESG,DS:CODESG,CS:CODESG
ORG 100H
START: JMP MAIN ;1-Jump over data
;
; 1- Define data
; --------------
DATA1 DB 35H
DATA2 DB 32H
DATA3 DB ?
;
; 2- The rest of instructions
; ---------------------------
MAIN PROC NEAR
MOV BL,DATA1 ;2- Move 35h to BL
SUB BL,30H ;3- Change to binary
MOV AL,DATA2 ;4- Move 32 to AL
SUB AL,30H ;5- Change to binary
ADD AL,BL ;6- Add BL to AL
MOV DATA3,AL ;7- Store sum in DATA3
;
MOV AX,4C00H ;8- End of
INT 21H ;9- processing
MAIN ENDP ; End of procedure
CODESG ENDS ; End of segment
END START ; End of program
[/code]


Description:
Download
Filename: EXAMPLE1.ASM
Filesize: 953 Bytes
Downloaded: 232 Time(s)

Post 13 Jan 2014, 20:07
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 14 Jan 2014, 08:50
ISP,
Code:
;;; PAGE 110,100
;;; TITLE 'EXAMPLE1.ASM' add two ASCII
;;; ;-----------------------------------------------
;;; ; Defining segment of program
;;; ; ---------------------------
;;; CODESG SEGMENT
;;; ASSUME SS:CODESG,DS:CODESG,CS:CODESG
ORG 100H
START: JMP MAIN ;1-Jump over data
;
; 1- Define data
; --------------
DATA1 DB 35H
DATA2 DB 32H
DATA3 DB ?
;
; 2- The rest of instructions
; ---------------------------

;;; 'proc'/'endp' aren't needed, define only 'MAIN' label
;;; MAIN PROC NEAR
MAIN:
;;; Note the following []s around data labels

MOV BL,[DATA1] ;2- Move 35h to BL
SUB BL,30H ;3- Change to binary
MOV AL,[DATA2] ;4- Move 32 to AL
SUB AL,30H ;5- Change to binary
ADD AL,BL ;6- Add BL to AL
MOV [DATA3],AL ;7- Store sum in DATA3
;
MOV AX,4C00H ;8- End of
INT 21H ;9- processing
;;; MAIN ENDP ; End of procedure
;;; CODESG ENDS ; End of segment
;;; END START ; End of program    
;;; comments either explain something or comment out the cruft. Perhaps resulting .COM would run under 32-bit Windows 8.
Post 14 Jan 2014, 08:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 14 Jan 2014, 08:56
baldr wrote:
Perhaps resulting .COM would run under 32-bit Windows 8.
I think not. Vista took care of the VDM by eliminating it. It won't be coming back. To run 16-bit code in Vista and later you will need a third party DOS emulator.
Post 14 Jan 2014, 08:56
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 14 Jan 2014, 12:21
revolution,

That's funny, I've run that prog under 16-bit debug.exe in 32-bit Windows 7 HB before posting. AFAIK VDM support was dropped in 64-bit Windows since XP.
Post 14 Jan 2014, 12:21
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1625
Location: Toronto, Canada
AsmGuru62 14 Jan 2014, 14:41
I think a simple Console app will be able to run OK.
Just it has to be recoded to use Console API.
Post 14 Jan 2014, 14:41
View user's profile Send private message Send e-mail Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 14 Jan 2014, 20:02
VDM was omitted for 64-bit Windows, supposedly long mode doesn't support v86.
Post 14 Jan 2014, 20:02
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 14 Jan 2014, 21:32
AsmGuru62,

What kind of Console API does it need? ExitProcess()? Wink
Post 14 Jan 2014, 21:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 14 Jan 2014, 22:38
baldr wrote:
revolution,

That's funny, I've run that prog under 16-bit debug.exe in 32-bit Windows 7 HB before posting. AFAIK VDM support was dropped in 64-bit Windows since XP.
Oh cool. It is not as bad as I was led to believe then. Of course my XP box still has no trouble with running DOS apps (not that I ever run DOS apps though).
Post 14 Jan 2014, 22:38
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1625
Location: Toronto, Canada
AsmGuru62 15 Jan 2014, 03:16
I missed that one.
Smile
I thought that small DOS code prints the result on console!
How one can prove that this code works?
I wish to see that 5+2=7 on console.
Otherwise, it is just moving stuff in memory.
Post 15 Jan 2014, 03:16
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.