🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1823

Calling .ASM from .C ?

#1823
From: Thomas Dwyer III
Date: Wed, 08 Aug 1990 22:46
50 lines
1625 bytes
Hi there.  I have RTFM many times over and still cannot grasp the idea of
how to call an assembly procedure from Turbo C (I have TC v1.5 & MASM 5.1).
Suppose I have two trivial programs, TEST.C and HELLO.ASM as follows:

TEST.C
------

extern hello();

main()
{
       hello();
}


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

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

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

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

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

_text  ends
       end             start


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.

Thanks,
Thomas Dwyer III                            TOMIII   @ MTUS5.BITNET
Network Programmer                          DWYERIII @ MTUS5.BITNET
Computing Technology Services
Michigan Technological University
Technical Details
Message-ID: <90220.174648TOMIII@MTUS5.BITNET>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!rutgers!psuvax1!psuvm!cunyvm!mtus5!tomiii

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!rutgers!psuvax1!psuvm!cunyvm!mtus5!tomiii
From: TOMIII@MTUS5.BITNET (Thomas Dwyer III)
Newsgroups: comp.os.msdos.programmer
Subject: Calling .ASM from .C ?
Message-ID: <90220.174648TOMIII@MTUS5.BITNET>
Date: 8 Aug 90 22:46:48 GMT
Organization: Computing Technology Services, Michigan Technological Univ.
Lines: 50