3783 get-argt st-mem-1: 235A C ARC GE1 23A3 DR SIN NZ 23C1 DR PRMS (3 times) 2425 ARC LOOP 2497 DRAW SAVE 2D60 E LOOP 2E24 PF SMALL 3453 G LOOP st-mem-2: 235A C ARC GE1 23C1 DR PRMS (3 times) 2425 ARC LOOP 2E01 PF LOOP (twice) 3449 series-06 3453 G LOOP st-mem-3 2497 DRAW SAVE 2DF8 PF POSTVE 36C4 EXP st-mem-4: 2497 DRAW SAVE 2DF8 PF POSTVE st-mem-5: 233B C R GRE 1 238D DR 3 PRMS 23C1 DR PRMS (twice) 2DF8 PF POSTVE Rems: 335B CALCULATE example of manipulatory operation STMT LOOP 1B28 (1B8A LINE RUN) see also BASIC INTERPRETER Jumps from: 1B29 STMT L 1 1BD1 NEXT LINE 1BF4 STMT NEXT STMT L 1 1B29 (1B8A LINE RUN) Jumps from: 1B17 LINE SCAN 1D00 IF 1 STMT NEXT 1BF4 (1B8A LINE RUN) Jumps from: 1B7D STMT R 1 1BD1 NEXT LINE STMT RET 1B76 (1B8A LINE RUN) Jumps from: 1EDC CLEAR 2 Indirect jumps from: 1C4E CLASS 02 1D7C F FOUND 1E1E READ 2 1E73 GO TO 2 1E7A OUT 1E80 POKE 1F4F PAUSE END Rems: 1B29 STMT L 1 made return address for statement loop 1BB2 REM address dropped 1BEE CHECK END address dropped 1CF0 IF address dropped 1EED GO SUB return address saved 1F23 RETURN return address saved STMT R 1 1B7D (1B8A LINE RUN) Jumps from: 1B76 STMT RET STOP key (E2) see also commands, functions and operators, KEYBOARD SCANNING, 026A symbol code key table (e) The A key in C, K or L mode with symbol shift produces the command STOP, which accepts no parameters. The command is read by 1B29 STMT L 1 referring through the syntax offset table 1A48 to the syntax parameter table 1A7A.1A8A P STOP causes a jump via 1C10 CLASS 00 and 1C16 JUMP C R tothe executive routine 1CEE REPORT 9 (STOP). 0C88 PO SCR 2 makes break after "scroll?" 133C MAIN 5 increments SUBPPC in case of CONTINUE 21B9 IN ASSIGN aborts INPUT routine 21D0 IN STOP error report only in run-time S TOP system variable 5C6C see also 1795 AUTO LIST Bytes: 2 The line number of the BASIC line which is to appear at the top of the screen when a listing is displayed. Written by: 17CE AUTO L 1 17E1 AUTO L 2 1835 LIST ALL (using 190F LN FETCH and 191C LN STORE) Read by: 1795 AUTO LIST 17E4 AUTO L 3 1835 LIST ALL STOP, STOP COMMAND ROUTINE see 1CEE REPORT 9 'STOP in INPUT' message see 21D4 REPORT H 'STOP statement' message see 140C REPORT 9 STORE IN MEMORY AREA SUBROUTINE see 342D st-mem STR ALTER subroutine 2070 see also channels and streams Either LIST, LLIST, PRINT or LPRINT may be followed by the (hatch) symbol and a number: the effect is to LIST or PRINT to the stream indicated. For some reason this option isn't mentioned in any edition of the Handbooks. Its only useful application on the unextended Spectrum is in commands such as PRINT (hatch)0 [or (hatch)1]; "hello": PAUSE 0 which prints the message in the input area. If the PAUSE is omitted, the message prints but is immediately obliterated by the "OK" message. This subroutine changes the stream if it finds (hatch). Input parameters: A holds the character immediately following the BASIC command. Action: return with carry unless A is 23h (hatch) - move on the BASIC pointer - call 1CB2 EXPT 1NUM to read the number following (hatch) on to the calculator stack - call 1E94 FIND INT1 to put it in a register - if it is more than 0Fh/15d report "Invalid stream"; 0Fmisprinted FF in the notes - call 1601 CHAN OPEN to open the stream. [But CHAN OPEN won't open any stream unless it has already a channel allotted to it; and the only streams with channels in the unextended Spectrum are zero -> 3; and although you can open others, for example with the command OPEN (hatch)4,"s" you cannot use any other channels than the upper or lower screens and the ZX printer channel. Not much of this amounts to anything useful in practice.] - clear the carry flag. Exit: RET. Output parameters: none - the carry flag is set if there has been no change, cleared if the stream has changed. Called from: 17FB LIST 1 2024 PR ITEM 3 STR DATA subroutine 171E see also channels and streams Converts a stream number into the corresponding stream data, which is a 2-byte offset for finding the channel data. Input parameters: none - the stream number N is on the calculator stack. Action: call 1E94 FIND INT1, misprinted STK TO A, to get N; this excludes the minus numbers - if N is more than 0Fh/15d report "Invalid stream". _1727_STR_DATA_1: add 3 to N - rotate it left to double it - add it to 5C10 STRMS; each item of stream data, starting with the data for stream -3, takes up 2 bytes, so this now addresses the N'th item of stream data [two bytes could havebeen saved here by omitting ADD A,03 and writing LD HL,5C16] - read the data. Exit: RET, from STR DATA 1. Output parameters: BC holds the stream data - HL holds the stream address. Called from: 16E5 CLOSE 1736 OPEN STR DATA 1 1727 Jumps from: 171E STR DATA stream code, stream data, stream information, stream numbers, streams see channels and streams str-gr-eql, str-grtr see 353B no-l-eql STRING AND NUMBER OPERATION see 352D str-&-no string argument, string arrays see arguments, arrays, strings string comparisons see 353B no-l-eql, strings STRING CONCATENATION OPERATION see 359C strs-add string entry see 2089 INPUT string expression see expressions string flag see strings string function (DEF FN) One whose result is a string; as opposed to a numeric function. Its arguments aren't necessarily strings, eg DEF FN c$(X,Y) = CHR$ X + CHR$ Y is a string function with numeric arguments. 27E9 SF FLAG 6 bit 6 of FLAGS cleared for 27F7 SF RUN zero flag for string length, string parameters see strings string quotes see " (22) after end of alphabet string result see expressions STRINGS 3559 (353B no-l-eql etc) Jumps from: 354E NU OR STR strings see also expressions, string functions, variables The original of a string will be in the editing area fora direct command PRINT "hello" in the program area if the command is a BASIC line 10 PRINT "hello" or in the variables area if it is made the value of a string variable LET h$="hello" In the last case the effect of 2BAF L ADD$, 2BC0 L NEW$ and following is - to create a new string variable h$ in the variables area, deleting any string variable of the same name which may already be there - to copy the characters of the string, and 2 bytes giving its length, to the variables area as the value of the variable. Sometimes the string is copied to the work space in executing a command; this is done when it contains embedded quotes and in executing a concatenation function, but not otherwise. Strings in the editing area or work space aren't preserved for long: for example, only until a PRINT command has been executed by 203C PR STRING, which takes the string parameters off the stack and thus finds the copy of the string. When the command has been executed, execution returns to the statement loop, and any copy in the editing area or the work space is deleted in 1B29 STMT 1. In scanning BASIC lines or commands the quote sign 22h "signals that what follows is to be evaluated as a string. Whenever 24FB SCANNING encounters this code, what follows the quotation marks up to the closing quotation marks is treated as a string (25B3 S QUOTE), and its_string_parameters are put on the calculator stack (25DB S STRING, calling 2A82 STK STO $): a 5-byte code giving the location, length and type of the string. Also bit 6 of FLAGS is zeroed to show that the last value on thecalculator stack is a pair of string parameters, not a FP number(25DB S STRING). In the case of variables, whenever an expression containing the string variable is evaluated (26C9 S LETTER) the variable is found in the variables area by a call to 28B2 LOOK VARS, and its string parameters stacked by a call to 2996 STK VAR. The copy stored in the variables area doesn't have quotation marks at start or end, and any embedded quotes are single, not double. No string parameters are made or stored for any of thesestrings until the expression is scanned for execution of a BASICcommand. String parameters are never stored in the variables area, and the only time they are put into the BASIC line is in the special case of a DEF FN statement:_each of the arguments onthe left side of the statement, whether string or numeric, has a6-byte "invisible space" after it with a 0Eh number marker in the first byte. These are filled with the current "value" of theargument whenever the function is used, and in the case of string variables the "value" is the pair of string parameters. String variables may be either simple strings or the elements of string arrays. Simple string variables don't have a fixed length; if the command LET h$="hello" is followed by LET h$="hooray" the length of the variable h$ is automatically increased from 5to 6. String array elements do have a fixed length, set by the last dimension of the DIM command by which the array was defined, and unalterable except by another DIM command which will delete all the former string elements. Either simple string variables or string array elements may be_sliced; expressions such as a$(X TO Y) a$(V,W,X TO Y) a$(V,W, TO Y) are all sliced strings. Either X or Y may be omitted, but TO may not. Another form of slice is the_single-character_slice: a$(X) when a$() has only one dimension, a$(X,Y) when it has only two, etc In a$(X TO Y) or a$(X), a$ may be a simple string instead of a one-dimensioned array. Slicing may also be specified by expressions such as a$(X,Y)(P TO Q) or a$(X,Y)(P TO Q)(R TO S) or even "hello"(P TO Q) In both the first two a$() must have_three dimensions. The handbooks don't mention these variants. The effect of slicing is that when the expression is read by the 24FB SCANNING loop, the string parameters of the whole string are first stacked, then replaced by the parameters of the slice selected (2A52 SLICING). Slices may be copied_from as in PRINT a$(X TO Y) LET b$=a$(X TO Y) or copied_to as in LET b$(X TO Y)=a$ In the latter case there is no need to reform the string variable or array, the new letters are just copied into the old variable. Some functions require strings as arguments, and some have strings as their result: the operation codes carry flags tosignal this (26DF S NEGATE): - bit 7 of the code is cleared if the_result is a string - bit 6 of the code is cleared if the_argument is a string.