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 / CPM3 / QS-CPM3.ARK / QS.ASM next >
Assembly Source File  |  1984-01-07  |  3KB  |  141 lines

  1. ;
  2.     title    'Quick Set - File Attribute Bit Set Program'
  3. ;
  4. ;    7Jan84    by Mike Griswold, Ft. Worth, TX
  5. ;
  6. ;    This program allows for setting the three system
  7. ;    attribute bits, t1', t2', t3', to the control R/O,
  8. ;    SYS and Archive features.  Usage is:
  9. ;        QS file.typ {options}
  10. ;
  11. ;    where options are:
  12. ;        R for R/O
  13. ;        S for SYS
  14. ;        A for Archive
  15. ;
  16. ;    All other option letters are ignored.  Only the
  17. ;    first three letters in the option field are
  18. ;    used, all others are ignored.  To turn off an
  19. ;    attribute use QS without the option letter.
  20. ;
  21. ;
  22. ;
  23. ;    aseg            ; for RMAC
  24. ;
  25.     org    0100h
  26. start:    lxi    sp,0100h
  27.     lda    05dh        ; see if file specified
  28.     cpi    ' '
  29.     jz    no$file        ; give usage message
  30.     xra    a
  31.     sta    ro        ; initialize attribute flags
  32.     sta    sys
  33.     sta    arch
  34.     lda    06dh        ; first option field
  35.     call    get$opt        ; decode it
  36.     lda    06eh        ; next
  37.     call    get$opt
  38.     lda    06fh        ; last
  39.     call    get$opt
  40.     lxi    d,05ch        ; point to FCB
  41.     mvi    c,30        ; set attribute function
  42.     call    5
  43.     call    signoff        ; tell what happened
  44.     jmp    0        ; exit
  45. ;
  46. ;    Check byte in A for legal options and set
  47. ;    attribute flag if found.
  48. ;
  49. get$opt:
  50.     cpi    'R'
  51.     jnz    get1
  52.     sta    ro
  53.     lda    065h        ; t1
  54.     ori    80h        ; set t1'
  55.     sta    065h
  56. get1:    cpi    'S'
  57.     jnz    get2
  58.     sta    sys
  59.     lda    066h
  60.     ori    80h
  61.     sta    066h        ; set t2'
  62. get2:    cpi    'A'
  63.     jnz    get3
  64.     sta    arch
  65.     lda    067h
  66.     ori    80h
  67.     sta    067h        ; set t3'
  68. get3:    ret
  69. ;
  70. ;    Display file's new attributes.
  71. ;
  72. signoff:
  73.     push    psw        ; save error code
  74.     mvi    a,'$'
  75.     sta    068h        ; set end of string
  76.     lxi    h,05ch
  77.     call    sout
  78.     pop    psw        ; retrieve error
  79.     ora    a
  80.     jz    sign0        ; no error
  81.     lxi    h,mess0        ; else file not found
  82.     call    sout
  83.     ret
  84. sign0:    lxi    h,mess1
  85.     call    sout
  86.     lxi    h,dirmess
  87.     lda    sys
  88.     ora    a
  89.     jz    sign1
  90.     lxi    h,sysmess
  91. sign1:    call    sout
  92.     lxi    h,rwmess
  93.     lda    ro
  94.     ora    a
  95.     jz    sign2
  96.     lxi    h,romess
  97. sign2:    call    sout
  98.     lxi    h,armess
  99.     lda    arch
  100.     ora    a
  101.     cnz    sout
  102.     ret
  103. ;
  104. ;    Output string from HL until '$'.
  105. ;
  106. sout:    xchg            ; DE points to string
  107.     mvi    c,09
  108.     call    5
  109.     ret
  110. ;
  111. ;    Print usage string if no file was given.
  112. ;
  113. no$file:
  114.     lxi    h,usage
  115.     call    sout
  116.     jmp    0        ; abort
  117. ;
  118. ;    Message strings
  119. ;
  120. mess0:    db    ' not found.',0dh,0ah,'$'
  121. mess1:    db    ' set to: $'
  122. dirmess:db    'DIR $'
  123. sysmess:db    'SYS $'
  124. rwmess:    db    'RW $'
  125. romess:    db    'RO $'
  126. armess:    db    'Archive$'
  127. ;
  128. usage:    db    0dh,0ah,'QS usage is:  QS  filename options'
  129.     db    0dh,0ah,0ah,'where legal options are:'
  130.     db    0dh,0ah,0ah,09h,'R - Sets RO attribute'
  131.     db    0dh,0ah,09h,'S - Sets SYS attribute'
  132.     db    0dh,0ah,09h,'A - Sets Archive attribute$'
  133. ;
  134. ;    Local storage
  135. ;
  136. ro:    ds    1        ; RO flag
  137. sys:    ds    1        ; SYS flag
  138. arch:    ds    1        ; Archive flag
  139. ;
  140.     end    0100h
  141.