Routines
| Prev: F56E | Up: Map | Next: F5FB |
F5D2: Plot the pen position in the current colour
|
Sets the pixel at (D, E) and gives its character cell the ink in F60B, keeping the cell's paper.
How it works:
1. Find the screen byte and bit for the pixel at (D, E) (F5FB).
2. Work out the attribute byte for that character cell.
3. Keep the cell's paper and set its ink to the pen colour at F60B. If the paper is already that colour, use the opposite ink so the pixel shows.
4. Set the pixel itself.
|
||||||||||||
| F5D2 | PUSH HL | Save HL on the stack | ||||||||||
| F5D3 | CALL $F5FB | Call the routine "Find the screen byte and bit for the pen" (F5FB) - HL = the pixel's screen byte, A its bit (F5FB) | ||||||||||
| F5D6 | PUSH AF | Save AF on the stack | ||||||||||
| F5D7 | PUSH HL | Save HL on the stack | ||||||||||
| F5D8 | LD A,H | Copy H into A - Find its attribute byte ($58xx) | ||||||||||
| F5D9 | AND $18 | Keep only bits 3, 4 of A (mask $18) | ||||||||||
| F5DB | RRCA | Rotate A right one place (bit 0 goes to carry and bit 7) | ||||||||||
| F5DC | RRCA | Rotate A right one place (bit 0 goes to carry and bit 7) | ||||||||||
| F5DD | RRCA | Rotate A right one place (bit 0 goes to carry and bit 7) | ||||||||||
| F5DE | ADD A,$58 | Add $58 to A | ||||||||||
| F5E0 | LD H,A | Copy A into H | ||||||||||
| F5E1 | LD A,(HL) | Read the byte HL points at into A - Keep the paper, set the ink to the pen colour (F60B) | ||||||||||
| F5E2 | AND $38 | Keep only bits 3, 4, 5 of A (mask $38) | ||||||||||
| F5E4 | LD (HL),A | Store A at the address HL points to | ||||||||||
| F5E5 | LD A,($F60B) | Read "Fill pattern for the picture interpreter" (F60B) into A | ||||||||||
| F5E8 | RLCA | Rotate A left one place (bit 7 goes to carry and bit 0) | ||||||||||
| F5E9 | RLCA | Rotate A left one place (bit 7 goes to carry and bit 0) | ||||||||||
| F5EA | RLCA | Rotate A left one place (bit 7 goes to carry and bit 0) | ||||||||||
| F5EB | CP (HL) | Compare A with the byte HL points at - (if the paper is that colour too, use the opposite ink) | ||||||||||
| F5EC | JR NZ,$F5F0 | If A differs from the byte HL points at, skip ahead to F5F0 | ||||||||||
| F5EE | XOR $38 | Flip in A the bits that are set in $38 | ||||||||||
| F5F0 | RRCA | Rotate A right one place (bit 0 goes to carry and bit 7) | ||||||||||
| F5F1 | RRCA | Rotate A right one place (bit 0 goes to carry and bit 7) | ||||||||||
| F5F2 | RRCA | Rotate A right one place (bit 0 goes to carry and bit 7) | ||||||||||
| F5F3 | OR (HL) | Set in A the bits that are set in the byte HL points at | ||||||||||
| F5F4 | LD (HL),A | Store A at the address HL points to | ||||||||||
| F5F5 | POP HL | Restore HL from the stack - Then set the pixel | ||||||||||
| F5F6 | POP AF | Restore AF from the stack | ||||||||||
| F5F7 | OR (HL) | Set in A the bits that are set in the byte HL points at | ||||||||||
| F5F8 | LD (HL),A | Store A at the address HL points to | ||||||||||
| F5F9 | POP HL | Restore HL from the stack | ||||||||||
| F5FA | RET | Return to the caller | ||||||||||
| Prev: F56E | Up: Map | Next: F5FB |