;Fake v0.2 ; (C) 2007 by Brandon Wilson. All rights reserved. ;v0.2 Changelog ;Lots of stuff I don't remember ;v0.1 Changelog ;Initial release include "settings.inc" NOLIST include "ti83plus.inc" LIST include "equates.inc" include "header.asm" SEGMENT MAIN GLOBALS ON EXTERN PutSApp,IGetKey,vputstring,VStrLen,VPutSAppCenter,DispHexA,GetHexA StartApp: COMMENT ~ ld hl,myLocalizeHook in a,(6) rst 28h DW 4F93h ld hl,sFake+1 ld de,progToEdit ld bc,8 ldir rst 28h DW 4C51h sFake: DB AppObj,"FlashCpy",0 myLocalizeHook: add a,e res 1,(iy+35h) ld a,(appBackUpScreen+1) ld b,a ld a,(appBackUpScreen) ld de,(appBackUpScreen+2) B_CALL WriteAByte quitFlash: B_JUMP JForceCmdNoChar tempStart: B_CALL ClrLCDFull B_CALL HomeUp ld hl,sEnterByteToWrite call PutSApp call GetHexA ld (appBackUpScreen+1),a B_CALL NewLine ld hl,sEnterDestAddr call PutSApp call GetHexA ld (appBackUpScreen+3),a call GetHexA ld (appBackUpScreen+2),a B_CALL NewLine ld hl,sEnterDestPage call PutSApp call GetHexA ld (appBackUpScreen),a B_CALL NewLine ld hl,sAreYouSure call PutSApp call IGetKey cp kEnter jr nz,quitFlash B_CALL NewLine ld hl,sReallySure call PutSApp call IGetKey cp kEnter jr nz,quitFlash jr StartApp sEnterByteToWrite: DB "Byte: ",0 sEnterDestAddr: DB "Address: ",0 sEnterDestPage: DB "Page: ",0 sAreYouSure: DB "Are you SURE?",0 sReallySure: DB "REALLY SURE?",0 ~ ld hl,sFakeAppVar rst 20h B_CALL ChkFindSym jr c,$F B_CALL DelVarArc $$: B_CALL ClrLCDFull B_CALL HomeUp ld hl,sPressKeys call PutSApp B_CALL NewLine ld hl,appData ld bc,256 B_CALL MemClear ld b,48 ld hl,appData $$: call IGetKey cp kClear jr z,ExitApp push hl ld de,appData or a sbc hl,de pop hl jr nz,normalKeypress cp kEnter jr z,$B normalKeypress: cp kEnter jr z,$F cp 0FCh ;no 2-byte tokens jr z,$B cp 0FEh jr z,$B ld (hl),a ld a,'*' B_CALL PutC inc hl djnz $B $$: ld hl,sFakeAppVar rst 20h B_CALL ChkFindSym jr c,$F B_CALL DelVar $$: ld hl,sFakeAppVar rst 20h ld hl,notEnoughMem call APP_PUSH_ERRORH ld hl,appData xor a ld bc,256 cpir ld de,appData sbc hl,de inc hl inc hl inc hl push hl B_CALL CreateAppVar pop bc inc de inc de xor a ld (de),a inc de ld (de),a inc de ld hl,appData ldir ld (de),a call APP_POP_ERRORH ld hl,myKeyHook in a,(6) B_CALL EnRawKeyHook ld hl,menuHook in a,(6) rst 28h dw 5083h jr ExitApp menuHook: add a,e or a jr z,isCondition0 cp 3 jr z,isCondition3 cp 4 jr z,isCondition4 dec a jr nz,$F ld a,(MenuCurrent) cp 20h jr nz,menuDrawOkay push hl push de push bc call isNormalMode pop bc pop de pop hl jr c,$F push hl push de push bc ld hl,(curRow) push hl ld hl,0B00h ld (curRow),hl ld hl,24290 B_CALL DispHL ld hl,0A01h ld (curRow),hl call getMaxFreeArcMemory call PutSApp pop hl ld (curRow),hl pop bc pop de pop hl ld a,(appBackUpScreen+1) or a jr z,menuDrawOkay xor a ld (curCol),a or 1 ret getMaxFreeArcMemory: ld hl,s83PFree in a,(2) and 80h ret z ld hl,s84PFree in a,(21h) and 3 ret z ld hl,sSEFree ret s83PFree: DB "163840",0 s84PFree: DB "491520",0 sSEFree: DB " 1524K",0 menuDrawOkay: ld a,(MenuCurrent) cp 02h jr nz,$F call isAppIgnoreActive jr c,$F ld hl,0201h ld (curRow),hl ld hl,sFinance call PutSApp ld a,1 or a ret sFinance: DB "Finance",0CEh,0 isCondition3: ld a,b cp 1Fh jr nz,$F push hl push de push bc call isNormalMode pop bc pop de pop hl jr c,$F ld a,1 ld (appBackUpScreen+1),a or a ret isCondition4: ld a,b cp 20h jr z,$F xor a ld (appBackUpScreen+1),a ret isCondition0: ld a,(MenuCurrent) cp 02h jr nz,$F overrideAppsMenu: call isAppIgnoreActive jr c,$F ld hl,appData ld (hl),1 inc hl ld (hl),1 inc hl ld (hl),30 inc hl ld (hl),0 inc hl ld (hl),kFin ld hl,appData or 1 ret $$: xor a ret isNormalMode: ld hl,sFakeAppVar rst 20h B_CALL ChkFindSym ret c ld a,b or a scf ret nz inc de inc de ld a,(de) or a scf ret z cp 21h scf ret z ccf ret isAppIgnoreActive: ld hl,sFakeAppVar rst 20h B_CALL ChkFindSym ret c ld a,b or a scf ret nz inc de inc de ld a,(de) cp 25h ret z cp 26h ret z cp 27h ret z scf ret notEnoughMem: B_CALL ClrLCDFull B_CALL HomeUp ld hl,sNotEnoughMem call PutSApp call IGetKey ExitApp: B_CALL ClrLCDFull B_CALL HomeUp B_JUMP JForceCmdNoChar myKeyHook: add a,e push af ld hl,sFakeAppVar rst 20h B_CALL ChkFindSym jr c,$F ld a,b or a jr nz,$F inc de inc de inc de ld h,d ld l,e ld c,(hl) ld b,0 inc hl add hl,bc pop af push af cp (hl) jr nz,resetKeys inc hl xor a cp (hl) jr z,uninstallApp ex de,hl inc (hl) jr $F uninstallApp: ;kill all hooks and stuff res 5,(iy+34h) res 6,(iy+36h) ld hl,(progPtr) ld b,0 showAllProgramsLoop: ld de,(pTemp) B_CALL cphlde jr z,showAllProgramsDone jr c,showAllProgramsDone dec hl ld c,(hl) ld de,-6 add hl,de ld a,(hl) cp 1Fh jr nz,showAllProgramsVisible ld (hl),c showAllProgramsVisible: inc hl ld c,(hl) inc c or a sbc hl,bc jr showAllProgramsLoop showAllProgramsDone: pop af or a ret resetKeys: xor a ld (de),a $$: ld a,(MenuCurrent) cp 02h jr nz,$F ld hl,sFakeAppVar rst 20h B_CALL ChkFindSym jr c,$F ld a,b or a jr nz,$F inc de inc de ld a,(de) cp 25h jr z,ignoreAppsKeys cp 26h jr z,ignoreAppsKeys cp 27h jr z,ignoreAppsKeys $$: pop af ld b,a ld a,(cxCurApp) cp 45h jr nz,$F ld a,b cp kCapS jr nz,$F ;fake self-test menu B_CALL RunIndicOff B_CALL ClrLCDFull B_CALL DispBootVer ld hl,1 ld (curRow),hl ld hl,sBaseVer call PutSApp call getOSVer call PutSApp ld a,25 ld (penRow),a ld hl,sEnterSelfTest call VPutSAppCenter ld a,37 ld (penRow),a ld hl,sThisWillClear call VPutSAppCenter ld a,57 ld (penRow),a ld hl,sPressOnToCancel call VPutSAppCenter ld a,23h ld (MenuCurrent),a selfTestKeyLoop: call IGetKeyNoHook cp kEnter jr z,doSelfTest noSelfTest: xor a ld (MenuCurrent),a B_JUMP JForceCmdNoChar doSelfTest: B_CALL ClrLCDFull ld hl,0403h ld (curRow),hl ld hl,sStart call PutSApp call IGetKeyNoHook cp kEnter jr nz,noSelfTest B_CALL ClrLCDFull ld hl,0503h ld (curRow),hl ld hl,21689 B_CALL DispHL call IGetKeyNoHook B_CALL ClrLCDFull ld hl,0403h ld (curRow),hl ld hl,0 B_CALL DispHL call IGetKeyNoHook B_CALL ClrLCDFull ld hl,0503h ld (curRow),hl ld hl,sROMFail call PutSApp call IGetKeyNoHook jr resetAttempted IGetKeyNoHook: set 7,(iy+28h) res 5,(iy+34h) call IGetKey set 5,(iy+34h) ret $$: ld a,(MenuCurrent) cp 20h jr z,inMemMgmtDel cp 21h jr z,$F cp 23h jr z,$F cp 24h jr z,$F cp 25h jr z,$F cp 26h jr z,$F cp 27h jr z,$F exitHook: ld a,b or a ret $$: ld a,b cp k2 jr z,resetAttempted cp kEnter jr nz,exitHook ld a,(MenuCurrent+2) dec a jr z,resetAttempted jr exitHook inMemMgmtDel: ld a,(appBackUpScreen+1) or a jr z,exitHook ld a,b cp kDel jr z,$F cp kEnter jr z,$F cp kUp jr z,$F cp kDown jr z,$F cp kAlphaUp jr z,$F cp kAlphaDown jr z,$F jr exitHook ignoreAppsKeys: pop af ld b,a cp kEnter jr z,goToFinance cp k1 jr z,goToFinance cp kUp jr z,$F cp kDown jr z,$F cp kAlphaDown jr z,$F cp kAlphaUp jr z,$F cp k0 jr z,$F cp k2 jp m,exitHook cp kCapZ+1 jp p,exitHook $$: xor a ret goToFinance: ld a,kFin or a ret resetAttempted: ld hl,sHomescreen rst 20h B_CALL ChkFindSym jr c,$F B_CALL DelVarArc $$: ld hl,sHomescreen rst 20h ld hl,0 B_CALL CreateProg ld a,(MenuCurrent) ld (appBackUpScreen),a xor a ld (MenuCurrent),a ld (cxCurApp),a B_CALL ClrLCDFull B_CALL ClrTxtShd B_CALL HomeUp ld hl,myGetCSCHook in a,(6) B_CALL EnableGetCSCHook ld a,kClear B_JUMP JForceCmd myGetCSCHook: add a,e res 0,(iy+34h) ; cp 1Ah ; jr nz,keypadScanned ld a,(appBackUpScreen) cp 27h jr nz,$F B_CALL ClrLCDFull B_CALL HomeUp ld hl,sResettingAll call PutSApp xor a out (20h),a ld hl,0 resettingAllLoop: inc hl ld a,h or l jr nz,resettingAllLoop $$: B_CALL ClrLCDFull B_CALL ClrTxtShd B_CALL HomeUp call getCalcName call VStrLen ld a,95 sub b srl a ld (penCol),a ld a,9 ld (penRow),a call getCalcName call vputstring call getOSVer call VStrLen ld a,95 sub b srl a ld (penCol),a ld a,16 ld (penRow),a call getOSVer call vputstring ld a,(appBackUpScreen) cp 23h jr nz,$F call hideRAMPrograms ld hl,sRAMCleared jr dispMessage $$: cp 21h jr nz,$F ld hl,sDefaultsSet jr dispMessage $$: cp 27h jr nz,$F ;hide APPS menu, too call hideAllPrograms ld hl,sMemCleared jr dispMessage $$: cp 24h jr nz,$F call hideArcPrograms ld hl,sArcVarsCleared jr dispMessage $$: cp 25h jr nz,$F ;hide APPS menu, too ld hl,sAppsCleared jr dispMessage $$: ;hide APPS menu, too call hideArcPrograms ld hl,sArcVarsAndAppsCleared dispMessage: ld e,(hl) inc hl ld d,(hl) inc hl ld (curRow),de call PutSApp ld hl,0 ld (curRow),hl ld hl,sFakeAppVar rst 20h B_CALL ChkFindSym jr c,$F ld a,b or a jr nz,$F inc de inc de ld a,(appBackUpScreen) ld (de),a $$: call IGetKey push af B_CALL ClrTxtShd B_CALL ClrLCDFull pop af ld b,a xor a ld a,b ret ;keypadScanned: ; or 1 ; ld a,b ; ret hideRAMPrograms: res 0,(iy+asm_Flag1) set 1,(iy+asm_Flag1) jr $F hideArcPrograms: res 0,(iy+asm_Flag1) res 1,(iy+asm_Flag1) jr $F hideAllPrograms: set 0,(iy+asm_Flag1) res 1,(iy+asm_Flag1) $$: B_CALL ZeroOP1 ld a,ProgObj ld (OP1),a hideProgramsLoop: B_CALL FindAlphaUp ret c B_CALL ChkFindSym bit 0,(iy+asm_Flag1) jr nz,$F bit 1,(iy+asm_Flag1) jr nz,checkIfRAM ld a,b or a jr z,hideProgramsLoop $$: ld de,-7 add hl,de ld a,(hl) ld (hl),1Fh ld de,6 add hl,de ld (hl),a jr hideProgramsLoop checkIfRAM: ld a,b or a jr nz,hideProgramsLoop jr $B getCalcName: ld hl,s83Plus in a,(2) ld b,a and 80h ret z ld hl,s84Plus in a,(21h) and 3 ret z ld hl,s84PlusSE bit 5,b ret nz ld hl,s83PlusSE ret getOSVer: B_CALL GetBaseVer ld hl,appData add a,30h ld (hl),a inc hl ld (hl),'.' inc hl ld a,b push hl ld h,0 ld l,a B_CALL DivHLBy10 ld c,a ld a,l add a,30h pop hl ld (hl),a inc hl ld a,c add a,30h ld (hl),a inc hl ld (hl),0 ld hl,appData ret s83Plus: DB "TI-83 Plus",0 s83PlusSE: DB "TI-83 Plus Silver Edition",0 s84Plus: DB "TI-84 Plus",0 s84PlusSE: DB "TI-84 Plus Silver Edition",0 sRAMCleared: DB 5,2,"RAM cleared",0 sDefaultsSet: DB 5,2,"Defaults set",0 sMemCleared: DB 5,2,"Mem cleared",0 sArcVarsCleared: DB 5,0,"Arc Vars Cleared",0 sAppsCleared: DB 5,2,"Apps Cleared",0 sArcVarsAndAppsCleared: DB 5,0,"Arc Vars & Apps Cleared",0 sPressKeys: DB "Press the keys " DB "(in order) to be" DB "used to restore " DB "memory:",0 sNotEnoughMem: DB "ERROR: not " DB "enough memory. " DB "Free up some " DB "RAM and try " DB "again.",0 sBaseVer: DB "BASE Code ",0 sEnterSelfTest: DB "Enter Self-Test?",0 sThisWillClear: DB "This will clear all memory",0 sPressOnToCancel: DB "Press ",LlBrack,"ON",LrBrack," to cancel",0 sStart: DB "START?",0 sROMFail: DB "ROM FAIL",0 sResettingAll: DB "Resetting All...",0 sFakeAppVar: DB AppVarObj," FAKE",0 sHomescreen: DB 05h,21h,0