moulinaie Posted December 27, 2011 Share Posted December 27, 2011 Hi, 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* 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 32 This 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. Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted December 29, 2011 Share Posted December 29, 2011 Very nice. Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted December 29, 2011 Share Posted December 29, 2011 Very nice, indeed! I may have to look into this sometime soon. Right now I'm immersed in Forth. ...lee Quote Link to comment Share on other sites More sharing options...
moulinaie Posted December 31, 2011 Author Share Posted December 31, 2011 Lee, Go on with Forth (I love this language too!) I'm totally rewritting the MLC english manual to incorporate everything concerning the PreCompiler with its assembler. I'll post a note here when the work is on my pages. Don't drink too much tonight! Guillaume. Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted December 31, 2011 Share Posted December 31, 2011 Lee, Go on with Forth (I love this language too!) I'm totally rewritting the MLC english manual to incorporate everything concerning the PreCompiler with its assembler. I'll post a note here when the work is on my pages. Wow---an MLC tickler! Thanks! Don't drink too much tonight! Guillaume. Going tonight to friends' house, overlooking the Baltimore Inner Harbor, to watch fireworks and, you guessed it, eat and drink in the New Year. Staying overnight, so drinking too much is a distinct possibility with unlikely harm to anyone but Yours Truly! Happy New Year! ...lee Quote Link to comment Share on other sites More sharing options...
moulinaie Posted January 4, 2012 Author Share Posted January 4, 2012 Hi, I took some time to modify my pages: * now only one MLC.ZIP file containing everything (compiler, precompiler, examples, disk images) * now only one PDF file with the complete manual for both MLC and PreCompiler Everything is up to date with Speech and the Inline Assembler. Page: http://gtello.pagesperso-orange.fr/mlc_e.htm Guillaume. Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted January 4, 2012 Share Posted January 4, 2012 Hi, I took some time to modify my pages: * now only one MLC.ZIP file containing everything (compiler, precompiler, examples, disk images) * now only one PDF file with the complete manual for both MLC and PreCompiler Everything is up to date with Speech and the Inline Assembler. Page: http://gtello.pagesp...ge.fr/mlc_e.htm Guillaume. You don't mess around! I'll have to crank up my editing of the TI Forth Instruction Manual. ...lee Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.