![]() |
Routines |
| Prev: 7F78 | Up: Map | Next: 806F |
|
Used by the routine at DRAW_LOCATION_PICTURE.
IY walks the stream; D and E are the current point, in a 256x128 space with y measured upwards from scanline 127. The opcodes are: $00 end, $08 move, $2x paint attributes, $4x flood fill, and anything with bit 7 set a line. Bits 0-2 of a fill or paint opcode are its colour.
A line is two bytes, and both are split: the opcode byte carries the direction in bits 0-2 and part of the minor-axis step in bits 2-5, while the second byte carries the length in bits 0-5 and the last two step bits in bits 6-7. That is a Bresenham line of up to 64 pixels in 16 bits.
|
||||||||
| RUN_PICTURE | 7FA7 | PUSH IY | ||||||
| 7FA9 | PUSH HL | |||||||
| 7FAA | PUSH HL | |||||||
| 7FAB | POP IY | |||||||
| 7FAD | PUSH DE | |||||||
| 7FAE | PUSH BC | |||||||
| 7FAF | CALL CLEAR_CANVAS | Clear the canvas and take the border and attribute bytes off the front | ||||||
| 7FB2 | LD D,$7F | The point a stream starts from if it draws before it moves: (127, 63) | ||||||
| 7FB4 | LD E,$3F | |||||||
| 7FB6 | LD B,$01 | |||||||
| 7FB8 | LD C,$01 | |||||||
| 7FBA | LD L,$01 | |||||||
| RUN_PICTURE_0 | 7FBC | LD A,(IY+$00) | ||||||
| 7FBF | AND A | |||||||
| 7FC0 | JP Z,PICTURE_DONE | $00: end of the picture | ||||||
| 7FC3 | INC IY | |||||||
| 7FC5 | CP $08 | $08: move... | ||||||
| 7FC7 | JR NZ,RUN_PICTURE_1 | |||||||
| 7FC9 | LD D,(IY+$00) | ...to the point in the next two bytes | ||||||
| 7FCC | INC IY | |||||||
| 7FCE | LD E,(IY+$00) | |||||||
| 7FD1 | INC IY | |||||||
| 7FD3 | JR RUN_PICTURE_0 | |||||||
| RUN_PICTURE_1 | 7FD5 | BIT 7,A | ||||||
| 7FD7 | JR Z,RUN_PICTURE_2 | |||||||
| 7FD9 | LD B,A | |||||||
| 7FDA | AND $07 | A line: bits 0-2 of the opcode are the direction | ||||||
| 7FDC | LD C,A | |||||||
| 7FDD | LD A,B | Bits 2-5 of it are part of the minor-axis step | ||||||
| 7FDE | RRCA | |||||||
| 7FDF | AND $3C | |||||||
| 7FE1 | LD B,A | |||||||
| 7FE2 | LD A,(IY+$00) | The second byte's bits 0-5 are the length, plus one | ||||||
| 7FE5 | AND $3F | |||||||
| 7FE7 | LD L,A | |||||||
| 7FE8 | INC L | |||||||
| 7FE9 | LD A,(IY+$00) | ...and its bits 6-7 are the rest of the step | ||||||
| 7FEC | INC IY | |||||||
| 7FEE | RLCA | |||||||
| 7FEF | RLCA | |||||||
| 7FF0 | AND $03 | |||||||
| 7FF2 | OR B | |||||||
| 7FF3 | LD B,A | |||||||
| 7FF4 | INC B | |||||||
| 7FF5 | CALL DRAW_LINE | Draw it | ||||||
| 7FF8 | JR RUN_PICTURE_0 | |||||||
| RUN_PICTURE_2 | 7FFA | BIT 6,A | ||||||
| 7FFC | JR Z,RUN_PICTURE_3 | |||||||
| 7FFE | AND $07 | Bit 6 set: a flood fill; bits 0-2 are its colour | ||||||
| 8000 | PUSH DE | |||||||
| 8001 | LD D,(IY+$00) | The fill's seed point, from the next two bytes | ||||||
| 8004 | INC IY | |||||||
| 8006 | LD E,(IY+$00) | |||||||
| 8009 | INC IY | |||||||
| 800B | CALL FLOOD_FILL | Fill from there | ||||||
| 800E | POP DE | The fill does not move the current point | ||||||
| 800F | JP RUN_PICTURE_0 | |||||||
| RUN_PICTURE_3 | 8012 | BIT 5,A | ||||||
| 8014 | JP Z,RUN_PICTURE_0 | |||||||
| 8017 | AND $07 | Bit 5 set: paint attribute cells; bits 0-2 are the colour | ||||||
| 8019 | RLCA | |||||||
| 801A | RLCA | |||||||
| 801B | RLCA | |||||||
| 801C | PUSH HL | |||||||
| 801D | PUSH DE | |||||||
| 801E | PUSH BC | |||||||
| 801F | LD C,A | |||||||
| 8020 | LD H,(IY+$00) | HL = the first attribute address, stored high byte first | ||||||
| 8023 | INC IY | |||||||
| 8025 | LD L,(IY+$00) | |||||||
| 8028 | INC IY | |||||||
| RUN_PICTURE_4 | 802A | LD A,(IY+$00) | ||||||
| 802D | INC IY | |||||||
| 802F | CP $FF | $FF ends the path | ||||||
| 8031 | JR Z,RUN_PICTURE_7 | |||||||
| 8033 | LD B,A | |||||||
| 8034 | AND $03 | |||||||
| 8036 | LD E,A | |||||||
| 8037 | LD A,B | Each path item: bits 0-1 the direction, bits 2-7 the count | ||||||
| 8038 | RRCA | |||||||
| 8039 | RRCA | |||||||
| 803A | AND $3F | |||||||
| 803C | INC A | |||||||
| 803D | LD B,A | |||||||
| RUN_PICTURE_5 | 803E | LD A,(HL) | Keep the cell's ink out of its paper, so a colour can never hide the lines | |||||
| 803F | AND $07 | |||||||
| 8041 | RLCA | |||||||
| 8042 | RLCA | |||||||
| 8043 | RLCA | |||||||
| 8044 | CP C | |||||||
| 8045 | JR NZ,RUN_PICTURE_6 | |||||||
| 8047 | XOR $38 | |||||||
| RUN_PICTURE_6 | 8049 | RRCA | ||||||
| 804A | RRCA | |||||||
| 804B | RRCA | |||||||
| 804C | OR C | |||||||
| 804D | LD (HL),A | |||||||
| 804E | LD A,E | |||||||
| 804F | AND A | |||||||
| 8050 | CALL Z,ATTR_UP | |||||||
| 8053 | DEC A | |||||||
| 8054 | CALL Z,ATTR_RIGHT | |||||||
| 8057 | DEC A | |||||||
| 8058 | CALL Z,ATTR_DOWN | |||||||
| 805B | DEC A | |||||||
| 805C | CALL Z,ATTR_LEFT | |||||||
| 805F | DJNZ RUN_PICTURE_5 | |||||||
| 8061 | JR RUN_PICTURE_4 | |||||||
| RUN_PICTURE_7 | 8063 | POP BC | ||||||
| 8064 | POP DE | |||||||
| 8065 | POP HL | |||||||
| 8066 | JP RUN_PICTURE_0 | |||||||
|
This entry point is used by the routine at CLEAR_CANVAS.
|
||||||||
| PICTURE_DONE | 8069 | POP BC | ||||||
| 806A | POP DE | |||||||
| 806B | POP HL | |||||||
| 806C | POP IY | |||||||
| 806E | RET | |||||||
| Prev: 7F78 | Up: Map | Next: 806F |