flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
HaHaAnonymous 21 Apr 2013, 00:53
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:00; edited 1 time in total |
|||
![]() |
|
AsmGuru62 21 Apr 2013, 12:27
This will be proper COM program:
Code: org 100h use16 ; ; COM Program begins here ; mov ax, [ValueA] add ax, [ValueB] mov [Result], ax ; ; Return to MS-DOS ; int 20h ; ; COM Data (variables) begins here ; ValueA dw 215 ValueB dw 125 Result dw ? Notice that no need to set up any segments, since COM has only one segment and loader will set all segment registers for you to that segment. You got the result of A+B, but how are you going to display it? |
|||
![]() |
|
s0s0s 21 Apr 2013, 16:20
thanks guys for you're guidance and consideration but this is exe file and that's the point because i don't know how to define stack , data and code segment in fasm and i think my book illustrate the code in masm 6.0.
|
|||
![]() |
|
AsmGuru62 21 Apr 2013, 16:45
I see.
You can find the EXE code samples for DOS in a FASM package for DOS: 1. Multi-segmented DOS EXE file: Code: ; fasm example of writing multi-segment EXE program format MZ entry main:start ; program entry point stack 100h ; stack size segment main ; main program segment start: mov ax,text mov ds,ax mov dx,hello call extra:write_text mov ax,4C00h int 21h segment text hello db 'Hello world!',24h segment extra write_text: mov ah,9 int 21h retf 2. A simple DOS EXE: Code: ; fasm example of writing simple EXE program format MZ push cs pop ds mov ah,9 mov dx,hello int 21h mov ax,4C00h int 21h hello db 'Hello world!',24h |
|||
![]() |
|
s0s0s 21 Apr 2013, 17:06
mmmmmmmmm..... in my book say that we must exactly define
the stack , data , code segment for exe file . but in you're second example you didn't something like that, is this because of fasm feature or the second example is .com file ? |
|||
![]() |
|
HaHaAnonymous 21 Apr 2013, 18:30
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:58; edited 1 time in total |
|||
![]() |
|
ACP 21 Apr 2013, 22:18
AsmGuru62 wrote: This will be proper COM program: Please note that int 20h is a legacy function and int 21h ah=4Ch should be used instead (just like in other examples). Obviously under plain MS-DOS it works but under some extended environments it might not. Just my 2 cents... |
|||
![]() |
|
AsmGuru62 22 Apr 2013, 14:56
Good point ACP, thanks.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.