A microcomputer with PS/2 keyboard, SD card storage and composite video output, running Terminal-BASIC
New software, I'v just built, based on Terminal-BASIC 2.1-b1. It uses russian lexems, because the computer is used by my 5 years old daughter, who don't understand English and still can't read latin alphabet. Also I use my new ps/2 keyboard Arduino library, from https://bitbucket.org/starling13/libps2 . This library supports locales switching and controls the keyboard LEDs, as can be seen on the photo.
Terminal-BASIC 2.0-rc introduced UNIX-style file operations. This video shows the process of loading 1-bpp BMP file from SD-card. Yes, it's damn slow. Image was loaded by the following BASIC program:
1 DEF FN BN% (BYT%, BIT%) = (BYT% \ (2 ^ BIT%)) AND 1 10 INPUT F$ 20 GOSUB 1000 100 END 1000 REM LOAD 1010 BMP% = FOPEN ( F$ ) 1020 IF BMP% = - 1 THEN PRINT "FOPEN" : GOTO 1995 1030 B% = FREAD ( BMP% ) : M% = FREAD ( BMP% ) 1040 S$ = CHR$ ( B% ) + CHR$ ( M% ) 1050 IF S$ <> "BM" THEN PRINT "HEADER" : GOTO 1990 1060 FOR I% = 1 TO 8 : B% = FREAD ( BMP% ) : NEXT I% 1070 DP% = FREAD ( BMP% ) 1080 DP% = DP% + FREAD ( BMP% ) * 256 1085 DP%=DP%-12 1090 IF DP% < 0 GOTO 1110 1100 FOR I%=0 TO DP%-1 : B%=FREAD(BMP%) : NEXT I% 1110 FOR Y%=191 TO 0 STEP -1 1120 FOR X%=0 TO 24 1130 B% = FREAD(BMP%) 1140 FOR XX%=0 TO 7 1150 POINTC X%*8+XX%, Y%, FN BN%(B%,7-XX%) 1600 NEXT XX% 1700 NEXT X% 1710 B%=FREAD(BMP%):B%=FREAD(BMP%):B%=FREAD(BMP%) 1800 NEXT Y% 1990 FCLOSE BMP% 1991 S$=GET$() 1992 IF S$="" GOTO 1991 1995 RETURN
This computers firmware is a variant of my Terminal-BASIC. It suffers from heavy weight, due to my limited abilities and C++ it's written in, but it is important for me as the window in the world of language translators and learning desk.
But I start to think about the alternative firmware, which is a compromise between the simplicity and flexibility. It will be based on Z80 CPU emulator.
On the host side there will be a piece of C++ code. First component is an interactive monitor, allowing to view/modify the Z80 emulator ram, load and store ram portions to or from SD card, may be some assemble/disassemble in the future. The second component is a Z80 emulator calls library, allowing to call the native C++ functions from the z80 code.
The main purpose of this firmware is the ability to write programs in C, using sdcc for z80, store multiple programs to SD card and run it without reprogramming the Arduino flash.
Unlike great projects, running CP/M emulator on Arduino DUE, this approach gives the ability to use the boards with a cople kilobytes of RAM to run simple programs, as long as CP/M will not run with less then 64k RAM, and more need to an emulator itself.
Compared to the Terminal-BASIC, which allows to run programs from SD card too, I expect, compiled C code, running in Z80 emulator to be much faster.
Minimal BASIC test programs, tetris game and other test programs can be found here.