A86: Disabling timer interrupts - Calc OFF sequence comments


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

A86: Disabling timer interrupts - Calc OFF sequence comments




Can a timer interrupt be disabled? I know you can have two types of
interrupts - one caused by the ON key, the other caused
by the ~ 200 hz timer. Can the timer interrupt be disabled? Here is the code
for the shut down routine in the ROM -

calc_off:
0c29  fdcb237e  bit     7,(iy+$23) ;call user off routine
0c2d  c4c53d    call    nz,user_off
0c30  b7        or      a
0c31  f5        push    af
0c32  21eec3    ld      hl,$c3ee ;res 2,(iy+onflags)
0c35  cb56      bit     2,(hl)  ;if it was set, call _clrScrn
0c37  cb96      res     2,(hl)
0c39  c4cb3d    call    nz,_clrScrn ;$3dcb
0c3c  f1        pop     af
0c3d  3805      jr      c,$0c44
0c3f  cdfb0d    call getRAMcksum ;getRAMcksum
0c42  1803      jr      $0c47
0c44  215aa5    ld      hl,$a55a
0c47  22d8c1    ld      (_onCheckSum),hl ;save RAM checksum
0c4a  3e01      ld      a,$01   ;shut down screen?
0c4c  d303      out     ($03),a
0c4e  fdcb129e  res     shift2nd,(iy+shiftflags)
0c52  fdcb099e  res     onRunning,(iy+onflags)
0c56  08        ex      af,af'
0c57  d9        exx
0c58  fb        ei
0c59  76        halt   ;minumum power loop
0c5a  18fd      jr      $0c59

If the timers keep on going during, that means that the interrupts are being
executed ~ 200 hz. This seems to apply to the
disassembling I have done. When an interrupt occurs, it checks to see if the
LCD is on and if the ON key was pressed. If the ON key was pressed, however,
it would execute different code when the interrupt occurs. But if the ON key
wasnt pressed, it
skips the interrupt

Which leads me to believe interrupts are executed in the background when the
calculator is shut off but you must right a custom interrupt handler to
handle these features

What I am trying to say is that It may be possible to overriding the default
interrupt routine in both IM 1 and IM 2. I could possibly modify it so it
would set up a counter when the calc is ON or the calc is OFF - i.e. A real
time clock - or less accurate maybe that little animal game/program that you
have to feed it or it dies type TSR.

BTW, Here is a speedy IM 1 routine I havent tested it yet. But it should
work -

in a,(3)
rra   ; Check rightmost bit

ld a,9
adc a,0  ; $09 or $0A
out (3),a
ld a,$0B
out (3),a  ; Sends a total of 2 bytes

pop hl       ; Ditch PC so it goes back to address originally called from
exx
ex af,af'
ret            (or reti? doesnt matter I dont think)

I also got an IM 2 set up working for a game that Dux is working on. And it
ends the interrupt at the end, it doesnt jump to $38
Notice two bytes need to be sent to Port 3, either $09 $0B (ON key has been
pressed) or $0A $0B (ON key has not been pressed). This appears to signal to
the TI hardware whether or not the ON key interrupt "has been handled". I am
not exactly sure though, I would love some elaboration

Later,
    Matt


Follow-Ups: