flat assembler
Message board for the users of flat assembler.

Index > DOS > Link files and far calls <coming from MASM>

Author
Thread Post new topic Reply to topic
Marco Leise



Joined: 19 Apr 2005
Posts: 5
Marco Leise
Could someone tell me how I write to ASM files in FASM where the first one calls far procedures from another one?
I just look for something like:
Code:
MAIN.ASM:
segment main use16
call far printABC
mov ax, 4C00h
int 21h

SUB.ASM:
segment subroutines use16
printABC:
mov ah, 2
mov dl, 'A'
int 21h
mov dl, 'B'
int 21h
mov dl, 'C'
int 21h
ret    


What is the correct syntax to:
    make the label 'printABC' known to FASM in Main.asm?
    link both files together?
Post 19 Apr 2005, 14:57
View user's profile Send private message ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
why not use include 'sub.asm' directive, and/or make printabc a procedure?

...
...
call printabc
...
...


proc printabc
...
...
...
endp
Post 19 Apr 2005, 19:50
View user's profile Send private message Reply with quote
Marco Leise



Joined: 19 Apr 2005
Posts: 5
Marco Leise
Thanks for replying, but the point is I'm a student and we are ment to use far calls to other segments. Also proc is not a FASM keyword, is it? How would I do this in plain FASM syntax?
Can I also link object files into the program so i do not always have to include them?
Post 20 Apr 2005, 06:15
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7796
Location: Kraków, Poland
Tomasz Grysztar
Raw solution without any macros:

SUB.ASM:
Code:
segment subroutines use16 
printABC: 
mov ah, 2 
mov dl, 'A' 
int 21h 
mov dl, 'B' 
int 21h 
mov dl, 'C' 
int 21h 
retf    


MAIN.ASM:
Code:
format MZ
entry main:start

segment main use16 
start:
call far subroutines:printABC 
mov ax, 4C00h 
int 21h

include 'SUB.ASM'    
Post 20 Apr 2005, 10:49
View user's profile Send private message Visit poster's website Reply with quote
Marco Leise



Joined: 19 Apr 2005
Posts: 5
Marco Leise
Clear and sharp! Now I get it. With the include directive, linking two seperate files is like cutting paper with a chainsaw.
Post 20 Apr 2005, 17:06
View user's profile Send private message ICQ Number 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.