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

  1.        - its line number is in decimal digits, and it should be in the hi-lo form in which it is kept in the program area; the  line number is in BC anyway                                            - it needs its length bytes to be inserted after the linenumber):                                                                - put the current line number in 5C4A E PPC                     - get a pointer to the start of the line from 5C5D CH   ADD; it was put there, after the line number, by the call to    19FB E LINE NO in MAIN 3                                                - put the address 1555 REPORT G "No room for line" on   the stack; the stack is empty, so this is temporarily the error address. Unlike all the other REPORT routines it makes no call  to 0008 ERROR 1 and just jumps to MAIN G; the only possible     error is in the call to MAKE ROOM in MAIN ADD1                          - subtract the line start address from the end of the   editing area stored in 5C61 WORKSP, less one; this is the line  length, excluding its line number and length bytes but includingthe newline at the end                                                  - call 196E LINE ADDR to check if there is a line in theprogram with the same number                                            - if not jump on to MAIN ADD1                                   - call 1988 NEXT ONE and 19E8 RECLAIM 2; this deletes   the old line from the program.                                         _157D_MAIN_ADD1: if the line length is one, just the     newline, jump on to MAIN ADD2; deleting the old line is all thatis required. [A BASIC line consisting of a space only, or colourcontrols only, is copied to the BASIC program: such lines can beused to punctuate or colour code BASIC programs]                        - increase the length by four for the line number and   length bytes                                                            - move the BASIC pointer returned by LINE ADDR back to  the byte before the insertion                                           - save the pointer from 5C53 PROG                               - call 1655 MAKE ROOM to make a space in the program at the pointer                                                             - restore PROG from the stack; if the line inserted was the first line, 1664 POINTERS called by MAKE ROOM has moved PROGup                                                                      - get the line length of the line in the editing area,  without its line number                                                 - copy the BASIC to the program area, from the end      backwards; the end is two before the address in 5C61 WORKSP, ie omitting the newline                                                    - get the line number from 5C49 E PPC                           - copy the length bytes in lo-hi order and the line     number in hi-lo order backwards into the remaining four bytes.         _15AB_MAIN_ADD2: drop the REPORT G error address and jumpback to MAIN EXEC.                                                                                                                  BASIC line, BASIC line number, BASIC statement see also 5C49E PPC, 1695 LINE NO, 24FB SCANNING, 5C6C S TOP, 5C3C TV FLAG/4          Lines are input to the lower screen, or brought down    from the program for revision there, by the 0F2C EDITOR         subroutine. The new line or the line being revised is first     copied or input to the editing area, and printed from there to  the lower screen. When ENTER is hit, the line is checked for    syntax by 1B17 LINE SCAN; if it isn't correct, execution returnsimmediately to EDITOR and the line is displayed again with an   error cursor. When it has passed syntax, if it has a line numberit is transferred into the program area by 155D MAIN ADD; see   BASIC execution above.                                                  The format of the_BASIC_line_in_the_program_area is:           1st two bytes:_line_number, as a two-byte integer but    reversed; hi byte followed by low byte, converted to this form  by 157D MAIN ADD1                                                      3rd and 4th bytes:_length, including the final newline   but excluding the line number and length bytes                         followed by the bytes of the line: any number in decimal,binary or E-format is followed by the number marker 0Eh/14d and then by five bytes giving the FP format of the number                  concluded by 0Dh/13d newline.                                    Variable letters in the BASIC line in the program area  may be upper or lower case, and don't have the type flags in    their first three bits, and numeric variables or expressions    other than simple numbers aren't followed by the FP form.               The format of the line in the editing area differs as   follows:                                                               the line number is an ordinary BASIC decimal                    the length bytes are omitted                                    the number markers and FP forms are omitted.                    _Statement_numbers aren't recorded anywhere, but counted up as required in a_statement_counter by counting colon         characters from the end of the line.                                    System variables holding line numbers: E PPC, NEWPPC,   NXTLIN, OLDPPC, PPC, S TOP;                                            holding statement numbers: NSPPC, OSPCC, SUBPPC;                holding pointers to the BASIC program: CH ADD, DATADD,   DEFADD, KCUR, PROG, X PTR.                                             _Terminators, marking the end of statements or lines, are       the newline 0Dh marking the end of the line                     the colon marking the end of a statement                        THEN is also taken as a statement terminator for most    purposes, but not in counting statement numbers.                        Another form of BASIC line is the "expression", string  or numeric, typed in by the user in response to an INPUT        command:                                                               it cannot have a line number or contain BASIC commands          it is input not to the editing area but to the work      space, where it is evaluated by SCANNING and its value given to a variable; but as before, it is copied as it is input from the work space to the lower screen.                                         The EDITOR subroutine is used to produce the input just as in typing in BASIC commands.                                         Introduction considered by BASIC INTERPRETER                    0020 NEXT CHAR steps along as line interpreted                  007D SKIP OVER return if end reached                            0692 SA DATA 1 checks end of SAVE etc array statement           06C3 SA CODE check for end of statement                         0723 SA LINE 1 finds LINE line number                           0873 LD PROG check start line saved with program                08B6 ME CONTRL part ii merges lines into old program            08D2 ME NEW LP checks number of new line                        08D7 ME OLD LP compares number of old line                      08DF ME OLD L1 finds place for new line                         08EB ME NEW L2 enter new line                                   092C ME ENTER NC flag signals BASIC line                        093E ME ENT 1 makes room for new line                           0958 ME ENT 3 copies into program and clears work space         0A3D PO RIGHT same as "PRINT OVER 1; CHR$32" statement          0F2C EDITOR enters line in main execution                       0F81 ADD CHAR adds byte to line                                 0FA9 ED EDIT edit key puts in editing area                      0FF3 ED DOWN next line number found                             1031 ED EDGE checks for start of line                           103E ED EDGE 1 addresses consecutive characters in              1059 ED UP line numbers checked                                 10A8 KEY INPUT edit or INPUT line copied to screen              111D ED COPY prints line in lower screen                        1150 ED BLANK blanks out old line in lower screen               117C ED C DONE exit after line copied                           11A7 REMOVE FP removes FP numbers from line                     12AC MAIN 2 calls EDITOR to write line                          12CF MAIN 3 sorts program lines from direct commands            1303 MAIN 4 reports after command line executed                 133C MAIN 5 line/statement number included in report            1376 MAIN 7 store CONTINUE line/statement number                155D MAIN ADD adds line to program                              157D MAIN ADD1 copies line from work space into program         168F LINE ZERO holds zeroes for line number                     1691 LINE NO A use zero if no suitable line number              1795 AUTO LIST evaluates line number etc for each line          17CE AUTO L 1 find first line to show on screen                 17E4 AUTO L 3 collect first line to show on screen              17ED AUTO L 4 skipped if scroll needed for current line         181F LIST 4 handles line number in LIST xxxx                    1822 LIST 5 finds line start for listing                        1835 LIST ALL loop to list BASIC lines                          1855 OUT LINE prints out line                                   1865 OUT LINE1 prints line number                               1894 OUT LINE4 loop to print each command of line               18B4 OUT LINE6 line print finished                              190F LN FETCH finds number of line                              191C LN STORE puts line number in system variable               1925 OUT SP 2 prints whole line                                 192B OUT SP 1 prints digit of line number                       196E LINE ADDR finds address of line start from number          1974 LINE AD 1 checks number found with number given            1980 CP LINES compares line numbers                             198B EACH STMT finds D'th statement                             1990 EACH S 1 looks at each statement                           1998 EACH S 2 finds end of statement                            19AD EACH S 5 loop at end of statement                          19B1 EACH S 6 checks for end of line                            19B8 NEXT ONE find start of next BASIC line                     19D5 NEXT O 3 skip line number in reading BASIC                 19D6 NEXT O 4 get length of BASIC line                          19DB NEXT O 5 first byte of next line found                     19FB E LINE NO reads line number in editing area                1B17 LINE SCAN checks each statement for syntax                 1B28 STMT LOOP loop to handle statements                        1B29 STMT L 1 identifies and executes each statement            1B76 STMT RET end of statement execution                        1B7D STMT R 1 check for new line execution                      1B8A LINE RUN entry point for execution of line                 1B9E LINE NEW jump to other than next line                      1BB3 LINE END goes to next line unless program finished         1BBF LINE USE prepares to execute next line                     1BD1 NEXT LINE reads line for interpretation                    1BEE CHECK END checks for end of statement                      1BF4 STMT NEXT finds next statement or next line                1C11 CLASS 05 save address of line start                        1C96 PERMS changes colours as directed by current stmt          1CDE FETCH NUM checks for end of line                           1CF0 IF skips line if false                                     1D00 IF 1 executes next statement if true                       1D03 FOR loop values for statement already on stack             1D34 F L&S gets line and statement number                       1D64 F LOOP checks each line in program                         1D7C F FOUND line holding NEXT found                            1D86 LOOK PROG checks for more statements in line               1D8B LOOK P 1 checks each line in program                       1DA3 LOOK P 2 checks each statement in line                     1DAB NEXT looping line and statement number found               1DEC READ 3 move along READ statements                          1DED READ check if another DATA statement required              1E0A READ 1 get pointer to READ statement                       1E27 DATA handling DATA statements                              1E2C DATA 1 check end of statement                              1E37 DATA 2 passed by in run time                               1E39 PASS BY skips DEF FN or DATA statements                    1E42 RESTORE operand read as line number                        1E45 REST RUN put DATADD before line start                      1E5F CONTINUE jumps to line/stmt in OLDPPC/OSPCC                1E67 GO TO finds next line (statement 0) to execute             1E73 GO TO 2 finds next line number to be executed              1EED GO SUB increments statement number                         1F23 RETURN line and statement number from GO SUB stack         1F60 DEF FN passed by in run time                               219B IN VAR 6 find length of line                               21AF IN NEXT 1 considers INPUT statement                        21E1 CO TEMP 1 look at next byte in statement                   268D S BIN copies FP number into line                           27BD S FN SBRN finds user-defined function in BASIC line        28FD V RUN look for vble in execution of line                   294B V END after vble search, CH ADD addresses next                        code in BASIC line                                   2996 STK VAR called from DIM just to check line syntax          29AE SV ARRAYS checks line for subscript                        29C3 SV COMMA finds subscript error if line executed            29D8 SV CLOSE line may still call for slicing                   2AFF LET for new variable, DEST points to line                  2C9B DEC TO FP numbers in line converted to FP form             2D3B INT TO FP integers in line converted to FP form                                                                        BASIC program see program                                                                                                       BASIC statement see BASIC line                                                                                                  BC SPACES subroutine 0030                                           Makes spaces in the work space. The 1655 MAKE ROOM      subroutine will make spaces anywhere in the RAM, moving up the  calculator stack etc and resetting the pointers. But space is sooften required specifically in the work space that this restart routine is worth having.                                                An empty workspace as set by 16B0 SET MIN has zero      length: 5C61 WORKSP and 5C63 STKBOT hold the same address,      preceded in memory by a newline and 80-byte marking the end of  the editing area.                                                       MAKE ROOM operates by LDDR, and the new "space" isn't   blanked; so the "space" made by this subroutine is actually a   copy of the following bytes. Because of the DEC HL near the     start of 169E RESERVE this space is always inserted_before the  last byte in the workspace. If five spaces are made in an empty workspace, the result will be (the new bytes are underlined)                     ... NL_80_a_b_c_d 80 A B C D E                  where "a" is at the address in 5C61 WORKSP, and A B C D E are  the first five bytes of the calculator stack; the NL and first  80-byte are the end of the editing area, a b c d are copies of AB C D.                                                                  Further calls to BC SPACES will again copy the last byteof the work space; it will always be an 80-byte unless it is    overwritten at some stage, or until 16B0 SET MIN is called to   delete the work space altogether.                                      Input parameters: BC holds the number of bytes space     required; it mustn't be zero!                                          Action: stack the number required and the address from   5C61 WORKSP and jump on to RESERVE.                                    _169E_RESERVE (it cannot be called direct, as implied by the header, because it POPs bytes before its RET): get the top  of the work space from 5C63 STKBOT                                      - move back one byte; to the 80-byte in the editing     area, or the last byte of the work space                                - call 1655 MAKE ROOM to make BC spaces below this      pointer                                                                 - restore 5C61 WORKSP; if the workspace was empty its   start address will have been moved up by MAKE ROOM                      - (HL was left by the LDDR in MAKE ROOM pointing to the byte before the new spaces, NL in the example) increment HL     twice and transfer it to DE; now DE points to the first byte of the new space, "a" in the example                                       - similarly point HL at the start of the calculator     stack.                                                                 Exit: RET from RESERVE.                                         Output parameters: BC unchanged: HL and DE as described  above.                                                                 Called from:                                                     0621 SA SPACE                                                   08B6 ME CONTRL                                                  211C IN PR 2                                                    255D S SC ROWS                                                  25BE S Q AGAIN                                                  2634 S INKEY$                                                   2B72 L DELETE$                                                  359C strs-add                                                   35C9 chrs                                                       35DE val                                                        361F str$                                                       3645 read-in                                                                                                                BE AGAIN 03F2 (03B5 BEEPER)                                        Jumps from:                                                      03D6 BE H&L LP                                                                                                              BE END 03F6 (03B5 BEEPER)                                          Jumps from:                                                      03D6 BE H&L LP                                                                                                              BEEP key (D7) see also commands, functions and operators,   KEYBOARD SCANNING, 0246 extended mode table (c)                         The Z key in E mode with either shift produces the      command BEEP. The command must be followed by two numeric       expressions, separated by a comma. It is read by 1B29 STMT L 1  referring through the syntax offset table 1A48 to the syntax    parameter table at 1A7A. 1AE3 P BEEP collects the parameters by 1C7A CLASS 08, then causes a jump via 1C10 CLASS 00 and 1C16    JUMP C R to the executive routine 03F8 BEEP.                                                                                        BEEP subroutine 03F8 see also timing                                Calculates a beep of given pitch and duration.The actualbeep is executed by 03B5 BEEPER, into which this routine exits.         Only used to execute the BEEP command; can be called    from m/c, but it is simpler to call 03B5 BEEPER direct.