Re: [Sdcc-user] trying to learn how to use C code for interrupts on Z80, CTC, SIO

2012-06-20 Thread Dan
On 6/19/2012 11:58 PM, Dave McGuire wrote: > 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 th

Re: [Sdcc-user] trying to learn how to use C code for interrupts on Z80, CTC, SIO

2012-06-20 Thread Maarten Brock
Hi, Looking in the code generator it seems that __interrupt should turn a normal function into an ISR and generates some PUSHes/POPs and a RETI. But it also seems that unless you make it callee-saves it forgets half of the registers. If the __interrupt function is also __critical it will use RETN

Re: [Sdcc-user] trying to learn how to use C code for interrupts on Z80, CTC, SIO

2012-06-20 Thread Philipp Klaus Krause
Personally, so far, I just use some asm code in my own crt0.s for the interrupts, e.g. for the NMI: push af push bc push de push hl ;push ix ; saved by callee push iy call _cv_vint pop iy ;pop ix pop hl pop de pop bc pop af retn where void cv_vint(void); is just an ordinary C function like any

Re: [Sdcc-user] trying to learn how to use C code for interrupts on Z80, CTC, SIO

2012-06-19 Thread Dave McGuire
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 cod

[Sdcc-user] trying to learn how to use C code for interrupts on Z80, CTC, SIO

2012-06-19 Thread Dan Roganti
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 refer