![]() |
Routines |
| Prev: 8151 | Up: Map | Next: 81DE |
|
Used by the routines at DrawingSetup and Drawing_PlotTheSelectedPixel.
Turns the pixel coordinate into a screen address and sets the bit in that screen byte.
|
||||
| Drawing_AddressThePixel | 81B5 | PUSH HL | Call Drawing_ScreenAddressFromTheRow to turn the pen into a screen address. | |
| 81B6 | CALL Drawing_ScreenAddressFromTheRow | |||
| 81B9 | PUSH AF | Keep the screen address and split out its row bits. | ||
| 81BA | PUSH HL | |||
| 81BB | LD A,H | |||
| 81BC | AND %00011000 | Move the row bits of the screen address into the attribute address. | ||
| 81BE | RRCA | Rotate right. | ||
| 81BF | RRCA | Rotate right. | ||
| 81C0 | RRCA | Rotate right. | ||
| 81C1 | ADD A,$58 | Add it on. | ||
| 81C3 | LD H,A | Point H at that attribute. | ||
| 81C4 | LD A,(HL) | Read the attribute byte. | ||
| 81C5 | AND %00111000 | Keep only the paper bits (3-5) of this attribute, and jump to Drawing_AddressThePixel_RestoreTheInkBits unless they match the colour in 824E shifted into bits 3-5. | ||
| 81C7 | LD (HL),A | |||
| 81C8 | LD A,($824E) | |||
| 81CB | RLCA | |||
| 81CC | RLCA | |||
| 81CD | RLCA | |||
| 81CE | CP (HL) | |||
| 81CF | JR NZ,Drawing_AddressThePixel_RestoreTheInkBits | |||
| 81D1 | XOR $38 | Flip the bits selected by 38. | ||
| Drawing_AddressThePixel_RestoreTheInkBits | 81D3 | RRCA | Shift the replacement ink back into the ink bits. | |
| 81D4 | RRCA | |||
| 81D5 | RRCA | |||
| 81D6 | OR (HL) | Combine it with the attribute on screen. | ||
| 81D7 | LD (HL),A | Store the attribute. | ||
| 81D8 | POP HL | Plot the pixel into the screen byte. | ||
| 81D9 | POP AF | |||
| 81DA | OR (HL) | |||
| 81DB | LD (HL),A | Store the screen byte. | ||
| 81DC | POP HL | Restore HL from the stack. | ||
| 81DD | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 8151 | Up: Map | Next: 81DE |