First peripheral

The first peripheral for the Z80 is working (although still somewhat alpha at this point): a two-line LCD text display. It’s mapped as I/O ports 0x00 and 0x01, with control commands being sent to 0x00 and data to 0x01.

It’s been tested with a “Hello, World!” program written in Z80 assembler. (The current version of the program is very inefficient; the ideal way to handle it would be to write the “Hello, World!” data into memory and then clock it out to the I/O port automatically (I believe the Z80 can do this in a single instruction, once the registers are set up.)

Here is the “Hello, World!” assembly code. The C register is loaded with 0x01, then the A register is loaded with the ASCII code for each character, which is output to the port.

In related news, I think I’ve found how to turn off all the peripherals on the PIC16F887. It’s a good replacement for the ‘877A — with an internal 8MHz clock, plus a complete 8-bit PORTA — but it does seem to power up with a lot of extraneous analog options turned on. The MPU for the text display is an ‘887.

Edit: Here is an updated version of the “Hello, World!” app — using a single OTIR (Output/Incrementing/Repeat) instruction to do the dirty work, once the registers are all updated. Apparently it works by not incrementing the program counter, so the same instruction is executed over and over until B counts down to zero. Whatever the mechanism, it works as advertised, and the program now takes up only 27 instead of 60 bytes of memory!

This entry was posted in Coding, Digital, DrACo/Z80, Drexel, EET325. Bookmark the permalink.

One Response to First peripheral

  1. Philip M. Bacchi says:

    You might want to check out http://www.xgamestation.com/index.php
    Its a retro video game hardware kit. I ran across this from comments on a slashdot post ( How To Encourage a Young Teen To Learn Programming? http://ask.slashdot.org/article.pl?sid=08/07/22/0452225 )about teaching teen children of programmers about computer hardware. Hope you find this helpful.

    Philip M. Bacchi

Leave a Reply