I have moved the runtime library to codepage 3 (600h - 7FFh)
to allow more compiled code. The DIV, MOD and MUL routines
are now conditionally assembled (others could be as well, but
these may call each other). Having the runtime library in page 3
allows it to moved down into page 3 until SASM generates an out
of memory error. The compiled code may enter page 3 as long as
there is space.
Like James suggested I now load M and W immediately with return address,
this saves a word for each call to a C function.
Unfortunately, it is not possible to make a macro decide wether to use
jmp label or jmp @label, due to forward referenced labels. So all jumps
are jmp @label.
The generated SASM source has 3 areas:
rcsc_sx28_16_header.inc· start of SASM source
generated SASM source from C file
rcsc_sx28_16_runtime.inc· runtimes
Just run mktest16.bat to generate test16.src from test.c
Comments
1. I use the secret instructions to jump to a 'C' function and to return
from it. See the callf and return runtime routines. By jumping the sx call
stack is not used and thus there is no 8-level limit on nested calls.
The limit is now dictated by available stack space. I also use the secret
fifo to save the virtual registers during an interrupt.
2. Yes, there are no page issues as all calls are only to runtime entries,
and these are all in the lower half of page 0.
3. You can include source code as comments but it requires the rcsc compiler
to be adapted and recompiled.·I have been concentrating on getting the
best possible macro file. Adapting the rcsc source should also increase
the size of functionnames (now only 8 chars are used). I also noted that
any compare between the primary and secondary register, is followed
by a test wether the primary register (which holds the boolean result) is
zero or not. The Z flag is already set by·the compare, so that could be
optimized (saves two words on every compare).
4. What macro specific do you refer to? It is quite possible to use ifdef
statements to assemble or not a speciifc runtime routine.
5. You can send the doc to my email address.
regards peter
to allow more compiled code. The DIV, MOD and MUL routines
are now conditionally assembled (others could be as well, but
these may call each other). Having the runtime library in page 3
allows it to moved down into page 3 until SASM generates an out
of memory error. The compiled code may enter page 3 as long as
there is space.
Like James suggested I now load M and W immediately with return address,
this saves a word for each call to a C function.
Unfortunately, it is not possible to make a macro decide wether to use
jmp label or jmp @label, due to forward referenced labels. So all jumps
are jmp @label.
The generated SASM source has 3 areas:
rcsc_sx28_16_header.inc· start of SASM source
generated SASM source from C file
rcsc_sx28_16_runtime.inc· runtimes
Just run mktest16.bat to generate test16.src from test.c
regards peter