Hey guys, I would like to learn how to program my own interrupt routines. I do not have much experience in assembly (I read TI in 28 Days until Interrupts) but the example does not work in debuggers.
I have also tried it on my own calculator and it works fine... Is there anything wrong with this code?
Code:
I have also tried it on my own calculator and it works fine... Is there anything wrong with this code?
Code:
.nolist
#include "ti83plus.inc"
#define ProgStart $9D95
time .EQU AppBackUpScreen ;1 Byte
.list
.org ProgStart - 2 ;-2 wegen den beiden tokens
.db t2ByteTok, tAsmCmp
INTRPT_MASK .EQU %00001011
b_call(_ClrLCDFull)
DI ; Turn interrupts off until we're ready
; Load interrupt address vectors
LD HL, interrupt
LD ($993F), HL
LD ($997F), HL
LD ($99BF), HL
LD ($99FF), HL
LD A, $99
LD I, A
LD A, INTRPT_MASK ; Enable hardware
OUT (3), A
IM 2 ; Switch to Mode 2
EI ; Activate interrupts
; GetKey and GetCSC only function in Mode 1,
; so gotta use the key port.
LD A, %10111111
OUT (1), A
KeyLoop:
IN A, (1)
CP %01111111 ; If [DEL] pressed, exit
JR NZ, KeyLoop
LD A, %00001011 ; Enable hardware
OUT (3), A
IM 1 ; Calculator needs Mode 1
RET
interrupt:
EX AF, AF'
EXX
XOR A ; Disable hardware
OUT (3), A
LD HL, 0
LD (CurRow), HL
LD HL, (counter)
INC HL
LD (counter), HL
b_call(_DispHL)
LD A, INTRPT_MASK ; Enable hardware
OUT (3), A
EX AF, AF'
EXX
EI
RET
counter:
.DW $0000
.end