I have added an integrated assembler into the PreCompiler. So now, there's no limit to what you can do with it.
Some examples...
If you want to access a function that was not included into MLC, you can now do it.
For example, the GPLLNK entry provides a strange function >3b that reverses a byte that can be used to get a mirror image of every character on screen. I wrote a little program to reverse the 26 upper case letters:
100 CALL CLEAR:: DIM A$(50)
$MLC F 110 10 3000
300 CALL LINK("MIRROR")
310 GOTO 310
$MIRROR
HIGHMEM 0
DIMTABLE C 66 ; buffer of 66 bytes
LET A 1288 ; vdp address for Chr$(65) definition = 8*(96+65)
LET B 208 ; number of bytes for whole alphabet (26*8)
BMOVE &h8300,66,C ; save bytes used by GPLLNK
$[ ; enter assembler
li r0,fac ; fac = >834a, where to write input parameters
mov @a,*r0+ ; vdp address
mov @b,*r0 ; and byte count
blwp @gpllnk ; call sys routine
data >003b ; 3B = reverse bytes in VDP
$] ; exit assembler
BMOVE C,66,&h8300 ; restore zone used
$$ ; back to XB
$END
(see thumnails for the result of execution!)
You can see how assembler and the PreCompiler are interfaced as the instruction
mov @a,*r0+tells the assembler to take the value of variable A and store it into memory pointed by R0.
Other ideas, if speed is your main concern, then you can optimize MLC by changing some instructions.
For example, if you want to add a constant to a variable:
ADD E 32This is assembled (for internal GOOD reasons!) as:
li r0,32 add r0,@e
Two instructions and 8 bytes of code! So now, you can use directly in the PreCompiler:
$[ ai @e,32 $]
That will use only one instruction and 4 bytes of code.
You can imagine more optimizations, for example the use of INCT or DECT (increment or decrement by two) that are not known by MLC, or work with unsigned words from 0 to 65535 using "logical" comparisons and not arithmetic ones.
I must do some testing first, and this will be version 1.10 of the PreCompiler.
Guillaume.















