A86: quick off


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

A86: quick off



heres a small, unintelligent pre-beta program that shuts your calc off
when you press on. only prob is you have to pull out a battery and press
on to turn the calc on without it turning off again. im planning on
using a routine to stop this....somehow :)
#include "asm86.h"
#include "ti86asm.inc"

#define pushR  in a,(5) \ push af \ ld a,$0d \ out (5),a \ nop \ nop \ nop
#define popR   pop af \ out (5),a

_user_int_ram EQU $d2fd

.org _asm_exec_ram
   res 2,(iy+$23)    ;turn user int off so it won't get called by
                     ;accident before we're ready
   
   ld hl,int         ;copy prog to user int buffer
   ld de,_user_int_ram+1
   ld bc,int_end-int
   ldir
   
   ld a,(_user_int_ram+1)  ;set up checksum byte
   ld hl,_user_int_ram+($28*1)
   add a,(hl)
   ld hl,_user_int_ram+($28*2)
   add a,(hl)
   ld hl,_user_int_ram+($28*3)
   add a,(hl)
   ld hl,_user_int_ram+($28*4)
   add a,(hl)
   ld hl,_user_int_ram+($28*5)
   add a,(hl)
   ld (_user_int_ram),a

   set 2,(iy+$23)    ;turn it on
   ret

int:
   push af
   push bc
   push hl

   in a,(3)        ;check for on being pressed
   and $8          ;|
   or 0            ;V
   jr nz,i0        ;if it wasn't then goto i0
   res 4,(IY+9)    ;reset break status
   pushR           ;save the registers
   call $0C29      ;turn the calc off
   popR            ;return the registers

i0:

   pop hl
   pop bc
   pop af
   ret

int_end:

.end



Follow-Ups: