[Select]

Application Suite: Edit


 

Writing and editing BASIC programs

Edit allows you to write BASIC programs, converting the Text files produced in Edit to tokenised BASIC files. A tokenised file is one where BASIC keywords are replaced by seldom-used ASCII characters, to make the program smaller and faster in execution.

Writing a new program

To write a new program, choose Create->BASIC from Edit's icon bar menu. You can type your program directly into an Edit window. There is no need to include line numbers, as Edit will insert them for you when you save the file. Press Return at the end of the last line of the program.

Editing an existing program

To use Edit for working on an existing BASIC program, simply drag the program's icon from its directory onto the Edit icon on the icon bar, or Shift double-click on its icon.

Line numbers

By default, line numbers will be stripped when a BASIC file is loaded. To turn this option on or off, choose Strip line numbers from the Edit icon bar menu. If a reference to a line is found, an error box will appear.

Line numbers are added when a BASIC file is saved. Use Line number increment from the Edit icon bar menu to set the number increment between successive lines in the program.

Converting to a tokenised file

A tokenised file saves space. Top-bit-set characters and control characters (non-printing characters) are used to represent the BASIC keywords. So, for example, the Hex character E3 represents the keyword FOR.

Converting a text file to a tokenised file is usually quite straightforward. If there are no line numbers, by default Edit will start at 10 and increment by 10. If line numbers are supplied, these are used as a basis for any lines without line numbers.

Warnings

If there are line numbers, Edit will not sort them into ascending sequence and the resulting BASIC program may behave strangely.

If your code is incomplete, Edit will warn you about the following problems:

  • Line number reference too large.
  • Mismatched quotes.
  • Mismatched brackets.

In all cases Edit will also quote the offending line number. After you have clicked on OK, the tokenising continues.

Attempts to tokenise a crunched program (e.g. one with the spaces removed) will generally result in a non-functioning program.

Printing a BASIC program

If you have Edit running, you can print a BASIC program on paper by dragging its icon onto a printer driver icon. Edit will perform the conversion to allow the program to be printed.

Quitting Edit

Choose Quit from the Edit icon bar menu to stop Edit and remove it from the computer's memory. A dialogue box may be displayed, warning you if there are any current files you have not saved.

Next


This documentation is copyright 3QD Developments Ltd 2013 and may not be reproduced or published in any form without the copyright holder's permission. RISC OS is subject to continuous development and improvement as such all information is provided by 3QD Developments Ltd in good faith and is believed to be correct at the time of publication E&OE. 3QD Developments Ltd cannot accept any liability for any loss or damage arising from the use of any information provided as part of the RISC OS Documentation.

HTML document version r23142 (3rd November 2015)