#include "asm86.h" #include "ti86asm.inc" #include "ti86user.inc" ;My new include file to make mods easier! #include "ram86.inc" ;For cursor update addresses. .org _asm_exec_ram ;This part is in the regular assembly area res userInt,(iy+userflags) ;Disable old user interrupt, if it exists ld hl,CodeStart ;Point hl at the new interrupt code ld de,_user_int_ram ;Point de to where it goes ld bc,IntEnd-IntStart ;Calculate how long the code is ldir ;Move bc bytes from hl to de ld a,(_user_int_ram) ;These codes just calculate ld hl,_user_int_ram+$27 ; the checksum of the user add a,(hl) ; interrupt. The calc checks ld hl,_user_int_ram+$4F ; this so it can avoid damaged add a,(hl) ; interrupt code. There's ld hl,_user_int_ram+$77 ; probably an easier way to add a,(hl) ; calculate it, but it's late ld hl,_user_int_ram+$9F ; at night and I'm too tired add a,(hl) ; to think about it. Besides, ld hl,_user_int_ram+$C7 ; you should only need to run add a,(hl) ; this once! ld (_user_int_chk),a ;Put the checksum where the calc will find it set userInt,(iy+userflags) ;Activates the new interrupt code! ret ;Return to TI-OS CodeStart: ;_asm_exec_ram pointer to interrupt .org _user_int_ram ;I don't use it here, but this lets you use JPs ; and CALLs in the interrupt IntStart: ;Makes the math easier push af ;_Must_ do! push bc ;Shouldn't need these, but the push hl ; checksum fails w/o them bit shiftAlpha,(iy+shiftflags) ;Is the calc in Alpha mode? jr z,SkipIt ;If not, skip all this crap! ld a,$5F ;Mask out all but [ALPHA]'s row out (1),a ;Send to keyboard nop ;Wait for the keyboard port nop ; to finish reading keypress in a,(1) ;Read keypress cp $80 ;Was the key in [ALPHA]'s column? jr nz,NoFix ;If not, just skip the the regular code. res shiftAlpha,(iy+shiftflags) ;Just turn off Alpha, don't bother w/ case NoFix: set shiftALock,(iy+shiftflags) ;Forces calc to go directly to A-lock bit shift2nd,(iy+shiftflags) ;Has 2nd been pressed? jr z,SkipIt ;If not, don't bother ld a,$28 ;Set bits 3 (turn off 2nd) and 5 (flip Alpha case). xor (iy+shiftflags) ;Modify flags into a... ld (iy+shiftflags),a ;...and put them back where they go SkipIt: pop hl ;And this cleans up our stack pop bc ;Ditto... pop af ;Restore the calc's registers ret ;Head back to the main interrupt IntEnd: ;See comment for IntStart ;) .end