[comp.lang.c] making COM program using assembly language with C routines ?

wei@tiger.Princeton.EDU (P Wei) (10/21/87)

I am using IBM MASM 2.0 and MSC 4.0.
The problem is that I want to make a COM program written in assembly
language in which I call some comercial library routines written in C.
The first naive intuition is the following:
_text segment byte public 'code'
_text ends
_data segment word public 'data'
_data ends
dgroup group _text, _data          ; forcing _text and _data to be
				   ; in the same segment
_text segment byte public 'code'
      assume cs:dgroup, ds:dgroup, ss:dgroup
      extrn  croutines:near
      public _main
      org 100h
_main proc near
      call _croutines
      int 20h
_main endp
_text ends
      end _main
AND this doesn't work.  The linker gave me three 'fixup overflow...'
messages.
It looks like I have to work on the start up code for MSC.
Well, can somebody give me some hints or suggestions ?
thanks
HP            wei@princeton.UUCP

rwhite@nusdhub.UUCP (10/23/87)

In article <200@tiger.Princeton.EDU>, wei@tiger.Princeton.EDU (P Wei) writes:
> I am using IBM MASM 2.0 and MSC 4.0.
> The problem is that I want to make a COM program written in assembly
> language in which I call some comercial library routines written in C.
[ Code that crashed the linker [etc] deleted.

My version of Microsoft C came with a program to make it's executables
into .COM programs.

My other question is WHY?  everythign you can do with .COM you can do
with .EXE.  The load is a fraction longer to accomidate runtime relocation
but the memory usage, speed, terminate and stay resident abilities [etc]
are all equally effective.

[This is now also true for device driver and etc.  If the program you
are writing is excessively small, the libraries are gonna grow it
without mercy, making it just as wasy to call the asm routines from
main() durring the first execution.]

Remember, the relocation information is removed durring load so the
in memory cost is comprable even though the disk space used is larger.

Rob.

wei@tiger.Princeton.EDU (P Wei) (10/23/87)

Since many people asked why COM ? Here is the reason:
I want to interface STSC APL with C.
STSC APL can call assembly language rouines in COM form.
I think I have to go through the start up code to change something
there in order to get COM program and to be called from APL.
HP             wei@princeton.UUCP

fbaube@note.nsf.GOV (10/28/87)

>My other question is WHY?  everythign you can do with .COM you can do
>with .EXE.

And, trying to make an .EXE out of a .COM is a pain.  MIX C makes
only .COM's, so I (will soon) have some monster-file management 
routines for whomever is similarly afflicted :-).