UnlockFlash:
;Unlocks Flash protection.
;Destroys: appBackUpScreen
; pagedCount
; pagedGetPtr
; arcInfo
; iMathPtr5
; pagedBuf
; ramCode
in a,(6)
push af
ld a,7Bh
call translatePage
out (6),a
ld hl,5092h
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld a,(hl)
call translatePage
out (6),a
ex de,hl
ld a,0CCh
ld bc,0FFFFh
cpir
ld e,(hl)
inc hl
ld d,(hl)
push de
pop ix
ld hl,9898h
ld (hl),0C3h
inc hl
ld (hl),returnPoint & 11111111b
inc hl
ld (hl),returnPoint >> 8
ld hl,pagedBuf
ld (hl),98h
ld de,pagedBuf+1
ld bc,49
ldir
ld (iMathPtr5),sp
ld hl,(iMathPtr5)
ld de,9A00h
ld bc,50
ldir
ld de,(iMathPtr5)
ld hl,-12
add hl,de
ld (iMathPtr5),hl
ld iy,0056h-25h
ld a,50
ld (pagedCount),a
ld a,8
ld (arcInfo),a
jp (ix)
translatePage:
ld b,a
in a,(2)
and 80h
jr z,_is83P
in a,(21h)
and 3
ld a,b
ret nz
and 3Fh
ret
_is83P: ld a,b
and 1Fh
ret
returnPoint:
ld iy,flags
ld hl,(iMathPtr5)
ld de,12
add hl,de
ld sp,hl
ex de,hl
ld hl,9A00h
ld bc,50
ldir
pop af
out (6),a
ret
Thanks for the help, but I was hoping for the routine in hex. ;)A SirCmpwn drew near? o.o
I can't think of any reason why you'd need to directly write to flash from a user program...Flash unlocking is unusual unless you are writing an OS or patching something.
Only an OS should need to do that, in which case you don't need to bother with a hack, since it's your OS.
The only reason for which it could be needed is if you need to create an app directly on-calc. But to do that, you'd have to mess w/the certificate too, and that is just a very bad idea.
Anybody have a better guess?
I personally do not like when people say things like "why do you need that?" or "why do you want to do that?" when someone asks for a routine or programming help, because it sounds like it implies any use of it would be pointless or that his idea makes no sense or something, while in fact, the programmer may have something special in mind. Why prevent someone from doing something he wants?You are right. But sometimes asking why can help can be to give better help or support, not this case, though.