GOOD COMPUTER: BASIC

2020-06-02 12:35

I am making a GOOD COMPUTER, my take on a 70/80s-style approach to building a computer!

Current focus: the BASIC interpreter

Here’s the code and more info: https://gitlab.com/good-computer/basic

Previously: https://twitter.com/robn/status/1255079227990261769


2020-06-03 15:47

I made a function! it turns out that functions can be parsed as just a special kind of parens. I’m really happy with how cleanly it came out


2020-06-03 15:52

meanwhile, some 128K SPI SRAMs arrived today, a month ahead of of the ETA, so soon I’ll be able to stop juggling housekeeping memory and be able to have actual decently long programs


2020-06-04 15:01

board tidied a lot, RAM added, and a simple test read/write program written to confirm the wiring is good and I understand how to drive it. next up, rewriting the memory manager to store the program in there!


2020-06-08 21:22

ok, all program storage is now in the external memory so now I can have enormous programs. nothing to show because it all looks exactly the same, but I’ve got room to move now. oh and I added a light so I can indicate things separately from a program that legit blinks a light


2020-06-08 22:30

just for fun I started fiddling with XMODEM. pleasantly straightforward!


2020-06-09 20:17

back to real life. jump targets for flow control instructions are now referenced by line pointer and offset into line, which allows RETURN (and soon NEXT) to jump to a point within a line


2020-06-11 20:28

finally got FOR/NEXT working. NEXT is kinda ridiculous, its sort of a shortcut for LET, IF and GOTO all one. its also showing up some real structural problems in my code, which I need to think hard about. but its there at leeast!


2020-06-11 21:54

this is a struggle. the “type” of an expression is set from its first operand. if later operands don’t have the same type, the whole expression is rejected. this works great until you have functions that take one (or both) types and emit the other. hmm.


2020-06-14 21:43

many hours work in the last few days to get to this point. obviously, implementing functions like LEN and MID$, but there’s also full string/number type checking and specs all the way through


2020-06-14 21:50

all functions now have a return type, and qualify as an operand of that type. they also have a signature, the number and type of arguments they expect

with only two types you can store them in a single bit, which allows some pretty tight code for tracking and checking types!


2020-06-15 12:37

debugging in action. dumping the operator stack after each character is consumed by the expression parser. something is dropping a comma, messing up the arg count

it’s low-tech, but still a luxury compared to what the early microcomputer programmers had


2020-06-15 16:42

big day of bugfixing, and here’s another fun little program

a couple of small changes necessary: a different way to test for even-length strings, because I don’t have floating point, and an extra increment because I don’t have variable loop steps

where even is the hollow tree?


2020-06-16 16:07

I got sick of typing in test programs over and over again. I’ve ordered a MicroSD module to store programs, but until then, I’ve added a program loader that receives program text over the serial line via XMODEM and parses it. its silly but I’m pretty chuffed about it 😎️


originally posted on twitter at: https://twitter.com/robn/status/1267645875855060993