home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / ZCPR33 / A-R / CD33.LBR / CD33.ZZ0 / CD33.Z80
Windows Setup INFormation  |  2000-06-30  |  7KB  |  282 lines

  1.  
  2. ; Program:  CD
  3. ; Version:  3.0
  4. ; Author:  Richard Conn
  5. ; Date: 12 Apr 84
  6. ; Previous Versions: None
  7. ; Derivation: In Concept from CD 2.4 for ZCPR2
  8.  
  9. VERSION    EQU    33
  10.  
  11. ; There was still a problem with the way directories were logged in under
  12. ; BGii, because BGii, unlike Z33, will not accept the command DIR: to log
  13. ; in a password-protected directory that is within the allowed DU range and
  14. ; can be logged in using DU:.  Now I use the DU: form in this case.
  15.  
  16. ;VERSION EQU    32
  17.  
  18. ; Unfortunately, Bruce's code fails in an annoying way if the selected
  19. ; directory cannot be logged in using the forms DU: or DIR: (this is often
  20. ; the reason for using CD in the first place).  In such cases, the user will
  21. ; be asked to repeat a password that has already been entered correctly.
  22. ; I have modified the code to check for this situation.  If ZCPR33 is running,
  23. ; then its method of changing the default drive/user is used instead.  If not,
  24. ; then the code checks to see if DU: or DIR: will be accepted.  If so, that
  25. ; command line is prefixed to the multiple command line buffer.  Otherwise,
  26. ; the old login method using a warm boot is used.  The code now also checks
  27. ; for a completely illegal directory (e.g., a named directory with a nonloggable
  28. ; user number above 15).  In that case, the multiple command line is flushed.
  29. ;                        Jay Sage, August 30, 1987
  30.  
  31.                 ; For ZCPR 3.3 & BGii compatilbility,
  32.                 ; Also deleted vestigial (this ain't
  33.                 ; CP/M 2 anymore...) messing with the
  34.                 ; CPR user/drive byte and annoying
  35.                 ; Warm Boots.
  36.                 ; @20:56:07 April 10, 1987
  37.                 ; Bruce Morgen
  38.  
  39. ;VERSION EQU    31        ; Responds to quiet flag.
  40.                 ; ??/??/8? Joe Wright
  41. Z3ENV    DEFL    0FE00H
  42.  
  43.  
  44. ;    CD is used to log into a new directory by name or DU (DIR or DU forms)
  45. ; and to automatically run ST once there if it is available.
  46. ;
  47. ;    Syntax:
  48. ;        CD or CD //    <-- Print Help
  49. ;        CD dir:     <-- Log In and Run ST.COM
  50.  
  51.  
  52. ; OS and ASCII Equates
  53.  
  54. FCB    EQU    5CH
  55. CR    EQU    0DH
  56. LF    EQU    0AH
  57.  
  58.  
  59. ; Library Functions: SYSLIB, Z3LIB, Z33LIB
  60.  
  61.     EXTRN Z3INIT,Z3LOG,GETQUIET,PUTCL,DUTDIR,GETCL2,GETMDISK,GETMUSER
  62.     EXTRN RETUD,EPRINT,EPSTR,COUT
  63.     EXTRN MAFDC,PAFDC,INITFCB,F$EXIST
  64.     EXTRN HIGHUSER,PDEFDU,Z33CHK,FCB1CHK
  65.  
  66.  
  67. ; Environment Definition
  68.  
  69.      IF    Z3ENV NE 0
  70.  
  71. ; External ZCPR3 Environment Descriptor
  72.  
  73.     JP    START
  74.     DB    'Z3ENV'        ; This is a ZCPR3 Utility
  75.     DB    1        ; External Environment Descriptor
  76. Z3EADR:
  77.     DW    Z3ENV
  78. START:
  79.     LD    HL,(Z3EADR)    ; Pt to ZCPR3 environment
  80.  
  81.      ELSE
  82.  
  83. ; Internal ZCPR3 Environment Descriptor
  84.  
  85.     MACLIB Z3BASE.LIB
  86.     MACLIB SYSENV.LIB
  87. Z3EADR:
  88.     JP    START
  89.     SYSENV
  90. START:
  91.     LD    HL,Z3EADR    ; Pt to ZCPR3 environment
  92.      ENDIF
  93.  
  94.  
  95. ; Start of Program -- Initialize ZCPR3 Environment
  96.  
  97.     CALL    Z3INIT        ; Initialize the ZCPR3 Env
  98.     LD    A,(FCB+1)    ; Check for help
  99.     CP    '/'        ; Help?
  100.     JP    NZ,CD        ; Skip ahead if not
  101.  
  102.     CALL    EPRINT
  103.     DB    'CD, Version '
  104.     DB    [VERSION/10]+'0','.',[VERSION MOD 10]+'0'
  105.     DB    CR,LF,'Syntax:'
  106.     DB    CR,LF,'  CD dir:  or  CD du:  <-- Change Directory'
  107.     DB    0
  108.     RET
  109.  
  110. ; Log into DU converted by ZCPR3
  111.  
  112. CD:
  113.     CALL    Z33CHK        ; See if we have ZCPR33
  114.     JP    NZ,CD0        ; If not, skip directory validity test
  115.     CALL    FCB1CHK        ; See if value directory given
  116.     JP    Z,CD0        ; If OK, skip message
  117.     CALL    EPRINT
  118.     DEFB    ' Illegal directory specification.',0
  119.     RET
  120.  
  121. CD0:
  122.     LD    DE,FCB        ; Point to FCB
  123.     CALL    Z3LOG        ; Login to DU
  124.  
  125. ; Validate the directory if above user 15
  126.  
  127.     LD    A,(FCB+13)    ; Get user number
  128.     CP    10H
  129.     JP    C,CD1        ; If in range 0..15, skip ahead
  130.  
  131.     CALL    HIGHUSER    ; See if Z33 and high users allowed
  132.     JP    NZ,CD1        ; If allowed, skip ahead
  133.  
  134.     CALL    EPRINT        ; Display error message
  135.     DEFB    ' Illegal user area ',0
  136.     LD    A,(FCB+13)
  137.     CALL    PAFDC
  138.     CALL    EPRINT
  139.     DEFB    CR,LF,' All commands aborted.',0
  140.     CALL    GETCL2        ; Terminate pending commands
  141.     LD    (HL),0
  142.     RET
  143. CD1:
  144.  
  145. ; Add the ":ST" command to the command line if ST.COM exists in target
  146. ; directory
  147.  
  148.     LD    DE,STFCB    ; Point to FCB for ST.COM
  149.     CALL    INITFCB
  150.     CALL    F$EXIST        ; Does ST.COM exist?
  151.     JP    Z,CD2        ; If not, proceed with login of directory
  152.  
  153.     LD    HL,STCL        ; Point to ":ST" command line
  154.     CALL    PUTCL        ; Add it to multiple command line
  155.     JP    Z,CLERR        ; Branch if overflow
  156. CD2:
  157.  
  158. ; Log into the new directory
  159.  
  160.     CALL    WRITEDU        ; Form command of form DU:<0>
  161.     CALL    GETQUIET    ; Display messages only if not quiet flag
  162.     JP    NZ,QUIET1
  163.     CALL    EPRINT
  164.     DB    ' Logging Into ',0
  165.     LD    HL,LOGCL    ; Point to "DU:" string
  166.     CALL    EPSTR
  167. QUIET1:    
  168.  
  169.     CALL    RETUD        ; Get user/drive
  170.     CALL    DUTDIR        ; Convert DU to DIR
  171.     JP    Z,LOG        ; Branch if directory has no name
  172.  
  173.     LD    DE,LOGCL    ; Copy directory name into LOGCL
  174.     LD    B,8        ; Maximum of 8 characters in name
  175. PRTNAME:
  176.     LD    A,(HL)        ; Get character from NDR
  177.     CP    ' '        ; Done?
  178.     JP    Z,LOG
  179.     LD    (DE),A
  180.     CALL    GETQUIET
  181.     LD    A,(DE)        ; Restore character
  182.     CALL    Z,COUT
  183.     INC    HL        ; Point to next
  184.     INC    DE
  185.     DEC    B        ; Count down
  186.     JP    NZ,PRTNAME
  187.  
  188. LOG:
  189.     EX    DE,HL        ; Switch LOGCL pointer to HL
  190.     LD    (HL),':'    ; Add colon to command line
  191.     INC    HL
  192.     LD    (HL),0        ; Terminate LOGCL
  193.  
  194. ; Log in directory:  This is done either by putting drive/user into the
  195. ; message buffer (if Z33) or by putting DU: or DIR: in the command line (if
  196. ; allowed) or by putting drive/user into page 0 and warm booting (if nothing
  197. ; else will do the job).
  198.  
  199.     CALL    RETUD
  200.  
  201.         ; Check for ZCPR33
  202.  
  203.     CALL    Z33CHK
  204.     JP    NZ,NOTZ33
  205.     CALL    PDEFDU        ; Make current DU the default
  206.     RET            ; That's all!
  207.  
  208.         ; Check whether directory can be logged into
  209.         ; ..using DU: or DIR: forms.
  210.  
  211. NOTZ33:
  212.     CALL    DUTDIR
  213.     JP    Z,CHKDU        ; If no name, check the DU value
  214.     LD    DE,8        ; Offset to password
  215.     ADD    HL,DE
  216.     LD    A,(HL)        ; See if there is a password
  217.     CP    ' '
  218.     JP    Z,USECL        ; If not, we can use the DIR: command line
  219.  
  220. CHKDU:
  221.     CALL    WRITEDU        ; Get "DU:<0>" back into LOGCL
  222.     CALL    GETMDISK    ; See if drive in range
  223.     DEC    A        ; Shift to range 0..15
  224.     CP    B
  225.     JP    C,BOOTLOG    ; If out of range, no choice but to warm boot
  226.     CALL    GETMUSER    ; See if user in range
  227.     CP    C
  228.     JP    C,BOOTLOG        ; If not, no choice but to warm boot
  229.  
  230. USECL:
  231.     LD    HL,LOGCL    ; Point to command line of form DU: or DIR:
  232.     CALL    PUTCL        ; Store it in ZCPR3 CL Buffer
  233.     RET    NZ        ; If no overflow, we are done
  234.  
  235. CLERR:
  236.     CALL    GETQUIET
  237.     RET    NZ
  238.     CALL    EPRINT        ; Print error message
  239.     DB    ' Command Line Overflow',0
  240.     RET
  241.  
  242. BOOTLOG:
  243.     LD    A,C        ; Shift user into high nibble
  244.     RLCA
  245.     RLCA
  246.     RLCA
  247.     RLCA
  248.     OR    B        ; Join with drive in low nibble
  249.     LD    (4),A        ; Store in user/drive byte in page 0
  250.     JP    0        ; Warm boot to log it in
  251.  
  252. ; Subroutine to write "DU:<0>" into the LOGCL buffer
  253.  
  254. WRITEDU:
  255.     CALL    RETUD        ; Get DU into BC
  256.     LD    DE,LOGCL    ; Point to destination
  257.     LD    A,B        ; Get drive
  258.     ADD    A,'A'        ; Convert to letter
  259.     LD    (DE),A
  260.     INC    DE
  261.     LD    A,C        ; Get user number
  262.     CALL    MAFDC
  263.     EX    DE,HL
  264.     LD    (HL),':'    ; Put in the colon
  265.     INC    HL
  266.     LD    (HL),0        ; And the null
  267.     RET
  268.  
  269.     DSEG
  270.  
  271. ; Buffers
  272.  
  273. LOGCL:
  274.     DS    10        ; Enough for any DU: or DIR: and null
  275. STCL:
  276.     DB    ':ST',0
  277.  
  278. STFCB:
  279.     DB    0,'ST      COM'    ; Default command FCB
  280.     DS    24
  281.     END
  282.