-
Notifications
You must be signed in to change notification settings - Fork 14
Software Design Notes
J.B. Langston edited this page May 17, 2018
·
18 revisions
The layout of the source code is as follows:
-
defines.h
contains the specific ports and pins used for the Z80 bus interface and SPI chip selects. -
bus.h
provides macros to set the address and data bus and read or toggle the various control lines. This abstracts control of these signals away from the specific hardware implementation. It should be possible, for example, to port this code to an ATmega2560 without needing an IO expander, simply by modifyingbus.h
anddefines.h
. -
disasm.c
contains a function that disassembles a single Z80 instruction. This is called by the real-time debugger and the from-memory diassembler. -
bus.c
provides functions to intialize the bus, control the clock, and enter and exit bus-master mode. -
memory.c
contains functions to do DMA transfers, and various convenience functions to dump, fill, and disassemble blocks of memory. -
spi.c
andiox.c
provide functions for the low-level control of the SPI bus in general and the IO Expander specifically. -
ff.c
,ffsystem.c
,ffunicode.c
, andmmc_avr_spi.c
are from the FatFS project and provide access via SPI to the FAT32 filesystem contained on the microSD card. -
z80.c
has functions run and debug the Z80 and handle I/O requests from it. -
diskemu.c
emulates an Altair 88-DISK controller to allow running CP/M and other disk-based programs. -
ihex.c
contains functions to read and write Intel HEX files. -
cli.c
contains the command-line monitor interface for controlling the Z80 and loading memory via the AVR. - The
uart.c
anduart.h
files borrowed from the avr-libc stdio demo allow the use of the C stdio library over serial. -
z80ctrl.c
contains the main function that starts initializes the bus and starts the command-line monitor interface.
The AVR is programmed with the MightyCore bootloader to allow it to be reprogrammed through the serial interface. Although I am using the MightyCore bootloader, I do not use the Arduino libraries; only avr-libc. I use the fatfs library to provide access to a FAT32-formatted SD-card containing ROM and disk images for the Z80.