Using the editor
    Il "Quarto" fuso ] The 4th Time Zone ]   


 

Introduction
Input/Output operations
Mathematical Operators
Stack operators
Other operators
Colon definition
Control structures
Conditional branching
Constants and variables
Other Forth words
Using the editor
Error messages


                                   

[ Index ][ Back ][ Next ]

Generally speaking, most users will want to use the Spectrum editor to type and edit the source, but a full Forth Line editor is included for compatibity with existing text. The maximum length of any line is 64 characthers. Any characters after this will be ignored.

The Line Editor

Included in this version of White Lightning is a Line editor to enable you to create source or text files. To facilitate text editing, the text is organised into blocks of 512 bytes, divided into 8 lines of 64 characters. Once the text has been edited, it may be compiled into the Forth dictionary and the text, if required, can be saved to tape. The text editor is stored in memory in the pages at C000 to F000, therefore you can edito into screen 1 to 23. If the background facility is utilised, text is stored from CC00 onwards in screen 6 to 23, and screen 0 to 5 cannot be used. Here is a list of the editor commands and their descriptions.

H

This will Hold the text pointed by the top number on the stack of the current screen in a temporary area known as PAD

e.g.      4 H

will hold line 4 of the current screen in PAD.

S

Fill (Spread) the line at the top of the stack with blanks, and shift down all subsequent lines by 1, with the last line being lost.

e.g.      6 S

will fill line 6 with blanks and move all others lines down by one pushing the last line off the screen.

D

Delete the line number hold on the stack. All other lines are moved up by 1. The line is held in PAD in case it is still needed. Line 7 cannot be deleted.

E

Erase the line number at the top of the stack by filling it with spaces.

RE

REplace the line number at the top of the stack with the line currently held in PAD.

INS

INSert the text from the PAD to the line number held on the stack. The original and subsequents lines are moved down by one with the last line being lost.

P

Insert (Put) the following text to the line number held on the stack. The original content of the line is lost.

EDIT

Works just like normal Sinclair line editor. Also, it does an automatic LIST and an automatic FLUSH. This is far and away the best way to edit and the above are included only for compatibility with existing Forth's.

CLEAR

CLEARs the screen number held on the stack and make it the current screen.

WHERE

If an error occurs during the LOADing of Forth’s text screen, then keying in WHERE will result in the screen number and offending line being displayed. You can use the other editing commands to edit the screen, or you may move to another screen by either LISTing or CLEARing it.

e.g.      15 LIST

will now make screen 15 the current screen and will list the contents. In order to compile this screen into. the dictionary, it is necessary to use the word LOAD.

LOAD

This will start loading at the screen number held on top of the stack and will stop at the end of the screen. If you wish to continue and LOAD the next screen, the current screen must end with -->. This means “continue loading and interpreting”. If you wish to stop the LOADing anywhere in a screen then use ;S. This means “stop loading and interpreting”.

At the end of every editing session and before saving your text, it is necessary to FLUSH the memory buffers into the text area. To do this, just key in

FLUSH  <CR>

Note that the EDIT command does automatic FLUSH. You can save your text to tape using the Spectrum SAVE command. You must first enter in BASIC typing

PROG  <CR>

Now for an example of how to edit a text file, the first step is to either LIST or CLEAR the screen about to be worked on

9 LIST

followed by the text below

0  P  THIS IS HOW TO PUT   <CR>

Then type

1  P  TEXT ON LINE 1 <CR>

and so on, until you have entered:

THIS IS HOW TO PUT
TEXT ON LINE 1
LINE 2
AND LINE 3 OF THIS SCREEN

Now:

9 LIST  <CR>

will produce

SCR# 9
0 THIS IS HOW TO PUT
1 TEXT ON LINE 1
2 LINE 2
3 AND LINE 3 OF THIS SCREEN
4
5
6
7

To change line 2 type

2 EDIT <CR>

and then change it in the normal way to insert ‘TEXT ON’ before ‘LINE 2’. Now type

9 LIST <CR>

to see the result. The editor ignores character after the 64th character of the line being edited.

If you have a Sinclair Printer connected, then it is probably worth defining a word to list screen to the printer:

: SLIST  PRT-ON  1 = SWAP  <CR>
DO 1 LIST CR LOOP PRT-OFF ; <CR>

To use the above word, type the first screen number, last screen number, SLIST.

e.g.      6 9 SLIST <CR>

will list screen 6 to 9 to the printer.

[ Index ][ Back ][ Next ]


Ultimo aggiornamento: 10-12-2002. Copyright (c) 2000-2002 Matteo Vitturi. 
Per problemi o domande relativamente a questo sito contattare il webmaster
Last update: 12.10.2002. Copyright (c) 2000-2002 Matteo Vitturi.
For problems or questions related to this web please contact the webmaster.
1