Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ti83plus.inc"
- .org $9D93
- .db $BB,$6D
- LWIDT = 11
- ;Overwrite application to jump to $9D9A on getcalcserial
- ;Overwrite application to jump to $9D97 for bad write
- ;
- ProgramStart:
- jr ProgramContinue
- jp NoGo ;9d97
- jp FakeGetCalcSerial ;9d9a
- ProgramContinue:
- bcall(_ClrLCDFull)
- di
- ; ld a,2
- ; out ($54),a ;kills the usb controller (ti84+[SE])
- ld a,1
- out ($20),a ;set fast mode
- call getresumefile
- ld a,(de) ;checking to see if the file is empty (will read $00)
- or a
- jr z,DoNotResume
- ex de,hl
- ld de,Ourkey
- ld bc,10
- ldir
- ld de,myappvar
- ld bc,10
- ldir
- ContinueResume:
- ld hl,myappvar
- rst 20h
- bcall(_ChkFindSym)
- jr nc,_
- call makeappvar
- jr ContinueResume
- _:
- ld a,b
- or a
- jr z,_
- bcall(_Arc_Unarc)
- jr ContinueResume
- _:
- ex de,hl
- ld (avartemp),hl ;starting location of the appvar
- ld e,(hl)
- inc hl
- ld d,(hl)
- inc hl
- add hl,de
- ld (avarpos),hl ;where the current write pointer ought to be.
- xor a
- inc a
- DoNotResume:
- call z,makeappvar ;if not zero, then do not recreate appvar. Already did it
- ld hl,0000
- ld (currow),hl
- in a,(6)
- ld (itemp1),a
- ld a,$68
- out (6),a
- MainLoop:
- ld hl,OurKey
- ld b,10
- _:
- inc (hl)
- ld a,(hl)
- cp '9'+1
- jr nz,_ ;did not go over, let's keep iterating.
- ld (hl),'0'
- inc hl
- djnz -_
- _:
- ld de,$9A00
- ld hl,OurKey
- ld bc,10
- ldir
- ld hl,(OurKey)
- ld a,h
- or L
- cp '0'
- jr nz,_
- ld hl,(OurKey+2)
- ld a,h
- or L
- cp '0'
- jr nz,_
- bcall(_ClrLCDFull)
- ld hl,0000
- ld (currow),hl
- ld hl,OurKey
- bcall(_PutS)
- bcall(_NewLine)
- ld hl,battstate
- bcall(_PutS)
- in a,(2)
- rrca ;checking bit 0 for battery state. 0=bad 1=good
- ld a,'0'
- adc a,0
- bcall(_PutC)
- xor a
- out (1),a
- nop
- nop
- in a,(1)
- inc a
- jp nz,QuickExit ;keep going until a key is pressed while something is found
- _:
- call $4440
- bcall(_ClrLCDFull)
- ld hl,0
- ld (currow),hl
- ld hl,KeyOutput
- bcall(_PutS)
- ld hl,myappvar+1
- bcall(_PutS)
- bcall(_NewLine)
- ld hl,KeyDrive
- bcall(_PutS)
- bcall(_PutS)
- call expandfile
- jp MainLoop
- QuickExit:
- call updateresumestate
- ld a,(itemp1)
- out (6),a
- ret
- NoGo:
- pop hl
- jp MainLoop
- FakeGetCalcSerial:
- ld hl,CalcSerial
- ld de,Op1
- ld bc,5
- ldir
- ld b,5
- or a
- ret
- expandfile: ;
- bcall(_MemChk)
- ld bc,-100
- add hl,bc
- jr c,_
- ld hl,myappvar
- rst 20h
- bcall(_Arc_Unarc)
- ld b,4
- ld hl,myappvar+8
- expandfilerenewname:
- inc (hl)
- ld a,(hl)
- cp '9'+1
- jr nz,expandfilenonewname
- ld (hl),'0'
- dec hl
- jr expandfilerenewname
- expandfilenonewname:
- call makeappvar
- _:
- ld hl,LWIDT
- ld de,(avarpos)
- push hl
- bcall(_InsertMem)
- pop de
- ld hl,(avartemp)
- push hl
- ld a,(hl)
- inc hl
- ld h,(hl)
- ld L,a
- add hl,de
- ex de,hl
- pop hl
- ld (hl),e
- inc hl
- ld (hl),d
- ld de,(avarpos)
- ld hl,ourkey
- ld bc,10
- ldir
- ld a,$0A
- ld (de),a
- inc de
- ld (avarpos),de
- ret
- makeappvar:
- ld hl,myappvar
- rst 20h
- bcall(_ChkFindSym)
- jr c,_
- bcall(_DelVarArc)
- _:
- ld hl,myappvar
- rst 20h
- ld hl,0
- bcall(_CreateAppvar) ;out: DE=filesize location
- ld (avartemp),de
- inc de
- inc de
- ld (avarpos),de
- ret
- updateresumestate:
- call getresumefile
- ld hl,Ourkey
- ld bc,10
- ldir
- ld hl,myappvar
- ld bc,10
- ldir
- ret
- getresumefile:
- ld hl,myappvarresume
- rst 20h
- bcall(_chkfindsym)
- jr nc,_
- ld hl,20
- bcall(_createappvar)
- inc de
- inc de
- xor a
- ld (de),a ;indicate that the file is empty
- jr getresumefile
- _:
- ld a,b
- or a
- jr z,_
- bcall(_Arc_Unarc)
- jr getresumefile
- _:
- inc de
- inc de
- ret
- CalcSerial:
- .db $0A,$3D,$A5,$8D,$B0
- itemp1:
- .dw 0
- itemp2:
- .dw 0
- itemp3:
- .dw 0
- avartemp:
- .dw 0
- avarpos:
- .dw 0
- KeyOutput:
- ; 1234567890123456
- .db "Factor saved to ",0
- myappvar:
- .db $15,"KDBZ0005",0
- KeyDrive:
- .db "Factor found was",0
- OurKey:
- ; 0123456789
- .db "2822211869",0
- myappvarresume:
- .db $15,"KDBRESUM",0
- battstate:
- .db "Battery Level:",0
- .echo "Utility File Size: ",$-ProgramStart," bytes."
Advertisement
Add Comment
Please, Sign In to add comment