Jump to content



0

Integrated Assembler into PreCompiler (MLC unchanged)


6 replies to this topic

#1 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Tue Dec 27, 2011 3:25 AM

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*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 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.

Attached Files



#2 sometimes99er ONLINE  

sometimes99er

    Stargunner

  • 1,922 posts
  • Location:Denmark

Posted Thu Dec 29, 2011 2:13 AM

Very nice. :)

#3 Lee Stewart OFFLINE  

Lee Stewart

    Chopper Commander

  • 175 posts

Posted Thu Dec 29, 2011 11:15 AM

Very nice, indeed! I may have to look into this sometime soon. Right now I'm immersed in Forth.

...lee

#4 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Sat Dec 31, 2011 3:46 AM

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.

#5 Lee Stewart OFFLINE  

Lee Stewart

    Chopper Commander

  • 175 posts

Posted Sat Dec 31, 2011 8:49 AM

View Postmoulinaie, on Sat Dec 31, 2011 3:46 AM, said:

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! :P

Quote

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! :party:

...lee

#6 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Wed Jan 4, 2012 10:12 AM

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.

#7 Lee Stewart OFFLINE  

Lee Stewart

    Chopper Commander

  • 175 posts

Posted Wed Jan 4, 2012 12:09 PM

View Postmoulinaie, on Wed Jan 4, 2012 10:12 AM, said:

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users