N    SYSLOCK.COM
A    100
JMP  013D           ;Jump to MAIN
DW   0
DW   0
STI                 ;**BEGIN** Interrupt Service Routine
PUSH AX
PUSH DS
IN   AL,60          ;read key from keyboard port
CMP  AL,00
JZ   0113
CMP  AL,53          ;If it's not DEL, jump to OK
JNZ  0136
MOV  AX,0000
MOV  DS,AX
MOV  AL,[0417]
TEST AL,04          ;If Ctrl isn't pressed, jump to OK
JZ   0136
TEST AL,08          ;If Alt isn't pressed, jump to OK
JZ   0136
IN   AL,61          ;Reset the keyboard, throw away the keystroke
MOV  AH,AL
OR   AL,80
OUT  61,AL
MOV  AL,AH
OUT  61,AL
MOV  AL,20
OUT  20,AL
POP  DS
POP  AX
IRET
POP  DS             ;:OK -- let the normal INT 9 process the key
POP  AX
CS:
JMP  FAR [0102]     ;**END** Interrupt Service Routine
MOV  AX,3509        ;:MAIN
INT  21
MOV  [0102],BX      ;Save the original interrupt vector
MOV  [0104],ES
MOV  DX,0106
MOV  AX,2509
INT  21             ;Install the Interrupt Service Routine
MOV  AX,CS
MOV  ES,AX
JMP  01AB           ;Jump to MAINLOOP
NOP
DB   D,A,"Please enter the system password : ",24
DB   D,A,"Password accepted.",24
DB   "xxxx      "
DB   "          ",0,0,0
MOV  AH,09          ;:MAINLOOP
MOV  DX,0159
INT  21             ;Print the prompt
MOV  CX,000A
MOV  AH,07
MOV  DI,019E
INT  21             ;:INPUTLOOP
CMP  AL,0D          ;If it's the ENTER key..
JZ   01C5           ;.. jump to CHECK
STOSB
LOOP 01BA           ;Jump back to INPUTLOOP
JMP  01B2
MOV  CX,000A        ;:CHECK
MOV  SI,0194        ;Compare the actual password..
MOV  DI,019E        ;.. with what was entered
REPZ
CMPSB
JZ   01DF           ;If it matches, jump to FINISH
MOV  AL,20          ;Otherwise, blank the input area..
MOV  CX,000A
MOV  DI,019E
STOSB
LOOP 01DA
JMP  01AB           ;.. and jump back to MAINLOOP
MOV  AH,09          ;:FINISH
MOV  DX,017F
INT  21             ;Print the "accepted" message
MOV  DX,[0102]
MOV  DS,[0104]
MOV  AX,2509
INT  21             ;Restore the old INT 9
INT  20             ;All done

RCX
F5
W
Q
