home *** CD-ROM | disk | FTP | other *** search
- ;*************** IntTest82 ver 1.0 ***************
- ;
- ; This program is a small demo of how interrupts can
- ; be used on the TI82 under Ash. The interrupt rutine
- ; ounts from o to 7 in ASCII, all the time storing
- ; the current value in a fix location in mem. This
- ; counter is shown in the top right corner of the
- ; display when you run IntTest82.
- ;
- ; To start the program, run it from Ash and press
- ; ENTER to initialize the interrupt rutine. You can
- ; stop the rutine by entering the program and then
- ; pressing DEL. Pressing MODE will exit the program.
- ;
- ; DO NOT ENTER GRAPH SCREEN WHILE RUNING THE PROGAM!
- ; The interrupt rutine is stored in the graph and will
- ; be overwrite if the graph mem is used for anything
- ; else.
- ;
- ; TURN OFF THE PROGRAM BEFORE TURNING OFF THE CALC!
- ; The interrupt vectors are stored in the backup buffer
- ; which is used when the calc is turned off (or on APD).
- ;
- ; If you do use the graph mem or turn off the calc, the
- ; calculator will crash.
- ;
- ; The reason that the program does not display the counter
- ; when you are not runing the program is that the build in
- ; display rutines sometime causes problems when used in
- ; an interrupt (i have never seen the calc crash because
- ; of this).
- ;
- ;
- ; Dines Justesen, (C) 1997
-
- #INCLUDE "ti82.h"
-
- Char = $82FE ; Char to be shown
- Counter = $8583 ; Counter in start of graph mem
-
- .ORG START_ADDR
- .DB "IntTest82 1.0 by DJ",0
- TEXT_START
- LD HL,TScreen ; Display text
- ROM_CALL(D_ZT_STR)
- KeyLoop: ; Wait for keypress
- LD HL,$0F00
- LD ($800C),HL
- LD HL,Char
- ROM_CALL(D_ZT_STR)
- CALL GET_KEY
- CP $9
- JR Z,SetupInt
- CP $38
- JR Z,RemoveInt
- CP $37
- JR Z,End
- JR KeyLoop
-
- RemoveInt:
- IM 1 ; Normal interrupt mode
- SET 0,(IY+3) ; Graph is dirty
- JR KeyLoop
-
- End:
- TEXT_END
- RET
-
- SetupInt:
- LD HL,$8300 ; Setup interrupt vector table in backup
- LD DE,$8301 ; buffer (only used for APD). The Int
- LD (HL),$85 ; rutine is placed in graph mem to have
- LD BC,257 ; as much space as possible.
- LDIR
-
- LD HL,IntProcStart ; Get pointer to interrupt rutine
- LD DE,$8585 ; Start of int rutine, and length of it
- LD BC,IntProcEnd-IntProcStart+1
- LDIR
-
- XOR A ; Init vars
- LD (Counter),A
- LD (Char+1),A
- LD A,$30
- LD (Char),A
-
- LD A,$83 ; Point to the new table
- LD I,A
- IM 2
-
- JR KeyLoop
-
- IntProcStart:
- EX AF,AF'
- EXX
- LD HL,Counter
- INC (HL)
- LD A,(HL)
- AND %00111111
- JR NZ,ExitInt
- LD HL,Char
- LD A,(HL)
- INC A
- AND $37
- LD (HL),A
- ExitInt:
- EXX
- EX AF,AF'
- JP $0038 ; Call Std inetrrupt handler
-
- IntProcEnd:
-
- TScreen:
- .DB " IntTest82 "
- .DB " ver 1.0 "
- .DB "Press: "
- .DB "ENTER to start "
- .DB "DEL to end "
- .DB "MODE to exit "
- .DB "(c) 1997 by "
- .DB "Dines Justesen ",0
- .END
-