- put its address in 5C5B K CUR; channel R uses K CUR asits destination pointer - call 1601 CHAN OPEN with stream number minus one; openchannel R to output to the work space - call 2DE3 PRINT FP to convert the last value Y to the BASIC decimal 14-character format and output it to the work space; 0F81 ADD CHAR, the output routine of channel R, makes room for the characters one by one before 5C5B K CUR and copies them in - call 1615 CHAN FLAG with the old channel address; thisis a short cut to restoration of the old channel - take away the start address in the work space from thefinal 5C5B K CUR value; K CUR is just past the end of the expression, so this gives the string length - call 2AB2 STK STO $ with the start and length; it putsthe string parameters on the calculator stack. Exit: RET. Output parameters: HL and DE point to the last value and the stack end respectively - the string parameters of the string version of Y are on the stack. 2DE3 PRINT FP called by str$ 2DF8 PF POSTVE must save alternate HL' for str$ 2E24 PF SMALL mistake in ROM str-&-no subroutine 352D Called only from 0028 FP CALC with literal 10 as the executive routine of the AND function when the first operand is a string, X$ AND Y; the literal 08 no-&-no returned by 2723 S OPERTR for AND is changed to 10 str-&-no when the string operandX$ is detected in 2773 S TIGHTER. Outputs a string equivalent toits first operand X$ unless the second operand Y is zero, when it outputs the null string. Can be called from m/c, given the correct input parameters. Input parameters: HL and DE point to the string parameters of X$ and the FP number Y; for direct calls they could be anywhere in memory, but for calls through the calculator they are always on the stack, with Y as last value. Action: call 34E9 TEST ZERO; it doesn't take Y off the stack - if Y isn't zero return at once; X$ is the correct result - (Y is zero) step back through the last two (length) bytes of the string parameters putting in zeroes; the start parameter is left unchanged, it is ignored in the case of a nullstring. Exit: RET. Output parameters: A may be corrupted, others unchanged - if the subroutine was called through the calculator 3365 RE ENTRY in effect deletes Y from the stack, so X$ is now last value. stylus (printer) "Wait for the stylus" at 0F0C COPY L 2 is just a fancy way of saying "wait for the printer". The ZX printer cannot receive data while it is operating its stylus to make the dots for the line stored in its print buffer, and it sends zeroes to port FB until it is ready for more data. sub-expression see expressions SUBN ONLY 31F2 (31AF division) Jumps from: 31DB DIV 34TH SUBPPC system variable 5C47 see also BASIC line Bytes: 1 The statement number of the statement currently being executed in the BASIC line: - set to zero at the beginning of the syntax checking scan of each line (1B17 LINE SCAN), and incremented at the beginning of each statement scan (1B29 STMT L 1). - given a value in 1BD1 NEXT LINE, which will be zero if a line has just been completed, but may not be when coming from 1B9E LINE NEW after a jump. - copied into a FOR ... NEXT control variable as the looping statement, and also read for copying into 5C44 NSPCC, in1D34 F L&S. - saved as a single byte on the machine stack, with the two bytes of the line number, by a GO SUB command; see 1EED GO SUB for this tricky manoeuvre. This is POPped in 1F23 RETURN, and the statement number put in 5C44 NSPCC in 1E73 GO TO 2. - printed out as part of any report message by 133C MAIN 5; and if the report comes from a STOP or a BREAK, it is incremented so that CONTINUE will start from the next statement.Usually it is the value taken to copy into 5C70 OSPCC when threebytes are put in it and 5C6E OLDPPC at 1384 MAIN 8. Written by: 1373 MAIN 6 1B17 LINE SCAN 1B29 STMT L 1 1BD1 NEXT LINE Read by: 133C MAIN 5 1376 MAIN 7 1D34 F L&S (twice) 1EED GO SUB subscripts see arrays subtract subroutine 300F Called from 0028 FP CALC with literal 03; the executive routine of the "-" operator, but also used in many other calculations, in one case directly without using FP CALC. Subtracts the last value Y, the "subtrahend", on the calculator stack from the second last value X, the "minuend"; see under addend for these tiresome expressions. Can be called from m/c directly or through FP CALC. Input parameters: HL and DE point to X and Y; in all the ROM calls, even the direct one, they are the second last and last values on the calculator stack, but this isn't necessary for direct calls. However the bytes of X and Y must be stored consecutively in memory, with Y following X, since this is how they are read in 3014 addition. Action: just call 346E NEGATE to change the sign of Y; the exit routine will add -Y to X. Exit: into 3014 addition. Output parameters: HL and DE unchanged. Called by literal 03 from: 03F8 BEEP 0427 BE OCTAVE 1DE2 NEXT 1 235A C ARC GE1 23C1 DR PRMS (twice) 2425 ARC LOOP 2439 ARC START (twice) 245F ARC END (twice) 2497 DRAW SAVE 25F8 S RND 2E01 PF LOOP 2E24 PF SMALL 3453 G LOOP (twice) 36A0 n-mod-m 36B7 X NEG (twice) 36C4 EXP (twice) 371C VALID (3 times) 373D GRE.8 (3 times) 3783 get-argt (twice) 37A1 ZPLUS 37AA cos 37B7 C ENT 37FA CASES 3833 asn 3843 acs Called as SUBTRACT by: 354E NU OR STR Rems: 2F9B PREP ADD exponent and mantissa of X and Y prepared subtrahend see addend S U PLUS subroutine 25AF The "unary plus" routine, entered from 24FB SCANNING viathe scanning function table at 2596 when a "+" is encountered asthe first code of a new expression, eg LET X = +17 As "+" only means "not minus", the routine merely moves on the BASIC pointer and reenters the scanning loop at 24FF S LOOP 1 to read the expression. suppress leading space see messages sv in this index = system variable SV ARRAYS 29AE (28B2 LOOK VARS) Jumps from: 2996 STK VAR SV CH ADD 29E0 (28B2 LOOK VARS) Jumps from: 29EA SV LOOP SV CLOSE 29D8 (28B2 LOOK VARS) Jumps from: 29C3 SV COMMA SV COMMA 29C3 (28B2 LOOK VARS) Jumps from: 29FB SV MULT SV COUNT 29E7 (28B2 LOOK VARS) Jumps from: 2996 STK VAR 29C0 SV PTR Rems: 2AC3 SV COMMA entry point to loop evaluating element SV DIM 2A48 (28B2 LOOK VARS) Jumps from: 29D8 SV CLOSE 29EA SV LOOP 2A2C SV ELEM$ SV ELEM$ 2A2C (28B2 LOOK VARS) Jumps from: 2A12 SV RPT C SV LOOP 29EA (28B2 LOOK VARS) Jumps from: 29C3 SV COMMA SV MULT 29FB (28B2 LOOK VARS) Jumps from: 29EA SV LOOP SV NUMBER 2A22 (28B2 LOOK VARS) Jumps from: 2A12 SV RPT C SV PTR 29C0 (28B2 LOOK VARS) Jumps from: 29AE SV ARRAYS SV RPT C 2A12 (28B2 LOOK VARS) Jumps from: 29C3 SV COMMA 29D8 SV CLOSE SV SIMPLE$ 29A1 (28B2 LOOK VARS) Jumps from: 29AE SV ARRAYS SV SLICE 2A45 (28B2 LOOK VARS) Jumps from: 29E0 SV CH ADD 2A49 SV SLICE? SV SLICE? 2A49 (28B2 LOOK VARS) Exit from: 29A1 SV SIMPLE$ 2A48 SV DIM SWAP BYTE 343E (343C exchange) Exit from: 343C exchange Jumps from: auto symbol code see shift keys The editing keys table at 0FA0 ends with two slightly mysterious items, one which jumps to 1076 ED SYMBOL if the tableis entered with a code 0E, and another which jumps to 107C ED GRAPH for a code 0F. In fact no key or combination of keys can produce these codes at this point; although 0E can be returned as a final code by 0333 K DECODE, the channel K input routine 10A8 K INPUT merely uses this to set E mode, and returns withoutcarry signalling "no new key value received". So in the unexpanded Spectrum the routines are never entered at all; but they might be input from other channel inputs such as a DATA stream from Microdrive. The effect of code0E is (1076 ED SYMBOL) to insert a number marker 0E in the editing line, but only if the INPUT ... LINE flag is set; and ofcode 0F to insert the GRAPHICS code 0F unconditionally. SYMBOL SHIFT key see KEYBOARD SCANNING, shift keys sync pulse see timing syntax check, syntax errors see errors syntax/run flag see 5C3B FLAGS bit 7 SYNTAX Z subroutine 2530 Checks the syntax checking/run time flag. BASIC lines are scanned by 1B8A LINE RUN for execution and by 1B17 LINE SCAN for syntax checking; these two scanning loops have most of their routines in common. Expressions are scanned by 24FB SCANNING in both cases. The action required is often different for checking and for execution; FLAGS bit 7 signals the present mode. The Z80 instruction BIT 7,(FLAGS), or strictly speaking,BIT 7,(IY+1) is only four bytes FD CB 01 7E, the 01 being the index; but CALL 2530h is only three bytes. As the flag is referred to thirty-two times in ROM, it was worth making this tiny subroutine out of it. Output parameters: Z for syntax checking, NZ for execution. Called from: 0605 SAVE ETC 0672 SA V OLD 17FB LIST 1 1BB3 LINE END 1BEE CHECK END 1C30 VAR A 2 1CBE CLASS 09 1CE6 USE ZERO 1CF0 IF 1DED READ 1E27 DATA 1F60 DEF FN 1FC3 UNSTACK Z 1FCF PRINT 1 204E PR POSN 1 2089 INPUT 20FA IN PROMPT 21D0 IN STOP 25BE S Q AGAIN 25F8 S RND 2627 S PI 268D S BIN 274C S STK LIST 27BD S FN SBRN 28E3 V TEST FN 28EF V RUN/SYN 2A52 SLICING 2AAD SL STORE 2ACD INT EXP2 2AF4 GET HL*DE 2C05 D RPORT C Exit from: 2522 S 2 COORD