home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / zcpr / nzcpr-16.ark / PASS.ASM < prev   
Encoding:
Assembly Source File  |  1985-06-30  |  2.0 KB  |  75 lines

  1. ;
  2. ;    Pass - Command to enable priviledged use of a ZCPR system
  3. ;        running under secure mode.
  4. ;        By Paul S. Traina -- OxGate Node 001 Sysop
  5. ;
  6. ;        Version 1.0 - 3/6/82
  7. ;
  8. ;    To run pass do the following:
  9. ;        A>PASS <password>  -  To enable wheel mode
  10. ;        A>PASS<cr>       -  To enable wheel mode without
  11. ;        Password: <password>     any echo of password
  12. ;        A>PASS -       -  To disable wheel mode manually
  13. ;
  14. CR    EQU    0DH        ;termination character
  15. PSTRING    EQU    09H        ;BDOS Print a string
  16. ENABLE    EQU    0FFH        ;this is poked into WHEEL
  17. FCB    EQU    005CH        ;file control block+1
  18. BDOS    EQU    0005H        ;bdos location
  19. WHEEL    EQU    003EH        ;location of wheel byte
  20.  
  21.     ORG    100H
  22. ;
  23. SELECT:    LDA    FCB+1        ;see what we are supposed to do
  24.     CPI    ' '        ;don't echo pasword (someone looking over
  25.     JZ    GETPASS        ;your shoulder?)
  26.     CPI    '-'        ;disable wheel mode (become humble again)
  27.     JZ    DISABLE
  28.                 ;No, we have a JCL, so let's read it in...
  29. COMPARE:
  30.     LXI    H,PASSWD    ;set up all the pointers
  31.     LXI    D,FCB+1        ;location of password buffer
  32.     MVI    B,PRGEND-PASSWD    ;number of characters of real password
  33. CKPASS:    LDAX    D        ;trial password to A
  34.     CMP    M        ;check for a match
  35.     RNZ            ;return to CCP (beware of skewed stacks)
  36.     INX    H        ;HL=HL+1
  37.     INX    D        ;DE=DE+1
  38.     DCR    B        ;B=B-1
  39.     JNZ    CKPASS        ;if B>0 then CKPASS
  40.     MVI    A,ENABLE    ;Set enable flag
  41. PWOUT:    STA    WHEEL
  42.     RET            ;return to CCP (watch stack or else...)
  43. ;
  44. DISABLE:
  45.     XRA    A
  46.     JMP    PWOUT
  47. ;
  48. GETPASS:
  49.     MVI    C,9
  50.     LXI    D,PMSG
  51.     CALL    BDOS
  52.     LXI    H,FCB+1        ;ok, use the fcb as a buffer
  53. GETLOOP:
  54.     PUSH    H        ;save HL
  55. LOOP1:    MVI    C,6        ;use direct console i/o
  56.     MVI    E,0FFH        ;input a character
  57.     CALL    BDOS        ;get character into A
  58.     ORA    A        ;set flags
  59.     JZ    LOOP1        ;no character found, try again
  60.     POP    H        ;restore HL
  61.     ANI    95        ;lowercase to uppercase (indiscriminate but
  62.                 ;effective)
  63.     CPI    CR        ;is it a <cr>?
  64.     JZ    COMPARE
  65.     MOV    M,A        ;store character in fcb
  66.     INX    H        ;increment pointers
  67.     JMP    GETLOOP        ;loop until we get a <cr>
  68. ;
  69. PMSG:    DB    'Password? $'
  70. PASSWD:    DB    'YOURPW'    ;Password shouldn't be more than 10 chars
  71.                 ;or somethings may die exotically.
  72. PRGEND:
  73. ;
  74.     END
  75.