Article View: comp.os.msdos.programmer
Article #1852Calling .ASM from .C ?
From: David Deitch
Date: Sat, 11 Aug 1990 01:19
Date: Sat, 11 Aug 1990 01:19
78 lines
2239 bytes
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
Technical Details
Message-ID:
<149.26C35F87@gisatl.FIDONET.ORG>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!mephisto!gatech!galbp!gisatl!davidShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!mephisto!gatech!galbp!gisatl!david From: david@gisatl.FIDONET.ORG (David Deitch) Newsgroups: comp.os.msdos.programmer Subject: Calling .ASM from .C ? Message-ID: <149.26C35F87@gisatl.FIDONET.ORG> Date: 11 Aug 90 01:19:55 GMT Organization: Galaxy Information System (GIS) 1:133/411 Atlanta, Ga Lines: 78