[net.micro.pc] BASIC-Assembler Interface Query

MANON.R@USC-ISIB@sri-unix.UUCP (07/22/83)

From:  Richard M. Levenberg <MANON.R@USC-ISIB>

How do you interface an assembly language program written and compiled
using MASM and LINK into a basic program?  The BASIC manual seems to
cover the procedure but it doesn't work.

			Richard

jph@whuxlb.UUCP (07/27/83)

#R:sri-arpa:-339100:whuxlb:6400006:000:1217
whuxlb!jph    Jul 25 11:30:00 1983

The lastest issue of PC WORLD had an article on how to
link assembler and MACRO together. The method I use
(which works if you have at least 128K) is to create
the assembler load module with the '/HIGH' option to
load into high memory. Then use DEBUG to load the
assembly program and record the value of CS. Exit DEBUG
and load BASIC. BASIC should not overlay the assembly
program if you have enough memory.

At this point you can setup the segments in BASIC to
call the assembly program. A trick is to include an
'INT 3' at the beginning of the program to trap back
into DEBUG. The command sequence for the above would
be:

   MASM pgm;
   LINK pgm/HIGH;
   DEBUG pgm.exe
   R          ! dump out the registers
   Q
   DEBUG BASIC.COM    ! invoke with DEBUG
   G

At this point set 'DEF SEG=' to the value of CS from
the 'R' command above and go to it. DEBUG will be
called (via the INT 3) in your program and you are
there.

If you don't have enough memory, the article in PC
WORLD shows how to create a '.COM' module that has the
correct 7 byte header to be loaded via the BLOAD
command in BASIC. If BASIC is invoked under DEBUG, the
INT 3 will be handled correctly.

Jim Holtman
..harpo!whlmos!jph
(201) 361-3395