home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
cpm3
/
qs-cpm3.ark
/
QS.ASM
next >
Wrap
Assembly Source File
|
1984-01-07
|
3KB
|
141 lines
;
title 'Quick Set - File Attribute Bit Set Program'
;
; 7Jan84 by Mike Griswold, Ft. Worth, TX
;
; This program allows for setting the three system
; attribute bits, t1', t2', t3', to the control R/O,
; SYS and Archive features. Usage is:
; QS file.typ {options}
;
; where options are:
; R for R/O
; S for SYS
; A for Archive
;
; All other option letters are ignored. Only the
; first three letters in the option field are
; used, all others are ignored. To turn off an
; attribute use QS without the option letter.
;
;
;
; aseg ; for RMAC
;
org 0100h
start: lxi sp,0100h
lda 05dh ; see if file specified
cpi ' '
jz no$file ; give usage message
xra a
sta ro ; initialize attribute flags
sta sys
sta arch
lda 06dh ; first option field
call get$opt ; decode it
lda 06eh ; next
call get$opt
lda 06fh ; last
call get$opt
lxi d,05ch ; point to FCB
mvi c,30 ; set attribute function
call 5
call signoff ; tell what happened
jmp 0 ; exit
;
; Check byte in A for legal options and set
; attribute flag if found.
;
get$opt:
cpi 'R'
jnz get1
sta ro
lda 065h ; t1
ori 80h ; set t1'
sta 065h
get1: cpi 'S'
jnz get2
sta sys
lda 066h
ori 80h
sta 066h ; set t2'
get2: cpi 'A'
jnz get3
sta arch
lda 067h
ori 80h
sta 067h ; set t3'
get3: ret
;
; Display file's new attributes.
;
signoff:
push psw ; save error code
mvi a,'$'
sta 068h ; set end of string
lxi h,05ch
call sout
pop psw ; retrieve error
ora a
jz sign0 ; no error
lxi h,mess0 ; else file not found
call sout
ret
sign0: lxi h,mess1
call sout
lxi h,dirmess
lda sys
ora a
jz sign1
lxi h,sysmess
sign1: call sout
lxi h,rwmess
lda ro
ora a
jz sign2
lxi h,romess
sign2: call sout
lxi h,armess
lda arch
ora a
cnz sout
ret
;
; Output string from HL until '$'.
;
sout: xchg ; DE points to string
mvi c,09
call 5
ret
;
; Print usage string if no file was given.
;
no$file:
lxi h,usage
call sout
jmp 0 ; abort
;
; Message strings
;
mess0: db ' not found.',0dh,0ah,'$'
mess1: db ' set to: $'
dirmess:db 'DIR $'
sysmess:db 'SYS $'
rwmess: db 'RW $'
romess: db 'RO $'
armess: db 'Archive$'
;
usage: db 0dh,0ah,'QS usage is: QS filename options'
db 0dh,0ah,0ah,'where legal options are:'
db 0dh,0ah,0ah,09h,'R - Sets RO attribute'
db 0dh,0ah,09h,'S - Sets SYS attribute'
db 0dh,0ah,09h,'A - Sets Archive attribute$'
;
; Local storage
;
ro: ds 1 ; RO flag
sys: ds 1 ; SYS flag
arch: ds 1 ; Archive flag
;
end 0100h