home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol050 / u.prn < prev    next >
Encoding:
Text File  |  1984-04-29  |  5.1 KB  |  134 lines

  1.  
  2.  
  3.                 ;        U.COM - VERSION 1.0
  4.                 ;            BY ROBERT FISHER
  5.                 ;               November 27, 1981
  6.                 ;
  7.                 ;Select drive and user area with one command.
  8.                 ;
  9.                 ;Usage:
  10.                 ;       U B4
  11.                 ;will select drive B:, user area 4.
  12.                 ;
  13.                 ;The drive may be any valid drive letter in upper or lower case,
  14.                 ;and the user area may be any user area in the range 0-31. 
  15.                 ;(But see the customization area below.)
  16.                 ;Either may be omitted.  If both are omitted, a usage message is printed.
  17.                 ;
  18.                 ;To be useful, this program must be accessable from all drives and
  19.                 ;all user areas.
  20.                 ;This is no problem if you are using one of the modified CCP's, but
  21.                 ;requires some other mechanism for a standare CCP.
  22.                 ;
  23.                 ;Check the public programs: DUPUSR21.ASM and CCPPATCH.ASM or the
  24.                 ;various versions of CCPZ.ASM
  25.                 ;
  26.                 ;One further note.  Your BIOS must be correctly written for this 
  27.                 ;program to work.  Specifically, it must not reset the user area
  28.                 ;to zero on warm boot.  (The California Computer System BIOS
  29.                 ;fails in this respect.)
  30.                 ;
  31.  0100               org 100h
  32.  005C =         fcb    equ    5ch
  33.  0005 =         bdos    equ    5
  34.  0004 =         cdrive    equ    04
  35.  0000 =         warmbt    equ    0
  36.                 ;
  37.  0009 =         prstr    equ    9
  38.                 ;
  39.  0009 =         tab    equ    9
  40.  000A =         lf    equ    0ah
  41.  000D =         cr    equ    0dh
  42.                 ;
  43.                 ;USER customization parameters
  44.  000F =         maxuser    equ    15    ;maximum user area   (may be in range 0-31)
  45.  0004 =         numdrvs    equ    4    ;number of drives in your system
  46.                 ;
  47.                 ;set selected drive
  48.  0100 215D00        lxi    h,fcb+1
  49.  0103 7E            mov    a,m
  50.  0104 FE20          cpi    ' '
  51.  0106 CA6901        jz    usage    ;no parameters
  52.  0109 FE3A          cpi    '9'+1    
  53.  010B DA2B01        jc    digit    ;no drive was specified
  54.  010E E65F          ani    5fh    ;make it upper case
  55.  0110 D641          sui    'A'
  56.  0112 DA6901        jc    usage    ;illegal character
  57.  0115 FE04          cpi    numdrvs
  58.  0117 D26901        jnc    usage    ;too high a drive specified
  59.  011A 5F            mov    e,a
  60.  011B 3A0400        lda    cdrive    ;put new drive into lower nibble of cdrive
  61.  011E E6F0          ani    0f0h    ;zero out old drive number
  62.  0120 B3            ora    e    ;slip the new drive in
  63.  0121 320400        sta    cdrive    ;this sets the drive
  64.                     
  65.                 ;
  66.                 ;set selected user area
  67.  0124 23            inx    h
  68.  0125 7E            mov    a,m
  69.  0126 FE20          cpi    ' '
  70.  0128 CA0000        jz    warmbt    ;no user area specified
  71.  012B D630      digit    sui    '0'
  72.  012D DA6901        jc    usage    ;non-digit
  73.  0130 FE0A          cpi    10
  74.  0132 D26901        jnc    usage    ;non-digit
  75.  0135 5F            mov    e,a    ;move it to e to preserve it
  76.  0136 23            inx    h
  77.  0137 7E            mov    a,m
  78.  0138 FE20          cpi    ' '
  79.  013A CA5101        jz    setusr    ;one-digit user
  80.  013D D630          sui    '0'
  81.  013F DA6901        jc    usage    ;non-digit
  82.  0142 FE0A          cpi    10
  83.  0144 D26901        jnc    usage    ;non-digit
  84.  0147 4F            mov    c,a
  85.  0148 AF            xra    a    ;clear the carry bit
  86.  0149 7B            mov    a,e    ;get first digit back
  87.  014A 17            ral        ;x2
  88.  014B 5F            mov    e,a    
  89.  014C 17            ral        ;x4
  90.  014D 17            ral        ;x8
  91.  014E 83            add    e    ;x10
  92.  014F 81            add    c    ;add in second digit
  93.  0150 5F            mov    e,a
  94.                 ;
  95.  0151 7B        setusr:    mov    a,e    ;get it back if it's not there already
  96.  0152 FE10          cpi    maxuser+1
  97.  0154 D26901        jnc    usage
  98.  0157 3F            cmc        ;clear the carry bit
  99.                 ;
  100.                 ;User area goes in upper nibble of cdrive.
  101.  0158 17            ral
  102.  0159 17            ral
  103.  015A 17            ral
  104.  015B 17            ral
  105.  015C 4F            mov    c,a
  106.  015D 3A0400        lda    cdrive
  107.  0160 E60F          ani    0fh    ;zero out old user number
  108.  0162 B1            ora    c    ;slip in new user number
  109.  0163 320400        sta    cdrive
  110.                 ;    
  111.                 ;
  112.  0166 C30000        jmp    warmbt
  113.                 ;Print USAGE message if no parameters provided, or if parameters
  114.                 ;are illegal.
  115.  0169 117201    usage:    lxi    d,message
  116.  016C 0E09          mvi    c,prstr
  117.  016E CD0500        call    bdos
  118.  0171 C9            ret
  119.                 
  120.  0172 4472697665message    db    'Drive and user selector: U.COM - Version 1.0',cr,lf
  121.  01A0 0909090962    db    tab,tab,tab,tab,'by Robert Fisher - November 27, 1981',cr,lf,lf
  122.  01CB 53616D706C    db    'Sample usage:',cr,lf,lf
  123.  01DB 0909552042    db    tab,tab,'U B4',cr,lf,lf
  124.  01E4 73656C6563    db    'selects drive B, user area 4.',cr,lf,lf
  125.  0204 0909552031    db    tab,tab,'U 13',cr,lf,lf
  126.  020D 73656C6563    db    'selects user area 13 of the current drive.',cr,lf,lf
  127.  023A 0909552042    db    tab,tab,'U B',cr,lf,lf
  128.  0242 73656C6563    db    'selects drive B, current user area.',cr,lf,lf
  129.  0268 4C6F776572    db    'Lower case is acceptable for the drive letter.',cr,lf
  130.  0298 5468652064    db    'The drive or the user area may be omitted.',cr,lf,lf
  131.  02C5 24            db    '$'
  132.                 
  133.  02C6               end
  134.