![]() |
Forum Index : Microcontroller and PC projects : Color Maximite, MMBASIC 5. Possible?
Author | Message | ||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
I have (and love) a Color Maximite, along a "stick" and the CG Microboard. They're all great boards, but I'm a little frustrated by the syntax differences between MMBASIC 5 and 4.5 4.5 allows for strings and numbers to share variable names. ie: A$ and A are different variables. This is very important to me, as I attempt to port forward old BASIC programs written back in the CP/M days. (Star Trek, for example, is a mess of spaghetti code and re-used variable names.) The problem is that the DOS/Windows version of MMBASIC is v5, and so the syntax isn't the same as the version that runs on the Color Maximite - this means that even after I refactor code so that it works on my PC, I have to do it again to optimize it for the Maximite. I've emailed Geoff about this already, but gotten no reply, so I'm considering taking on this project myself. What I'd like to do is build Maximite BASIC 5 for the Color Maximite...which seems reasonable to be able to do, but for some reason the Color Maximite is stuck on 4.5 How hard would it be to port back the Minimite BASIC to run on the Color Maximite's PIC? Has anybody done that already? |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Would a DOS V4.5 help? I couldn't find it on Geoff's website with a quick look so here it is. 2019-04-06_095409_DOS_MMBasic.zip Using the same variable name for strings and numbers is not a good idea. I would fix that now before you get caught when there IS an update to the Maximite firmware. Jim VK7JH MMedit |
||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
Thank you for the 4.5 DOS version. That's really helpful. Like I said, I'm porting old BASIC programs from the 70s and 80s, which re-used variables a lot. You're absolutely correct that it's a bad idea, and so one of the things I'm doing is refactoring the code as I go: expanding variable names with things like "Status" instead of "S$", etc. The frustration is that every time I get a program working on the Maximite, it doesn't work properly on MMBASIC 5. And when I write a program on MMBASIC 5, it has things that don't work on the Maximite. So I use a lot of conditional code to make it work on both platforms, but that's also got its share of frustrations. I think what I'll end up having to do is save library routines for each system, then load the correct library routine at startup, based on the detected system. |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
i believe that geoff has been working on updating the maximite range with mmbasic 5 - essentially porting the micromite interpreter back to the maximite. however, this has just been mentioned in passing, is a long-term project, and may be overtaken by the availability of newer hardware so don't take this as gospel. the disallowing of duplicate variable names - A and A$ - was a change introduced in the last couple of years purely to discourage bad programming practices. having said this, the change may well be sufficiently entrenched in the interpreter's code to such a degree that it can not be undone. at the time there was wide support on these forums for the change with just a few of us holding reservations. at the same time, string names without the $ symbol at the end became allowable, and in some instances the variants could be mixed: Dim a$ As string a$="abc" Print a Print a$ End > > > RUN abc abc > cheers, rob :-) |
||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
Yeah, that's an understandable change, but it makes porting Microsoft BASIC programs a challenge, since variable references all have to be fixed. What's frustrating me right now is the loss of the FORMAT$ function and the LIBRARY statement. I can kind of get behind losing FORMAT$, since the STR$ overloads take its place, but removing LIBRARY means I can't export my platform-dependent code to an include file. Is there a replacement for LIBRARY in MMBASIC 5? |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
For the FORMAT function, this is what I used before STR$ got a facelift: STR$ does enough now. LIBRARY is still use in some current devices. You have to check what device you are coding for. If the device has plenty of available memory, LIBRARY is not needed. Jim VK7JH MMedit |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
As Peter M has said in a recent post, here, the ArmMite H7 makes an ideal platform for games and could be an upwards path from the Colour Maximite. Doesn't have VGA unfortunately. Advantages are a (relatively) cheap pre-built module in the NUCLEO-H743ZI and with the addition of Peter's backpack, it makes a very powerfull, low cost option. If VGA is important/essential then the Micromite Extreme series (100 and 144 pin varients) might be the way to go. Using either of these options means that the DOS MMBasic and MMXBasic are pretty much in step other than no I/O for the DOS varient. WhiteWizard on the Backshed here supplied my 144 pin Extreme pre-built and it works a treat. Shade expensive (no offence WW, I know there is a lot of work building these ![]() ![]() panky. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
you're missing the point... I'm not using LIBRARY to save memory. I want to use LIBRARY to export platform-dependent code to external modules, so I can port the code to the Color Maximite without needing to write conditional code in all of my I/O routines. For example, I'm working on a clone of Mike Mayfield's 1971 Star Trek game. I want to use drawing commands to display the map on the Maximite, but I want o use text to display the map on DOS or the Micromite systems. However, n order to do that, I have to write two completely different programs, or I have to wrap every output function in a platform check. Instead, what I'd like to do is have a single IF/THEN/ELSE block at the top of the program to include the correct functions for each platform. Since I can't actually do that, I'll have to settle for creating a make system that concatenates several different files to build a BAS file for each platform. That will work, but it's frustrating. As much as I love the Maximite ecosystem, this kind of fragmentation is a problem. |
||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
Thanks. I'll look into that. Honestly, as much as I like the Maximite computer, I'm considering a move back to a software-only solution that can run on Windows and Linux. In the long term, I'll probably end up building my own interpreter from the ground up, using something like SDL for graphics. Something that would be really cool would be a bare metal port of MMBASIC for the Raspberry Pi. I've played with the Pi Linux version, and it's good, but there are some issues I'd need to address before I could do what I have in mind. Long term, I want to build a programming system for schools and colleges that would teach someone to program from the ground up. I'd start with an 8-bit style environment (like MMBASIC) and take the person through all of the basic (no pun intended) lessons needed to learn programming. |
||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
So it turns out a MAKE script is fairly straightforward. This solves the worst of my problems for now: I can break the platform dependent and common code into separate files. Here it is, if anyone is interested: 2019-04-10_111353_make.zip ' ' Make script for Maximite and Micromite platform compatibility. ' Requires DOS MMBASIC. This will not run on the Color Maximite. ' Option BASE 1 Option EXPLICIT ' ' Platforms ' To add a new platform, add it to this list. Then ' add a new Source colum, with the files for that version. ' Dim Integer Platform.Count = 2 Dim String Platform(Platform.Count) Length 20 Platform(1)="Colour Maximite" Platform(2)="DOS" Dim String Target(Platform.Count) Length 12 Target(1)="TrekMax.bas" Target(2)="TrekDOS.bas" ' ' Included files ' These files will be included, in order. ' List each file that will be assembled to make the final ouput ' ' Source holds the names of each source file that will be ' used to build your final target. ' array is (platform, file) ' Dim Integer Source.Count=3 Dim string Source(Platform.Count, Source.Count) Length 50 'Maximite sources Source(1,1)="Trek Intro.bas" Source(1,2)="Trek UI Max.bas" Source(1,3)="Trek Main.bas" 'DOS sources Source(2,1)="Trek Intro.bas" Source(2,2)="Trek UI DOS.bas" Source(2,3)="Trek Main.bas" Dim Integer p Dim Integer f Dim Integer fOut = 1 Dim Integer fIn = 2 Dim string L,LL For p=1 To Platform.Count Print "Create "; Target(p) Open Target(p) For Output As #fOut For f=1 To Source.Count Print " Reading "; Source(p,f);"..."; Open Source(p,f) For Input As #fIn Do While Not Eof(#fIn) Line Input #fIn, L if not (LL="" and L="") then Print #fOut, L endif LL=L Loop Close #fIn Print "Done" Next Close #fOut Print " Closed ";Target(p) Next Print "Make Complete" quit |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
That's a neat solution to your problem. I was thinking that it would be good to have a variable number of source files ie: 3 for one version and 4 for the other. That could be achieved by adding a dummy file with just one comment line? Bear in mind that Geoff has said: Bill PS Thanks for putting the program in the Library. Keep safe. Live long and prosper. |
||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
That's an interesting thought. The approach I took with this version was quick & dirty... what I really want to do is use preprocessor directives in the source, like this: [code] #if SYSTEM="DOS" #include "textutil dos.bas" #elseif SYSTEM="Maximite" #include "textutil maximite.bas" #include "graphutil maximite.bas" #endif [/code] So instead of baking the build into the MAKE script, I'd bake it into the master BAS file, and the build script would be generic and usable for any compatible BAS file. Long term, that could also allow for DEBUG builds and other fun stuff. |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
That's also an interesting thought. I also thought that something similar would be a useful addition to MMEdit. Not just for the purpose you describe but for similar programs that have different I/O requirements or to include things like functions or subroutines without having to use copy and paste. Jim has said that elsewhere that he needs a more powerful compiler to add things like function folding and so on so I guess it's unlikely. @Jim: If you are listening, you could add a 'new compiler fund' on your web site. I'll chip in. Bill Keep safe. Live long and prosper. |
||||
tomxp411 Newbie ![]() Joined: 04/04/2019 Location: United StatesPosts: 24 |
Visual Studio 2019 Community is free, and it works great; even though I have access to the highest tier of MSDN for work, I still use Community for personal projects. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I have the compiler thank you. That is not the reason for my delays. I realise that I had left a section out of the help file when I changed the format. MMEdit does have an INCLUDE ability. No one used it so I haven't done anything with it for a while. This is from the old help file: You can also use the power of Notepad++ if you want something better. Jim VK7JH MMedit |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |