Table of Contents
CMM2 Converting older MMBASIC programs
Tips on converting code from older versions of MMBASIC, e.g. the version for the original Colour Maximite, to the CMM2's current version.
Language References
The current CMM2 MMBASIC manual is at https://geoffg.net/maximite.html
Some of the older versions to convert from:
older CMM2 manuals:
https://geoffg.net/Downloads/Maximite/CMM2_Archive/
original Colour Maximite:
https://geoffg.net/OriginalColourMaximite.html
Monochrome Maximite:
https://geoffg.net/MonoMaximite.html
Different variable names by type
Many old programs re-use variables with different types. e.g. A and A$. Modern versions of MMBasic (V5 onwards) don't allow this so that is the first thing to fix. e.g they could be A and AStr$ instead.
Old:
DIM A DIM A$ A=1.6 A$="Hello" PRINT A$
New:
DIM A DIM AStr$ A=1.6 AStr$="Hello" PRINT AStr$
For porting space invaders, where there were these two variables:
Dim InvLine(5) Dim InvLine$(5)
I (capsikin) added an S for the second one, making it Dim InvLineS$(5) Then copied
InvLineS$
and searched for InvLine$, pressed Ctrl-V to replace it, pressed Right Arrow to move to the next instance, replaced that, and so on.
OPTION LEGACY, and PIXEL, LINE, BOX and CIRCLE
You can use OPTION LEGACY ON at the start of a program to continue using the old syntax for the graphics commands: PIXEL, LINE, BOX and CIRCLE. or you can change the code for the new syntax.
LINE and BOX
There was discussion about the LINE / Box command in this thread, along with a BASIC SUB version that used similar arguments to the old version.
http://www.thebackshed.com/forum/ViewTopic.php?TID=12562&PID=152617#152617
MODE
The MODE command has different syntax, and different modes.
Old syntax is
MODE mode
(and optional argument, palette) New syntax is
MODE resolution, bits
(and 2 more optional arguments). Setting bits as 8 is the minimum, and plenty more than the old modes.
The old Colour Maximite, modes 1,2,3 have resolution 480 x 432 pixels, which you can match with mode resolution 4 in the Colour Maximite 2. The old Colour Maximite, mode 4 has resolution 240 x 216 pixels, which you can match with mode resolution 5 in the Colour Maximite 2.
But a different mode may work better in some cases, as the new mode resolution 1 (800×600), 2 (640×400) and 3 (320×200) align properly with the the expected pixel locations of modern LCD displays. The other modes may appear to have uneven pixel sizes.
LOCATE
The space invaders game port had a LOCATE SUB to be compatible with the version in older MMBASIC
sub locate x,y print @(x,y); end sub
Fonts
discussed in this thread NEXT STEP- To start converting all the archive of programs
here:
https://www.thebackshed.com/forum/ViewTopic.php?TID=12433&P=2#151593
about converting font files.
and here:
https://www.thebackshed.com/forum/ViewTopic.php?TID=12433&P=2#151603
you can only have one font file.
Sprites
CMM2 has a limit of 64 sprites (maybe 63 in early firmware versions due to a bug)
Space Invaders game port
This is used as an example a couple of times in the page.
http://www.thebackshed.com/forum/ViewTopic.php?TID=12549&PID=152612#152612