|
Forum Index : Microcontroller and PC projects : MMBasic ANSI - MMBasic on Mac/Windows/Linux in a terminal
| Author | Message | ||||
| robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2529 |
Frank: have you tried launching it using the --console-only switch: user@HP-stream11-392758:~$ user@HP-stream11-392758:~$ ./mmbasic_ansi --console-only PicoMite MMBasic ANSI 1.0.6 Copyright 2011-2026 Geoff Graham Copyright 2016-2026 Peter Mather MMBasic Anywhere - Copyright 2025-2026 Josh Vanderberg Bytecode VM, HAL refactor, host/WASM/stdio ports > quit user@HP-stream11-392758:~$ user@HP-stream11-392758:~$ i was also unable to get the graphics working sensibly either... unfortunately linux/unix consoles do vary quite a bit in their inbuilt capabilities and rendering speed. while the way Josh is creating the 'pixels' is quite ingenious, it is dependent on the console it is running within (a) being able to cope with dimensions (320, 640, or even 800 columns) way beyond what would normally be encountered in a normal terminal screen, along with (b) needing the operating system's font engine being able to intelligently/efficiently scale characters down to 1pt size (potentially only 1 pixel wide x 2 pixels high) and cache those scaled characters. i would be surprised if any linux terminal had ever been tested at such extremes. on the other hand, i could well imagine Apple optimizing for such 'non-standard' ways for using fonts! i did try to get the linux mint terminal on my machines (xfce4-terminal) operating with 'sixel' graphics, which divides each character cell into 6 pixels (2 wide x 3 high) but it seems that sixel is not supported in the versions of xfce4-terminal (pre 1.2) that linux mint uses. Josh: how would you feel about someone writing a custom launcher that could provide your mmbasic_ansi version of mmbasic with access to a graphics window? i think this could be fairly easily done using Lazarus/FPC with mmbasic_ansi just needing to send simple graphics commands to stdout. cheers, rob :-) |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
I got the graphics version running on a few year old Ubuntu version just running whatever the default terminal was. Nothing special about the Mac. I’d recommend ghostty as a terminal. It runs well on Linux and it has some config options you can use to make the characters have the perfect aspect ratio. If you want the full graphics experience with sound I’ve already done that with the electron versions, linked in the original post. It will also perform a lot better. This, I admit was a bit of a novelty, and I think the most useful thing is the console only version. And I’d love it if some somebody wanted to fork or send a PR to do native graphics. But I am not sure that’s a terribly portable route, and MMBasic anywhere is mostly about portability. Edited 2026-05-28 22:20 by jvanderberg |
||||
| robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2529 |
yep, just after i'd posted i realized that what i was describing was really just a variation on what your electron version already accomplishes! i am quite excited about your text-only version - perhaps even one where the --console-only switch was the default. while i can't speak for others, my interest in mmbasic has always been (1) use on embedded controllers (like the MX170 version) and (2) as a scripting language in the terminal/console. the games/graphics side of things is of little interest to me, but does seem to be the direction 'official' development has headed in in recent years - along with a constant stream of bolted-on 'enhancements'. unfortunately it (native graphics) is exceptionally un-portable. Lazarus/FPC tries to do it, but is suffering at the hands of wayland vs X11, and GTK2 vs GTK3 vs Qt. not to mention the ever-evolving Apple ecosystem. prior to your postings i had not heard of Electron before. i may start a thread about Electron on the Lazarus/FPC forums to see if there is any interest in them using it there. cheers, rob :-) Edited 2026-05-28 23:05 by robert.rozee |
||||
| Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 1102 |
@rob: Yes, it works for me with the --console-only switch... Frank |
||||
| gadgetjack Senior Member Joined: 15/07/2016 Location: United StatesPosts: 233 |
jvanderberg , Did you once say you had a version of mmbasic running on a esp32-c3 device? I have a couple with nothing to run on them of any count. Jack |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
I do, in serial only mode - no display support or sound yet. Porting the existing LCD drivers should be easy - VGA I think will be a bit of work, not sure HDMI is doable. I2S support should be straightforward. If you want to DIY it: https://github.com/jvanderberg/PicoMiteAllVersions/tree/main/ports/esp32_s3_metro |
||||
| gadgetjack Senior Member Joined: 15/07/2016 Location: United StatesPosts: 233 |
I am not the best coder but I will give it a play and see what I can do. Thank you! Jack |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
I will add a pre-packaged build soon. The current build supports WiFi - though I've only tested it on an Adafruit 'Metro' board, which is an ESP32-S3 - basically all Adafruit added are Arduino headers, PSRAM and an SD card slot, so this build should be reasonably compatible. |
||||
| gadgetjack Senior Member Joined: 15/07/2016 Location: United StatesPosts: 233 |
Great!!! Thank you. |
||||
| gadgetjack Senior Member Joined: 15/07/2016 Location: United StatesPosts: 233 |
Sorry , I meant I had esp32-s3 boards , not c3. They have the added memory on them. |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
The ESP32-S3 port is here: https://github.com/jvanderberg/PicoMiteAllVersions/tree/main/ports/esp32_s3 Download link and flash instructions are in the readme. It directly supports the Adafruit Metro, and the Freenove 2.8" LCD/Touch (search amazon for that one) using 'configure metro' and 'configure freenove' For more generic boards they support VGA out via GPIO, also support I2S sound output. The image boots as a 'generic' profile, which should support serial terminal, wifi, and psram. I am pretty confident the general profile should boot on most any generic esp32-s3. If your board has an sd card, you'll have to configure the GPIOs with OPTION SDCARD. Give it a try at let me know how it goes. Edited 2026-06-08 13:32 by jvanderberg |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 531 |
jvanderberg, flashed merged.bin onto an S3. Cannot properly connect to console after flashing, there is just no response. Connection was possible (115200). What I get at the console after pressing RESET key is ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x1 (POWERON),boot:0x0 (DOWNLOAD(USB/UART0)) waiting for download for flashing I used the espressif flash-download-tool on windows 11. What have I done wrong? Gerald Edited 2026-06-08 23:16 by ville56 73 de OE1HGA, Gerald |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
Not sure, I just followed the instructions from my readme and successfully flashed https://github.com/jvanderberg/PicoMiteAllVersions/releases/download/latest/MMBasic-Anywhere-esp32-s3-merged.bin What board do you have? |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 531 |
this is the chip info from the download tool: Chip is ESP32-S3 (QFN56) (revision v0.2) Features: Wi-Fi, BT 5 (LE), Dual Core + LP Core, 240MHz, Embedded PSRAM 8MB (AP_3v3) Crystal is 40MHz MAC: fc012ccc6fd0 Manufacturer: 68 Device: 4018 Status value: 0x600200 Detected flash size: 16MB a press of the reset button gives the message posted in the previous link, a power cycle after flashing leads to the following message on the console port in a loop: ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x400454d5 SPIWP:0xee mode:QIO, clock div:2 load:0x3fce2810,len:0x178c ets_loader.c 78 73 de OE1HGA, Gerald |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
My working theory is that you have a board that doesn't expose the USB console over the usb port, but instead has a UART bridge chip. I am ordering a board like that to confirm that I can support both types of usb port wiring. I believe I can do it with a single build. One issue though is that USB keyboards won't work with that sort of board. |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
If you follow the Readme instructions for command line tools it should properly program in DIO. If you are using the GUI tool, make sure to set SPI MODE = DIO (not QIO), SPI SPEED = 40MHz. Let me know if that works. |
||||
| Doktorn Newbie Joined: 09/07/2019 Location: SwedenPosts: 36 |
Test with WaveShare ESP32-S3-PICO I (359) esp_image: segment 4: paddr=001ce3bc vaddr=40376e18 size=170e4h ( 94436) load I (380) esp_image: segment 5: paddr=001e54a8 vaddr=600fe100 size=00004h ( 4) load I (391) boot: Loaded app from partition at offset 0x10000 I (392) boot: Disabling RNG early entropy source... E (393) octal_psram: PSRAM ID read error: 0x00000000, PSRAM chip not found or not supported, or wrong PSRAM line mode E (394) esp_psram: PSRAM enabled but initialization failed. Bailing out. I (394) cpu_start: Failed to init external RAM; continuing without it. I (395) cpu_start: Multicore app I (406) cpu_start: Pro cpu start user code I (406) cpu_start: cpu freq: 240000000 Hz I (407) app_init: Application information: I (407) app_init: Project name: mmbasic_anywhere_esp32_s3 I (407) app_init: App version: 0755caa I (407) app_init: Compile time: Jun 8 2026 03:18:06 I (408) app_init: ELF file SHA256: a2a1320cb... I (408) app_init: ESP-IDF: v5.3 I (408) efuse_init: Min chip rev: v0.0 I (408) efuse_init: Max chip rev: v0.99 I (408) efuse_init: Chip rev: v0.2 I (409) heap_init: Initializing. RAM available for dynamic allocation: I (409) heap_init: At 3FCD85D8 len 00011138 (68 KiB): RAM I (409) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM I (410) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM I (410) heap_init: At 600FE104 len 00001EE4 (7 KiB): RTCRAM I (413) spi_flash: detected chip: winbond I (413) spi_flash: flash io: dio W (413) spi_flash: Detected size(16384k) larger than the size in the binary image header(4096k). Using the size in the binary image header. W (414) i2c: This driver is an old driver, please migrate your application code to adapt `driver/i2c_master.h` I (415) sleep: Configure to isolate all GPIO pins in sleep state I (416) sleep: Enable automatic switching of GPIO sleep configuration I (417) main_task: Started on CPU0 I (427) main_task: Calling app_main() E (427) octal_psram: PSRAM ID read error: 0x00000000, PSRAM chip not found or not supported, or wrong PSRAM line mode E (427) esp_psram: PSRAM enabled but initialization failed. Bailing out. hal_psram_init: esp_psram_init failed (262); PSRAM disabled I (427) mm_options: loaded options from raw mmslots sector I (1437) mmslots: partition: size=1048576 slots=3 slot_size=49152 W (1457) wifi_init: WiFi cache TX buffers should be disabled when initialize SPIRAM failed W (1457) wifi_init: TX buffers type should be changed from static to dynamic when initialize SPIRAM failed W (1457) wifi_init: WiFi/LWIP prefer SPIRAM should be disabled when initialize SPIRAM failed W (1467) wifi:malloc buffer fail E (1467) wifi:Expected to init 6 rx buffer, actual is 0 W (1477) wifi_init: Failed to unregister Rx callbacks W (1477) wifi_init: Failed to deinit Wi-Fi driver (0x3001) E (1477) wifi_init: Failed to deinit Wi-Fi (0x3001) WiFi init failed I (1477) lfs: lfsdata partition: size=917504, 224 blocks I (1477) lfs: LittleFS mounted (A:) I (1647) lfs: wrote demo site.bas (5395 bytes) I (1787) lfs: wrote demo server.bas (5395 bytes) I (1847) lfs: wrote demo index.htm (1744 bytes) I (1917) lfs: wrote demo status.htm (1960 bytes) I (1987) lfs: wrote demo about.htm (2223 bytes) I (2057) lfs: wrote demo gpio.htm (1101 bytes) I (2117) lfs: wrote demo files.htm (771 bytes) I (2177) lfs: wrote demo style.css (1957 bytes) MMBasic Anywhere (esp32-s3) 1.1.0 Copyright 2011-2026 Geoff Graham Copyright 2016-2026 Peter Mather MMBasic Anywhere - Copyright 2025-2026 Josh Vanderberg Bytecode VM, HAL refactor, host/WASM/stdio ports ESP32-S3 REPL. Profile: GENERIC > /Lasse |
||||
| jvanderberg Regular Member Joined: 06/05/2026 Location: United StatesPosts: 82 |
Interesting, the PSRAM didn't work. Seems it's common to have to ship two variants for octal vs. non-octal psram, as it's compiled into the firmware. Will have to take a look |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 531 |
- thats exactly what I did set up. - The serial is available over USB, just tested with Annex32 basic. Will try to investigate further. The board is one of the many chinese clones, has 16Mb flash and runs fine with Annex32. Have a different board with 32Mb, will try with that as well. 73 de OE1HGA, Gerald |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 531 |
got it running on a ESP32-S3-WROOM-2 (MCN32R16V) with OPI flash which is currently not supported by Annex32 anymore. Flashed in DIO mode, but running anyway. > cpu restart Restarting... ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x40375f90 SPIWP:0xee Octal Flash Mode Enabled For OPI Flash, Use Default Flash Boot Mode mode:SLOW_RD, clock div:1 load:0x3fce2810,len:0x178c load:0x403c8700,len:0x4 load:0x403c8704,len:0xc10 load:0x403cb700,len:0x2dc0 entry 0x403c8904 I (32) boot: ESP-IDF v5.3 2nd stage bootloader I (32) boot: compile time Jun 8 2026 14:33:27 I (33) boot: Multicore bootloader I (33) boot: chip revision: v0.2 I (33) boot.esp32s3: Boot SPI Speed : 80MHz I (33) boot.esp32s3: SPI Mode : SLOW READ I (34) boot.esp32s3: SPI Flash Size : 4MB I (34) boot: Enabling RNG early entropy source... I (34) boot: Partition Table: I (34) boot: ## Label Usage Type ST Offset Length I (34) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (35) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (35) boot: 2 factory factory app 00 00 00010000 00200000 I (36) boot: 3 lfsdata Unknown data 01 81 00210000 000e0000 I (36) boot: 4 mmslots Unknown data 01 40 002f0000 00100000 I (37) boot: End of partition table I (37) esp_image: segment 0: paddr=00010020 vaddr=3c160020 size=57398h (357272) map I (122) esp_image: segment 1: paddr=000673c0 vaddr=3fc9e000 size=06008h ( 24584) load I (129) esp_image: segment 2: paddr=0006d3d0 vaddr=40374000 size=02c48h ( 11336) load I (133) esp_image: segment 3: paddr=00070020 vaddr=42000020 size=15e514h (1434900) map I (474) esp_image: segment 4: paddr=001ce53c vaddr=40376c48 size=172b4h ( 94900) load I (500) esp_image: segment 5: paddr=001e57f8 vaddr=600fe100 size=00004h ( 4) load I (511) boot: Loaded app from partition at offset 0x10000 I (512) boot: Disabling RNG early entropy source... I (513) octal_psram: vendor id : 0x0d (AP) I (513) octal_psram: dev id : 0x03 (generation 4) I (514) octal_psram: density : 0x05 (128 Mbit) I (514) octal_psram: good-die : 0x01 (Pass) I (514) octal_psram: Latency : 0x01 (Fixed) I (514) octal_psram: VCC : 0x00 (1.8V) I (515) octal_psram: SRF : 0x01 (Fast Refresh) I (515) octal_psram: BurstType : 0x01 (Hybrid Wrap) I (515) octal_psram: BurstLen : 0x01 (32 Byte) I (516) octal_psram: Readlatency : 0x02 (10 cycles@Fixed) I (516) octal_psram: DriveStrength: 0x00 (1/1) I (517) MSPI Timing: PSRAM timing tuning index: 6 I (517) esp_psram: Found 16MB PSRAM device I (517) esp_psram: Speed: 80MHz I (518) cpu_start: Multicore app I (1330) esp_psram: SPI SRAM memory test OK I (1339) cpu_start: Pro cpu start user code I (1339) cpu_start: cpu freq: 240000000 Hz I (1339) app_init: Application information: I (1340) app_init: Project name: mmbasic_anywhere_esp32_s3 I (1340) app_init: App version: e7b7b6b I (1340) app_init: Compile time: Jun 8 2026 14:33:22 I (1340) app_init: ELF file SHA256: 6f027a83e... I (1340) app_init: ESP-IDF: v5.3 I (1340) efuse_init: Min chip rev: v0.0 I (1341) efuse_init: Max chip rev: v0.99 I (1341) efuse_init: Chip rev: v0.2 I (1341) heap_init: Initializing. RAM available for dynamic allocation: I (1341) heap_init: At 3FCD85D8 len 00011138 (68 KiB): RAM I (1342) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM I (1342) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM I (1342) heap_init: At 600FE104 len 00001EE4 (7 KiB): RTCRAM I (1342) esp_psram: Adding pool of 16384K of PSRAM memory to heap allocator W (1343) spi_flash: Octal flash chip is using but dio mode is selected, will automatically swich to Octal mode I (1343) spi_flash: detected chip: mxic (opi) I (1343) spi_flash: flash io: opi_str W (1344) spi_flash: Detected size(32768k) larger than the size in the binary image header(4096k). Using the size in the binary image header. W (1344) i2c: This driver is an old driver, please migrate your application code to adapt `driver/i2c_master.h` I (1345) sleep: Configure to isolate all GPIO pins in sleep state I (1345) sleep: Enable automatic switching of GPIO sleep configuration I (1346) main_task: Started on CPU0 I (1356) main_task: Calling app_main() hal_psram_init: slab=0x3c1c0c00 slab_bytes=6930432 heap=6291456 slot=245760 PSRAMbase=0x3c1c0c00 PSRAMsize=6291456 I (1356) mm_options: loaded options from raw mmslots sector .....I (2366) mmslots: partition: size=1048576 slots=3 slot_size=49152I (2556) lfs: lfsdata partition: size=917504, 224 blocksI (2556) lfs: LittleFS mounted (A:)I (2666) lfs: wrote demo site.bas (5395 bytes)I (2736) lfs: wrote demo server.bas (5395 bytes)I (2766) lfs: wrote demo index.htm (1744 bytes)I (2806) lfs: wrote demo status.htm (1960 bytes)I (2836) lfs: wrote demo about.htm (2223 bytes)I (2876) lfs: wrote demo gpio.htm (1101 bytes)I (2906) lfs: wrote demo files.htm (771 bytes)I (2936) lfs: wrote demo style.css (1957 bytes) MMBasic Anywhere (esp32-s3) 1.1.0 Copyright 2011-2026 Geoff Graham Copyright 2016-2026 Peter Mather MMBasic Anywhere - Copyright 2025-2026 Josh Vanderberg Bytecode VM, HAL refactor, host/WASM/stdio ports ESP32-S3 REPL. Profile: GENERIC > 73 de OE1HGA, Gerald |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |