I`ve been working on some software side of C-Z80 Computer project. Here are the results:
I`ve added a new Monitor command for downloading data and code to RAM using 16450 UART board.It`s syntax is very simple:
sload <16-bit destination address in hex>
The command waits for begining of a transmission on serial port. After receiving the first byte it stores it in RAM at given address. Then, all following bytes are read and stored in appropriate memory locations. After detecting too much idle time, the command assumes, that it has just received the last byte, and exits displaying a confirmation message. The UART is configured for a fixed value of 9600 baud (most compatible in my opinion). All possible UART problems are handled and indicated by error messages (buffer overrun, framing error, break condition).
The next new feature is the graphics mode of the VGA display board.Initialy, the firmware written for VGA display board`s Atmegs328P chip was only able to render text, having ASCII characters patterns stored in program memory. As I mentoined in earlier post, With 2KB of RAM in Atmega328P it was theoreticaly possible to display 160×100 graphics in one colour (1 bits per pixel: (160×100)/8=2000 bytes). Altough it prooved to be very tricky job considering Atmega`s limitations – both RAM and timming requirements for VGA signal generation, I`ve finally managed to implement the graphics mode in my display board. What`s more: video memory seen form Z80 side looks like a linear framebuffer. In Z80 code, when I want to switch to graphics mode I have to execute following code:
This switches the AVR chip to graphics mode. a delay is needed to give it some time to clear the video RAM. Withou the delay the display would be corrupted, and cannot be fixed from Z80 side. Now all individual pixels of 160×100 graphics mode can be addressed with single OUT instruction: BC register holds the coordinates (b=y c=x) and a value of 0 or ffh passed to chosen port turns off or on corresponding pixel. Below is a code to switch back to text mode:
The addresses and OUT instructions are much different this time, as text and graphics modes use completly different address decoding schemes inside AVR code. Those new features of my C-Z80 computer can be seen on the video below. I use a standard Atari-style joystick plugged into input port on the motherboard (with pullup resistors inside db9 socket) and a 7segment LED display, to show the output port status:
The CTC interrupt example and Snake game sources can be checked in the download section. I`ve also included a new version of ROM Monitor sources (with UART command included) and an updated issue of User`s Manual.
I`ve decided to choose a Compact Flash card as a mass storage for my project. There are few reasons for that:
- Broad availability and popularity
- Low price
- Simple 8-bit interface for microprocessor bus.
- Possibility to use as a disk drive for CP/M system in future.
As the CF-card interface to Z80 will be so simple – just an address decoder and some passives, I`m planning to add a 8255 chip as a bonus on that card. It could be used for any I/O purpose possible (maybe a printer interface for example ?)