[A83] Re: TI-OS shutdown
[Prev][Next][Index][Thread]
[A83] Re: TI-OS shutdown
Here's a little program that does take over the shutdown.
It's a five minute hack, but it's saving some power for
you, I think. :) (More halts are running during "off".)
PG
-------
.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "ti83asm.inc"
#include "tokens.inc"
.org 9327h
ld hl,interrupt ; setting up interrupt and
ld de,$fe70 ; exiting
ld bc,calcstate-interrupt+1
ldir
ld hl,$8600
ld de,$8601
ld (hl),$87
ld bc,$0100
ldir
ld hl,$8787
ld (hl),$c3
inc hl
ld (hl),$70
inc hl
ld (hl),$fe
inc hl
ld a,$86
ld i,a
im 2
ret
interrupt:
ex af,af'
exx
ld a,(calcstate+$fe70-interrupt) ; calcstate: 0 - on
or a ; 8 - off
jp z,calcison+$fe70-interrupt
in a,(3) ; this is the custom
and 8 ; "off" part
jp nz,myintend+$fe70-interrupt
ld (calcstate+$fe70-interrupt),a
ld a,3
out ($10),a
res shift2nd,(iy+shiftflags) ; "releasing" 2nd
inc sp ; since the original
inc sp ; interrupt couldn't
jp myintend+$fe70-interrupt ; do that
calcison: ; the custom "on" part
bit shift2nd,(iy+shiftflags) ; checkind 2nd
jp z,intend+$fe70-interrupt
in a,(3) ; checking on
and 8
jp nz,intend+$fe70-interrupt
ld a,2
ld (calcstate+$fe70-interrupt),a
out ($10),a
di
checkon:
in a,(3)
and 8
jr z,checkon
ei
ld bc,offloop+$fe70-interrupt
push bc
myintend: ; evading the rom interrupt
in a,(3) ; (calc is in the custom "off" state)
rra
ld a,0
adc a,9
out (3),a
ld a,$0b
out (3),a
ex af,af'
exx
ei
reti
intend: ; jumping to the rom interrupt
in a,(3)
rra
ld a,0
adc a,9
out (3),a
ld a,$0b
out (3),a
jp $3a
offloop: ; this is the "off" routine,
halt ; the first thing to be used to get
jr offloop ; out of it is the custom interrupt
calcstate:
.byte 0
.end
END
References: