Chapter
1
I
System Calls
Example:
The following program prompts for the name
of
a
file, opens the
file
to
fill in the Record Size field of the
FCB,
issues a File Size
function call, and displays the file size and number
of
records in
hexadecimal format.
fcb
prompt
m5gl
msg2
crlf
six
t
een
reply
func-23H:
get-length:
convert-it:
ShOW-lt:
all-done:
db
db
db
db
db
db
db
37 dup
(7)
"File name:
0"
"Record
I
eng t h
:
"Rec
or
ds
:
13,l
0
,"$"
17 dup(7)
16
"
,
1
3,l
0
,
"t
"
'I,
1
3,l
0
,
"$"
open
file-size
mov
mov
CmP
le
convert
inc
i
nc
fcb
fcb
51,33
di ,9
fcb[5i
fcb[si
di
5hOW-1
51
display prompt ;seeFunction 09H
get-string 17,reply ;seeFunction 0FIH
CmP reply[l 1
,O
;Just aCR7
1ne get-length ;no,keepgoing
1"P a1 I-done ;yes, gohome
display crlf ;seeFunction 09H
parse reply[21,fcb ;seeFunction29H
;seeFunction 0FH
;THIS
FUNCTION
;offset
to
Relative
;Record field
;reply inmsg-2
;no,
prepareme55age
;bumpn-o-r index
;bumpme55age index
t
;check foradigit
ixteen,msg-1 [151
;seeFunction 09H
;5eeFunction 09H
;geta filename
;see
Function 10H
,o
;digit
to
convert?
.sixteen,msg-2[dil
Imp
convert-
convert fcbil41,
di5play m5g-l
display m5g-2
JmP
f
unc-23H
Close icb
74