4 ms·
Has anyone ever written a BASIC for a 4-bit CPU?
by entrylevel 4y ago
Has anyone ever written a BASIC for a 4-bit CPU?
- actionfromafar 4y agoOn these small CPU, size of addressable RAM is even more important than word size. I think if you want to get a BASIC running on that 4-bit CPU in the article, the easiest is probably to create a 6502 or Z80 emulator, then run the emulator on the 4-bit CPU. After all, someone made an ARM (32 bit CPU) emulator for an 8 bit CPU and booted Linux on that.
- Someone 4y agoI think writing a simple basic for it would be easier. The machine has enough memory (“4096 8-bit bytes for programs and 4096 4-bit nibbles for data.”), but the instruction set is lacking compared to a 6502, so it would be a limited one. I would look at Apple’s first Basic (https://en.wikipedia.org/wiki/Integer_BASIC https://en.wikipedia.org/wiki/Integer_BASIC) and trim away all but the bare essentials. Some possible simplifications: - only support variable names of length one - remove the exponentiation operator - only support 8-bit integers - only support line numbers between 0 and 255 If, then, there’s program space left, add in features.
- howerj 4y agoI wrote a Forth for a 1-bit CPU (sort of, it was really a 16-bit bit-serial CPU) once.