EUG PD


Programming Tips

 
Published in EUG #20

In EUG #19, Gus mentioned about people writing in with various tips they use to make programming easier. I have a listed a few below.

Finding The Last Line

To find the last line of the program in memory, instead of LISTing the program all the way to the bottom, just type LIST, hold down CTRL and SHIFT and then press ESCAPE twice.

Invisible !BOOT File

To get an invisible !BOOT file, create the file as normal, but have a string of five Xs on the first line. Then use a sector editor to change the Xs to the following hexadecimal values:

      1C 01 07 01 07 

This will create a zero-sided text window right next to the initial BASIC prompt. I use this on most of my !BOOT files, and I think it would look nice used on the EUG disks.

Dumping Machine Code

To get a memory dump of machine code which is stored at &900 using the ADT ROM (as has been noted corrupts this page if you use *MEX addr 0), set your printer up and type the following:

      *SAVE filename <start> <end>
      *DUMP filename 0 <turn printer on> <CR>

Change Mode Quick!

A quick mode change (to Mode 6) can be achieved by hitting CTRL-V and CTRL-F. Likewise, CLS can be quickened by CTRL-L.

Quick Program Indentation

It's sometimes necessary to have a program with all loops indented for presentation purposes. However, unless you are prepared to either enter (or re-enter) a program and indent your lines, or use the BASIC Editor's COPY function to indent them, it's impossible.

The BASIC LISTO command does not work, since a program is not SAVEd with these indentations. However, I recently worked out a method that will indent BASIC programs after they've been written in the same way that the LISTO command does. Simply LOAD in the program with no indentations and then type in the following: (The LISTO setting I've chosen is 6, giving all loop indentations, but does not insert the wasteful space at the start of the line.)

      >LISTO 6
      >*SPOOL listing
      >LIST
      >*SPOOL
      >*EXEC listing
      >SAVE "filename"

The LIST command will take a fair while to execute before control comes back to you. Wait until the prompt returns before typing the next command. After the second *SPOOL command, an ASCII text file will have been created which is your detokenised indented BASIC listing. The *EXEC command will not enter this program at the keyboard (and the computer will treat it like you are entering it), which is then saved under whatever filename you've specified. I have used this method successfully in the Mastermind game which is part of this issue's GAME SHOW.

However, all users of this method should bear in mind that it slows down a program in the same respect as REMs (and wastes memory too!). I have never found this a problem though!

Ross Little, EUG #20

Ross Little