This second bit of code is designed to show us how to write a
subroutine for BASIC that is compatible with all versions of
the BASIC interpreter.
This routine will accept three parameters, adding the first two
together and then storing the sum into the third parameter.
The third parameter must be a legal variable that can accept a
value (don't specify 5, for example.)
This program can be downloaded directly as
project 2's source
or you can just look at it directly as
pretty project 2.
ML /AT /Sa /Fl PROJCT02.ASM
You should get a warning message from the linker, this time.
Something like:
LINK : warning L4055: start address not equal to 0x100
for /TINY
The warning is just because the linker believes we've told it to
produce a valid .COM file and the object file that the assembler
made just doesn't look right.
However, we're not planning on running this .COM file, because
the data in it is going into our BASIC program, instead.
So, it's no problem at all.
Once the PROJCT02.COM file has been generated, you need to convert
it into DATA statements.
I've written a short piece of BASIC code to do this for you.
Here's the
BASIC source code for the converter
program.
That program will generate a series of DATA statements into a
file for you.
You can then include those DATA statements in your program
as you see fit.
Here's my
final version
final version
of the code to test this assembly program.