A83: Password program


[Prev][Next][Index][Thread]

A83: Password program




Hey fellas,
	Im working on a password program, it uses only numbers, and it's just 
like Joe W.'s "PW".  It's pretty ghetto, but i have a problem.  In certain 
times during the program and error comes up, "Err: Break".  This usually 
happens after I type the correct password and it rets, and during the typing 
of a new pw (which screws up the write-back process).  It's a very simple 
setup.  A subroutine called "keyloop" fetches the keypresses and puts them in 
(count).  Then, it compares that to (password).  if it is correct it either 
rets or goes to the new password screen (depending on whether the user pushes 
enter or mode).  the new password routine calls "keyloop", then writes to 
(password) the contents of (count).
	the code is exactly as follows, so squish and check it out if you'd 
like.  the current PW is nothing, so press enter to ret or mode to change it. 
 The left key clears the current pw being typed.

										
		I'd greatly appreciate any help,
										
				Bud
.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#define END .end
#include "ti83asm.inc"
#include "tokens.inc"
#define zeroop1	$428E
.LIST
#DEFINE count	8265h
#DEFINE temp	8271h
#DEFINE limit	8281h
#DEFINE dlay	8285h
.org 9327h
start:
	xor a
	ld (count),a
	ld (temp),a
	DI
      LD A,001H
      OUT (003H),A
      LD A,000H
      OUT (004H),A
      EX AF,AF'
      EXX
      EI			
	call delay
	call _runindicoff
	call _clrlcdfull
	call _homeup
	ld a,8
	ld (limit),a
	call delay
	ei
	halt
	ld hl,pw
	set textInverse, (iy+textflags)
	call _puts
	res textInverse, (iy+textflags)
	call _newline
	ld hl,20000
	ld (dlay),hl
	jp done
keyloop:
	ld a,0ffh
  	out (1),a
  	ld a,0feh
  	out (1),a
	in a,(1)
	cp 253
	jp z,backspace
	ld a,0ffh
  	out (1),a
  	ld a,0fdh
  	out (1),a
  	ld a,0
	in a,(1)
	cp 254
      ret z
	ld a,0ffh
  	out (1),a
  	ld a,0fbh
  	out (1),a
	in a,(1)
	cp 253
	jp z,three
	cp 251
	jp z,six
	cp 247
	jp z,nine
	ld a,0ffh
  	out (1),a
  	ld a,0f7h
  	out (1),a
	in a,(1)
	cp 253
	jp z,two
	cp 251
	jp z,five
	cp 247
	jp z,eight
	ld a,0ffh
  	out (1),a
  	ld a,0efh
  	out (1),a
	in a,(1)
	cp 254
      jp z,zero
	cp 253
	jp z,one
	cp 251
	jp z,four
	cp 247
	jp z,seven
	ld a,0ffh
  	out (1),a
  	ld a,0bfh
  	out (1),a
	in a,(1)
	cp 191
	jp z,change
	jp keyloop
backspace:
	call _homeup
	call _newline
	ld hl,line
	call _puts
	ld a,0
	ld (curcol),a
zerocount:
	ld a,0
	ld (count),a
	jp keyloop
change:
	ld a,154
	ld (temp),a
	ret
zero:
	ld a,0
	ld (temp),a
	jp keypressed
one:
	ld a,2
	ld (temp),a
	jp keypressed
two:
	ld a,3
	ld (temp),a
	jp keypressed
three:
	ld a,4
	ld (temp),a
	jp keypressed
four:
	ld a,6
	ld (temp),a
	jp keypressed
five:
	ld a,8
	ld (temp),a
	jp keypressed
six:
	ld a,9
	ld (temp),a
	jp keypressed
seven:
	ld a,11
	ld (temp),a
	jp keypressed
eight:
	ld a,12
	ld (temp),a
	jp keypressed
nine:
	ld a,14
	ld (temp),a
keypressed:
	ld hl,star
	call _puts
	ld hl,(temp)
	ld de,(count)
	add hl,de
	ld (count),hl
	ld a,(limit)
	dec a
	ret z
	ld (limit),a
	call delay
	call delay
	jp keyloop
done:
	call keyloop
	ld a,(temp)
	cp 154
	jp z,changepw
	ld a,(password)
      ld hl,(count)
      ld h,0
      sub l
	ret z
      jp start
changepw:
	call delay
	ld a,(password)
      ld hl,(count)
      ld h,0
      sub l
	jr z,clearpw
      jp start
clearpw:
	call zeroop1
	ld de,op1
     	ld hl,prog
     	ld bc,7
     	ldir
     	call _chkfindsym
     	inc de
     	inc de
     	ld hl,password-$9327
     	add hl,de
	ld hl,0
	call _clrlcdfull
	call _homeup
	ld hl,new
	call _puts
	call _newline
	ei
	halt
	call keyloop
	ld a,(count)
	push af
	call zeroop1
	ld de,op1
     	ld hl,prog
     	ld bc,7
     	ldir
     	call _chkfindsym
     	inc de
     	inc de
     	ld hl,password-$9327
     	add hl,de
	pop af
	ld (hl),a
	ret
delay:
	PUSH AF
	PUSH BC
	LD BC,(dlay)
delayLoop:
	DEC BC
	LD A, B
	OR C
	JR NZ, delayLoop
	POP BC
	POP AF
	ret
password:
	.db	0000h
prog:
	.db	5,"PW2",0
blank:
	.db		" ",0
description:
	.db 		"PW 1.2 - Bud M",0
star:
	.db 		"*",0
line:
	.db		"        ",0
new:
	.db 		"New Password:",0
pw:	
	.db 		"Password:",0
.end
END


Follow-Ups: