2 ; Oliver Schmidt, 2012-11-17
4 ; IRQ handling (Apple2 version)
7 .export initirq, doneirq
8 .import callirq, __dos_type, _exit
21 ; Allocate interrupt vector table entry
22 jsr $BF00 ; MLI call entry point
23 .byte $40 ; Alloc interrupt
27 ; Enable interrupts, as old ProDOS versions (i.e. 1.1.1)
28 ; jump to SYS and BIN programs with interrupts disabled.
32 ; Print error message and exit
40 errmsg: .ifdef __APPLE2ENH__
41 scrcode $0D, "tpurretni colla ot deliaF", $0D
43 scrcode $0D, "TPURRETNI COLLA OT DELIAF", $0D
51 ; Check for valid interrupt vector table entry number which
52 ; IS necessary as this gets called even if initirq failed.
56 ; Deallocate interrupt vector table entry
57 dec i_param ; Adjust parameter count
58 jsr $BF00 ; MLI call entry point
59 .byte $41 ; Dealloc interrupt
66 ; ProDOS TechRefMan, chapter 6.2:
67 ; "Each installed routine must begin with a CLD instruction."
70 ; Call interruptors and check for success
74 ; ProDOS TechRefMan, chapter 6.2:
75 ; "When the routine that can process the interrupt is called, it
76 ; should ... return (via an RTS) with the carry flag clear."
80 ; ProDOS TechRefMan, chapter 6.2:
81 ; "When a routine that cannot process the interrupt is called,
82 ; it should return (via an RTS) with the cary flag set ..."
88 ; MLI parameter list for (de)alloc interrupt
89 i_param:.byte $02 ; param_count
90 int_num:.byte $00 ; int_num
91 .addr intptr ; int_code