Code: Select all
void rtunes_pixel( uint8_t, uint8_t, uint8_t ) __z88dk_callee;
I have interrupts enabled, my interrupt routine is empty. It's compiling to:
Code: Select all
700 0000 _isr:
701 0000 EXTERN asm_im2_push_registers
702 0000 EXTERN asm_im2_pop_registers
703 0000 CD 00 00 call asm_im2_push_registers
704 0003 CD 00 00 call __im2_isr_isr
705 0006 CD 00 00 call asm_im2_pop_registers
706 0009 FB ei
707 000A ED 4D reti
708 000C ; ---------------------------------
709 000C ; Function _im2_isr_isr is a stub
710 000C ; ---------------------------------
711 000C EXTERN l_ret
712 000C defc __im2_isr_isr = l_ret
The problem seems to be in the way I'm trying to pick up the values passed by the C code. My function is simple and probably not relevant, but the top bit is:
Code: Select all
PUBLIC _rtunes_pixel
_rtunes_pixel:
;di
pop af ; Callee convention, this is the return address
pop de ; Args are passed as 2 unsigned chars, x,y. Y is in D, X is in E
pop bc ; C=1 for draw, 0 for clear, caller puts single byte on stack so B not used
dec sp ; adjust for single byte
push af ; Push the return address back. Stack is now ready for the return.
;ei
...
I'm new to this sort of thing, and I can't see what I'm doing wrong here. I can't see where in that pop/push sequence an interrupt might occur which would upset it. Wherever the interrupt comes in I'd expect the asm_im2_push_registers call to protect my sequence.
What am I doing wrong?