NEW
  AUTO 3,1
* object code = mli_3
*
* this routine handles interrupts and is coded to reach 'lreset' precisely at
* address $FFCB (ROM rts opcode) for rom switching to function.

lanirq	.EQ	*-ofsR2
	
H2D9B	pha                            $2D9B-2DFF moved to $FF9B-FFFF
         lda   accsav
         sta   oldacc
         pla
         sta   accsav                      
         pla				get status register from stack
         pha                            and put it back.
         and   #$10                     is it a break or interrupt?
         bne	H2DC2                   branch if break.
         lda   $D000                    get ram bankid (LC1 = $D8, LC2=$EE)
         eor   #$D8                     is the system active? ($D8)
         beq	sysactv                 branch if it is
         lda	#$FF
sysactv	sta	bankid
         sta   afbank
         lda   #>aftirq			setup return address
	pha
         lda   #<aftirq
	pha
         lda   #$04			status reg with interrupt flag set
	pha
H2DC2    lda   #>romirq			setup ROM re-entry
	pha
         lda   #<romirq
	pha
gorom	.EQ	*-ofsR2
         sta   romin			hits ROM rts at $FFCB

* 'lreset' address must = $FFCB for rom switch i/o to work

lreset	.EQ	*-ofsR2
         lda   rreset+1
         pha
         lda   rreset
         pha
         jmp   gorom
rreset	.EQ	*-ofsR2
         dc	I2'resetv-1'		rts to resetv
fix45	.EQ	*-ofsR2
         sta   p8areg                   A register savearea
         lda   oldacc
         sta   accsav
         lda   ramin			read/write RAM bank 1
         lda   ramin
         lda   afbank
         jmp   irqxit0
stypfx	.EQ	*-ofsR2			fix appletalk PFI bug
         sty   newpfxptr
         sty   preflag                  prefix flag
         rts
stapfx	.EQ	*-ofsR2
         sta   newpfxptr
         sta   preflag
         rts

* these 3 vectors hard-coded into processor

                .DA nmivect'              nmi handler
                .DA lreset'               reset handler
irqv	.EQ	*-ofsR2
	dc    i2'lanirq'		irq handler

* end of obj mli_3
*--------------------------------------
MAN
LOAD USR/SRC/PRODOS.203/PRODOS.S.IRQ
SAVE USR/SRC/PRODOS.203/PRODOS.S
ASM
