; »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»«««««««««««««««««««««««««««««««««««««««««« ; »»»»»»»»»»»»»»»»»»»»»»»»»» AutoDetect Protection Program «««««««««««««««««««««««««««« ; »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»«««««««««««««««««««««««««««««««««««««««««« ; ; ; This is a "little" program that I wrote. When you run it, everything is pretty much ; self explainatory. ; ; I tried to explain as much stuff as possible, if you don't understand anything ; just email me and I'll try to help you out. Please understand that I am still ; learning also. ;-] ; ; ______________________________________________________________________________ ; ; »» You are free to use this but a little thanks to me would be appreciated. «« ; ______________________________________________________________________________ ; ; ; Please send all questions to Jimmy Conner at »» TIMagic@yahoo.com «« ; http://www.geocities.com/Silicon Valley/Network/6963/ TI-XX Page ; ; ; This should always be opened in Ultra Edit ; .NOLIST ; Required #define equ .equ ; Include these so the program will compile right #define EQU .equ ; '' '' '' '' '' '' '' '' #define END .end ; '' '' '' '' '' '' '' '' #define curlist 8265h ; My var for the current program list #define prog 8266h ; My var for the number of the programs #define type 8267h ; My var for the type of the program #define nprog 8268h ; My var for the number of the current program #define load 8269h ; My var for if its done passing the programs on the pages in front of it #define loadn 826Ah ; My var for which program to change the type on #define curloc 826Bh ; My var for the current program you are on #define old 826Dh ; My var for the pixels on screen #define row 826Eh ; Old start for direct input #define row2 826Fh ; End of where it should reverse #define rev 8271h ; Reverse?? #define noxor 8272h ; Not ot reverse #define nextl 8273h ; Show a > arrow or not #include "ti83asm.inc" ; Include these so the program will compile right #include "tokens.inc" ; '' '' '' '' '' '' '' '' .LIST ; Required .org 9327h ; ALL TI-83 Programs start here in memory ccf ; Makes the program invisible to AShell. jr prog_start .dw $0000 ; pointer to the libraries ; use $0000 if no libraries are used .dw description ; pointer to a description string ; (0 terminated) prog_start: set plotloc, (iy+plotFlags) call _runIndicOff ; Turns off Runindicator call _clrLCDFull ; Clear Screen call _grbufclr ; Clear the GraphBuffer xor a ; Reset our current list ld (loadn), a ; Reset our current Load program inc a ; Increase or cursor location ld (curlist), a ; Store it ld (curloc), a ; Store it mainloop: call display1 ; Call the display call detect2 ; Call my detection routine ld hl, 0800h ; Load the coordinates for pencol ld (pencol), hl ; Set these coordinates call reversetext jp marp ; Call the run routine ret ; This exits completely display1: ld bc, 3800h ; Load the coordinates ld de, 383Fh ; Load the coordinates ld h, 01h ; Tell it a solid line call _iline ; Draw the line ld bc, 4000h ; Load the coordinates ld de, 403Fh ; Load the coordinates call _iline ; Draw the line ld bc, 3000h ; Load the coordinates ld de, 303Fh ; Load the coordinates call _iline ; Draw the line ld hl, 0033h ; Load the coordinates ld (pencol), hl ; Set them up ld a, 50h ; Load a 'P' call _vputmap ; Put it on the screen ld hl, 003Bh ; Load the coordinates ld (pencol), hl ; Set them up ld a, 55h ; Load a 'U' call _vputmap ; Put it on the screen ld bc, 0 ; Load the coordinates ld (pencol), bc ; Set them up ld hl, author ; Protect Program call _vputs ; Put it on the screen ld bc, 0842h ; Load the coordinates ld (pencol), bc ; Set them up ld hl, author1 ; "2nd -" call _vputs ; Put it on the screen ld bc, 1042h ; Load the coordinates ld (pencol), bc ; Set them up ld hl, author2 ; "Changes" call _vputs ; Put it on the screen ld bc, 1C42h ; Load the coordinates ld (pencol), bc ; Set them up ld hl, author3 ; "Clear" call _vputs ; Put it on the screen ld bc, 244Dh ; Load the coordinates ld (pencol), bc ; Set them up ld hl, author4 ; "Quits" call _vputs ; Put it on the screen set textEraseBelow, (iy+textflags) set textinverse, (iy+textflags) ; Toggle text inverse on ld bc, 0041h ; Load the coordinates ld (pencol), bc ; Set them up ld hl, thankyou ; "TIMagic" call _vputs ; Put it on the screen res textinverse, (iy+textflags) ; Reset text inverse (off) ret ; End this sub routine delay: ld bc, 7FFFh ; Delay length->bc delayLoop: dec bc ; bc-1->bc ld a, b ; Find where it is at or c ; '' '' ' ' ' jr nz, delayLoop ; If not done reloop ret ; Return the call reversetext: ld a, (penrow) ; Get the penrow add a, 80h ; Add 80h ld (row), a ; Store that to the row add a, 7 ; Add 7 more to make the end of the row ld (row2), a ; Store it call hlight ; Call the reversing routine ret marp: xor a ; Reset our load program ld (loadn), a ; Store it ld a, (curloc) ; What it the current Cursor location?? ld (nprog), a ; Store it ld h, a ; Store it to h ld l, 7 ; Store 7 to l call _htimesl ; Multiply them to find penrow inc hl ; Go down one ld h, l ; Load penrow to h ld l, 00h ; Load the coordinates for pencol ld (pencol), hl ; Set these coordinates getkey: ld a, 0ffh ; Reset keyport out (1), a ; Necessary code ld a, 0bfh ; Enable row with clear out (1), a ; Necessary code in a, (1) ; Get # of any key pressed->a cp 254 ; Is it Clear?? jp z, exit ; If so then exit ld a, 0ffh ; Reset keyport out (1), a ; Necessary code ld a, 0bfh ; Enable row with Y= out (1), a ; Necessary code in a, (1) ; Get # of any key pressed->a cp 239 ; Is it the # for Y= jp z, pressed2nd ; If so then go there ld a, 0ffh ; Reset keyport out (1), a ; Necessary code ld a, 0feh ; Enable row with arrows out (1), a ; Necessary code in a, (1) ; Get # of any key pressed->a cp 0 ; Was there no key jp z, getkey ; If no key then loop again cp 254 ; Down? jp z, down ; If so then go there cp 247 ; Up? jp z, up ; If so then go there cp 253 ; Left? jp z, left ; If so then go there cp 251 ; Right? jp z, right ; If so then go there jp getkey ; If anything else then reloop left: ld a, (curlist) ; Get the current cursor list pointer cp 1 ; Is it 1?? jp z, getkey ; If so then dont go back a page dec a ; If not then decrease the list jp nprog2 ; Jump to the page turner routine right: ld a, (nextl) ; Do we have a >??? cp 1 ; Do we??? jp nz, getkey ; If not then don't go to the next page ld a, (curlist) ; Get the current cursor list pointer inc a ; Increase the page number nprog2: ld (curlist), a ; Get the current cursor list pointer ld a, 1 ; Reset the program number ld (nprog), a ; Store it the number of the current program ld (curloc), a ; Store it the current location call _clrLCDFull ; Clear Screen call display1 ; Call the display call detect2 ; Call my detection ld hl, 0800h ; Load the coordinates for pencol ld (pencol), hl ; Set these coordinates call reversetext ; Call the reverse text routine xor a ; Reset our load program ld (load), a ; Store it jp marp ; Jump back up to the recalibrate down: call reversetext ; Call the reverse text routine ld a, (nprog) ; Get the number of programs ld c, a ; Store it in c call down2 ; Ckeck if its not the last page ld a, (prog) ; Get the current program number cp c ; Is it the same?? jp z, noloop ; If zero then don't move down ld a, (penrow) ; Get the corrdinates add a, 7 ; Move down one notch ld (penrow), a ; Store it back ld a, (nprog) ; What program number?? inc a ; Well increase it ld (nprog), a ; Store it back call reversetext ; Call the reverse text routine call delay ; Call the delay routine jp getkey ; Go move the arrow down2: ld a, (nextl) ; Do we have a next page?? cp 1 ; Yes?? ret nz ; If not then ret inc c ; If so then increase c ret ; Return to the down routine up: call reversetext ; Call the reverse text routine ld a, (penrow) ; Get what row we are at cp 8 ; Is it the top program? jp z, noloop ; If so then don't move up ld a, (penrow) ; Get what row we are at add a, -7 ; Go Up one program ld (penrow), a ; Store it back ld a, (nprog) ; What program number??? dec a ; Well decrease it ld (nprog), a ; Store it back noloop: call reversetext ; Call the reverse text routine call delay ; Call the delay routine jp getkey ; Go move the arrow pressed2nd: ld a, (nprog) ; What program number?? ld (curloc), a ; Store it ld a, 0ffh ; Reset keyport out (1), a ; Necessary code ld a, (nprog) ; What program number?? ld (loadn), a ; This is where we want to change the type ld (curloc), a ; Store it to the cursor location call display1 ; Call the display call detect2 ; Call my detection routine xor a ; Reset our load program ld (load), a ; Store it jp marp ; Go back to the run routine detect2: ld a, (curlist) ; Get the current list cp 1 ; Is it 1?? call nz, bnng ; If not then put a < ld a, -2 ; Load back two programs (skip programs # and !) ld (prog), a ; Store it xor a ; Reset our load program ld (load), a ; store it ld (nextl), a ; Reset out Next List variable detect: ld hl, 0801h ; Load the coordinates ld (pencol), hl ; Set them up ld hl, (progptr) ; Start here to look for programs startdetect: ld a, (hl) ; Get the type and %00011111 ; Need to mask out bits 0-4 cp 6h ; Is it a protected program? jp z, program ; If so jump to the program cp 5h ; Is it a program, but not protected? jp z, program ; If so jump to the program cp 1h ; Is it a list? jp z,list ; If so jump to the list loop cp 0Dh ; Is it a complex list? jp z,list ; If so jump to the list loop ld h, 1 ; Tell it to draw a solid line ld bc, 0038h ; Load the coordinates ld de, 6038h ; Load the coordinates call _iline ; Draw the line ld a, (curlist) cp 1 jp z, returnfromdetect displaydash: ld hl, 384Dh ; Load the coordinates ld (pencol), hl ; Store it ld hl, dash ; Load the Store Symbol call _vputs ; Put it on the screen returnfromdetect: ret ; Nothing left so quit program: ld a, (curlist) ; What list?? cp 1 ; The first?? jp z, suckyprograms ; If so then go jp ndset ; If not then go on continueon: push hl ; Store this for later xor a ; Reset a to 0 ld (rev), a ; Store this to tell us if we changed types ld a, (prog) ; Get the number of programs ld c, a ; Store this in c ld a, (loadn) ; Get the current program number cp c ; Compare our two sets jp z, changetype ; If they are the same then change the type donewithtype: ld a, (rev) ; Did we change types?? cp 1 ; Did we?? call z, blankout ; If so then put spaces where the old square was ld a, (hl) ; Get the type ld (type), a ; Store the type again dec hl ; Skip past var type dec hl ; Skip the first pointer dec hl ; Skip the second pointer ld a, (hl) ; Put the length in 'a' ld b, a ; Put the length in b programloop: dec hl ; Get the next letter ld a, (hl) ; Find out what it is call _vputmap ; Put it on the screen djnz programloop ; Loop until past the letters ld a, (penrow) ; What row are we at?? dec a ; Decrease it to put on block ld (penrow), a ; Store it back ld a, (type) ; Get the type ld c, 33h ; Move to the first place to put it cp 5 ; Are we unprotected? jp z, markoutother ; If so then don't mark in this spot ld c, 3Bh ; If not then load the second place markoutother: ld a, c ; Store the place ld (pencol), a ; Put it in the pencol ld hl, spaces ; Load the spaces call _vputs ; Put them on the screen ld a, (rev) ; Did we change the type?? cp 1 ; 1 if so.. call z, blankout2 ; If so then blank out the second spot ld a, (type) ; Load what type cp 6 ; Is it unprotected jp z, nopro ; Then goto there ld a, 3Bh ; Else load the coordinates for the block ld (pencol), a ; Set them jp movenext ; Go put them on nopro: ld a, 33h ; Load the coordinates for the block ld (pencol), a ; Set them movenext: ld a, 0Ah ; Get the block call _vputmap ; Put it where it is supposed to be ld a, (penrow) ; What row?? add a, 8 ; Add 8 (One extra to make up for the dec a earlier) ld (penrow), a ; Store it back ld a, 1 ; Put the original column back ld (pencol), a ; Store it nextprog: pop hl ; Go back to the length list: dec hl ; Skip the first part of the ptr dec hl ; Skip the last part of the pointer dec hl ; Should be at the length ld b, (hl) ; Get the length nextprogloop: dec hl ; Dec hl to get to next letter djnz nextprogloop ; Loop until we get past the name dec hl ; Goto address of next list\program jp startdetect ; Go find the next one blankout: ld a, 1 ; Load 1 ld (noxor), a ; Stick it in noxor call reversetext ; Reverse the text xor a ; A = 0 ld (noxor), a ; Load that ret ; Return blankout2: ld a, (penrow) ; Get the penrow inc a ; Increase it because of the earlier work ld (penrow), a ; Store it back call reversetext ; Reverse it ld a, (penrow) ; Get the row again dec a ; Decrease it to go back to work ld (penrow), a ; Store it ret ; Return ndset: ld a, (load) ; Already did this enough?? cp 1 ; Did we??? jp z, suckyprograms ; If so then skip this crap push hl ; Keep this in a safe spot ld a, (prog) ; Load number of programs inc a ; Add 1 ld (prog), a ; Store it back ld b, a ; Store it to b ld a, (curlist) ; Get the current list ld h, a ; Store that ld l, 8 ; Store 8 inot l so we can get the row call _htimesl ; Multiply them ld a, l ; Store the multipled answer in a add a, -7 ; Take away 7 ld b, a ; Store it to b pop hl ; Take it out of hiding ld a, (prog) ; Load number of programs cp b ; Past the programs yet jp nz, list ; If not then skip this program xor a ; Load program 0 ld (prog), a ; Load number of programs inc a ; Load 1 ld (load), a ; Do this so we don't have to go through this again suckyprograms: ld a, (prog) ; What program is it?? inc a ; Goto next program ld (prog), a ; Store it cp -1 ; Is it the first unwanted one?? jp z, list ; If so then outta here cp 0 ; Is it the other one??? jp z, list ; Then good bye cp 9 ; Are there 9 programs on the screen?? jp z, full ; If so then jump here jp continueon ; Go print the program changetype: ld a, 1 ; Load 1 ld (rev), a ; Say that we changed types ld a, (hl) ; Get the type inc a ; Increase it (to 6 or 7) ld (hl), a ; Store it cp 6 ; Is it 6 jp z, donewithtype ; If so then go back ld a, 5 ; If not then it needs to be 5 ld (hl), a ; Store it jp donewithtype ; Go back bnng: ld hl, 3848h ; Load the coordinates ld (pencol), hl ; Store it ld hl, backarrow ; Load the Store Symbol call _vputs ; Put it on the screen ret ; Do this for now but display "->" later full: ld h, 1 ; Tell it to draw a solid line ld bc, 0038h ; Load the coordinates ld de, 6038h ; Load the coordinates call _iline ; Draw the line ld hl, 3856h ; Load the coordinates ld (pencol), hl ; Store it ld hl, fowardarrow ; Load the Store Symbol call _vputs ; Put it on the screen ld a, 1 ; Load 1 ld (nextl), a ; Say that we have another list of programs jp displaydash exit: call _clrLCDFull ; Clear the Current Screen ld a, 0ffh ; Reset keyport out (1), a ; Necessary code call delay ; Call the delay routine ret ; Quit the assembly program ; ; ------------------------------------- MESSAGES ------------------------------------ ; backarrow: .db 0CFh, 0 ; Arrow saying we can go back a page fowardarrow: .db 005h, 0 ; Arrow saying we can forward back a page dash: .db "--", 0 ; Arrow saying we can go back a page author: .db "Protect v7.5", 0 ; Title author1: .db "Y= -", 0 ; My directions author2: .db " Changes", 0 ; My directions author3: .db "Graph -", 0 ; My directions author4: .db "Quits", 0 ; My directions spaces: .db " ", 0 ; My Spaces thankyou: .db " TIMagic ", 0 ; 0 terminated string ; ; ------------------------------------- Reverse Text ------------------------------------ ; Description: .db "Protection by Jimmy Conner",0 ; My description hlight: di ; Disable interrupts (you have to) ld a, 05h ; Set y inc mode call lcdbusy ; Must make this call before writing to LCD out (lcdinstport), a ; Send to LCD ld a, 20h ; Set to leftmost col ld e, a ; Store to e loop2: call lcdbusy ; Must make this call before writing to LCD out (lcdinstport), a ; Send to LCD ld a, (row) ; Set to top row ld d, a ; Store it in d loop: call lcdbusy ; Must make this call before writing to LCD out (lcdinstport), a ; Send to LCD call lcdbusy ; Dummy read in a, (lcddataport) ; Get from the LCD call lcdbusy ; Dummy read in a, (lcddataport) ; Read byte from display ld (old), a ; Store old data ld a, d ; Get the row call lcdbusy ; Must make this call before writing to LCD out (lcdinstport), a ; Send to LCD ld a, e ; Get Leftmost column call lcdbusy ; Dummy read out (lcdinstport), a ; Send to the LCD ld a, (noxor) ; Did we have to xor? cp 1 ; Yes? ld a, (old) ; Load the old stuff ld b, 255 ; Load the new jp z, notxoring ; If not then skip this xor b ; Reverse the bytes jp xoring ; Skip the next part notxoring: ld a, 0h ; Get 0 to erase the spot xoring: call lcdbusy ; Dummy read out (lcddataport),a ; Send to LCD inc d ; Increase the row ld a, (row2) ; Get final row cp d ; Is it the final row ld a, d ; Load row to a jr nz, loop ; Loop until done inc e ; Increase the column ld a, e ; Store in a cp 26h ; Is it hte last column? jr nz, loop2 ; If not then loop again ei ; Enable the interrupts ret ; Return ;---------------= lcdbusy =------------- lcdbusy: push af ; Create a small delay before inc hl ; Communicating with LCD dec hl ; Waste time here pop af ; Waste time here ret ; Return .end END ; ; »»»»»»» TIMagic@yahoo.com ««««««« ;