I have finally reached the point where I only have two problems. Well, I also need to optimize. Anyway, the first problem: the calculator doesn't turn off, at least not in jsTIfied. The second problem: the calculator always acts as though I typed in the wrong password.
Here is my code. What is wrong with it?
Code:
Here is my code. What is wrong with it?
Code:
.nolist
#include "ti84pcse.inc"
#define MathPrintFlags1 $44
#define MathPrintActive 5
.list
.org UserMem-2
.db tExtTok,tAsm84CCmp
PasswordProgram:
bcall(_EnableAPD)
ld a,1
ld (apdTimer),a
ld (apdSubTimer),a
res MathPrintActive,(iy+MathPrintFlags1)
bcall(_ClrScrnFull)
bcall(_HomeUp)
ld hl,PressText
bcall(_PutS)
bcall(_NewLine)
bcall(_NewLine)
bcall(_PutS)
Unlock:
bcall(_GetCSC)
or a
jr z,Unlock
bcall(_ClrScrnFull)
bcall(_HomeUp)
ld hl,Prompt
bcall(_PutS)
ld a,$20
bcall(_PutC)
ld b,0
KeyPress1:
bcall(_GetCSC)
or a
jr z,KeyPress1
cp kUp
ld a,$2A
bcall(_PutC)
jr nz,KeyPress2
inc b
KeyPress2:
bcall(_GetCSC)
or a
jr z,KeyPress2
cp kRight
ld a,$2A
bcall(_PutC)
jr nz,KeyPress3
inc b
KeyPress3:
bcall(_GetCSC)
or a
jr z,KeyPress3
cp kDown
ld a,$2A
bcall(_PutC)
jr nz,KeyPress4
inc b
KeyPress4:
bcall(_GetCSC)
or a
jr z,KeyPress4
cp kDown
ld a,$2A
bcall(_PutC)
jr nz,Check
inc b
Check:
ld a,b
cp 4
ret z
WrongPassword:
ld hl,WrongPasswordMsg
bcall(_NewLine)
bcall(_PutS)
Stuff:
bcall(_GetCSC)
or a
jr z,Stuff
jp PasswordProgram
PressText:
.db "Calculator locked.",0
.db "Press a key to unlock.",0
Prompt:
.db "Password:",0
WrongPasswordMsg:
.db "Wrong password!",0