home *** CD-ROM | disk | FTP | other *** search
- #include "asm86.h"
- #include "ram86.inc"
- #include "ti86asm.inc"
-
- _user_int_ram EQU $d2fd ;Area where interrupt handler goes
-
- .org _asm_exec_ram ;Instruction Counter starts at $D748
-
- bit 2,(iy+$23)
- jp z,Install
- res 2,(iy+$23)
- ld hl,$0000
- ld (_curRow),hl
- ld hl,UnInstMsg
- jp DoneMain
-
- Install:
- ld hl,int_copy ;copy prog to user int buffer
- ld de,_user_int_ram+1 ;1 byte ahead of checksum
- ld bc,int_end-int_start ;length of interrupt handler
- ldir ;hl is the source, de is the destination,
- ;and bc is the length
-
- ld a,(_user_int_ram+1) ;set up checksum byte
- ld hl,_user_int_ram+($28*1) ;load byte
- add a,(hl) ;add to total
- ld hl,_user_int_ram+($28*2) ;load byte
- add a,(hl) ;add to total
- ld hl,_user_int_ram+($28*3) ;load byte
- add a,(hl) ;add to total
- ld hl,_user_int_ram+($28*4) ;load byte
- add a,(hl) ;add to total
- ld hl,_user_int_ram+($28*5) ;load byte
- add a,(hl) ;add to total
- ld (_user_int_ram),a ;load checksum in its location
-
- set 2,(iy+$23) ;turn it on
- ld hl,$0000
- ld (_curRow),hl
- ld hl,InstMsg
- DoneMain:
- call _puts
- call _getkey
- ret
-
- InstMsg:
- .db "Installed",0
- UnInstMsg:
- .db "Uninstalled",0
-
- int_copy:
-
- .org $D2FE ; Intruction Counter starts at $D2FE
- int_start:
- jr RealStart
- .db $00 ;Have we set bit 3 at $C3ED?
- RealStart:
- push af ;Save regs for rest of interrupt
- push bc
- push hl
- xor a ;Check if we set bit 3 of $C3ED
- ld hl,(int_start+2)
- cp (hl)
- jr z,Cont
- res 3,(iy+$08) ;If so, reset it...
- ld (hl),a ;...and the marker.
- Cont:
- ld a,%01101111 ;Check row 4
- out (1),a
- nop
- nop
- in a,(1)
- cp $FF ;Exit if no key pressed
- jr z,Done
- bit 4,a ;Check if EE pressed
- jr nz,Done
- bit 3,a ;Check if 7 pressed
- jr nz,Done
- ld a,1 ;Set APD timer
- ld ($C00A),a
- ld (int_start+2),a ;Mark that we set 3, iy+$08
- set 2,(iy+$08) ;Should be already set, but it doesn't hurt to make sure
- set 3,(iy+$08) ;Must be set to trigger APD
- Done:
- pop hl ;Restore regs
- pop bc
- pop af
- ret
- int_end:
-
- .end
-