![]() |
Forum Index : Microcontroller and PC projects : MMBasic for Android
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Not something I'm actively working on but in an idle 30 minutes this morning: ![]() MMBasic is running natively on the phone (I'm not cheating by logging into a Linux box). Terminal emulation is provided by the Termux app. Whilst I can run commands at the command line it won't list or run programs "in flash" at the moment. I don't expect it will be difficult to flush out the issue when I come back to it ... perhaps some bad pointer cast somewhere. Other Android BASICs may be available ![]() Tom Edited 2021-09-11 20:31 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
... it may also be a battery killer because of its 100% CPU usage ... like the PicRoMite if memory serves. Best wishes, Tom Edited 2021-09-11 21:00 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Whoa, this could be awesome. ![]() To be able to program MMBasic for a device that is packaged and ready to install, would open up all kinds of possibilities. ![]() ![]() |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
All these backpacks that are designed around PIC and STM32 chips running MMBasic are basically targetting this product. USB (keyb+mouse and terminal), serial (2x), ethernet, and discrete IO. Most likely 24V in / relay out. This is just perfect. Nice..... PicomiteVGA PETSCII ROBOTS |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
<Dances a happy dance> I actually got it "properly" working on Android ![]() ![]() ![]() There is a subtle bug in the heap initialisation code for MMBasic for DOS (which MMB4L is based upon): // memory for the actual heap char MMHeap[HEAP_SIZE]; #define RAMEND (MMHeap + HEAP_SIZE) void InitHeap(void) { ... MBitsSet((char *) RAMEND, PUSED | PLAST); } Peter, Geoff, I looked, but because of differences in how the memory works for the 'mites it wasn't immediately obvious if the same issue existed on the other platforms - you might want to check. Best wishes, Tom Edited 2021-09-20 21:11 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Not sure what you think the bug is? There is no issue AFAIK as long as the map array is big enough. Otherwise you lose 256bytes of heap if you set RAMEND = MMHeap + HEAP_SIZE - PAGESIZE |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Now I have to double-check to see that I am not being an idiot ![]() Thank you, it's more complex than I thought, but it's still an issue: #define RAMEND (MMHeap + HEAP_SIZE) Means that RAMEND is the address of the byte immediately after MMHeap[]. As a result calling: MBitsSet((char *) RAMEND, PUSED | PLAST); writes to the byte immediately after the end of mmap[] - i.e. the write overflows. And it just so happens that when compiled on Termux/Android that byte is the first byte of ProgMemory, which explains why stored programs wouldn't run. Do I make sense, or am I still talking cobblers ? Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Only if mmap is set to exact size - I just set it slightly bigger |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Glad to hear it, but MMBasic for DOS does not and that's the bug. I was just practicing due diligence and reporting it in case the same mistake existed in other MMBasic implementations ... or I could keep these things to myself and let others flail around with their debugger ![]() Best wishes, Tom Edited 2021-09-20 22:44 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
On the PicoMite I don't even use MBitsSet((char *) RAMEND, PUSED | PLAST); I just clear mmap completely. GetMemory only looks at the Heap from RAMEND-PAGESIZE down so the fact that there is no PUSED/PLAST bits set is irrelevant |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
![]() And trying to use gdb on a 5" Android phone screen is not any fun. Then I worked out how to start an ssh daemon on my phone which solved the problem, but left me rather uneasy about how it is possible to run an ssh daemon on an unrooted phone. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I just clear mmap completely. GetMemory only looks at the Heap from RAMEND-PAGESIZE down so the fact that there is no PUSED/PLAST bits set is irrelevant Thanks, I'll look into that when I finalise the "fix" for MMB4L. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |