EasyManua.ls Logo

Atari ST series - Page 281

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Fread
Read File
Fread() Opcode = 63 ($3F)
T his fu nctio n r e ad s a spe cified n u m b er of b ytes from a n o p en file.
C macro format
lo n g sta tu s, co u n t;
in t h an d le ;
ch a r ^bu ffer;
statu s = F rea d (h a n d le, co u n t, bu ffer);
Machine language format
m o v e.l b uffer, - (sp )
m ov e.l
# c o u n t , - (sp ) i
m ov e.l # h a n d l e , - (sp )
m o v e .w # $ 3 F , - (sp )
trap
# 1
ad d .l
# 1 2 ,sp
Inputs
bu ffer
lo ng A p o in te r to th e bu ffer w h ere th e d ata
th at is rea d in w ill be sto re d .
co u n t
lo n g
T h e n u m b er o f b yte s to re a d . N o te: T h is
m u st be a lo n g valu e.
h an d le w o rd
T h e file ha n d le of th e file to re ad .
Results
DO statu s w o rd If th e fun ctio n su c ce ed s, th e actu a l n u m b er o f b y tes
re ad is retu rn ed . If th e fu n ction a ttem p ts to rea d
p ast th e e n d of th e file, 0 is re tu rn e d . F o r an y o th er
e rro r, a ne g ativ e G EM D O S erro r n u m b er is re tu rn e d
See also
F o p e n ( ), F c lo s e ()
273