I am making a new password protection program. It is not nearly completed yet, but I have run into a problem. Whenever typing in the password, if the user hits the ON button, the program repeats over and over rapidly with no pause. Also, is there a way to hide the Alpha lock icon in the upper right corner?
I am using a modified version of David's input source for inputting, it displays the text as x's to hide the password, and it displays on the graphscreen. Full source:
Code: ;Standard template for ti83+ asm programs
#include "ti83plus.inc";File needed to access system routines
.org userMem-2 ;Define where to start in memory
.db $BB,$6D ;AsmPrgm instruction
#define stringpointer saveSScreen
#define textbuffer appbackupscreen
; AEGISone;;;;;;;;;;;;;;;;;;;;;;;;
; Jeffrey of UTI;;;;;;;;;;;;;;;;;;
; BEGINNING;;;;;;;;;;;;;;;;;;;;;;;
start:
call askpass ; ask for password routine
call getpass
call compass
ret
askpass:
bcall(_clrlcdfull) ; clear screen
call gui
ld a,3
ld (pencol),a
ld a,10
ld (penrow),a
ld hl, prompt ; load prompt info
bcall(_VputS) ; display prompt
ld hl,appbackupscreen ; get the appbackupscreen ready
ld (stringpointer),hl
res indiconly,(iy+indicflags) ;Enable reading of keys
set shiftalock, (iy+shiftflags) ;Enable alpha-lock
set shiftalpha, (iy+shiftflags)
ld a,0
ld (curcol),a
ld a,2
ld (currow),a
ld b,6
inkey:
ld a,b
ld (bstore),a
bcall(_getkey)
cp kClear
jp z,askpass
ld d,0
ld e,a
bcall(_keytostring)
ld a,(hl) ;Get the size of the string.
cp 1 ;See if it's 1
jr nz,inkey ;If it not 1, a "bad key" has been pressed. If so, goto getkey
ld a,(pencol)
ld (pencol),a
ld hl,passnull
bcall(_VputS)
ld a,(keytostrram+1)
ld hl, (stringpointer)
ld (hl),a
inc hl
ld (stringpointer),hl
ld a,(bstore)
ld b,a
djnz inkey
endkey:
res shiftalock, (iy+shiftflags)
res shiftalpha, (iy+shiftflags);Disable alpha-lock
bcall(_eraseEOL) ;Erase from current cursor position to end of line.
bcall(_newline) ;Insert a new line on the screen
ld hl,(stringpointer)
xor a
ld (hl),a
bcall(_clrlcdfull)
ld hl,appbackupscreen
ret ; finally return to calling code
getpass: ; get the password
ld hl,appvarname
rst 20h
bcall(_chkfindsym)
push de
jp nc,getexist
call default
getexist:
pop hl
inc hl
inc hl
ld de,5
add hl,de
ld (hltemp),hl
ret
default:
ld hl,appvarname
rst 20h
ld hl,50
bcall(_CreateAppvar)
inc de
inc de;by incrementing de twice we have bypassed the size bytes of the appvar
ld hl,defaultstuff ;load pointer to text into hl
ld bc,12 ;10 being the length of the string
ldir ;copy the bytes
ret
compass:
ld de,6 ; 6 chars
push de
ld hl,appbackupscreen
bcall(_StrLength)
ld h,b
ld l,c
pop de
bcall(_cpHLDE)
jp z,contin
jp start
ret
contin:
ld bc,6
ld hl,(hltemp)
add hl,bc
push hl
ld de,appbackupscreen
ld h,d
ld l,e
add hl,bc
ex de,hl
pop hl
ld b,6
bcall(_cmpsyms)
ld a,c
cp 6
jp z,win
jp start
win:
ret
gui:
ld h,63
ld l,0
ld d,0
ld e,95
bcall(_drawrectborder)
set TextInverse,(IY + TextFlags)
set TextEraseBelow,(IY + TextFlags)
ld a,1
ld (penrow),a
ld a,1
ld (pencol),a
ld hl,title
bcall(_vputs)
ld a,1
ld (penrow),a
ld a,30
ld (pencol),a
ld hl,extra
bcall(_vputs)
ld a,1
ld (penrow),a
ld a,50
ld (pencol),a
ld hl,extra
bcall(_vputs)
ld a,1
ld (penrow),a
ld a,70
ld (pencol),a
ld hl,extra
bcall(_vputs)
res TextInverse,(IY + TextFlags)
res TextEraseBelow,(IY + TextFlags)
ret
clearout:
xor a
ld a,0
jp start
; DATA;;;;;;;;;;;;;;;;;;;;
prompt:
.db "Insert password:",0
passnull:
.db "x",0
bstore:
.db $12
defaultstuff:
.db "00000PASWRD",0
appvarname:
.db AppvarObj,"Aegis1",0
hltemp:
.db $21
title:
.db " AEGIS 1 ",0
extra:
.db " ",0
.end
|