; CalcControl v 1.0 by Eric Piel on January 1999 ; Changes the contrast and turns Off the ti82 when you want ; Thanks to all I took code : ; CrASHMan and Jeff Mears ; Mattias Lindqvist and Dines Justesen ; Wouter Demuynck ; David Eriksson ; Jon R. Johnson ; Nicolas Hannebicque ; Evil Sam and Matt A. ; Randy Gluvna #INCLUDE "crash82.inc" .DB "CalcControl",6,"-",6 ;6 is a big space State: .DB "Disabled",0 INT_CCrt .EQU 083h ; I have no registered ID byte :-((( ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ; Main ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Main: ld a, (INT_STATE) ; Check out CrASH's interrupt byte or a jr z, Install cp INT_CCrt jr z, Remove Another: call CR_GRBCopy ; Clear screen ld hl, 1A03h ld (GRAF_CURS), hl ld hl, szAnother ROM_CALL(D_ZM_STR) WaitKey: ; After this, it will return to CrASH jp CR_KHAND ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ; Install interrupt ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Install: ld a,' ' ;draw Enabled ld (State),a ld hl,'E' + ( 'n'<< 8) ld (State + 1),hl ld hl, 8400h ld de, 8401h ld (hl), 83h ld bc, 100h ldir ld hl, IntProcStart ld de, 8383h ld bc, IntProcEnd-IntProcStart ldir ld hl, 15bh ld (APD_FREE), HL ld a, 84h ld i, a im 2 ret ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ; Remove interrupt ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Remove: ld a,'D' ;draw Enabled ld (State),a ld hl,'i' + ('s' << 8) ld (State + 1),hl im 1 ld hl, 300h ld (APD_FREE), hl xor a ld i, a ld (INT_STATE), a ret szAnother: .DB "Disable the other interrupt",0 ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ; Interrupt proc ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ IntProcStart: di ex af, af' exx ; Set CrASH's interrupt byte ld a, INT_CCrt ; Int state is set - on (ID) ld (INT_STATE), A ; (to tell other programs our interrupt is loaded) LD A, ($800A) ; Word 8009: Counter used for APD CP $11 JR NC, Continue ; If APD counter < 17, call switch off ;why so big? Pause: call 07EAh ; it is: ;xor a ; The TI routine ;OUT (003H),A ;inc a ;OUT (003H),A ; turn off screen ;ei ;halt ;call DISP_DELAY ; The End of the routine di res 4,(IY+$09) ; reset ON ld a,073h ld ($800A),a ; reset APD counter jr ExitResAlpha Continue: ; Check keyboard ld a, 11011111b ; Alpha ? out (P_KEYBOARD), a in a, (P_KEYBOARD) rla jr c, ExitInt IN A, ($03) ; ON ? BIT 3, A JR Z,Pause ld a,r and 01110b jr nz,ExitInt ; Not too much! Only once on 8 ld hl,CONTRAST ld a, 11111110b ; The Arrows ? out (P_KEYBOARD), a in a, (P_KEYBOARD) rra jr nc,down bit 2,a jr nz,ExitInt up: ld a,(hl) cp $28 jr nc,update_contrast inc a jr change down: ld a,(hl) or a jr z,update_contrast dec a change: ld (hl),a update_contrast: add a,$D7 ; courtesy of out ($10),a ; Randy Gluvna ExitResAlpha: res 4,(IY+12h) ; reset Alpha ExitInt: exx ex af, af' jp 38h IntProcEnd: .END