This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 08 Nov 2003 04:31:57 pm    Post subject:

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
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 08 Nov 2003 05:17:16 pm    Post subject:

add this line during the typing in code :
Code:
  res onInterrupt, (IY + onFlags)
if you want to add on as a key, add this code :
Code:
  bit onInterrupt, (IY + onFlags)
  call nz,ONPRESSED
  ...
  ...
ONPRESSED:
  res onInterrupt, (IY + onFlags)
  (code to add on as a key sequence)
  ret
HOPE THAT HELPS!
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement