RC 2022/10 Day 5: A Bit More C

A project log for Flounder Z180 Computer

Standalone single-board computer based on the Zilog Z180 CPU

Colin MaykishColin Maykish 10/06/2022 at 02:500 Comments

Small improvements today...

I spent some time upgrading the monitor program by adding peek/poke commands for both the memory and I/O address ranges. This means I can do fun stuff like poke arbitrary patterns on the PIO LEDs. It's also another small tool in the box for debugging hardware, reading the state of the internal Z180 peripherals, etc.

** Flounder Z180 System Monitor **
> peek 8000
> poke 8000 00
> ipoke 2001 F0

> ipeek 2001

It turns out z88dk has extensive C libraries that I was not utilizing. There's even a z180.h that defines a bunch of nice functions for manipulating memory and I/O ports from C. I ported most of my hardware initialization code from assembly to C. This might not be perfectly optimal, but I'll take the hit in performance for the cleanliness of fewer files and higher level code.

I've still got a lot to learn about z88dk in general though. I'm using the embedded Z180 target, but I think eventually I'll need to define a new target for Flounder. I am missing all of the device driver and stdio stuff at the moment. It would be nice to have printf() support among other things. The z88dk project has been around a while and it's a bit daunting trying to decipher the correct approach to doing anything with it. The documentation seems alright for explaining how specific pieces work, but the bigger picture of choosing the right pieces is a little harder to grasp.

Fortunately, I've managed to hack together enough of it to get a useful monitor tool, but there's much more work to be done on the software side of Flounder.