[A83] interrupt with shutdown


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

[A83] interrupt with shutdown




So this piece of code works fairly good for now,
but there is something weird with putting the calc
back on when the interrupt is running.
If you press <ON> too long or quite shortly, it does
some weird stuff.
And I still don't know how to make a romcall from within
this interrupt...


               SUCKER


;  STANDARD INTERRUPT ROUTINE by SUCKER
;  ------------------------------------

;make sure to compile this with devpack

;regular Ti-83 only !!


.nolist
#define end .end
#define END .end
#define equ .equ
#define EQU .equ
#include "ti83asm.inc"
#include "tokens.inc"

.list

.org 9327h


        im 1

	ld a,(current)
	or a
	push af
	ld hl,text1
	call _puts
	call _newline
	pop af
	jr nz,disable

install:
	ld hl,text3
	call _puts
        ld hl,$8300
        ld de,$8301
        ld (hl),$84
        ld bc,$0100
        ldir
        ld hl,interrupt_start
        ld de,$8484
        ld bc,interrupt_end-interrupt_start
        ldir
        ld a,$83
        ld i,a
        im 2
	ld a,1
store:
	push af
	ld hl,prog
	rst 20h
	call _chkfindsym
	ld hl,current-$9327+2
	add hl,de
	pop af
	ld (hl),a
	ret

disable:
	ld hl,text2
	call _puts
	im 1
	xor a
	jr store

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

	di
	ex af,af'
	exx

        ld a,($800A)               ; check for apd
        cp $11                     ;
        jr nc,resume        	   ;
        ld a,$74                   ; reset apd counter
        ld ($800A),a               ;
shutdown:
	res shift2nd,(iy+shiftflags)
	ld a,8
	out (3),a
	ld a,1
	out (3),a
	ei
	halt
	jr stop

resume:
	bit shift2nd,(iy+shiftflags)
	jr z,stop
	in a,(3)
	and 8
	jr z,shutdown
stop:
	exx
	ex af,af'
	call $0038
	ei
	ret


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

text1: .db "Interrupt",0
text2: .db "Disabled",0
text3: .db "Enabled",0
prog: .db 6,"ZINT",0
current: .db 0
.end
END

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp