S LOOP 1 24FF (24FB SCANNING) Jumps from: 25AF S U PLUS 270D S PUSH PO 2790 S NEXT SL OVER 2AA8 (2A52 SLICING) Jumps from: 2A94 SL DEFINE SL RPT C 2A7A (2A52 SLICING) Jumps from: 2A12 SV RPT C 2A81 SL SECOND SL SECOND 2A81 (2A52 SLICING) Jumps from: 2A52 SLICING (twice) SL STORE 2AAD (2A52 SLICING) Jumps from: 2A52 SLICING SMALL 37F8 (37E2 atn) Jumps from: 37E2 atn small integer format of FP numbers see CALCULATE S NEGATE 26DF (24FB SCANNING) see also BASIC INTERPRETER Jumps from: 2684 S ALPHNUM S NEXT 2790 (24FB SCANNING) Jumps from: 2773 S TIGHTER 2788 S NOT AND S NOT AND 2788 (24FB SCANNING) Jumps from: 2773 S TIGHTER S NO TO $ 2707 (24FB SCANNING) Jumps from: 26DF S NEGAT S NUMERIC 26C3 (24FB SCANNING) Jumps from: 2630 S PI END 2672 S ATTR 267B S POINT 268D S BIN S OPERTR 2723 (24FB SCANNING) Jumps from: 2713 S CONT 3 sound generation loop see 03B5 BEEPER. source variable see variables space, space character, SPACE key (20h) see also space in RAM below Without shift, or with symbol shift, read as space whether in C, E, G, K or L mode. With caps shift, read as BREAK in contexts where a BREAK is looked for, otherwise as space. For many purposes, space behaves as a letter code. But not in 007D SKIP OVER; hence not in 0018 GET CHAR and 0020 NEXT CHAR, so spaces are ignored in reading variable names and generally in executing BASIC lines, except within quotes. 0205 main key table (a) 0333 K DECODE jumps for space as if digit 0367 K DIGIT return with space 0629 SA BLANK "save" filename filled out with spaces 0A3D PO RIGHT "cursor right" implemented by printing a space with OVER 1 0AC3 PO FILL calculate no of spaces to execute TAB 0AD0 PO SPACE print calculated no to execute TAB 0B6A PO CHAR 2 space printed as leading space 0C14 PO TABLE print leading space before message 1150 ED BLANK line of BASIC filled out with spaces 115E ED SPACES prints spaces to fill line 133C MAIN 5 report code followed with space, message with comma and space 1925 OUT SP 2 prints leading space if required 192B OUT SP 1 digit with leading space if required 1937 OUT CHAR space after INK to TAB 28AB FN SKPOVR skip over spaces 2913 V SPACES ignored in variable long name 295A SFA LOOP skip over spaces after variable letter 2B0B L EACH CH ignore spaces in variable name 2B0C L NO SP skip over spaces 2B72 L DELETE$ new room in work space filled with blanks 2C2E D NO LOOP space put in last element of string array space (in RAM) In 111D ED COPY, rather confusingly used to mean "work space or editing area, whichever is being used". Otherwise usually refers to the operation of moving up a block of code to leave room for insertion of new code, see 1655 MAKE ROOM. spaces see space above S PI subroutine 2627 Called only by the scanning loop from the table at 2696;the executive routine of the PI function, which has no operand but merely returns the number pi, 3.1415927d/3.243FA68h, or in FP format 82 49 0F DA A2. Pi is a "real number", so all these representations are approximate. Input parameters: none. Action: use the calculator; pi isn't in the list of constants at 32C5, but pi/2 is - get pi/2 on the calculator stack - increment its exponent byte; ie double it. _2630_S_PI_END (also used as exit by 26F8 S RND): move onthe BASIC pointer. Exit: into 26C3 S NUMERIC, which goes back into the scanning loop, with the string/numeric flag appropriately set, at 2712 S CONT 2; the next code may be a binary operator. Output parameters: none - pi is now last value on the calculator stack. Rems: 2625 S RND END skipped over S PI END 2630 (2627 S PI) Jumps from: 2625 S RND END 2627 S PI S POINT subroutine 267B Called only by the scanning loop from the function table2696; the executive routine of the POINT function, which has twooperands; POINT (X,Y) is one if the pixel at X,Y on the screen is ink colour, zero if it is paper colour. Most of the action is in POINT SUB, which is only calledfrom here, and therefore not described separately: the only point of this is to abbreviate S POINT to fit in the 256d-byte range of the table offsets. Input parameters: none. Action: call 2522 S 2 COORD to check that the coordinatesare in place in the BASIC - call POINT SUB. _22CB_POINT_SUB: call 2307 STK TO BC to get the coordinates - call 22AA PIXEL ADD to convert them to a pixel addressin the display area and the bit number of the pixel - make a pixel counter by incrementing the bit number - read the pixel byte from the display area. _22D4_POINT_LP: rotate the byte left - loop back to POINT LP counting down to zero; this leaves the pixel in the lo bit - AND the rotated byte with 00000001b - exit to 2D28 STACK A, which puts one or zero on the calculator stack. - (return to S POINT) move on the BASIC pointer. Exit: into 26C3 S NUMERIC, which goes back into the scanning loop with the string/numeric flag set to numeric, at 2712 S CONT 2; the next code may be a binary operator. Output parameters: none - one for ink pixel or zero for paper pixel on the calculator stack. Rems: 2522 S 2 COORDS called by S POINT S POSN system variable 5C88 see also DISPLAY AREA Bytes: 2 The print position in the upper screen, ie the position at which the last character was printed, updated after every output to the upper screen or cursor move by 0ADC PO STORE. - in the hi byte the line number goes from 18h/24d at the_top to one at the bottom - in the lo byte the column number goes from 20h/32d on the_left of the screen to one on the right; however S POSN lo never holds the value one. If printing reaches the end of a lineor skips to the start of a new line, the hi byte is decremented,usually with a test for scrolling, and the lo byte set to 21h/ 33d, which is notionally the last position printed. When the screen is cleared, S POSN is set to lo 21h/33d,hi 18h/24d, by 0DAF CL ALL followed by PO STORE. Written by: 0ADC PO STORE 20AD INPUT 2 0D1C PO SCR 4A (hi byte) Read by: 0B03 PO FETCH 0D1C PO SCR 4A (hi byte) 0D2D PO SCR 4B 12CF MAIN 3 (hi byte) 1835 LIST ALL (hi byte) 2096 INPUT 1 S POSNL system variable 5C8A Bytes: 2 Similar to S POSN, but gives the current print position in the_lower part of the screen; and the line number is counted from the top of the lower part of the screen. This is line 18h/ 24d of the lower screen, and always left blank: so initially, and each time the lower screen is cleared, the hi byte is set to17h/23d and the lo byte to 21h/33d by 0DA0 CL CHAN A followed by0ADC PO STORE. Written by: 0AF0 PO ST E Read by: 0B03 PO FETCH 111D ED COPY (twice) 1150 ED BLANK (once each byte) 1167 ED FULL 117E ED C END S PUSH PO 270D (24FB SCANNING) Jumps from: 2634 S INKEY$ 26DF S NEGATE (three times) 2707 S NO TO $ S Q AGAIN 25BE (25B3 S QUOTE) Jumps from: auto SQUARE ROOT FUNCTION see 384A sqr S Q COPY 25CB (25B3 S QUOTE) Jumps from: auto (twice) S Q PRMS 25D9 (25B3 S QUOTE) Jumps from: 2583 S QUOTE 25BE S Q AGAIN SQR key (BB) see also commands, functions and operators, KEYBOARD SCANNING, 022C extended mode table (b) The H key in E mode without shift produces the function SQR; it requires one numeric operand X, and the value of the function is the square root of X. On execution, 24FB SCANNING quickly leads to 26DF S NEGATE. This converts the key code BB first to 0C, then to E8, and adds the priority 10h/16d. Code and priority 10E8 are now pushed on to the machine stack (270D S PUSH PO) while the expression following SQR is evaluated. When the code is taken off the stack (2734 S LOOP), it is converted (2773 S TIGHTER) from E8 to 28, the calculator offset for 384A sqr. sqr subroutine 384A Called only from 0028 FP CALC by offset 28; the executive routine of the SQR function, but also called a couple of times in performing other calculations - both times through the calculator, but it could be called direct. Given any positive number X, returns the square root of X. Most square roots aren't rational numbers, ie not a ratio of two integers a/b, so only an approximation can be foundin decimals, hex, binary etc: for example the square root of twois 1.414..., but as Pythagoras discovered this isn't a rational number; he kept this terrifying fact secret. See under real numbers. Zero X returns a square root zero, negative X gives an error: though the square roots of minus numbers are extensively used in some types of physics, they aren't real numbers and can't be expressed in decimals, hex, etc in the ordinary way. Input parameters: X must be last value on the calculator stack, even for direct calls. Action: use the calculator with literals for duplicate/ not/jump-true, equivalent to "jump on zero", to LAST - (non-zero X) put 0.5d on the stack. Exit: to 386C LAST if X is zero; this is merely end-calc and RET, but zero X on the stack is already the result - otherwise into 3851 to-power, which finds the 0.5'th power of X, ie its sauare root, or reports error if X is negative. Output parameters: none - the calculator stack holds, from the top, 0.5d, X. Called from: 247D CD PRMS1 3833 asn Rems: 3449 series-06 indirectly produced by Chebyshev polynomials (through offset 25 ln) S QUOTE subroutine 25B3 Called by SCANNING through the scanning function table 2696; the executive routine for handling string quotes. See also22h " after the end of the alphabet. Quotation marks signal the beginning of a string, of length up to the next quotes; but repeated double quotes may be included as part of the string, to count as a single " character. This subroutine collects the start address and lengthof the string and puts them on the calculator stack as string parameters. If the string includes quotes, a copy is made to thework space with the doubled quotes reduced to single, and the string parameters point to this copy. Input parameters: none. Action: get the BASIC pointer and increment it; now on the start of the string - make a zero byte; "length so far" - call 250F S QUOTE S which steps along the string counting bytes till it comes to another "; it returns with Z if this " is immediately followed by another. On each call it returns one more than the actual length so far - if it returns with NZ jump on to S Q PRMS; "end of string". _25BE_S_Q_AGAIN (S QUOTE S returned with zero): call S QUOTE S again