home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol247 / pass.aq6 / PASS.A86
Encoding:
Text File  |  1986-02-28  |  2.8 KB  |  112 lines

  1. ;
  2. ;
  3. ; This program allows you to set the default password for a given process
  4. ; (console), without using the SET utility. SET forces you to type the
  5. ; password, as in SET [DEFAULT=TEST]. This utility prompts you, but types
  6. ; a # in response to each key pressed. This permits passwords to be used
  7. ; on files, even when someone "is looking" at your screen.
  8. ;
  9. ;  Dave Rand
  10. ;  72 Longfellow St.
  11. ;  Thousand Oaks, CA  91360
  12. ;  805-493-1987
  13. ;  05/29/85 - Version 1.0
  14. ;
  15.  
  16. ccpm        equ    224
  17.  
  18. f_passwd    equ    106
  19. c_writestr    equ    9
  20. c_rawio        equ    6
  21.  
  22. p_pdadr        equ    156
  23.  
  24.  
  25.     cseg
  26.  
  27. begin:    mov    dx,offset message    ;Ask the user for the password
  28.     mov    cl,c_writestr        ;print the message on the cosole
  29.     int    ccpm
  30.  
  31.     mov    bx,offset buffer    ;point to our local buffer
  32.     mov    cx,8            ;max of 8 chars
  33.  
  34. lp1:    push    bx            ;save the pointer
  35.     push    cx            ;and the current count
  36.     mov    dl,0fdh            ;get input from CCPM
  37.     mov    cl,c_rawio        ;via raw I/O
  38.     int    ccpm
  39.     pop    cx            ;restore the count
  40.     pop    bx            ;and the pointer
  41.     cmp    al,3            ;was it a ^C?
  42.     jz    exit            ;yes, exit
  43.     cmp    al,13            ;was it a return?
  44.     jz    done            ;yes, do the password
  45.     cmp    al,8            ;was it a backspace?
  46.     jnz    lp2            ;no, must be a valid char
  47.     cmp    cx,8            ;It is a backspace. Are we at left
  48.     jz    lp1            ;edge already? Yes, ignore key
  49.     dec    bx            ;no, so decrement pointer
  50.     inc    cx            ;and increment count
  51.     mov    dl,8            ;display a BS
  52.     call    dchar
  53.     mov    dl,' '            ;SP
  54.     call    dchar
  55.     mov    dl,8            ;BS triplet to erase char displayed
  56.     call    dchar
  57.     jmps    lp1            ;and loop for more input
  58.  
  59. lp2:    cmp    al,'a'            ;Since it is a good char, convert
  60.     jb    lp3            ;lower to uppercase
  61.     cmp    al,'z'
  62.     jae    lp3
  63.     and    al,5fh            ;by anding with 5f
  64. lp3:    mov    byte ptr [bx],al    ;store the char in the buffer
  65.     mov    dl,'#'            ;and display a # to tell the world
  66.     call    dchar
  67.     inc    bx            ;increment the buffer pointer
  68.     loop    lp1            ;and loop for more chars
  69.  
  70. done:    jcxz    done1            ;we are done, so fill the
  71.     mov    byte ptr [bx],' '    ;rest of the buffer with spaces
  72.     inc    bx            ;increment pointer
  73.     loop    done            ;and loop for rest
  74. done1:
  75.     mov    dx,offset buffer    ;point to buffer
  76.     mov    cl,f_passwd        ;and issue a password call
  77.     int    ccpm
  78.  
  79.     mov    cl,p_pdadr
  80.     int    ccpm            ;get address of calling PD
  81.     push    es:word ptr 10h[bx]    ;save my UDA address
  82.     mov    bx,es:word ptr 1eh[bx]    ;get parent PD address
  83.     mov    bx,es:word ptr 10h[bx]    ;BX -> parents UDA
  84.     pop    ds            ;DS -> my UDA
  85.     mov    es,bx            ;ES -> parents UDA
  86.     mov    si,12h            ;point to reserved PASSWORD area
  87.     mov    di,12h            ;point to reserved PASSWORD area
  88.     mov    cx,8            ;move 8 bytes
  89.     rep    movsb            ;with a rep.
  90.  
  91.     
  92.  
  93. exit:    mov    cl,0
  94.     mov    dl,0
  95.     int    ccpm
  96.  
  97. dchar:    push    bx            ;display a char on the console
  98.     push    cx
  99.     mov    cl,c_rawio
  100.     int    ccpm
  101.     pop    cx
  102.     pop    bx
  103.     ret
  104.  
  105.     dseg
  106.  
  107. message    db    'Enter password: $'
  108.  
  109. buffer    rs    8
  110.     end
  111.