![]() |
Routines |
| Prev: C15E | Up: Map | Next: C3F7 |
|
Used by the routine at DrawBlock.
Copies the four step bytes of the shape into this routine and sign-extends each one, then draws the block. A shape below 09 and shape 11 is drawn here a row at a time. Shapes 09 to 10 are drawn by DrawBlockShapeThree and shapes 12 to 15 by DrawBlockShapeTwo. DrawBlock patches in the shape number and the row count.
|
||||||||
|
Each step byte of the shape is sign-extended into a word that the row loops add to the screen address and the sprite address.
|
||||||||
| DrawBlockShape | C381 | LD A,(IY+$01) | Read the shape's first step. | |||||
| C384 | LD ($C3DC),A | Keep it as the low byte of a row step. | ||||||
| C387 | RLA | Sign-extend it when its top bit is set. | ||||||
| C388 | LD A,$00 | |||||||
| C38A | JR NC,DrawBlockShape_High | |||||||
| C38C | DEC A | The high byte is FF. | ||||||
| DrawBlockShape_High | C38D | LD ($C3DD),A | Keep the high byte of the row step. | |||||
| C390 | LD A,(IY+$02) | Read the shape's second step. | ||||||
| C393 | LD ($C3E1),A | Keep it as the low byte of the other row step. | ||||||
| C396 | RLA | Sign-extend it when its top bit is set. | ||||||
| C397 | LD A,$00 | |||||||
| C399 | JR NC,DrawBlockShape_High2 | |||||||
| C39B | DEC A | The high byte is FF. | ||||||
| DrawBlockShape_High2 | C39C | LD ($C3E2),A | Keep that high byte. | |||||
| C39F | LD A,(IY+$04) | Read the shape's fourth byte. | ||||||
| C3A2 | LD ($C3EA),A | Keep it as the low byte of a column step. | ||||||
| C3A5 | RLA | Sign-extend it when its top bit is set. | ||||||
| C3A6 | LD A,$00 | |||||||
| C3A8 | JR NC,DrawBlockShape_High3 | |||||||
| C3AA | DEC A | The high byte is FF. | ||||||
| DrawBlockShape_High3 | C3AB | LD ($C3EB),A | Keep that high byte. | |||||
| C3AE | LD A,(IY+$03) | Read the shape's third byte. | ||||||
| C3B1 | LD ($C3F0),A | Keep it as the low byte of the other column step. | ||||||
| C3B4 | RLA | Sign-extend it when its top bit is set. | ||||||
| C3B5 | LD A,$00 | |||||||
| C3B7 | JR NC,DrawBlockShape_High4 | |||||||
| C3B9 | DEC A | The high byte is FF. | ||||||
| DrawBlockShape_High4 | C3BA | LD ($C3F1),A | Keep that high byte. | |||||
| C3BD | LD A,$00 | Read the shape number. The byte is patched. | ||||||
| C3BF | CP $09 | A shape below 09 is drawn here. | ||||||
| C3C1 | JR C,DrawBlockShape_Second | |||||||
| C3C3 | CP $11 | Shapes 09 to 10 use the third shape. | ||||||
| C3C5 | JP C,DrawBlockShapeThree | |||||||
| DrawBlockShape_Second | C3C8 | CP $12 | Shape 11 is drawn here. | |||||
| C3CA | JR C,DrawBlockShape_Rows | |||||||
| C3CC | CP $16 | Shapes 12 to 15 use the second shape. | ||||||
| C3CE | JP C,DrawBlockShapeTwo | |||||||
| DrawBlockShape_Rows | C3D1 | PUSH BC | Remember the column count and both addresses. | |||||
| C3D2 | PUSH HL | |||||||
| C3D3 | PUSH DE | |||||||
| C3D4 | LD B,$00 | Take the patched row count. | ||||||
| DrawBlockShape_Loop | C3D6 | PUSH BC | Remember how many rows remain. | |||||
| C3D7 | CALL DrawBlockRow | Draw this row. | ||||||
|
This entry point is used by the routine at DrawBlockShapeTwo.
|
||||||||
| DrawBlockShape_Resume | C3DA | EXX | Step both addresses on by the row steps. | |||||
| C3DB | LD BC,$0000 | |||||||
| C3DE | ADD HL,BC | |||||||
| C3DF | EX DE,HL | |||||||
| C3E0 | LD BC,$0000 | |||||||
| C3E3 | ADD HL,BC | |||||||
| C3E4 | EX DE,HL | |||||||
| C3E5 | POP BC | Bring the row count back. | ||||||
| C3E6 | DJNZ DrawBlockShape_Loop | Repeat for the remaining rows. | ||||||
| C3E8 | POP HL | Restore the screen address. | ||||||
| C3E9 | LD BC,$0000 | Step on by the column step. | ||||||
| C3EC | ADD HL,BC | |||||||
| C3ED | EX DE,HL | Switch the addresses. | ||||||
| C3EE | POP HL | Restore the sprite address. | ||||||
| C3EF | LD BC,$0000 | Step it on by the other column step. | ||||||
| C3F2 | ADD HL,BC | |||||||
| C3F3 | POP BC | Bring the column count back. | ||||||
| C3F4 | DJNZ DrawBlockShape_Rows | Repeat for the remaining columns. | ||||||
| C3F6 | RET | Return. | ||||||
| Prev: C15E | Up: Map | Next: C3F7 |