Trying to learn how to use C code for interrupts on Z80, CTC, SIO

Discussion about other targets
Post Reply
Rogtronics
New member
Posts: 1
Joined: Wed Jun 20, 2012 2:43 am

Trying to learn how to use C code for interrupts on Z80, CTC, SIO

Post by Rogtronics »

I'm trying to learn how to implement interrupts in C code for a Z80 controller board I made with a CTC and SIO/0 to get the console port running. I'm not having much success to figure out how to code this. I was wondering if there were any C code examples for the Z80 that I could use as a reference.

I've normally worked with assembly code to get something like this running on my other vintage computers - some using the 8080, 6502 or 6800. Now that I have Z88dk installed, I like to learn how to do this in C code - much like what I do with present-day microcontrollers, such as the AVR.

This is just a generic Z80 board that I made, it's not any home microcomputer. Just a design which I've taken straight out of the Zilog Manuals and books I have on the Z80. The serial port has a Z80A CTC and Z80A SIO/0 with a Z80A CPU running at 4Mhz. I have 32KB eprom at 0x0000 and 32KB Sram at 0x8000. The wiring on this board has the standard interrupt configuration that I used from the SIO manual with the IEI and IEO wired from the CTC to the SIO/0. The I/O ports for the CTC is 0xE0 and the SIO/0 is 0xC0

What I'm not sure is how to organize and code with the proper syntax, the interrupt service routines on the SIO/0 interrupts. I'm familiar now with how Z88dk lets me organize the I/O ports in C code. As this board also has a 8255 PIO, at I/O port oxF0. And I've written some C code to test this and I can write and read to all 3 ports on the 8255. I used this part versus the Z80PIO because I can get 24 bits of I/O with one part instead of 16bits with the Z80PIO.

any info is appreciated

thanks,
Dan
Post Reply