Z80 Project

Z80 Project Mark 2: More UART Shenanigans

Last updated: Jan. 18, 2010, 10:38 p.m.

A couple of minor updates you might be interested in. I got a quick demo echoing characters back to the PC working last week. This uses the interrupt on receive feature of the UART setup to trigger a send routine as soon as a character is received. The demo code is available on the Z80 Project page.

It's all fairly simple but there are a few delay loops and things involved. It's also worth checking out the updated Memory and IO schematic as I've updated it with the software reset control for the UART. The only problem I had with this new bit of code was that the compiler wasn't doing exactly what I expected. After a bit of fiddling and dis-assembly I discovered that (probably fairly logically) the org statement doesn't pad the output with anything when generating the binary file, it just offsets the current count for calculating jumps. This of course meant that when I downloaded the binary file I'd generated the first instruction was a jump that missed the entire block of code, and when the Z80 tried to handle an interrupt there was no interrupt handler at the right place. I added the Seek directive as well which makes sure the output file matches the current address count and all was well. I wasn't expecting this mainly because I've not done enough Z80 programming for a long time and because the ORG directive in PIC assembly language does the seek operation as well.

I also thought I should point out that I'm using an odd extension on my assembly files, I started this a couple of years ago when I was working on a Sinclair Spectrum project. I name my Z80 assembly files .z8a which is my abbreviation of "Z80 assembly" to 3 letters. The main reason for this is to make it quickly apparent which source files are for the PIC and which are for the Z80. It has the added benefit of allowing me to have the correct syntax highlighting when I open the file as the editor I used defaults to 6502 assembly on a .asm (since 6502 sorts alphabetically before Z80 in most cases).

All that's left to test is the RTC, then implement the SD card. However, my imagination has been running wild with these successes, so design of a new add-on board to give the Z80 computer a proper keyboard and monitor of its own rather than relying on a serial terminal is under-way. More details of this and some schematics soon, rest assured it's very feature-full.

Section:
Z80 Project
Tags:
programming,
Z80 Mark 2,
Z80 homebrew,
RS232,
assembly code

Comments

Posting comments is not currently possible. If you want to discuss this article you can reach me on twitter or via email.


Contact

Email: nathan@nathandumont.com

Twitter: @hairymnstr

Links