home *** CD-ROM | disk | FTP | other *** search
/ Old Hackers Atari User Group Newsletter / Old_Hackers_Atari_User_Group_Newsletter_OHJA94A.atr / munbug.txt < prev    next >
Text File  |  2023-02-26  |  3KB  |  1 lines

  1.                 *+*+*+*¢             UNBUGGING BASIC!¢¢ UNDOING THE BASIC GARBAGE QUIRK¢ A mini-tutorial by Les Wagar¢ Reprinted from  NORTH  SCOTLAND  ATARI¢ USER GROUP "FUTURA" newsletter, by OL'¢ HACKERS, N.Y.¢¢ (Ed. This article, I  believe,  refers¢ to the famous ATARI BASIC BUG "B", not¢ the later "C" version, but it's  still¢ good advice for all!)¢¢ BASIC GROWS ON YOU¢¢      Have you ever noticed  that  your¢ Basic  programs seem to get bigger all¢ by   themselves,   taking  up  one  or¢ several sectors more disk  space  than¢ they  used  to?   Take VIEWDOCS.BAS on¢ Futura issue  11,  for  instance.   It¢ takes  up  24   sectors--but   without¢ changing  one  byte  of the program as¢ written,   it   should   take   up  22¢ sectors.¢¢ ITS NOT THE PROGRAM¢¢      The quirk is not in the program. ¢ The  quirk  is  a  bug  in  the   SAVE¢ procedure.   If  you have been working¢ on   a   program--adding,    deleting,¢ whatever--or been working in Immediate¢ Mode with the program  installed,  and¢ then  proceed to SAVE the program, you¢ have likely added garbage data to your¢ program.   The  variable   list,   for¢ instance,  will  still   include   any¢ variables  which you have deleted from¢ the program or have  otherwise  played¢ around  with.   The simple solution to¢ the problem is:  don't SAVE, LIST.¢¢ THE REMEDY!¢   ¢       To   SAVE  a  clean  version  of¢ VIEWDOCS.BAS,   enter   commands    in¢ Immediate Mode as follows:¢¢       1. LIST "D?:VIEWDOCS.LST¢       2. NEW¢       3. ENTER "D?:VIEWDOCS.LST¢       4. SAVE "D?:VIEWDOCS.BAS¢¢ Your  BAS  version  now  takes  up  22¢ sectors.    You   have   removed   the¢ garbage.¢¢ BUT¢¢      Note in  passing  that  your  LST¢ version  takes up only 18 sectors, and¢ you may well ask why your BAS  version¢ is still taking up 4 more sectors than¢ it possibly could.¢¢ WHY?¢¢       There's   an   answer   to  that¢ question, too, but now you've  got  to¢ look  hard at the program itself.  How¢ many times do you repeat numbers  that¢ could be replaced by a variable?  If a¢ number is repeated  more  than  twice,¢ replace  it  with  a letter.  Let A=1,¢ B=2, C=0, D=3, etcetera,  replace  the¢ numbers  accordingly,  and   (lo   and¢ behold!) your SAVE after a LIST is now¢ getting close to  18  sectors--if  not¢ bang on!¢¢ CAVEAT¢¢      But  be careful, of course.  When¢ you start revising a  program,  ALWAYS¢ be  sure  a  working version is tucked¢ away somewhere out of reach.¢¢     Have fun!¢                *+*+*+*¢¢