Data  and  the  Microdrive 
Opening  and  naming  a  data  file 
When  you  store  information  in  a  cartridge  you  keep  it  in  a file.  You  also  give 
the  file  a  name  so  that  you  can  find  it  again  later.  The  statement  that  opens 
and  names  a  data  file  always  takes  the  same  form.  For  example  try  entering: 
OPEN  #4:“m”;l;“Numbers” 
I\\ 
This  statement  does  two  distinct  jobs: 
-  it  sets  up  a  new  channel:  “m”;l;“Numbers” 
-  it  attaches  this  new  channel  to  stream  #  4. 
This  will  have  taken  about  seven  seconds,  during  which  time  the 
computer  searches  the  cartridge  for  a  file  called  “Numbers”.  Since  there  is 
no  file  “Numbers”,  it  opens  a  file  for  writing.  (However,  if  it had  found  a 
file  “Numbers”,  it  would  have  opened  it  for  reading.  And  had  it  found  a 
program  “Numbers”.  it  would  have  given  the  report  Wrong  file  type.) 
Entering  data 
Once  you  have  opened  a  file  you  can  enter  data.  Suppose  that  you  want  to 
store  the  numbers  1 to  10  with  their  squares..  Enter  and  run  this: 
10  FOR  n=l  TO  10 
20  PRINT  #4,n’nYn 
30  NEXT  n 
You  might  think  that  all  the  numbers  have  now  been  stored  away  in  the 
cartridge.  But  in  fact  the  computer  does  not  automatically  transfer  anything 
to  the  cartridge  until  a  certain  amount  has  built  up,  which  it  transfers  all  at 
once.  This  is called  buffering.  A  Microdrive  buffer  is  512  bytes  (or  characters) 
long. 
To  store  in  the  cartridge  the  data  you  have  entered  you  must  CLOSE  the  file. 
Until  this  is done  you  will  be  unable  to  read  back  from  the  file. 
23