Just before the RTI, there is an additional PLA (i.e. not matched with a previous PHA). The comment, taken from the disassembly described here, https://www.acornatom.nl/atom_handleidi ... ow2044.htm suggests it is to get the stack pointer.
The handler does one of two things depending upon whether data is present. It either calls a subroutine vectored via D5/D6 and returns with an RTS and then adds the PLA before the RTI. Or, it jumps to a routine in ZP which, when complete executes RTI but not before issuing the extra PLA. Obviously I am missing something.
Is anyone able to help me understand this?
Code: Select all
;============================================
; ENTRY NMI ROUTINE HARDWARE
;--------------------------------------------
LE87B lda REG8271+0 ; Load status register
and #$04 ; Test data ready bit
beq LE88B ; If set check register
inc $00F6 ; Increment low byte save/load address
bne LE888 ; Check overflow
inc $00F7 ; Increment high byte save/load address
LE888: jmp $00F2 ; Jump to zeropage routine
;--------------------------------------------
; Save register and accu before checking the result
;--------------------------------------------
LE88B: txa ;
pha ;
tya ;
pha ;
cld ;
jsr LE899 ; Load result register
pla ;
tay ;
pla ;
tax ;
pla ; Pull stack pointer ????
rti ;
;--------------------------------------------
; Interrupt request routine
;--------------------------------------------
LE899: jmp ($00D5) ;
Code: Select all
;--------------------------------------------
; Interrupt request routine initialisation controller
;--------------------------------------------
LE729 jsr LE7E4 ; Read result register
lda #$0A ; Set number of attemps = 10
sta $00F0
rts
Example of the ZP Routine
Code: Select all
;============================================
; NMI LOAD ROUTINE HARDWARE
;--------------------------------------------
LE84F: lda REG8271+4 ; Read data
sta $1FFF ; Store in memory
; address changes during NMI
pla ; Pull stackpointer ????
rti ; End of interrupt