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

  1.         The start address of the top line L is found by calling 0E9B CL ADDR; call it M.                                                The main loop of the subroutine first moves the first   row of pixels in all the lines to be scrolled, starting at M,   then the second row starting at M + 100h, etc - eight rows in   all in eight turns of the loop.                                         The line number L is used in a somewhat devious way as acounter, quite similar to its use in OE44 CL LINE. L has at mostfive binary digits 000XYPQRb, where XYb is the number of        complete thirds to be scrolled and PQRb is the number of lines  to be scrolled in the incomplete top third - or zero if all     eight lines of this third are to be scrolled.                          - AND 00000111b/07h with L, giving zero for a "first"    line - but L is kept unchanged                                         - the first part of the loop deals with "first" lines: itmoves 20h/32d bytes back 720h bytes, overwriting those in the   last line of the previous third, and decrements L. Since L was  the "first" line of a third, PQRb was zero; thus PQRb goes to   111b/07 and XYb gets decremented                                       - the second part of the loop ANDs L with 00000111b/7h,  giving the number of "odd" lines remaining to be scrolled in    this third, and multiplies the result by 20h/32d for the number of characters in these lines by rotating 00000PQRb three times  right to PQR00000b; see "one-byte arithmetic" for similar       examples. Then it moves this number of pixel bytes back by 20h/ 32d                                                                    - the third part of the loop moves the pixel address M onby 700h bytes. M ended up as one after the last byte moved,     which was the last of that pixel row in a third. If it was say  the fourth pixel row of the second third, its last byte was at  4BFF, and M was 4C00, so adding 700h makes it 5300 - which is asit should be, the first fourth-row byte of the last third.             - AND L with 11111000b, which will give zero if XYb is   zero, ie if the third just completed was the last; if it wasn't the last, then jump back to the first part of the loop - but    still in the same turn of the loop.                                     If it was the last, all the first-row pixels have been  moved; the original start address M is recovered from the       machine stack and its hi byte incremented to give the start     address of the second row pixels, L is reset to its starting    000XYPQRb value, and the whole loop is gone through again. And  then again for the third row, and so on till eight loops are    complete.                                                               Scrolling the attributes is a much simpler operation,   since the attributes for the whole screen are stored            consecutively and it is just a matter of moving as many as      necessary back 20h bytes.                                               [The attributes for the top line on the screen, if that is scrolled, are actually moved into the display area, so that  they momentarily become visible as pixels in the last pixel row on the display; but they are cleared so quickly this is almost  impossible to spot. White PAPER and black INK, 00111000b,       produces a row of 32d thin dashes.]                                     The entry point 0DFE CL SC ALL is used after the        "scroll?" prompt to scroll the whole screen.                           Input parameters: B holds the line number L of the top   line to be scrolled; this is also the number of lines to be     scrolled.                                                              Action: call 0E9B CL ADDR to get the start address M             - make a loop counter of eight for the eight pixel rows.       _0E05_CL_SCR_1: stack L, M and the loop counter                  - AND L with 00000111b/07; if line L is a "first" line  this gives zero                                                         - restore L                                                     - if the flag shows NZ jump on to CL SCR 3; L is an     "odd" line.                                                            _0E0D_CL_SCR_2 ("first" lines): add F8E0 to M; the same  as subtracting 720h, making an address to which the pixels will be copied                                                               - make a copying counter 20h                                    - decrement the L counter                                       - copy 20h/32d pixel bytes back to the copy addresses.         _0E19_CL_SCR_3 ("odd" lines): add FFE0 to M; the same as subtracting 20h, making an address to which the pixels will be  copied                                                                  - AND the L counter with 00000111b/07 and rotate the    result three times right; making PQR00000b = 20h * PQRb, the    number of remaining bytes in this third                                 - move back this number of pixel bytes                          - increment the resulting address M by 700h                     - AND the L counter with 11111000b/F8h; is XYb now zero?        - if the result isn't zero jump back to CL SCR 2; there are more thirds to be treated in this turn of the loop                  - (bottom third has been scrolled) recover M from the   stack                                                                   - add 100h for the next pixel row                               - recover the counters                                          - decrement the loop counter                                    - if it isn't yet zero jump back to CL SCR 1 for anotherturn of the loop                                                        - (all eight pixel rows have been moved) call 0E88 CL   ATTR; it returns HL with the first address in the attribute areaand BC with the number of attributes to be changed                      - add FFE0 to the attribute address; it sets an address 20h bytes above                                                         - move all the attribute bytes back by 20h bytes                - load a counter with one to clear one bottom line.            Exit: into 0E44 CL LINE, which clears the bottom line -  it was copied into the next one up, but nothing was copied into it except the attribute row.                                           Output parameters: B holds 01, to clear the last line.          Called from:                                                     0D2D PO SCR 4B                                                                                                              CL SCR 1 0E05 (0E00 CL SCROLL)                                     Jumps from:                                                      0E19 CL SCR 3                                                                                                               CL SCR 2 0E0D (0E00 CL SCROLL)                                     Jumps from:                                                      0E19 CL SCR 3                                                                                                               CL SCR 3 0E19 (0E00 CL SCROLL)                                     Jumps from:                                                      0E05 CL SCR 1                                                                                                               CL SET subroutine 0DD9 see also DISPLAY AREA                        Finds the start address in the display area or in the   printer buffer corresponding to a given print position on screenor column number.                                                      Input parameters: BC holds the print position line/columnnumber.                                                                Action: get the start address of the print buffer 5B00           - if bit 1 of FLAGS is set jump on to CL SET 2; the ZX  printer is being used, column numbers are the only ones to be   considered                                                              - if bit zero of TV FLAG is set jump on to CL SET 1; theupper screen is being used                                              - (lower screen) add the value from 5C6B DF SZ to the   print position line number and subtract 18h; line 18h means the top line of the lower display, which holds DF SZ lines, so L -  18h + DF SZ gives the line number counting from the bottom of   the screen.                                                            _0DEE_CL_SET_1: call 0E9B CL ADDR to find the display    address of the line start of the given line number.                    _0DF4_CL_SET_2: subtract the print position column numberfrom 21h; this converts it to a tab value on the line                   - add the result either to the line start address found in CL SET 1, or to the printer buffer start address.                   Exit: into 0ADC PO STORE which loads the print position  svs with the appropriate values.                                       Output parameters: HL holds the required address in the  printer buffer or display area                                          - BC still has the print position.                             Called from:                                                     0D2D PO SCR 4B                                                  117E ED C END                                                   20AD INPUT 2                                                    2161 IN VAR 4                                                  Exit from:                                                       0A3A PO BACK 3                                                  0A4F PO ENTER                                                   0ABF PO AT SET                                                  0C55 PO SCR                                                     0D6B CLS                                                        0DA0 CL CHAN A                                                  0DAF CL ALL                                                     0EE7 PRB BYTES                                                                                                              CL SET 1 0DEE (0DD9 CL SET)                                        Jumps from:                                                      0DD9 CL SET                                                                                                                 CL SET 2 0DF4 (0DD9 CL SET)                                        Jumps from:                                                      0DD9 CL SET                                                                                                                 CLS LOWER subroutine 0D6E                                           Clear and reform the lower screen.                             Input parameters: none.                                         Action: zero bit 5 of TV FLAG; "don't clear lower screen on next keystroke"                                                      - set bit zero; "use lower screen"                              - call 04D4 TEMPS to use the permanent colours; they    will be got from 5C48 BORDCR                                            - get the value from 5C6B DF SZ as counter; the number  of lines in the lower screen                                            - call 0E44 CL LINE with this counter; it blanks all thecharacters in the lower screen, but if DF SZ was more than two  it will put the wrong attributes in lines above the bottom two          - get 5AC0; a pointer to the first attribute byte of thebottom two lines and so the first whose attribute is_not to be  changed                                                                 - get the upper screen attributes from 5C5D ATTR P              - reduce the line count in B by one; CL LINE has left B holding the number of lines cleared                                     - jump on to CLS 3; this is a DJNZ, which immediately   jumps back to CLS 1 decrementing the line count again, so now itis the number of lines less_two.                                       _0D87_CLS_1: make a byte counter 20h/32d for the         attribute bytes of the line.                                           _0D89_CLS_2: move the pointer back                               - put the ATTR P attribute in the byte at the pointer           - decrement the byte counter and jump back to CLS 2 if  it isn't yet zero.                                                     _0D8E_CLS_3: decrement the line counter and jump back to CLS 1 if it isn't yet zero                                              - (all attributes corrected) load two into 5C6B DF SZ;  the size of the lower screen.                                          Exit: into 0D94 CL CHAN, which resets channel K and makesthe print position the first in the lower screen, and then to   0DD9 CL SET to set the print position svs.                             Output parameters: none.                                        Called from:                                                     10A8 KEY INPUT                                                  12CF MAIN 3                                                     1313 MAIN 6                                                     2089 INPUT                                                      20AD INPUT 2                                                   Exit from:                                                       0D6B CLS                                                                                                                    CLS 1 0D87 (0D6E CLS LOWER)                                        Jumps from:                                                      0D8E CLS 3                                                                                                                  CLS 2 0D89 (0D6E CLS LOWER)                                        Jumps from:                                                      auto                                                                                                                        CLS 3 0D8E (0D6E CLS LOWER)                                        Jumps from:                                                      0D6E CLS LOWER                                                                                                              CL 09 1 1CD6 (1CBE CLASS 09)                                       Jumps from:                                                      1CBE CLASS 09                                                                                                               C-mode see 5C41 MODE                                                                                                            CO CHANGE subroutine 226C see also colours, masks                   Used to set bits in the colour system variables 5C8F    ATTR T, 5C90 MASK T and 5C91 P FLAG.                                    The mask in B has zero "holes" in the bits which the    subroutine is to set or zero in (HL). The setting byte in A     contains the required settings of these bits - the other bits inA are immaterial. Eg:                                                                     B = 11010111                                                    A = 11001011                           will set bit 3 and zero bit 5 of (HL), leaving the others      undisturbed.                                                            The subroutine also increments HL, which is convenient  for dealing with the colour system variables.                           Can be used in m/c to change any bits in any byte.             Input parameters: HL holds the address of the byte to be changed                                                                 - B holds the mask                                              - A holds the setting byte.                                    Action: XOR/AND/XOR (HL) with A using B as mask                  - increment HL                                                  - copy the mask to A.                                          Exit: RET.                                                      Output parameters: (HL) is changed as required                   - A and B now both hold the "mask"                              - HL is incremented by 1.                                      Called by:                                                       2258 CO TEMP B (twice)                                          2287 CO TEMP E                                                 Exit from:                                                       2228 CO TEMP 6                                                  2287 CO TEMP E                                                                                                              CODE key (AF) see also commands, functions and operators,   KEYBOARD SCANNING, 0246 extended mode table (b)                         The I key in E mode without shift produces the dual-    purpose token CODE.                                                     As a function, it requires one string operand X$, and   the value of the function is the character code of X$(1), or    zero if X$ = "".                                                        On execution, 24FB SCANNING quickly leads to 26DF S     NEGATE. This converts the key code AF first to 00, then to DC,  and adds the priority 10h/16d. Code and priority 10DC are now   pushed on to the machine stack (270D S PUSH PO) while the       expression following CODE is evaluated.                                 When the code is taken off the stack (2734 S LOOP), it  is converted (2773 S TIGHTER) from DC to 1C, the calculator     offset for 3669 code.                                                   However, if CODE is used as an "adverb" in a SAVE/LOAD/ VERIFY command, it isn't a function and isn't read by SCANNING; this use of CODE is handled by the 0605 SAVE ETC subroutine at  06C3 SA CODE.                                                           0710 SA TYPE 1 type in header is 3                              07AD LD CH PA loading handled in 07CB VR CONTRL                 07CB VR CONTRL used to load CODE                                26DF S NEGATE handles functions CODE to NOT                                                                                 code see also channels and streams, character code, colours,control codes, KEYBOARD SCANNING                                                                                                    code subroutine 3669                                                Called from 0028 FP CALC by offset 1C; the executive    routine of the CODE function. Finds the character code of the   first character of a string.                                            Not called otherwise from ROM; can be called from m/c   either by RST 28h or direct, but there are usually easier ways!        Input parameters: none                                           - the string parameters must be the last value on the   calculator stack.                                                      Action: call 2BF1 STK FETCH to put the string parameters into the AEDCB registers                                                - if the length BC is zero jump on to STK CODE with zero        - (non-null) get the code from the start address DE.           _3671_STK_CODE: exit.                                           Exit: into 2D28 STACK A, which puts the code or zero on  the calculator stack as a small integer.                               Output parameters: code in A.                                                                                                COLLECT A LINE NUMBER SUBROUTINE see 1695 LINE NO                                                                               COLLECT CHARACTER RESTART see 0018 GET CHAR                                                                                     COLLECT NEXT CHARACTER RESTART see 0020 NEXT CHAR