home *** CD-ROM | disk | FTP | other *** search
/ Outlet 51 / outlet-51.mgt / d1 < prev    next >
Text File  |  2021-04-18  |  20KB  |  1 lines

  1.        Output parameters: A holds E4 on exit into PASS BY.             Rems:                                                            1E2C DATA 1 checking for syntax                                 1E37 DATA 2 passed by in run-time                                                                                           data block (save/load) see program/data block                                                                                   DATADD system variable 5C57                                        Bytes: 2                                                         Holds the address after the last DATA item read from theBASIC program; used in executing READ commands to find the next DATA item. One of the "fourteen pointers" which must be adjustedeach time space is made or reclaimed in the RAM, see 1664       POINTERS.                                                              Written by:                                                      1219 RAM SET                                                    166B PTR NEXT                                                   1E0A READ 1                                                     1E45 REST RUN                                                  Read by:                                                         1DED READ                                                                                                                   DATA list see DATA key                                                                                                          DATA 1 1E2C (1E27 DATA)                                            Jumps from:                                                      auto                                                                                                                        DATA 2 1E37 (1E27 DATA)                                            Jumps from:                                                      1E27 DATA                                                                                                                   DECIMAL 2CCB (2C9B DEC TO FP)                                      Jumps from:                                                      2CB8 NOT BIN                                                                                                                decimal, decimal point see "." (code 2E) after end of       alphabet                                                                                                                            decimal adjust instruction (DAA) see 2EBA FP BYTES under    2DE3 PRINT FP                                                                                                                       decimal numbers see also BIN key, E-format numbers, number  marker                                                                  Decimal numbers aren't some special kind of numbers likerational numbers, just a way of writing down any kind of real   numbers; the same numbers can also be written in other ways, eg in binary. Ten still has factors two and five, however they are written down.                                                           The BASIC can handle numbers written in decimal form, in_E_format or in_binary_format, but not in hex format. Any numberexcept a line number mentioned in the BASIC program, in whateverformat it is entered, is followed in the representation of the  line in the program area by six bytes which are never printed   out: the first is 0E, the_number_marker, the other five are the number in full FP format.                                               26C3 S NUMERIC numeric result on SCANNING                       2C9B DEC TO FP converted to FP form                             2CB8 NOT BIN considered as integer + fraction                   2CCB DECIMAL check for digit after decimal point                2CCF DEC RPT C zero stacked for 0.xyz                           2CD5 DEC STO 1 saves 1 as FP number                             2CDA NXT DGT 1 loop adding digit*memory/10 to number                                                                        DECIMAL TO FLOATING POINT SUBROUTINE see 2C9B DEC TO FP                                                                         dec-jr-nz subroutine 367A                                           Called from 0028 FP CALC with offset 35 followed by a   "distance literal" XX. Operates like DJNZ, counting down to zeroand making a looping jump forward or back by XX bytes, forward  if less than 80h, backward if >= 80h; an auto jump to the       distance literal itself would be FF. The jump must land on a    calculator literal, though it can pass over 38 end-calc and/or  new calls to 0028 FP CALC.                                              The system variable 5C67 BREG is used to store the      counter, which is loaded from the B register whenever 0028 FP   CALC is called. The calculator can be used without loading BREG,ie leaving it undisturbed, by calling 3362 GEN ENT 2.                   Only used once in the ROM, in the series generator; but useful for m/c programmers who use the calculator. No obvious   point in calling it direct.                                             Most assembler programs can calculate the distance      literal for you: write something like                                         LOOP    ...                                                             35; dec-jr-nz                                           LPRET   LOOP - LPRET - 1; distance literal               Input parameters: HL' is a "return pointer" to the       address of the byte following 35 dec-jr-nz                              - 5C67 BREG already holds the counter.                         Action: change to the alternate registers and stack the  return pointer                                                          - decrement 5C67 BREG and recover the return pointer            - if BREG didn't reach zero, exit to 3687 JUMP 2 with   the alternate registers; this executes the jump                         - (BREG is zero) increment the return pointer; it skips the distance literal and now addresses the byte following dec-  jr-nz XX                                                                - restore the original registers.                              Exit and output parameters: if BREG reduced to zero, HL' now points to the next literal after the distance literal; RET  to the calculator loop at 3365 RE ENTRY                                 - if not, HL' still points to the distance literal; into3687 JUMP 2 with the registers switched to alternates.                 Called from:                                                     3453 G LOOP                                                    Rems:                                                            3686 JUMP used by                                                                                                           declared variable see variables                                                                                                 decoding key input see KEYBOARD SCANNING, 0333 K DECODE                                                                         DECREASE THE COUNTER SUBROUTINE see 367A dec-jr-nz                                                                              DEC RPT C 2CCF (2C9B DEC TO FP)                                    Jumps from:                                                      2CFF ST E PART                                                                                                              DEC STO 1 2CD5 (2C9B DEC TO FP)                                    Jumps from:                                                      2CB8 NOT BIN                                                                                                                DEC TO FP subroutine 2C9B                                           Reads a decimal, binary, or E-format number in the BASICline and puts it on the calculator stack in five-byte FP form,  ready for insertion by 268D S DECIMAL in the five spaces        following the number marker.                                            Reading_binary_integers from the BIN format is fairly   straightforward, though executed by very concise coding. BIN    DIGIT cannot read numbers with fractional parts such as BIN     1.101, nor numbers greater than 1111,1111,1111,1111b/FFFFh; noneof the handbooks mentions these limitations.                            The integer part of_decimal_numbers is also handled     quite simply. Evaluation of the fractional part is a little morecomplex: one is put in the calculator memory for a "decimal     unit", which is then successively reduced to 0.1, 0.01, 0.001,  etc. Each successive unit is multiplied by the next digit in thefractional part to give successive components of the fraction,  which are accumulated in the calculator's last value.                   The fullest form of_E_format can be seen by commanding  PRINT (10**-20)/7: it comes out as 1.4285714E-21. This number isin four parts, each of which must be considered:                       "1" is the integer part of the mantissa                         ".4285714" is the fractional part of the mantissa               "E" signals that the number so far is a mantissa; if     there is no "E" the reading of the number is complete                  "-21" is the decimal exponent; a fractional part isn't   accepted.                                                               The value required is M times 10**X, where X is the     exponent and M is the mantissa: in the example, X = 1.4285714,  ie 10/7, and M = -21.                                                   All numbers are read as positive, though there is       provision for reading negative exponents in E-format numbers; ifthe number is negative it was preceded by a "unary minus", whichhas already been read and stacked as an operator before this    subroutine was called.                                                 Input parameters: the BASIC pointer in 5C5D CH ADD is on the first code of the number as recorded in the BASIC line              - A holds the byte at the pointer.                             Action: if the first code isn't C4 BIN, jump on to NOT   BIN                                                                     - (BIN format) make a zero accumulator to evaluate the  BIN expression.                                                        _2CA2_BIN_DIGIT: read the next digit and subtract 31h;   giving FF with carry if the digit is 30h zero, 00 with no carry if it is 31h one                                                        - ADC A,00 gives zero for both digits; but with carry   for zero                                                                - if it didn't give zero, jump on to BIN END; there are no more binary digits to be evaluated                                   - (it is a digit) put the accumulator in HL                     - reverse the carry flag; now C for one and NC for zero         - ADC HL,HL shifts all the binary digits of the         accumulator left one place and adds the new digit in at the end         - if the result is more than FFFF, report "Number too   big"                                                                    - store the incremented accumulator and loop back to BINDIGIT for more digits.                                                 _2CB3_BIN_END (all binary digits read): exit to 2D2B     STACK BC with the accumulator in BC.                                   _2CBB_NOT_BIN: if the first character is 2E point, jump  on to DECIMAL                                                           - (first character is a digit) call 2D3B INT TO FP,     which converts any digit characters up to the first non-digit toan integer stored in FP format on the calculator stack                  - if the next character isn't 2E point, jump on to E    FORMAT                                                                  - (point) get the next character and call 2D1B NUMERIC          - if it isn't a digit jump on to E FORMAT                       - (it is a digit) jump on to DEC STO 1.                        _20CB_DECIMAL (decimal point has been found as the first character of the number in BASIC): get the next character and   call 2D1B NUMERIC; NC shows a digit                                    _2CCF_DEC_RPT_C: on C, report "Nonsense in BASIC"                - put a zero on the calculator stack for the integer    part.                                                                  _2CD5_DEC_STO_1 (there are digits after a decimal point):put one in the calculator memory for the decimal unit.                 _2CDA_NXT_DGT_1: read the next character                         - call 2D22 STK DGT, which puts the value of a single   digit on the calculator stack                                           - if it wasn't a digit jump on to E FORMAT                      - use the calculator to divide the decimal unit by ten  and return the reduced unit to memory                                   - multiply the new digit by the decimal unit                    - add it to the running total on the stack; the originallast value was the integer part of the number, or zero                  - move on the BASIC pointer                                     - jump back to NXT DGT 1. [The label is in the wrong    place: the code would work slightly faster if the loop was to   the line after NXT DGT 1. But no harm done.]                           _2CEB_E_FORMAT (non-digit and non-point found, before or after a point): if the next character isn't "E" or "e", return; the full evaluation is on the calculator stack.                        _2CF2_SIGN_FLAG ("E" found: the next character must be   either "+", "-" or a digit. "XeM" and "Xe+M" are both accepted):make a sign flag FF for positive                                        - read the next character                                       - if it is 2B "+" jump on to SIGN DONE                          - if it isn't 2D "-" jump on to ST E PART                       - (it is "-") increment the sign flag; 00 for negative.        _2CFE_SIGN_DONE ("+" or "-" read): move on the BASIC     pointer.                                                               _2CFF_ST_E_PART (the pointer is past E): call 2D1B       NUMERIC and if the character isn't a digit, report "Nonsense in BASIC"                                                                  - call 2D3B INT TO FP to read the exponent on to the    calculator stack                                                        - call 2DD5 FP TO A to get it off again                         - if FP TO A returned with carry report "Number too     big"; more than 255d                                                    - also if AND A shows it more than 127d; actually the   exponent mustn't be more than 38d. The exit routine checks this,but A > 127d would be read as negative                                  - check the sign flag; if it shows positive jump on to EFP JUMP                                                                 - (negative sign flag) negate the exponent.                    _2D18_E_FP_JUMP: exit.                                          Exit and output parameters:                                      - from BIN END, with the number in BC into 2D2B STACK   BC, which puts it on the calculator stack.                              - from E FORMAT, RET; the number is already on the      stack.                                                                  - from E FP JUMP, into 2D4F E TO FP with the mantissa onthe stack and the exponent in the A register; it calculates M   times 10**X.                                                           Called from:                                                     268D S DECIMAL                                                                                                              DE,(DE+1) subroutine 2AEE                                           A kind of two-byte version of LD A,(DE): given any      address, loads DE with the value of the two_following bytes. If the address is the sign byte (second byte) of a number in "smallinteger" form, the number is returned in DE.                           Input parameters: address in DE.                                Action: load E with the value in address DE+1, and D withthe value in address DE+2.                                             Exit: RET.                                                      Output parameters: DE holds the result                           - HL holds the pointer moved on twice.                         Called from:                                                     29FB SV MULT                                                    2A2C SV ELEM$                                                                                                               DEFADD system variable 5C0B                                        Bytes: 2                                                         Holds the address of the arguments of a DEF FN if one isbeing evaluated; otherwise zero. If nested DEF FNs are          evaluated, a series of DEFADD values is stacked on the machine  stack with a zero at the bottom.                                        Only the hi byte needs to be checked for zero, because  the address, if any, is in the RAM and hence more than 4000.    Zero signals "we aren't at present evaluating a DEF FN".               Written by:                                                      1313 MAIN G                                                     288D SF VALUE (twice)                                          Read by:                                                         288D SF VALUE                                                   2951 STK F ARG                                                 Checked for zero:                                                28E3 V TEST FN                                                                                                              DEF FN key (CE) see also commands, functions and operators, KEYBOARD SCANNING, 0284 extended mode table (f)                         The one key in E mode with symbol shift produces the    command DEF FN. The "DEF FN statement" must consist of:                a single-letter variable name, with "$" if the result of the defined function is a string                                       followed by a pair of brackets "()"                             which may or may not contain a list of arguments, single-letter numeric or string "dummy" variable names separated by    commas; the_operands or_parameters                                     followed by "=" and an expression, which must match in   string/numeric status the name of the DEF FN function. This     expression may contain variables matching those before the "="; any such variables are read as "dummy" variables.                       In this index I sometimes refer to the "left side" and  the "right side" of DEF FN statements: I don't think this       terminology is ever used in the notes.                                  The command is read by 1B29 STMT L 1 referring through  the syntax offset table 1A48 to the syntax parameter table 1A7A.1AF9 P DEF FN causes a jump via 1C11 CLASS 05 and 1C16 JUMP C R to the executive routine 1F60 DEF FN.                                   1D86 LOOK PROG finds occurrences of DEF FN                      1F7D DEF FN 2 if followed by (), no parameters                  1F86 DEF FN 3 loops to handle parameters                        1F94 DEF FN 5 comma indicates more parameters                   26C9 S LETTER vbles in FN are first looked for in DEF FN        27BD S FN SBRN search made for DEF FN                           27F7 SF RUN search made for DEF FN                              2808 SF FND DF search made for DEF FN                           2814 SF CP DEF check for match with FN