;Secure86 v3.0.0 by Kirk Meyer. Please tell me why if you use this. Send any ;e-mail to "_@ibm.net". If you steal large portions then Phil the Demon of ;Insufficient Light will darn you to heck. #include "asm86.h" #include "ram86.inc" #include "ti86asm.inc" #include "ti86abs.inc" .org _asm_exec_ram call $49DC ;_flush_all_menus it_begins: call _clrscrn call _homeup ld hl,MessageStr ;get the message they want call _puts xor a ld (_ioprompt),a ld hl,(_CLEANTMP) push hl ld hl,(_PTempCnt) ld (_CLEANTMP),hl ld a,$0C ld (_asap_ind),a call _exec_pg3 ;input string pop hl ld (_cleantmp),hl call _runindicoff ;turn indicator back off ld hl,$0000 ld (_penCol),hl call displaythestring ;display their string ld a,(_penCol) ;see its column xor $7F ;flip it rra ;and divide it by 2 ld h,$22 ld l,a ld (_penCol),hl ;now set the pen column again set 3,(iy+$05) ;invert our menu text call _clrscrn ld b,144 ;fill 144 bytes w/ black (9 lines) ld hl,$FE10 BlackLoop: ld (hl),$FF inc hl djnz BlackLoop call displaythestring ;now display the string centered and inverted res 3,(iy+$05) ld hl,$0003 ;ask if it is okay ld (_curRow),hl ld hl,OkayStr call _puts happykey: ;it was late and i was tired halt call _getky or a jr z,happykey cp K_0 jp nz,it_begins ld hl,$FE10 ;this program uses the _alt_slink_exec area ld de,_alt_slink_exec ;of RAM to store its information ld bc,144 ;here we copy the bitmap for their message ldir ;to _alt_slink_exec call _clrscrn ld hl,$0001 ld (_curRow),hl ld hl,CodeStr call _puts bigger_getcode: ld bc,$077F ;here is where we poll the keypad ; b = number of times to loop (7) ; c = keypad bitmask ($7F to start) ld hl,keys ;hl = where to store all the keys getcode: halt ;w/o a HALT, port 0 is strange ld a,c rrca ;now shift C right once ld c,a out (1),a ;put the bitmask (still in A) out the port nop \ nop \ nop \ nop ;wait for the port in a,(1) ;read from the port ld (hl),a ;store the value read inc hl ;increment our pointer djnz getcode ;repeat 7 times in a,(3) ;see if on is pressed bit 3,a ;and if not then jr nz,bigger_getcode ;poll the port all over again ;now starting at memory location "keys" is 7 bytes w/ port info res 2,(iy+$23) ;make sure the _interrupt doesn't run res 4,(iy+$23) ;make sure the _slink doesn't run ld hl,password ;copy our password routine ld de,_alt_interrupt_exec ;into interrupt memory push de ld bc,$00C8 ldir ld de,$28 ;and checksum it. pop hl ;thanks to Matt Shepcar for this ld a,(hl) ;efficient checksum routine. dec hl push hl ld b,5 checksum: add hl,de add a,(hl) djnz checksum pop hl ld (hl),a call horizline ;show the title screen call _puts ;w/ activation message set 2,(iy+$23) ;engage the interrupt lockup_: ;do not exit until ON is released halt in a,(3) bit 3,a jr z,lockup_ jp $409C ;perform a clean exit (leave a shell too) deactivateme: call horizline ;show the title screen ld hl,ActivateNo ;show deactivation message call _puts res 2,(iy+$23) ;disable the interrupt jp $409C ;clean exit horizline: ;displays title screen call _clrScrn call _homeup ld hl,TitleStr call _puts ld b,21 ld a,'=' horizloop: call _putc djnz horizloop ret displaythestring: rst 10h ;find the inputed string ex de,hl ld a,b ;AHL=string location call $521D ;DE=size, AHL+=2 ld a,e ;A=lower byte of DE which is size or a ;if A=0 then deactivate because if ON is ;pressed during the input routine it is the ;same as pressing ENTER... thus if they push ;ON the size will be zero (unless they had ;already typed something...) jr z,deactivateme ld a,b ;get A back (it was still in B) ld b,e ;B now equals the size (0<=B<=255) displayloop: push hl ;save the ABS address push af call _GETB_AHL ;A = (AHL) call _vputmap ;put character to screen pop af ;recall the ABS address pop hl call _inc_ptr_ahl ;AHL++ djnz displayloop ;repeat for length of string ret MessageStr: ;123456789012345678901 .db "Enter the message you" .db "want to appear or hit" .db " [ON] to disable the " .db " protection for now. ",0 OkayStr: .db " Is this okay (Y/N)? ",0 CodeStr: .db " Simultaneously push " .db " the keys that you " .db "want to be your code." .db "To set the code, push" .db "ON as you continue to" .db "hold down these keys.",0 TitleStr: .db " Secure86 - v3.0.0 " .db " (C) 1998 Kirk Meyer ",0 ActivateYes: .db "To lock your TI-86 at" .db "any time push [ALPHA]" .db " and then push [ON]. ",0 ActivateNo: .db "Program now disabled.",0 password: bit shiftAlpha,(iy+shiftflags) ;is ALPHA pressed? ret z ;return if not in a,(3) ;is on pressed? bit 3,a ret nz ;return if not res 2,(iy+$23) ;disable our interrupt for now ei ;enable system interrupts res shiftAlpha,(iy+shiftflags) ;reset the ALPHA they pushed res shiftALock,(iy+shiftflags) lockup: ld a,1 ;turn off the calculator out (3),a ;w/o allowing them to take advantage halt ;of the holding down ENTER bug ld a,11 out (3),a ld hl,keys ;just as before, poll the keyboard ld bc,$077F ;(see earlier routine for comments) checkloop: halt ld a,c rrca ld c,a out (1),a nop \ nop \ nop \ nop in a,(1) cp (hl) ;here's the difference - if the value jr nz,lookscankill ;read is different than the stored inc hl ;values then it locks up again djnz checkloop xor a ;i don't think this does anything... ld ($C006),a ;get rid of it why don't you... halt ;make sure we don't set the flag ;during mid-interrupt set 2,(iy+$23) ;re-enable our interrupt! ret lookscankill: ;it was early and i wasn't awake ;this shows their message res curAble,(iy+curflags) ;make sure the cursor doesn't flash call miscellany ;show message ld bc,$0400 ;delay for a short while wait_loop: halt dec bc ld a,b or c jr nz,wait_loop call miscellany ;undo message jr lockup ;lock it back up! miscellany = $ - password + _alt_interrupt_exec ;this routine swaps the message with the video memory ld b,144 ;9*128/8 pixels ld hl,$FDC0 ;starting at $FDC0 ld de,_alt_slink_exec ;point to the stored message (144 bytes) miscloop: ld a,(hl) ;A=(vid mem) ld c,(de) ;C=(message) ld (hl),c ;(vid mem)=C=(message) ld (de),a ;(message)=A=(vid mem) inc hl ;increment pointers inc de djnz miscloop ;and repeat 144 x ret keys = _alt_slink_exec + 144 ;password is stored .end