This time I am finally sitting down and (starting) to write the operating system for the Cat-644. (external link to hackday.io) The hardware is a 20 Mhz 8-bit homebrew computer built around an AtMega 644 microcontroller, and features VGA video output. Retrochallenge main page
This retrochallenge was fun! It also gave me an excuse to spend a bunch of time working on an old project that I just never got around to finishing. There is still stuff to do, but I can walk away from it feeling very productive. One thing I wish I had the time to get to, but didn't, was getting the sound working again. I had audio mostly working in the old hardware test program. I also didn't get as far as I would have liked with the SD card. But, there's future retrochallenges!
Kitty OS boots, and outputs on the serial line:
Then switches to the VGA driver, and runs a short program:
I have gotten an interpreted program to find the screen and keyboard in the system main device mux. The program only prints "Hello World", and then enters a loop repeated reading the keyboard and writing the characters to the display. It is the minimal interactive interpreted program sample. It demonstrates the mux device, the chardevices, and interaction between an interpreted program, the interpreter written in assembly, the VGA driver interrupt, the PS2 polling algorithm, and syscalls written in C. Without crashing.
This is the interpreted bytecode program:test.s
ldi a @out_dev offset syscall 1 #find device swp b #b has the device ldi a @hello offset nextchar: ldc a #get character *a to c swp c # c has ptr, a has char #jump to halt if low byte of A is zero ldi d $00ff and d jaz @done syscall 2 #write reg A to device in B swp c #get pointer ldi d 1 add d jmpr @nextchar done: # register B has output device swp B # A has output swp D # D has output device ldi a @in_dev offset syscall 1 #get input device swp b # b as input device again: syscall 3 # read a char #char in a , input in B, output in D swp b #char in b, input in A, output in D swp d #char in b, input in D, output in A swp b #char in A, input in D, output in B syscall 2 #write char #zero in A, input in D, output in B swp b swp d swp b jmpr @again halt: jmpr @halt out_dev: string 'scr byte 0 in_dev: string 'key byte 0 string ' hello: string 'Hello World byte 0
And no, this is not running off the SD Card. I didn't get that far. The interpreted program is stored in the AVR Flash, and copied to SRAM, and runs out of SRAM. It is stored in a file called "introm.c". Future versions will find the sdcard in the device list, read the first block, and then run from there. But not yet. Maybe in the next retrochallenge, I will make a game for this computer!
And sometimes it doesn't go to plan! This was a bug I had this morning.