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 / GENASM / U.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  3KB  |  132 lines

  1. ;        U.COM - VERSION 1.0
  2. ;            BY ROBERT FISHER
  3. ;               November 27, 1981
  4. ;
  5. ;Select drive and user area with one command.
  6. ;
  7. ;Usage:
  8. ;       U B4
  9. ;will select drive B:, user area 4.
  10. ;
  11. ;The drive may be any valid drive letter in upper or lower case,
  12. ;and the user area may be any user area in the range 0-31. 
  13. ;(But see the customization area below.)
  14. ;Either may be omitted.  If both are omitted, a usage message is printed.
  15. ;
  16. ;To be useful, this program must be accessable from all drives and
  17. ;all user areas.
  18. ;This is no problem if you are using one of the modified CCP's, but
  19. ;requires some other mechanism for a standare CCP.
  20. ;
  21. ;Check the public programs: DUPUSR21.ASM and CCPPATCH.ASM or the
  22. ;various versions of CCPZ.ASM
  23. ;
  24. ;One further note.  Your BIOS must be correctly written for this 
  25. ;program to work.  Specifically, it must not reset the user area
  26. ;to zero on warm boot.  (The California Computer System BIOS
  27. ;fails in this respect.)
  28. ;
  29.     org 100h
  30. fcb    equ    5ch
  31. bdos    equ    5
  32. cdrive    equ    04
  33. warmbt    equ    0
  34. ;
  35. prstr    equ    9
  36. ;
  37. tab    equ    9
  38. lf    equ    0ah
  39. cr    equ    0dh
  40. ;
  41. ;USER customization parameters
  42. maxuser    equ    15    ;maximum user area   (may be in range 0-31)
  43. numdrvs    equ    4    ;number of drives in your system
  44. ;
  45. ;set selected drive
  46.     lxi    h,fcb+1
  47.     mov    a,m
  48.     cpi    ' '
  49.     jz    usage    ;no parameters
  50.     cpi    '9'+1    
  51.     jc    digit    ;no drive was specified
  52.     ani    5fh    ;make it upper case
  53.     sui    'A'
  54.     jc    usage    ;illegal character
  55.     cpi    numdrvs
  56.     jnc    usage    ;too high a drive specified
  57.     mov    e,a
  58.     lda    cdrive    ;put new drive into lower nibble of cdrive
  59.     ani    0f0h    ;zero out old drive number
  60.     ora    e    ;slip the new drive in
  61.     sta    cdrive    ;this sets the drive
  62.     
  63. ;
  64. ;set selected user area
  65.     inx    h
  66.     mov    a,m
  67.     cpi    ' '
  68.     jz    warmbt    ;no user area specified
  69. digit    sui    '0'
  70.     jc    usage    ;non-digit
  71.     cpi    10
  72.     jnc    usage    ;non-digit
  73.     mov    e,a    ;move it to e to preserve it
  74.     inx    h
  75.     mov    a,m
  76.     cpi    ' '
  77.     jz    setusr    ;one-digit user
  78.     sui    '0'
  79.     jc    usage    ;non-digit
  80.     cpi    10
  81.     jnc    usage    ;non-digit
  82.     mov    c,a
  83.     xra    a    ;clear the carry bit
  84.     mov    a,e    ;get first digit back
  85.     ral        ;x2
  86.     mov    e,a    
  87.     ral        ;x4
  88.     ral        ;x8
  89.     add    e    ;x10
  90.     add    c    ;add in second digit
  91.     mov    e,a
  92. ;
  93. setusr:    mov    a,e    ;get it back if it's not there already
  94.     cpi    maxuser+1
  95.     jnc    usage
  96.     cmc        ;clear the carry bit
  97. ;
  98. ;User area goes in upper nibble of cdrive.
  99.     ral
  100.     ral
  101.     ral
  102.     ral
  103.     mov    c,a
  104.     lda    cdrive
  105.     ani    0fh    ;zero out old user number
  106.     ora    c    ;slip in new user number
  107.     sta    cdrive
  108. ;    
  109. ;
  110.     jmp    warmbt
  111. ;Print USAGE message if no parameters provided, or if parameters
  112. ;are illegal.
  113. usage:    lxi    d,message
  114.     mvi    c,prstr
  115.     call    bdos
  116.     ret
  117.  
  118. message    db    'Drive and user selector: U.COM - Version 1.0',cr,lf
  119.     db    tab,tab,tab,tab,'by Robert Fisher - November 27, 1981',cr,lf,lf
  120.     db    'Sample usage:',cr,lf,lf
  121.     db    tab,tab,'U B4',cr,lf,lf
  122.     db    'selects drive B, user area 4.',cr,lf,lf
  123.     db    tab,tab,'U 13',cr,lf,lf
  124.     db    'selects user area 13 of the current drive.',cr,lf,lf
  125.     db    tab,tab,'U B',cr,lf,lf
  126.     db    'selects drive B, current user area.',cr,lf,lf
  127.     db    'Lower case is acceptable for the drive letter.',cr,lf
  128.     db    'The drive or the user area may be omitted.',cr,lf,lf
  129.     db    '$'
  130.  
  131.     end
  132.