![]() |
Forum Index : Microcontroller and PC projects : CMM2: How to extend the BASIC library?
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
gevik![]() Newbie ![]() Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Hi, I got my CMM2 last week and it has been fun playing with the machine in these lockdown times. I would like to experiment adding custom libraries to the BASIC interpreter. I am thinking about adding functionality for creating TUI's (Text Based User Interface). Something similar to TurboVision of the 80s and 90s. At the moment I am looking for any information regarding the development process of adding custom C functions to the CMM2's firmware. Do I have to compile and deploy my changes on the firmware each time I make a change? (I hope not!). Or is there a development environment with an emulator/debugger. Greatly appreciated if anyone can shed some light on this. Regards, Gevik |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi "gevik", That's not how it works ![]() If you literally extended the firmware then the restrictions on the license by which you get access to the firmware source means that you cannot distribute the result of your efforts. In any case there is no room in the MMBasic symbol table for you to add new functions into the language itself. Instead you provide "libraries" as .inc files (for use with #Include) in which you include global variables, constants, Subs (BASIC) and Functions (BASIC), you can also include CSUBs. CSUBs contain the hex-encoded representation of subroutines that have been written in C (or in theory assembler) and then compiled into position independent code on a Windows/Linux PC. There is an MMBasic utility that then processes these to create the hex-encoded representation. See http://www.thebackshed.com/forum/ViewTopic.php?TID=12289 for details. There is no specific "development environment", "debugger" or "emulator" for developing CSUBs ... welcome to the 1980s ![]() Happy hacking, Tom Edited 2020-09-17 20:39 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
That said, those who like, say, gdb, and such as debug via JTAG (perhaps using OpenOCD), could likely debug (presumably C code) that way. Unless Peter already does something similar the above will require some hand-to-hand combat... (Other tools are available of course.) John |
||||
gevik![]() Newbie ![]() Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Thank you for your answers: This means that CSUBS are the way to go for now. I found the mandelbolt example on github. So I will have to take a look at that for and of cource the thread mentioned above. https://github.com/thwill1000/cmm2-welcome/tree/master/mandelbrot-explorer I have just downloaded the MMBasic source to go check out the parser and see if I can learn about the internals. |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
I also suggest you take a look at this document I’ve been putting together. There are a number of things you should consider if making a library that you want to be maximally useful people. There’s also a section specifically on good practices for library authors in it. https://docs.google.com/document/d/1dkQcLM2FRTiNELj5P3neeFih0oN2tOOxC2jy3BBH5Po/edit?usp=sharing |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1427 |
I'm very fond of this idea. A TUI would be a good feature of the CMM2. It would have been great if TUI could have been a keyword and the functionality included in the firmware, but there are no remaining tokens. But it is still very doable as a CSUB. I know that games and whatnot use the great graphics capabilities of this fine machine and that a text interface may seem like a step back. But a well-written TUI would be great for education and utilities. I've tried to find on-line resources for... ready for this?... Visual Basic for DOS to see what that development environment had to offer. I was hoping to find a pdf of the VB for DOS book. It would have all of the elements such as input fields, labels, buttons, checkmark boxes, message boxes, etc. (Note that the default font of the CMM2 has all of the box-draw characters.) A TUI CSUB would grant the programmer the ability to be able to interact with the program user in a way that is several steps better than just a single INPUT command line entry at-a-time. ![]() ![]() Micromites and Maximites! - Beginning Maximite |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
Yeah I had thought about something like this as well.. It WON'T be an easy thing to implement but certainly could be a useful library! |
||||
William33 Newbie ![]() Joined: 27/07/2020 Location: GermanyPosts: 9 |
Sorry, but would it useful without a mouse? |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
I've also thought about this. I have a QBASIC.EXE from 1993, but it won't run on 64-bit win10. I have an older laptop now at a repair shop. When I get it back I'll see if it can run it. I think the user interface is windowed text, but as far as I remember, it doesn't give you the ability to build windowed text programs. Regarding the lack of tokens, I know it's contrary to design intent, but since the MATH token is already overloaded, for an individual's modification of the MMBASIC source code, I don't know why you couldn't in theory, for instance, use: MATH TUI SOMECOMMAND SOMEPARAMETERS But talk about retro . . . Edited 2020-09-18 05:57 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
RetroJoe![]() Senior Member ![]() Joined: 06/08/2020 Location: CanadaPosts: 290 |
Those old TUIs were designed to work without a mouse. You either tabbed or arrowed around until you reached the target widget, or you used a shortcut key - note in the first screenshot every screen item has a unique letter in red or yellow, which is the keystroke associated with it. Typical Windows BIOS configuration screens are an artifact of this keyboard-only UI method. Edited 2020-09-18 06:22 by jpusztai Enjoy Every Sandwich / Joe P. |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
If Win10 can do VMs then it should run. It runs OK on Linux under DOSBOX, for example. John |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1427 |
If one slot were open: TUI BUTTON x, y, z TUI RADIO x, y, z TUI MESSAGE x, y, z But a CSUB or a set of CSUBs could do nearly the same thing. Micromites and Maximites! - Beginning Maximite |
||||
Womble![]() Senior Member ![]() Joined: 09/07/2020 Location: United KingdomPosts: 267 |
QBASIC.EXE runs fine under DOSBox 0.74-3 on my Windows 10x64 (v.2004) machines. So does TurboC which has a similar IDE. I have been using it to check out some of my ancient code with a view to porting some stuff across to the CMM2. Edited 2020-09-18 11:21 by Womble |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
I don't know how the token table works, or how overloaded tokens like 'math' work, but the 'end' and 'exit' commands would be candidates for overloading to free up slots. Someone (other than Peter ;-) with the source might be entertained by studying possibilities... Visit Vegipete's *Mite Library for cool programs. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
It is utterly pointless to "study" things which are going to break existing programs. It ain't going to happen |
||||
gevik![]() Newbie ![]() Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Could someone please elaborate on the symbol table limitations? Where should I look in MMBasic's source code. Is there a documentation on this. Please pardon my newbie question. Just trying to learn more here. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
There are 127 slots for commands and 127 slots for Functions and operators. This is fundamental to the way MMbasic works. It isn't going to change - don't waste your time looking for a "solution". This would require a major re-write which isn't going to happen |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
QBASIC.EXE runs fine under DOSBox 0.74-3 on my Windows 10x64 (v.2004) machines. So does TurboC which has a similar IDE. I have been using it to check out some of my ancient code with a view to porting some stuff across to the CMM2. I'd never heard of DOSBOX. Have now installed it and run QBASIC.EXE. Thanks. Also enabled me to run TurboC--TCC.EXE dated 1988. Oh the thrills. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
RetroJoe![]() Senior Member ![]() Joined: 06/08/2020 Location: CanadaPosts: 290 |
Apropos this TUI thread, and various other ones about MMBasic’s text editor, I have very fond memories of the TurboPascal package and its built-in editor. I ended up using that Turbo editor to edit everything - it was vastly superior to any of the “default” CP/M and DOS editors at the time. Feels like a DOSBOX kinda weekend coming up :) Enjoy Every Sandwich / Joe P. |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Ok, now we're talking crazy. What would a MMBasic CSUB 8080/Z80+8086 emulator look like on the CMM2? Now I'll just crawl back under my rock. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |