Jump to content

Recommended Posts

Hello,

 

I have updated MLC and added this:

  • logical instructions
  • constant data initialization (tables of bytes, words, strings) (that could lead to an inline assembler...)
  • better I/O of strings through CALL LINK

And so the PreCompiler had to be upgraded too:

  • the things above from MLC
  • more pseudo-instructions

Example: N0DO / N0LOOP that can loop from N to 0 (n+1 loops)

N-1DO / N-1LOOP that can loop from N-1 to 0 (n loops)

  • The char definitions into $CHAR section can be "graphical", example:

$CHAR
$PATTERN	   ; here one char is defined
........
..00000.
.0.....0
.0000000
.0.....0
.0.....0
.0.....0
........
$$
$PATTERN	   	 	  ; here two consecutive chars are defined
........00000000
.......0.0000000
......0...000000
.....0.....00000
....0.......0000
...0.........000
..0...........00
.0.............0
$$
$$

  • The numbers can now be written in hex or bin with &H and &B prefixes.

 

To illustrate the new functions with data initialization, I have written ROMAN, a program that turns a number into a ROMAN number with letters M, D, C, L, X, V and I. The call is "CALL LINK("ROMAN",X,R$)" with X the number to convert and R$ a string with the returned value.

 

100 CALL CLEAR::DIM A$(44)
$MLC F 110 10 3000
300 INPUT "A=":A
310 CALL LINK("ROMAN",A,R$)
320 PRINT "  = ";R$
330 GOTO 300
$ROMAN
HIGHMEM 0
STARTDATA
	WORDS 1000,999,995,990,950,900  ; create a word table with values of
	WORDS 500,499,495,490,450,400   ; usable symbols or combined symbols (by pair)
	WORDS 100,99,95,90
	WORDS 50,49,45,40
	WORDS 10,9,5,4,1,0
ENDDATA A						   ; this table pointed by A (because A, B, C, D are word table pointers)
STARTDATA
	STRING "M IMVMXMLMCM"		   ; creeate a long string with symbols alone or by pair
	STRING "D IDVDXDLDCD"
	STRING "C ICVCXC"
	STRING "L ILVLXL"
	STRING "X IXV IVI "
ENDDATA E						   ; pointed by E (because E, F, G, H are byte table pointers)
DIMTABLE F 255					  ; the output string reserved here with 255 max chars
GETPARAM 1 X						; get the value to be converted in X
CLEAR K							 ; will point into output string (0 to 254)
CLEAR I							 ; points into A() (from 0 to 25, the last A(25) is null for marker)
CLEAR J							 ; points into E() string (from 0 to 49)
DO
	GETTABLE A(I) Y				 ; one value from table A() into Y
WHILE<>
	DO
		COMPARE X Y				 ; does Y fit in X?
	WHILE>=
		SUB X Y					 ; if YES, remove Y from X
		GETTABLE E(J) C			 ; get one symbol
		PUTTABLE F(K) C			 ; and put it into output string
		INC J					   ; see next
		INC K					   ; idem
		GETTABLE E(J) C			 ; get next symbol
		COMPARE C 32				; is it a SPACE? (32)
		IF<>
			PUTTABLE F(K) C		 ; if not, it's a pair, add second symbol
			INC K				   ; one more char
		ENDIF	  
		DEC J					   ; back on 1st symbol if to be repeated
	 LOOP
	 INC I						  ; if Y doesn't fit in X anymore, next value in A()
	 ADD J 2						; and next symbols in E()
 LOOP
 LET U 2							; second paramater in CALL LINK (U, V, W, X are string pointers in CALL LINK)
 LET Z K							; get lenght of string in Z
 PUTTABLE U(0) F					; return Z chars from F table to string R$ in CALL LINK
$$
$END

 

You can download things here:

MLC with a disk image with the compiler, the english manual and programs into MLC.ZIP:

http://gtello.pagesperso-orange.fr/mlc_e.htm

The PreCompiler with other sources into PRECOMPILER.ZIP:

http://gtello.pagesperso-orange.fr/precompiler.htm

 

Guillaume.

Link to comment
https://forums.atariage.com/topic/191096-lot-of-news-on-mlc-and-precompiler/
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...