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

  1.         - set bit zero of FLAGS; "no leading space before a     following token".                                                      _0AD0_PO_SPACE: make a space byte and call 0C3B PO SAVE  to output it; the alternate registers are in use throughout the PRINT OUT routine                                                       - decrement the counter and loop back to PO SPACE till  it reaches zero                                                         - return.                                                      _2211_CO_TEMP_5 (although in a quite different part of   the ROM, this routine logically belongs here; it is entered onlyfrom PO CONT, to handle colour controls): subtract 11h/17d from the control code; they ran from 10h/16d INK to 15h/21d OVER             - add back the carry; now both INK and PAPER are zero,  but with carry for INK, and FLASH to OVER are 01 -> 04                  - if the result is zero jump on to CO TEMP 7; INK and   PAPER                                                                   - subtract 02 and add back the carry; now                                 FLASH is zero with carry                                        BRIGHT is zero without carry                                    INVERSE is 01, OVER is 02                             - if the result is zero jump on to CO TEMP C; FLASH and BRIGHT                                                                  - (INVERSE and OVER) check whether the result is 01             - get the on/off parameter; it came from BASIC, zero foroff or 01 for on                                                        - make a mask 00000001b; this will control bit zero in PFLAG, which controls OVER, using the on/off parameter which is  also in bit zero as a setting byte                                      - if the control code came to 02 jump on to CO TEMP 6;  OVER                                                                    - (INVERSE) rotate the on/off parameter twice left; now it is in bit 2, making a setting byte                                   - make the mask 00000100b/04; to control bit 2 in P     FLAG, which controls INVERSE                                           _2228_CO_TEMP_6: if the parameter as it came from BASIC  was more than one report "Invalid colour"                               - (zero or one are OK) put a pointer on P FLAG                  - jump on to CO CHANGE.                                        _2234_CO_TEMP_7 (INK and PAPER, with carry set for INK): get the colour parameter; it is already a setting byte for INK          - make a mask 00000111b/07 for INK                              - if carry was set jump on to CO TEMP 8                         - (PAPER) rotate the colour parameter 3 places left; to the PAPER position, making a setting byte for PAPER                     - make the mask 00111000b/38h for PAPER.                       _223E_CO_TEMP_8: if the parameter as it came from BASIC  was more than nine report "Invalid colour".                            _2240_CO_TEMP_9: put a pointer on 5C8F ATTR T                    - if the colour parameter is zero -> 7 jump on to CO    TEMP B                                                                  - (colours 8 and 9) put the value of ATTR T in the      setting byte                                                            - if the colour is 8 jump on to CO TEMP A                       - (colour 9) OR the setting byte with the mask; making  colour 7 WHITE                                                          - reverse the setting byte and AND the result with      00100100b/24h; this will give zero if the hi bit of the colour  is one, ie GREEN, CYAN, YELLOW or WHITE                                 - if it gives zero jump on to CO TEMP A; the setting    byte is now zero, colour BLACK                                          - (BLACK, BLUE, RED, MAGENTA) copy the mask to the      setting byte; colour WHITE                                              Perhaps some examples will help:                               INK 9 (mask 00000111b)                                          ATTR T is blue INK (001) on cyan PAPER (101b/5)            XX101001 -> XX101111 -> YY010000 -> 00000000, so use 00000000bto get black INK XX101000b                                             ATTR T is cyan INK (101b/5) on blue PAPER (001)            XX001101 -> XX001111 -> YY110000 -> 00100000, so use 00000111band get white INK XX001111b.                                           PAPER 9 (mask 00111000b)                                        ATTR T is blue INK (001) on cyan PAPER (101b/5)            XX101001 -> XX111001 -> YY001110 -> 00000100, so use 00111000band get white PAPER XX111001b                                          ATTR T is cyan INK (101b/5) on blue PAPER (001)            XX001101 -> XX111101 -> YY000010 -> 00000000, so use 00000000bto get black PAPER XX000101b.                                          _2257_CO_TEMP_A and_2258_CO_TEMP_B: call 226C CO CHANGE  to correct 5C8F ATTR T                                                  - make a mask 00000111b/07                                      - subtract from it the colour parameter from BASIC;     making carry for colours 8 and 9                                        - subtract it from itself with the carry; this makes a  setting byte for 5C90 MASK T which is all zeroes for colours    zero to 7, all ones for 8 or 9. The PAPER or INK mask for MASK Tis the same as for 5C8F ATTR T                                          - call CO CHANGE again to correct 5C90 MASK T; it is thenext byte after 5C8F ATTR T                                             - shift the mask last used left twice; it was 00111000b or 00000111b, so this makes 11100000b or 00011100b                      - AND the result with 01010000b/50h; making 01000000b   for PAPER or 00010000b for INK. These are the correct masks for PAPER 9 and INK 9 in P FLAG                                             - subtract the colour parameter from BASIC from 08;     making carry for 9 only                                                 - subtract the result from itself with the carry; as    before, this makes a setting byte for P FLAG 00000000b if the   colour is not 9 or 11111111b if it is                                   - exit into CO CHANGE; to correct P FLAG.                      _[226C_CO_CHANGE, which comes next, is a viable m/c      subroutine so is given a description under its own name in this index, though in ROM it is only called or entered from this     section.]                                                              _2273_CO_TEMP_C (FLASH and BRIGHT, with carry for FLASH):SBC A copies the carry flag to the Z/NZ flag; now NZ flags FLASH        - rotate the parameter from BASIC; the on/off parameter goes to the hi bit, making a correct setting byte for FLASH             - make a mask 10000000b/80h; correct for FLASH                  - if the flag shows NZ jump on to CO TEMP D                     - (BRIGHT) rotate the parameter again; now the on/off   parameter is in bit 6, correct for BRIGHT                               - remake the mask as 01000000b/40h; for BRIGHT.                _227D_CO_TEMP_D: if the parameter from BASIC is 08 jump  on to CO TEMP E; FLASH 8 and BRIGHT 8 are good syntax, but the  set bit will have no effect on 5C8F ATTR T, because the         rotations have not moved it to the "hole" in the mask                   - if it is not zero or one, report "Invalid colour".           _2287_CO_TEMP_E: put a pointer on 5C8F ATTR T and call COCHANGE to correct it                                                    - rotate the setting byte three times right and exit    into CO CHANGE to correct 5C90 MASK T; if the parameter was 8,  this will set the bit in MASK T, otherwise not.                        _0AD9_PO_ABLE (entered either direct from PRINT OUT or   from PO QUEST, with any printable code from space upwards): callPO ANY to output the code; PO ANY is described below.                  _0ADC_PO_STORE (exit here after any change in the print  position due to cursor moves, position controllers, scrolling orprinting of characters, to put the new values in the system     variables relating to the screen or printer: BC holds line and  column numbers of the_last print position, HL the pixel address of the first byte of the next character position) if bit 1 of   FLAGS is set jump on to PO ST PR; output to the ZX printer              - if bit zero of TV FLAG is set jump on to PO ST E;     output to the lower screen                                              - (upper screen) put the position values in 5C88 S POSN         - put the pixel address in 5C84 DF CC                           - return.                                                      _0AF0_PO_ST_E (lower screen): put the position values in 5C8A S POSNL and 5C82 ECHO E                                            - put the pixel address in 5C86 DF CCL                          - return.                                                      _0AFC_PO_ST_PR (ZX printer): put the column number in    5C7F P POSN; there is no line number                                    - put the pixel address in 5C80 PR CC                           - return.                                                      _0B03_PO_FETCH (a free-standing subroutine, but only     called in the PRINT OUT block: from PRINT OUT, PO COMMA - an    unnecessary call - PO FILL, PO ANY; also the apparent exit from PRINT OUT, but its return is to another PRINT OUT routine): if  bit 1 of FLAGS is set jump on to PO F PR; output to the ZX      printer                                                                 - get the upper screen print position from 5C88 S POSN  and the display address from 5C84 DF CC                                 - if bit zero of TV FLAG is not set, return; output to  the upper screen                                                        - (lower screen) get the print position from 5C8A S     POSNL and the display address from 5C86 DF CCL                          - return.                                                      _0B1D_PO_F_PR (ZX printer): get the column number from   5C7F P POSN and the print buffer address from 5C80 PR CC                - return.                                                      _0B24_PO_ANY (formally a free-standing subroutine, but   only called from PO ABLE; A holds a code to be output): if the  code is less than 80h/128d jump on to PO CHAR; a single         character                                                               - if the code is more than 8Fh/143d jump on to PO T&UDG;a token or user-defined graphic                                         - (the code is one of the keyboard graphics 80h/128d to 8Fh/143d) call PO GR 1 to construct the graphic form in the     calculator memory area                                                  - call PO FETCH to recover the print position parameters        - put a pointer on the graphic form just constructed            - jump on to PR ALL.                                           _0B38_PO_GR_1 (formally a free-standing subroutine, but  only called from PO ANY; it constructs any of the "graphic      forms", character codes 80h/128d to 8Fh/143d. These are not     stored as "character forms", like the alphanumeric characters,  since it is relatively easy to "draw" them whenever they are    required.                                                               All the forms consist of a byte repeated four times to  make the upper half of the form and then another byte repeated  four times to form the lower half: each of these bytes is alwayseither 00h, 0Fh, F0h or FFh.                                            The 10h/16d forms can be tabulated as follows: the upperline shows the last four bits of the character code, the lower  shows the byte used in the_lower half of the character followed by the byte used in the upper half:                               0000    0001    0010    0011    0100    0101    0110    0111    0000    000F    00F0    00FF    0F00    0F0F    0FF0    0FFF                                                                    1000    1001    1010    1011    1100    1101    1110    1111    F000    F00F    F0F0    F0FF    FF00    FF0F    FFF0    FFFF          The correspondence is obvious):                                 - put a pointer on 5C92 MEMBOT; the calculator memory   area of 30d bytes                                                       - call PO GR 2 and immediately exit into it; thus going through it twice and then returning into PO ANY.                       _0B3E_PO_GR_2 (formally a subroutine, but never called   except at this point): rotate the character code right into the carry flag; on the first run this sets carry for odd character  codes, which have F as last digit of their lo byte, see the     table above. On the second run the character code has already   been shifted twice, so carry is set by what started out as bit  2, and codes with bit 2 set have F as last digit of their hi    byte                                                                    - take the code from itself with the carry; making 00   for even codes or FF for odd, depending on the carry                    - AND the result with 0F; making 00 for even, 0F for    odd, the lo nibble of the byte                                          - rotate and subtract the character code again                  - AND this time with F0; making 00 for even, F0 for odd,the hi nibble of the byte                                               - OR the two nibbles together to make the whole byte.           - make a counter 04; the byte is used four times.              _0B4C_PO_GR_3: put the byte just formed into the next    location of the memory area                                             - move on the pointer                                           - reduce the counter                                            - if it is not zero loop back to PO GR 3                        - (four bytes loaded) return; the first time the routineis called, PO GR 2 is immediately entered again with the lo byteof the character code already shifted four bytes right,         producing the byte for the lower half of the graphics character.The second time, this is a return into PO ANY.                         _0B52_PO_T&UDG (entered from PO ANY if the code is a     token or user-defined graphic): subtract A5h/165d from the code         - if this does not give carry jump on to PO T; the code is 165d or more, a token                                                - (a user-defined graphic) add back 15h/21d; now the    code is zero -> 14h/20d; 0Fh in the notes is incorrect                  - put a pointer on the address in 5C7B UDG; this is the base address for the UD graphics                                        - jump on to PO CHAR 2 to print the character.                 _0B5F_PO_T (tokens): call 0C10 PO TOKENS to print out thetoken                                                                   - jump back to PO FETCH to exit; the display address in HL has been overwritten.                                               _0B65_PO_CHAR (output a single character code from the   standard set; this entry point is also called as a subroutine   from PO RIGHT, to move the cursor right by printing an          "invisible space"): get the "base address of the character set" from 5C36 CHARS; this base is 100h/256d bytes before the start  of the character set, so code 20h/32d lands on the first byte ofthe set, which is also the first byte of the form for 20h       "space", and other codes correspondingly                               _0B6A_PO_CHAR_2: zero bit zero of FLAGS; "print the next token with a leading space"                                             - if the present code is not space jump on to PO CHAR 3         - (it is space) set bit zero of FLAGS; no leading space after a space.                                                          Perhaps some examples will help:                               INK 9 (mask 00000111b)                                          ATTR T is blue INK (001) on cyan PAPER (101b/5)            XX101001 -> XX101111 -> YY010000 -> 00000000, so use 00000000bto get black INK XX101000b                                             ATTR T is cyan INK (101b/5) on blue PAPER (001)            XX001101 -> XX001111 -> YY110000 -> 00100000, so use 00000111band get white INK XX001111b.                                           PAPER 9 (mask 00111000b)                                        ATTR T is blue INK (001) on cyan PAPER (101b/5)            XX101001 -> XX111001 -> YY001110 -> 00000100, so use 00111000band get white PAPER XX111001b                                          ATTR T is cyan INK (101b/5) on blue PAPER (001)            XX001101 -> XX111101 -> YY000010 -> 00000000, so use 00000000bto get black PAPER XX000101b.                                          _2257_CO_TEMP_A and_2258_CO_TEMP_B: call 226C CO CHANGE  to correct 5C8F ATTR T                                                  - make a mask 00000111b/07                                      - subtract from it the colour parameter from BASIC;     making carry for colours 8 and 9                                        - subtract it from itself with the carry; this makes a  setting byte for 5C90 MASK T which is all zeroes for colours    zero to 7, all ones for 8 or 9. The PAPER or INK mask for MASK Tis the same as for 5C8F ATTR T                                          - call CO CHANGE again to correct 5C90 MASK T; it is thenext byte after 5C8F ATTR T                                             - shift the mask last used left twice; it was 00111000b or 00000111b, so this makes 11100000b or 00011100b                      - AND the result with 01010000b/50h; making 01000000b   for PAPER or 00010000b for INK. These are the correct masks for PAPER 9 and INK 9 in P FLAG                                             - subtract the colour parameter from BASIC from 08;     making carry for 9 only                                                 - subtract the result from itself with the carry; as    before, this makes a setting byte for P FLAG 00000000b if the   colour is not 9 or 11111111b if it is                                   - exit into CO CHANGE; to correct P FLAG.                      _[226C_CO_CHANGE, which comes next, is a viable m/c      subroutine so is given a description under its own name in this index, though in ROM it is only called or entered from this     section.]                                                              _2273_CO_TEMP_C (FLASH and BRIGHT, with carry for FLASH):SBC A copies the carry flag to the Z/NZ flag; now NZ flags FLASH        - rotate the parameter from BASIC; the on/off parameter goes to the hi bit, making a correct setting byte for FLASH             - make a mask 10000000b/80h; correct for FLASH                  - if the flag shows NZ jump on to CO TEMP D                     - (BRIGHT) rotate the parameter again; now the on/off   parameter is in bit 6, correct for BRIGHT                               - remake the mask as 01000000b/40h; for BRIGHT.                _227D_CO_TEMP_D: if the parameter from BASIC is 08 jump  on to CO TEMP E; FLASH 8 and BRIGHT 8 are good syntax, but the  set bit will have no effect on 5C8F ATTR T, because the         rotations have not moved it to the "hole" in the mask                   - if it is not zero or one, report "Invalid colour".           _2287_CO_TEMP_E: put a pointer on 5C8F ATTR T and call COCHANGE to correct it                                                    - rotate the setting byte three times right and exit    into CO CHANGE to correct 5C90 MASK T; if the parameter was 8,  this will set the bit in MASK T, otherwise not.                        _0AD9_PO_ABLE (entered either direct from PRINT OUT or   from PO QUEST, with any printable code from space upwards): callPO ANY to output the code; PO ANY is described below.