🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.msdos.programmer
1 messages
1 total messages Started by David Deitch Sat, 11 Aug 1990 01:19
Calling .ASM from .C ?
#1852
Author: David Deitch
Date: Sat, 11 Aug 1990 01:19
78 lines
2239 bytes
In a message of <Aug 08 22:46> Thomas Dwyer III (TOMIII@MTUS5.BITNET ) 
writes:

     Let me preface this by saying that I work with MSC not Turbo C, 
but I believe it will still hold true.


 > TEST.C
 > ------

 > extern hello();

 > main()
 > {
 >        hello();
 > }


     Do you need the () on your external declaration?


 > HELLO.ASM
 > ---------

 > _text  segment         public
 >        org             100h
 >        assume          cs:_text,ds:_text

     Why use the org line?  That is supposed to be for when you are 
creating a .COM program, not an object file that will be linked into a 
C program.

 > start:
 >        call            _hello
 >        mov             ax,4c00h
 >        int             21h

 > msg:   db              13,10,"Hello world.",13,10,"$"

     It appears you want to run your program both ways.  I do not 
think you can do this.  It either has to be .COM (start:) or object 
(_hello).

 >        public          _hello
 > _hello proc
 >        mov             ah,9
 >        mov             dx,offset msg
 >        int             21h
 >        ret
 > _hello endp

 > _text  ends
 >        end             start


Try not using the _ in hello.  I do not in MSC.

 > The question is, how to I hack up HELLO.ASM so that I can link it 
with
 > TLINK?  Does my "hello" need to be prefixed in my "extern" 
statement?
 > I tried it both ways.  Any insight on the matter would be most 
 > appreciated.

     I just hope I am semi-accurate.  This is not my forte!

     David Deitch (GIS)
          deitch@gisatl.fidonet.org
               1:133/411@fidonet
 
 


--  
-----------------------------------------------------------------------------
David Deitch - via FidoNet node 1:133/411
UUCP: galbp!gisatl!david
INTERNET: david@gisatl.FIDONET.ORG
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads