From: Dave M. <mc...@ne...> - 2012-06-20 04:24:02
|
On 06/19/2012 11:10 PM, Dan Roganti wrote: > 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 as the sdcc manual doesn't seem to describe this. ... > What I'm not sure is how to organize and code the proper syntax needed > for the interrupt service routines on the SIO/0 interrupts. I'm familiar > now with how SDCC lets me organize the I/O ports in C code. Using the > "__sfr __at " syntax to define the I/O ports. Hey, you're fifty feet from me. ;) Here's an example ISR function prototype from some of my 8051 code: void timer0_isr(void) interrupt 1; I guess the first question is what interrupt mode are you putting the processor into? I assume mode 2...don't know offhand if SDCC's Z80 startup code sets an interrupt mode for you or not. I know the Z80's default after reset is mode 0. In any event, I'd write a piece of code with an ISR defined in it as above and look at the assembly listing. This part of the Z80 support seems to be incompletely documented. (I didn't know you had gotten that far on your board yet...I'm swamped until the ~24th with a work deadline but can hack on it with you after that) -Dave -- Dave McGuire, AK4HZ New Kensington, PA |