An alternative to using the reset button is the BASIC command PRINT [or RANDOMIZE] USR 0. The effect is similar to NEW, but in fact more complete, in that 5CB2 RAMTOP, the user- defined graphics, the click and the rasp are all reset to their standard values. Input parameters: none. Action: disable the interrupt; the keyboard scanning interrupt routine would be chaotic until IY gets its value in 1219 RAM SET - make a START/NEW flag of zero; when 11EF RAM DONE is reached, 5CB4 P RAMT, 5C38 RASP, 5C39 PIP and later 5C7B UDG will be given their standard values, and 168d bytes from the character set, A -> U, will be copied into the top end of RAM - signal FFFFh for "maximum possible RAM". Exit: into 11CB START/NEW; see under 11B7 NEW. Output parameters: A holds the START/NEW flag - DE holds the RAM limit. Exit from: 0066 RESET Rems: 11B7 NEW at 11CB START/NEW A holds zero from START 11DA RAM CHECK check continues up to FFFF 11EF RAM DONE restoration of svs is meaningless 1219 RAM SET from here on common to START and NEW start address of BASIC line, etc see BASIC line, etc START/NEW 11CB (11B7 NEW) Jumps from: 0000 START Rems: 11B7 NEW entry point from 0000 START start of data block see program/data block, 0605 SAVE ETC start (pointer) of array data, etc see arrays, etc start of program see 5C53 PROG start of slice see 2A52 SLICING start of string see strings 'starts' in memory An expression only used in 19DD DIFFER; it seems to meanthe start addresses of the various sections of RAM such as thosekept in 5C53 PROG, 5C4B VARS, 5C59 E LINE, 5C61 WORKSP. As the subroutine merely returns the difference between HL and DE, whatever numbers they happen to hold, the expression is unnecessary anyway. 'Start tape, then press any key' message see cassette messages statement (BASIC) see BASIC line; for eg "DEF FN statement",see DEF FN key statement counter, statement number see BASIC line STATEMENT LOOP see STMT L 1 in 1B8A LINE RUN status, numeric/string see expressions STEP key (CD) see also KEYBOARD SCANNING, 026A symbol code table (e) The D key with symbol shift in C, K or L mode produces the "adverb" token STEP, which is neither a command, a function nor an operator; not in the command table at 1A48 and never partof an expression, unless you include it in a string within quotes, which is quite acceptable; so isn't read by 24FB SCANNING either. The only context in which this token can be used is within a FOR statement, see 1D03 FOR. ST E PART 2CFF (2C9B DEC TO FP) Jumps from: 2CF2 SIGN FLAG steps (line drawing) see 24B7 DRAW LINE S TIGHTER 2773 (24FB SCANNING) Jumps from: 2734 S LOOP STKBOT system variable 5C63 Bytes: 2 Holds the address of the bottom of the calculator stack,which also marks the end of the work space. It is one of the fourteen system pointers which are adjusted by 1664 POINTERS whenver space is made or reclaimed in the RAM. Written by: 1219 RAM SET 166B PTR NEXT 16BF SET WORK Read by: 1195 SET DE 166B PTR NEXT 169E RESERVE 16CF SET STK 219B IN VAR 6 STK CODE 3671 (3669 code) Jumps from: 3669 code STK CONST subroutine 33C8 See 33C6 stk-data below. Called from: 33F8 SKIP NEXT 341B stk-zero stk-data subroutine 33C6 Called from 0028 FP CALC with literal 34; once also called direct. It puts on the calculator stack a number X defined by 2, 3, 4 or 5 bytes which it finds at the address in the alternate HL register: when called from FP CALC these are the bytes following the 34 literal, when it is called direct from one of the calculator routines they are the bytes followingthe literal of the calling routine. Such a call is made from 3453 G LOOP in the series-06 routine. To call it from m/c it is necessary to load HL' with a pointer to the first byte. The bytes of the constant are supplied not in normal FP format but in a special "stk-data format"; see the header notes.The algorithm is: Delete zero bytes from the end of the FP number. Reduce the first byte by 50h, and then add 40h for each byte remaining after the_second. If this produces a multiple of 40h, put this multiple of40h as an additional first byte, and put the first byte of the FP number, less 50h, as the_second byte. This additional byte _doesn't count when adding 40h in the second step. Using the same examples as those used in the index entryCALCULATE for FP numbers: X = 73d = 49h FP(73) = 87 12 00 00 00 Stk-data: (34) 37 12 X = 500d = 1F4h FP(500) = 89 7A 00 00 00 Stk-data: (34) 39 7A X = pi = 3.1415927d FP(pi) = 82 49 0F DA A2 Stk-data: (34) F2 49 0F DA A2 X = e**pi = 23.140693d FP(e**pi) = 85 39 20 23 A8 Stk-data: (34) F5 39 20 23 A8 X = -41764d = -A324 FP(X) = 90 A3 24 00 00 Stk-data: (34) 80 40 A3 24 Input parameters: HL holds the address of the first byte of the last value - DE holds the stack end pointer from 5C65 STKEND - alternate HL' holds the "return address", which in fact holds the next literal; all these are the usual for a unaryoperation. Action: put a result pointer on the stack end; it will bethe address of the first byte of the new last value. _33C8_STK_CONST (the entry point when X is one of the five constants in the table at 32C5; in this case the result pointer already points to the address where the number is to be put): call 33A9 TEST 5 SP to check that there is room to extend the calculator stack - get the "return" address and read the byte there, saving the result pointer - AND the byte with 11000000b/C0h - rotate the two hi bits into the two lo bits; the effect is to divide it by 40h, discarding the remainder - increment the result; now a byte counter for the otherbytes of X - AND the original "return" byte with 00111111b/3Fh; this finds the remainder on dividing the byte by 40h - if the remainder isn't zero jump on to FORM EXP; this remainder is the exponent byte of X, less 50h - (the remainder was zero) read the next byte. _33DE_FORM_EXP: add 50h; making the exponent byte of X - copy the exponent to the result pointer - subtract the counter from 5; this is the number of trailing zero bytes that will be needed - copy bytes from the "return" address into the result using the counter - put the "return" address, now moved on past the bytes of the number, back in HL' - recover the result pointer - set the counter for the trailing zeroes - make a zero byte. _33F1_STK_ZEROS: decrement the zero counter - if it is now zero, return - put a zero byte in the result on the calculator stack - loop back to STK ZEROS. Exit: RET, from STK ZEROS. When called by literal 34 thiswill be to 3365 RE ENTRY, the address put on the stack in 338E ENT TABLE. Output parameters: HL' holds the address following the data bytes; it was incremented each time a byte was read from the "return" address - DE holds the new stack end pointer - HL points to the first byte of the last value. Called by literal 34 from: 03F8 BEEP 0427 BE OCTAVE (twice) 247D CD PRMS1 25F8 S RND (twice) 2DC1 LOG(2**A) 36C4 EXP 371C VALID (twice) 373D GRE.8 (twice) 3783 get-argt Called as STK DATA by: 3453 G LOOP Rems: 341B stk-zero uses STK CONST entry point STK DIGIT subroutine 2D22 Given the character code for a decimal digit, 30h/48d "zero" -> 39h/57d "nine", puts the digit value on the calculatorstack as a small integer. Used in calculating the FP forms of decimal numbers in BASIC. Input parameters: A holds the character code. Action: call 2D1B NUMERIC - if the code isn't a digit, return at once - (a digit) subtract 30h/48d for the value of the digit. Exit: immediate RET if not a digit, with carry set - into 2D28 STACK A to put it on the stack. Output parameters: A holds the result, nothing else changed. Called from: 2CDA NXT DGT 1 2D40 NXT DGT 2 STKEND system variable 5C65 Bytes: 2. Holds the address of the top of the calculator stack. Itis the last of the fourteen system pointers adjusted by 1664 POINTERS each time space is made or reclaimed in RAM: STKEND moves upwards into the "spare space" in RAM, initially a very large space, until it collides with the top of the machine stackexpanding downwards, producing an "Out of memory" error. STKEND is not on, but one beyond, the last byte of the last number on the stack; therefore also the first byte to be filled by any new number put on the stack, or if a number has just been deleted from the stack it points to the first byte of that number, which isn't overwritten until there has been a callto 16C5 SET STK or similar. Written by: 1219 RAM SET 166B PTR NEXT 16C5 SET STK 19FB E LINE NO 268D S DECIMAL 2852 SF ARG VL 2981 SFA MATCH 2AB6 STK STORE 2BF1 STK FETCH 3365 RE ENTRY 33B4 STACK NUM Read by: 1655 MAKE ROOM 166B PTR NEXT 1EB7 CLEAR 1 1F05 TEST ROOM 268D S DECIMAL 2852 SF ARG VL 2981 SFA MATCH 2AB6 STK STORE 2BF1 STK FETCH 338E ENT TABLE (really a read of BREG; should be written LD BC,(BREG-1)) 33B4 STACK NUM 35BF STK PNTRS Rems: 167F PTR DONE left in DE after PTR NEXT; top of block to be moved up or down 2B59 L NUMERIC delete moves STKEND down five bytes 2D2B STACK BC end-calc makes HL point to STKEND-5 2DA2 FP TO BC end-calc makes HL point to STKEND-5 2DAD FP DELETE after end-calc DE points to STKEND 3014 addition exits with DE=STKEND, HL=STKEND-5 30EA MULT RSLT exits with DE=STKEND 323F T SMALL save STKEND on machine stack* 3267 T STORE exit with DE=STKEND* 3272 NIL BYTES save STKEND on machine stack* 3290 IX END exit with DE=STKEND* 335B CALCULATE set DE=STKEND 342D st-mem exit with DE=STKEND* 3483 INT CASE exit with DE=STKEND* 3492 sgn exit with DE=STKEND* *These notes aren't quite correct, because DE isn't necessarily STKEND; the subroutines are always used in the ROM for numbers on the stack, but they could be used otherwise. STK F ARG 2951 (28B2 LOOK VARS) Exit from: 28E3 V TEST FN (28B2 LOOK VARS) STK FETCH subroutine 2BF1 Copies the last value from the calculator stack into theregisters AEDCB, and moves 5C65 STKEND down so that the value isnotionally removed from the stack; but in fact it is still thereand can be read by appropriate m/c. Input parameters: none. Action: set a pointer on 5C65 STKEND - step it back five times, copying the byte into the appropriate register at each step - put the final pointer address in 5C65 STKEND. Exit: RET. Output parameters: A, BC, DE have all been given values as indicated - HL holds the new 5C65 STKEND - if the last value is a pair of string parameters, as often - BC holds the length of the string - DE its start address