[A83] Re: interrupt with shutdown


[Prev][Next][Index][Thread]

[A83] Re: interrupt with shutdown




> But with the current interrupt routine, when the calc
> shuts down with that 2nd+on, it immediately get's back
> on if I hold on to the <ON> and release it after a few
> seconds (sometimes), or I press 2nd and a short push
> on <ON> it also get's back on. (also only sometimes)
> I do not know why that happens, but it shouldn't do that
> in the final program. Like when you shut the calc down
> like normal and then it's suddenly back on.
> We do not want that to happen, do we?

I forgot something. You must wait until an on-key hold down (bit 3 port 3)
generates an on-key interrupt (bit 0 port 3) and only then shut down the
calculator. If you don't do this and shut down the calc as soon as you
detect an on-key press, that press might generate an interrupt which turns
the calc back on.

I've never tested it, but I this should work now.

interrupt_start:
;---------------

    ex af,af'
    exx
    ld a,($800A)
    cp $11
    jr nc,resume
shutdown:
    res shift2nd,(iy+shiftflags)
    ld a,$74
    ld ($800A),a
    ld a,8
    out (3),a
    ld a,1
    out (3),a
    exx
    ex af,af'
    ei
    halt
    ret
resume:
    in a,(3)
    bit 0,a
    jr z,stop
    bit 3,a
    jr nz,stop
    bit shift2nd,(iy+shiftflags)
    jr nz,shutdown
stop:
    jp    003Ah

;------------
interrupt_end: