| Routines

03035: 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 | 03035 | LD A,H | The high byte of the destination address is divided by eight and ANDed with 3 to determine which third of the screen is being addressed, i.e. 0, 1 or 2.
| 03036 | RRCA
| 03037 | RRCA
| 03038 | RRCA
| 03039 | AND 3
| 03041 | OR 88 | The high byte for the attribute area is then formed.
| 03043 | LD H,A
| 03044 | LD DE,(23695) | E holds ATTR-T, and D holds MASK-T.
| 03048 | LD A,(HL) | The old attribute value.
| 03049 | XOR E | The values of MASK-T and ATTR-T are taken into account.
| 03050 | AND D
| 03051 | XOR E
| 03052 | BIT 6,(IY+87) | Jump forward unless dealing with PAPER 9 (bit 6 of P-FLAG set).
| 03056 | JR Z,PO_ATTR_1
| 03058 | AND 199 | 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).
| 03060 | BIT 2,A
| 03062 | JR NZ,PO_ATTR_1
| 03064 | XOR 56
PO_ATTR_1 | 03066 | BIT 4,(IY+87) | Jump forward unless dealing with INK 9 (bit 4 of P-FLAG set).
| 03070 | JR Z,PO_ATTR_2
| 03072 | AND 248 | 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).
| 03074 | BIT 5,A
| 03076 | JR NZ,PO_ATTR_2
| 03078 | XOR 7
PO_ATTR_2 | 03080 | LD (HL),A | Enter the new attribute value and return.
| 03081 | RET