Jump to content
IGNORED

Integrated Assembler into PreCompiler (MLC unchanged)


moulinaie

Recommended Posts

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.

post-31118-0-63976400-1324977897_thumb.jpg

post-31118-0-95064900-1324977907_thumb.jpg

Link to comment
Share on other sites

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

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...