J.E.Lawrie                                                            HINTS-6.
                                                                         v.2  



Using % variables

  You may have wondered about all these T%  x%  etc in Basic programs and  you
  may wonder why, because they are not really percentages.  These are "integer
  variables".  They take up less  memory.   It  is  claimed  that  the  system
  operates  much faster with these integers since no decimal places are shown.

  Of  course  it  is  often  essential  to  obtain  exact  values,  especially
  where roots or divisions are involved.  This is not impaired by the  use  of
  % integers - the decimal values  are  used  in  all  internal  calculations.
    A% through Z% are "special" variables in that they are not cleared by RUN,
  CHAIN, and CLEAR statements.

"No Room"

  The dreaded error message.  Occurs most often because  there  really  is  no
  room in the memory.  Irritates especially when you look at the "free memory"
  at the Diary (when in Diary type <>EMF) or Pipedream (type <>O) and  there's
  oodles of it!

  For a start, these figures are meaningless!  But there may well be  no  room
  in  a  particular  RAM  but  plenty elsewhere, and don't forget that all the
  entries in the Suspended Activities in the Index are still taking up  memory
  space.  This is the first place to weed out.

  Another reason, and it nearly drove me mad until the designer of BBC and Z88
  Basic  put  me  straight, occurred in one of my programs.  This had about 12
  arrays dimensioned, including four which allowed  for  over  200  characters
  each.   These were in continuous use, sections taken out, moved and replaced
  until after playing the game ("words") I very  often,  but  maddeningly  not
  always, got "no room".

  The solution was so simple I could hardly believe it.  At the start  of  the
  listing  I  put,  for each array, after the DIM statements like DIM X$(255),
  this-   X$=STRING$(255," "):X$=" "  i.e. filled up the reserved area, to the
  limit  of  the  DIMs  with spaces and then emptied them!   This reserved the
  maximum space to cover the worst case(s). S'easy when you know how!

Spreadsheets (1)

  Did  you  know  that  you  can use the "conditional" IF... THEN... ELSE.. in
  spreadsheets, like this in (say) cell E14 -
          IF(D12<0,"Loss","   ")     i.e   "If  the  figure  in  cell  D12  is
           negative THEN print "Loss" ELSE leave this cell empty.

Channel error

  In  Basic  programs  you  may  meet the error "channel" which means you have
  tried to open a channel already open - not  difficult  to  do.   Immediately
  after  a  line  such  as   IF chnl=OPENIN("array")   put another line     IF
  chnl<>=0 THEN .........  to allow the program to continue and not  end  with
  an error message.

                                                                           END

Back to HINTS-INDEX