Tandy 1000 Programmer's Reference Manual page 72

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter 1
I
System Calls
Example:
The following program prompts for a letter, converts the letter to
its alphabetic sequence (A
=
1, B
=
2, etc.), and then reads and
displays the corresponding record from a file named ALPHA-
BET.DAT on the disk in Drive B. The file contains 26 records;
each
record is 28 bytes long.
r e c o r d - s i z e
r e l a t i v e - r e c o r d
f c b
db
db
b u f f e r
db
p r o m p t
d b
c r l f
d b
e q u
1 4
; o f f s e t o f R e c o r d s i z e
e q u
33
; o f f s e t o f R e l a t i v e R e c o r d
; f i e l d o f FCB
; f i e l d o f FCB
2,
"ALPHABETDAT"
2 5
dup
( 7 )
3 4 d u p ( ? ) , " $ "
" E n t e r L e t t e r :
$ "
1 3 , 1 0 , " $ "
f u n c - 2 1 H :
s e t - d t a
b u f f e r
; s e e F u n c t i o n
1 A H
o p e n
f c b
; s e e F u n c t i o n B F H
mov
f c b [ r e c o r d _ s i z e 1 , 2 8 ; s e t r e c o r d s i z e
g e t - c h a r :
d i s p l a y
p r o m p t
; s e e F u n c t i o n 09H
r e a d - k b d - a n d - e c h o
; s e e F u n c t i o n
0 1 H
CmP
a1,BDH
; j u s t a C R 7
l e
a1
1-done
; y e s , g o h o m e
sub
a 1 , 4 1 H
; c o n v e r t
A S C I I
c o d e
mov
f c b [ r e l a t i v e - r e c o r d 1 , a l
; s e t r e l a t i v e
d i s p l a y
c r l f
; s e e F u n c t i o n 09H
r e a d - r a n
f c b
;THISFUNCTION
d i s p l a y
b u f f e r
; s e e F u n c t i o n 09H
d i s p l a y
c r l f
; s e e F u n c t i o n 09H
I m p
g e t - c h a r
; g e t a n o t h e r c h a r
a l l - d o n e :
c l o s e
f c b
; s e e F u n c t i o n l B H
; t o r e c o r d a
; r e c o r d
70

Advertisement

Table of Contents
loading

Table of Contents