- (it was AT or TAB) move the pointer on again; the trial position is still on the control code, the pointer is on the second parameter. _1051_ED_EDGE_2: check the pointer with the cursor position - move on the trial position to the pointer - if the pointer is still before the cursor position jump back to ED EDGE 1 - (the trial position is either just before the cursor or only control code parameters are between them) return with the trial position as next cursor position. Exit: double return (to 0F38 ED LOOP) if the cursor is already on line start - otherwise normal RET from ED EDGE 2. Output parameters: HL holds the new cursor position in the editing area or work space. Called from: 1007 ED LEFT 1015 ED DELETE ED EDGE 1 103E (1031 ED EDGE) Jumps from: 1051 ED EDGE 2 ED EDGE 2 1051 (1031 ED EDGE) Exit from: 103E ED EDGE 1 (twice) (1031 ED EDGE) ED EDIT subroutine 0FA9 Called only from the editing keys table 0FA5 by 0F92 ED KEYS in response to 07 EDIT; part of the 0F2C EDITOR loop. In editing, copies the current BASIC line to the lower screen; in input mode it clears whatever has been input and waits for a fresh input. Not otherwise called from ROM; could be called from m/c,but of doubtful usefulness. The line is copied to the editing area by opening channel R, which sends output to the editing area, and then calling 1855 OUT LINE, the same routine used to print BASIC lines to the main screen. OUT LINE expands all the tokens - doesn't reproduce the hi-lo line number of the line in the program area, but prints it as a decimal number with leadingspaces - omits the length bytes of the line which follow the line number in the program area - and skips any number markers and FP forms in the line as held in the program area. If the line number matches the one in 5C49 E PPC, OUT LINE will print the "current line" cursor ">" as part of the line. This is of course not wanted in the lower screen printout,and the programmer tried to sidestep it by decrementing E PPC temporarily before calling OUT LINE. [It usually works; but it fails if the last two lines inyour BASIC have consecutive numbers, and you delete the last one, leaving its number in 5C49 E PPC, then press EDIT. Try it: type 9998 STOP 9999 STOP and then type 9999 to delete the last line. Now EDIT will bringdown line 9998 with the current line cursor, and this will give a syntax error unless it is deleted. It would have been better to temporarily set the hi bit of 5C49 E PPC, making an impossible line number.] Input parameters: HL holds the cursor position in the editing area or work space - the return address 0F38 ED LOOP is on top of the stack. Action: get the current line number from 5C49 E PPC - if FLAGX bit 5 isn't zero exit to 1097 CLEAR SP; inputmode, it will clear the work space - (editing mode) call 196E LINE ADDR and 169B LINE NO tofind the start address and line number of the line in BASIC matching or next after the line number in 5C49 E PPC; if there are no more lines in the program, they return values for the last line - if this gives line zero exit to 1097 CLEAR SP to clearthe editing area; there are no lines to edit - read the line length from the two bytes after the linenumber - add 0Ah/10d; to allow for expanding the tokens - call 1F05 TEST ROOM, which will report "Out of memory"if there is no room for an editing area this size - call 1097 CLEAR SP to clear the editing area - save the address of the current channel from 5C51 CURCHL - call 1601 CHAN OPEN with stream minus one to open channel R; it outputs through 0F81 ADD CHAR to the editing area/work space at the position marked by 5C5B K CUR - recover the pointer to the start of the line in the program area; it was returned by 196E LINE ADDR called above - decrement the line number in 5C49 E PPC - call 1855 OUT LINE, which prints out the line through channel R into the editing area - restore 5C49 E PPC [see note above] - make a pointer from 5C59 E LINE; the start of the editing area - move it on four places; past the line number with its leading spaces [the notes are wrong here; 1855 OUT LINE has transformed the line] - put this address, just after the line number, in 5C5B K CUR; the editing cursor pointer - get back the current channel address and call 1615 CHAN FLAG to reset the channel; no doubt to channel K. Exit: RET; to 0F38 ED LOOP, in the ROM call. Output parameters: none. ED END 1026 (1024 ED ENTER) Exit from: 1024 ED ENTER 107F ED ERROR ED ENTER subroutine 1024 Called from the editing keys table 0FA5 by 0F92 ED KEYS in response to 0D ENTER; part of the 0F2C EDITOR loop. It appears in ROM as the exit routine from three other sections of the EDITOR loop, 1001 ED STOP, 101E ED IGNORE and 1076 ED SYMBOL; but only the first of these can be used for keyboard inputs. Not otherwise called from ROM; could be called from m/c,to remove three return addresses from the machine stack, puttingthe last of them into 5C3D ERR SP, and return to a fourth. When the EDITOR is called it first loads several addresses on the machine stack: - 0F38 ED LOOP, top of the stack, the looping return address for each of the editing subroutines - 107F ED ERROR, the temporary error address - the value currently in 5C3D ERR SP; usually the addressat this value would be 1303 MAIN 4. Below this is the return address for the EDITOR subroutine, 12AC MAIN 2 if it was called from main execution or 2148 IN VAR 2 or 215E IN VAR 4 if it was called from the INPUT command routine. ED ENTER exits from the 0F2C EDITOR routines as a whole by dropping the top two addresses and restoring the third to 5C3D ERR SP before returning. Input parameters: none - addresses as shown above on the machine stack. Action: drop the top two addresses. _1026_ED_END (entry point for 107F ED ERROR): recover thethird address and restore it to 5C3D ERR SP - check the hi bit of 5C3A ERR NR - if it is set, return; this must be "OK", FFh - otherwise jump to the error address just restored; this will arise for the "STOP in INPUT" error introduced at ED STOP or produced by a STOP against ordinary inputs, but it isn'teasy to see what other errors could arise at this point. Exit: RET, from 1026 ED END, twice: once to the error address, once to the routine which called the EDITOR loop. Output parameters: none. Exit from: 1001 ED STOP 101E ED IGNORE 1076 ED SYMBOL ED ERROR subroutine 107F There are no direct jumps to or calls of this label in the ROM, but its address is put on the stack and marked as the error address on entry, or reentry, to the 0F2C EDITOR loop at 0F30 ED AGAIN. Thus any call to 0008 ERROR 1 or 0053 ERROR 2 or 0055 ERROR 3 during execution of the EDITOR will jump to here. Alist is given below of such "possible calls": all of them arise either from attempts to print to an already full screen, or fromattempted expansion of a full memory. Instead of printing an error report, as for normal errors, the Spectrum gives a kind of sigh or groan - the "rasp" - and jumps straight back into the EDITOR loop at 0F30 ED AGAIN.As most of the errors involve severe pressure on available memory, attempting to do anything else might crash the system. A simple way to test the "rasp" is to command INPUT s, then input repeated THENs: the quickest way to fill the lower screen. When the lower screen is full up to the point of leavingonly one line in the upper, it groans; and groans again each time you press any editing key, but doesn't refuse further input. Press EDIT to delete the input. Action: check FLAGS2 bit 4; if channel K isn't in use exit to 1026 ED END. Other channels from peripherals or user m/cproduce no groan - put FF in 5C3A ERR NR; cancel the error number - call 03B5 BEEPER with a fixed pitch and the duration specified in 5C38 RASP; groan. Exit: to 0F30 ED AGAIN. "Possible" calls from ("Out of screen"): 0C55 PO SCR (via 0FA9 ED EDIT, through more than one different route to 09F4 PRINT OUT and 0B93 PR ALL 1) (or via 106E ED LIST, 1795 AUTO LIST, 17ED AUTO L 4, 1835 LIST ALL and 0010 PRINT A 1, 09F4 PRINT OUT etc) "Out of memory": 1F05 TEST ROOM (via 0F6C ED CONTR and 1655 MAKE ROOM) (or via 0F81 ADD CHAR and 1652 ONE SPACE) (or via 0FA9 ED EDIT) Rems: 1024 ED ENTER return address discarded ED FULL 1167 (111D ED COPY) Very like 107F ED ERROR; no direct jumps or calls from the ROM, but it is made the error address on entry to 111D ED COPY, and any error in copying to the lower screen will jump to here; I think only "Out of screen" errors are possible. Eg input a BASIC line consisting of a line number, REM, and enough THENs to more than fill the lower screen; now press ENTER and it will go into the program; now press EDIT. The Spectrum will copy as much as it can to the lower screen, but itwon't all fit in. You will get the "groan". ED FULL exits to ED C END after the groan, ie regards the copying as completed, but then exits normally into the editing loop. You can move the cursor and even add more THENs toyour overlong BASIC line - but you get a fresh groan for every editing command except ENTER. It differs from ED ERROR essentially only in exiting to 117E ED C END instead of direct to the editing loop, so that themachine stack can be properly rearranged. edges, edge-type see 05E7 LD EDGE 1 ED GRAPH 107C see symbol code ED IGNORE 101E Deals with the parameters of 16h AT and 17h TAB codes included in an INPUT command. Such inputs are impossible from the keyboard, though the situation might arise with input from peripherals such as Microdrives, or from user m/c. The two parameters are discarded, without any error report. Jumps from: 0F38 ED LOOP EDIT key (07) see also KEYBOARD SCANNING, 0260 control codestable (d) The one key with caps shift in K, L or C mode effects the EDIT control in editing mode; the "current" line of BASIC, if any, is copied to the editing area and then displayed in the lower screen. In input mode it merely deletes all input so far and waits for new input. Later models of the Spectrum mostly have a special EDIT key, but "one" with caps shift still works. 0260 control code table (d) 0A12 control character table - ineffective 0F92 ED KEYS jumps to the executive routine 0FA0 editing keys table 0FA9 ED EDIT executive routine editing see also control characters _Editing_mode is signalled by bit 5 of FLAGX being switched off; this is done each time execution passes through 1313 MAIN G, and is the normal mode of ROM operation. If FLAGX bit 5 is set, the program is in input mode. The_editing_area is the part of memory used to hold the_edit_line, either a new line or a copy of the BASIC line currently being edited, which can be changed by editing commands. It is located at the address stored in 5C59 E LINE, and is always followed by a newline and an 80-byte marker; and 5C61 WORKSP marks the address just after this. It is important to understand that all the editing commands operate on this copy in the editing area; only after they have been executed there is the line copied again to the lower screen to display the effect. The_editing_codes/keys are those covered by the editing keys table 0FA0: code 07 EDIT code 08 left arrow code 09 right arrow code 0A down arrow code 0B up arrow code 0C DELETE code 0D ENTER code 0E SYMBOL SHIFT code 0F GRAPHICS but the last two cannot be used without peripherals. Editing is executed by the 0F2C EDITOR loop, mostly using the routines addressed by the table. This loop is also used for inputs in response to INPUT commands, but in this case the input is built up in the work space area and copied from there to the lower display. 0F38 ED LOOP for edit keys jump to 0F92 ED KEYS 0F81 ADD CHAR code added to edit line 0F92 ED KEYS edit keys dealt with through table 0FA0 editing keys table 0FA9 ED EDIT different effect for editing and input 1031 ED EDGE line start marker at E LINE for editing 1097 CLEAR SP clears edit area 10A8 KEY INPUT edit line copied if "mode changed" 111D ED COPY copies editing area to lower screen 117C ED C DONE exit after copying to lower screen 1190 SET HL puts HL at last location of editing area 1195 SET DE puts DE at start of editing area 1219 RAM SET single newline in edit area on start-up 12A2 MAIN EXEC controls editing mode 133C MAIN 5 clear editing area after error report 157D MAIN ADD1 finds newline at end of editing area 1795 AUTO LIST misprint for "lower part of the screen" 1822 LIST 5 skip if checking syntax of edit line 19FB E LINE NO reads line number in editing area 1A1B OUT NUM 1 line number -2 in reports shown as zero 1B17 LINE SCAN edit area scanned by CH ADD 1B7D STMT R 1 flag signals running line in edit area 1B8A LINE RUN direct command in editing area has line number -2 1BD1 NEXT LINE next line is same line in edit area 2174 IN VAR 5 flag reset to signal edit mode editing area, editing codes, editing keys, editing mode see editing editing cursor see 5C5B K CUR editing key table 0F99 see tables EDIT KEY SUBROUTINE see 0FA9 ED EDIT edit line, edit mode, editor see editing