;password.asm Program that waits for password. ;10/11/89 ;Copyright 1989, Logic Associates ***************************************************************************** * * * Copyright 1989, Logic Associates, 1433 W. Thome, Chicago, IL 60660 * * (312) 274-0531. (Contact us about our other packages for CP/M.) * * * * Permission is granted to distribute free copies of the HOST package. * * All other rights are reserved. * * * * HOST package includes-- * * * * HOST.ASM * * HOST.DOC * * HOSTTEST.SUB * * PASSWORD.ASM * * PASSWORD.DOC * * PASSWORD.COM * * 2CON.ASM * * * * (We are interested in your comments and suggestions about this program.) * * * ***************************************************************************** org 100h jmp start errlim equ 3 cr equ 13 lf equ 10 help: db cr,lf,'PASSWORD 1.2 Copyright 1989, Logic Associates, Chicago' db cr,lf db cr,lf,' Waits silently for a password, without displaying keystrokes:' db cr,lf,' * If password is correct, passes control to CP/M.' db cr,lf,' * If password is wrong after ',errlim+30h db ' attempts, locks the keyboard.' db cr,lf db cr,lf,' This program provides simple log-on security ' db 'for any CP/M computer' db cr,lf,' used as a remote-accessible system.' db cr,lf db cr,lf,' The password must be 1 to 8 characters' db ' and must end with a blank.' db cr,lf,' To set password, include it on the PASSWORD command line.' db cr,lf,' To use password, precede it with a carriage return.' db cr,lf db cr,lf,' Example:' db cr,lf db cr,lf,' a) Setting the password: PASSWORD WXYZ_' db cr,lf db cr,lf,' b) Using the password: WXYZ_' db cr,lf db cr,lf,' where "" = RETURN key, and "_" = blank.' db cr,lf db cr,lf db '$' waiting: db cr,lf,'Awaiting password... ' db cr,lf db '$' boot equ 0 bdos equ 5 fcb equ 5ch template equ fcb+1 errcnt: db 0 ;----------------------------------------------------------------------- start: lda template ;is designated password blank? cpi ' ' lxi d,help mvi c,9 ; yes, display help, ... push psw cz bdos pop psw jz start9 ; ...then go to exit. xra a ;initialize error count sta errcnt lxi d,waiting ;say "waiting". mvi c,9 call bdos start2: lxi h,template ;start with first char of template. start4: call charin ;get a character. cpi cr ;char = cr? jz start2 ; yes, restart template. cmp m ;this character matched? inx h cnz error ; no, process the error. jnz start2 ; restart if error routine says so. cpi ' ' ;end of password? jnz start4 ; no, go get next char. start9: ret ; yes, return to CP/M. ;----------------------------------------------------------------------- ;Count this error. Hang the system if error-limit reached. error: lda errcnt ;increment error count. inr a sta errcnt cpi errlim ;error limit reached? error2: jz error2 ; yes, hang here. error4: call charin ; no, flush rest of attempt, cpi cr ; up to next carriage return. jnz error4 ori 1 ;say "restart the comparison." ;(set z = no.) ret ;----------------------------------------------------------------------- charin: mvi c,6 mvi e,0ffh push h call bdos pop h ani 7fh jz charin ;no char? try again. cpi 'a' ;lower case letter? jc charin9 ; no, skip. cpi 'z'+1 jnc charin9 ani 5fh ; yes, convert to upper case. charin9: ret ;----------------------------------------------------------------------- end