1 #include "../z80-cpu.h" 2 3 typedef unsigned char(*ptr_Func)(unsigned char); 4 5 static unsigned char p, prio = 0xff; 6 static ptr_Func put_byte, (*peripheral)(void); 7 8 set_my_priority(unsigned char v,ptr_Func (* func)(void))9void set_my_priority(unsigned char v, ptr_Func (*func)(void) ) 10 { 11 set_cpu_pin(inter,1); 12 if (v <= prio) { prio=v; peripheral=func; } 13 } 14 15 acknowledge_interrupt(void)16void acknowledge_interrupt(void) 17 { 18 if (peripheral) 19 put_byte= (*peripheral)(); 20 else 21 set_cpu_pin(inter,0); 22 p= prio; 23 prio = 0xff; 24 } 25 26 read_request_to_peripheral(void)27unsigned char read_request_to_peripheral(void) 28 { 29 return put_byte ? (*put_byte)(p) : 0xff ; 30 } 31