| Routines

0BDB: THE 'SET ATTRIBUTE BYTE' SUBROUTINE

Used by the routines at PO_ANY and PLOT. The appropriate attribute byte is identified and fetched. The new value is formed by manipulating the old value, ATTR-T, MASK-T and P-FLAG. Finally this new value is copied to the attribute area.
Input
HL | Display file address
PO_ATTR | 0BDB | LD A,H | The high byte of the destination address is divided by eight and ANDed with +03 to determine which third of the screen is being addressed, i.e. +00, +01 or +02.
| 0BDC | RRCA
| 0BDD | RRCA
| 0BDE | RRCA
| 0BDF | AND $03
| 0BE1 | OR $58 | The high byte for the attribute area is then formed.
| 0BE3 | LD H,A
| 0BE4 | LD DE,($5C8F) | E holds ATTR-T, and D holds MASK-T.
| 0BE8 | LD A,(HL) | The old attribute value.
| 0BE9 | XOR E | The values of MASK-T and ATTR-T are taken into account.
| 0BEA | AND D
| 0BEB | XOR E
| 0BEC | BIT 6,(IY+$57) | Jump forward unless dealing with PAPER 9 (bit 6 of P-FLAG set).
| 0BF0 | JR Z,PO_ATTR_1
| 0BF2 | AND $C7 | The old paper colour is ignored and depending on whether the ink colour is light or dark the new paper colour will be black (000) or white (111).
| 0BF4 | BIT 2,A
| 0BF6 | JR NZ,PO_ATTR_1
| 0BF8 | XOR $38
PO_ATTR_1 | 0BFA | BIT 4,(IY+$57) | Jump forward unless dealing with INK 9 (bit 4 of P-FLAG set).
| 0BFE | JR Z,PO_ATTR_2
| 0C00 | AND $F8 | The old ink colour is ignored and depending on whether the paper colour is light or dark the new ink colour will be black (000) or white (111).
| 0C02 | BIT 5,A
| 0C04 | JR NZ,PO_ATTR_2
| 0C06 | XOR $07
PO_ATTR_2 | 0C08 | LD (HL),A | Enter the new attribute value and return.
| 0C09 | RET