MachiKania type P is an open source platform that runs BASIC program on Raspberry Pi Pico ($4!). It is connected to 320x240 LCD and MMC/SD card, so it can read files in the card and displays the result of BASIC program execution on the LCD.
The source code and ZIP archive package are available in github page ( https://github.com/machikania/phyllosoma ).
The BASIC isn't an interpreter but compiler. The BASIC system (aka KM-BASIC) compiles BASIC codes to ARM Cortex-M0 native code for the fastest execution speed.
The BASIC language is compatible to the ones of the other MachiKania computers (type M, type Z, and web), so the programs are easily transported among the types.
This photo shows an example of running a game BASIC program, SPACE ALIEN (provided as a sample in ZIP package). KM-BASIC provides the enough speed to run many games written in BASIC as it generates ARM native code.
The LCD is 320x240 resolution; 256 color photo can be displayed by BASIC code (full color photo can be also shown by a small hacking).
The syntax of BASIC language is described in help-e.txt file in documents folder of ZIP archive (repository: https://raw.githubusercontent.com/machikania/phyllosoma/main/documents/help-e.txt). The help file is translated by computer from Japanese one. Therefore, if there are somethings wrong, or confusing, please let me know.
The BASIC language supports following programing styles:
- classical line number BASIC
- structured BASIC
- object oriented BASIC (class based)
For the detail of object oriented programing, please refer class-e.txt in document folder (https://raw.githubusercontent.com/machikania/phyllosoma/main/documents/class-e.txt).
MachiKania type P can be used as not only a game console but also an I/O controller. By simple BASIC codes, one can control SPI, I2C, UART, PWM, and A/D converter.
REM SPI LED Matrix x8 (MAX7219 LED Driver) SPI 10000,16,0:REM 10MHz/16bit/Mode0 REM Not Test Mode D=$0F00:SPIWRITE D,D,D,D,D,D,D,D REM Not Shutdown Mode D=$0C01:SPIWRITE D,D,D,D,D,D,D,D REM No Decode Mode D=$0900:SPIWRITE D,D,D,D,D,D,D,D REM Set Briteness D=$0A05:SPIWRITE D,D,D,D,D,D,D,D REM Scan All LEDs D=$0B07:SPIWRITE D,D,D,D,D,D,D,D DIM F(63) RESTORE FONTDT FOR I=0 TO 63 F(I)=CREAD() NEXT FOR Y=0 TO 7 D=(Y+1)<<8 SPIWRITE D+F(Y),D+F(8+Y),D+F(16+Y),D+F(24+Y),D+F(32+Y),D+F(40+Y),D+F(48+Y),D+F(56+Y) NEXT END LABEL FONTDT CDATA $38,$6C,$C6,$FE,$C6,$C6,$C6,$00:REM A CDATA $FC,$66,$66,$7C,$66,$66,$FC,$00:REM B CDATA $3C,$66,$C0,$C0,$C0,$66,$3C,$00:REM C CDATA $F8,$6C,$66,$66,$66,$6C,$F8,$00:REM D CDATA $FE,$C0,$C0,$F8,$C0,$C0,$FE,$00:REM E CDATA $FE,$C0,$C0,$F8,$C0,$C0,$C0,$00:REM F CDATA $3C,$66,$C0,$CE,$C6,$66,$3C,$00:REM G CDATA $C6,$C6,$C6,$FE,$C6,$C6,$C6,$00:REM H
Photo is an example of controling LED-tape (containing 144 LEDs) by MachiKania type P (programmed by KenKen). For a movie, please refer this page.
To control I/O, the LCD and MMC/SD card aren't necessary. One can embed BASIC program to MachiKania type P and install to naked Raspberry Pi Pico (photo by KenKen), For the detail, please refer embed-e.txt in documents folder (https://raw.githubusercontent.com/machikania/phyllosoma/main/documents/embed-e.txt) and my blog page (google translated).