;******************************************************************** ; Password Routine ; by Doug Melton ; August, 1997 ; ;This routine adds password protection to a USGARD program ; ;to use: just #include "pwrout.asm" to your program ; and call &PassWd when you want to pw protect ;******************************************************************** PassWd: call OTH_SHUTDOWN call CLEARLCD ; ld de, 0000H ;de gets cleared by CLEARLCD ld (CURSOR_ROW), de ;reset cursor to 0,0 set 3, (IY+5) ;display white on black ld hl, &Prot call D_ZT_STR res 3, (IY+5) ;display black on white ld de, PASWRD ld c, K_ENTER PWKeyLoop: call GET_KEY or a jr z, PWKeyLoop ld hl, (PROGRAM_ADDR) add hl, de inc de cp (hl) jr z, CheckEnter inc c CheckEnter: cp K_ENTER jr nz, PWKeyLoop cp c jr nz, PassWd ;relock--invalid pw ret ;go back to main program--valid pw Prot: .db " PASSWORD PROTECTED ",0 ;scancodes of password keys, last one should be K_ENTER ;following password is LOCK: PASWRD: .db $24,$0C,$1E,$2C,K_ENTER