Tandy 1000 Programmer's Reference Manual page 83

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chawter 1
I
System Calls
Example:
The following program copies a file using the Random
Block Read and Random Block Write function calls. It
speeds the copy by specifying a record count equal to the
file size and a record length of 1. With a buffer of 32K
bytes the file is copied quickly, requiring 1 disk access
each to read and write. (Compare this example with the
sample program for Function 27H, that specifies a record
count of 1 and a record length equal to file size.)
current-record
f ile-size
e q u
32
;offset
-
Current Rec field
equ
16
;offset
-
File Size field
f c b
db
37 dup
(7)
f
i
lename
db
17 dup(7)
prompt1
db
"File
t o
copy:
$ "
; 5 e e
Function E9H for
prompt
2
db
"Name of copy:
$ "
;explanation of
$
crlf
db
1 3,l
0
, " $ "
num-recs
d w
7
buffer
d b
32767 dup(7)
func-28H:
set-dta
buffer
; 5 e e
Function
1 A H
display
prompt 1
; s e e
Function E9H
get-string
15,filename
; 5 e e
Function ERH
display
crlf
; s e e
Function E9H
parse
filename[21,fcb
; s e e
Function 29H
open
fcb
; s e e
Function
EFH
mov
fcb[current-record1,E
;set Current Record
;field
set-relative-record
f c b
; s e e
Function 24H
mov
a x , word ptr f c b [file-size1
mov
num-recs,ax
;5ave i t for
ran-block-read
fcb,num-rec5,l
; T H I S
FUNCTION
display
prompt2
; s e e
Function E9H
get-string
15,filename
; s e e
Function %RH
display
crlf
: s e e
Function 89H
parse
filenameI21,fcb
; s e e
Function
29h
create
fcb
; s e e
Function 16H
mov
fcb[current-
; 5 e t
Current
set-relative-record
f c b
; 5 e e
Function 24H
mov
a x , file-length
;get size of
ran-block-write
fcb,num-recs,l
; 5 e e
Function 28H
close
f c b
:5ee
Function
18H
;get file
s i z e
;ran-block-write
record1
, E
;Record field
;or
i g
ina
I
____
81

Advertisement

Table of Contents
loading

Table of Contents