![]() |
Routines |
| Prev: C3F7 | Up: Map | Next: C522 |
|
Used by the routine at DrawBlockShape.
Draws a block whose shape number is 09 to 10. DrawBlockShape has already copied the shape's steps into this routine. The shape number chooses the edges: shapes below 0B use one edge, 0B and 0C leave the edges alone, 0D and 0E use two, and 0F and 10 lengthen the row count by 0E as well. Each column is drawn a row at a time by DrawBlockRow.
|
||||
|
The shape number is in A. It chooses how many edge steps this column adds, and which edges are written before a single-row column.
|
||||
| DrawBlockShapeThree | C418 | PUSH HL | Remember the screen address. | |
| C419 | LD L,$01 | One edge step for a shape below 0B. | ||
| C41B | LD H,L | |||
| C41C | CP $0B | |||
| C41E | JR C,DrawBlockShapeThree_Steps | |||
| C420 | INC H | Two edge steps for shape 0D or 0E. | ||
| C421 | CP $0D | |||
| C423 | JR Z,DrawBlockShapeThree_Steps | |||
| C425 | CP $0E | |||
| C427 | JR Z,DrawBlockShapeThree_Steps | |||
| C429 | INC L | None for shape 0B or 0C and three for a higher shape. | ||
| C42A | INC H | |||
| C42B | CP $0E | |||
| C42D | JR NC,DrawBlockShapeThree_Steps | |||
| C42F | LD H,$00 | |||
| DrawBlockShapeThree_Steps | C431 | LD A,L | Remember how many steps this column adds. | |
| C432 | LD ($C504),A | |||
| C435 | LD A,H | Remember the edge choice. | ||
| C436 | LD ($C46F),A | |||
| C439 | LD ($C4F1),A | |||
| C43C | XOR A | Clear the running total of steps. | ||
| C43D | LD ($C502),A | |||
| C440 | LD A,($C3D5) | Copy the row count into the row loop. | ||
| C443 | LD ($C469),A | |||
| C446 | LD HL,($C3D8) | Copy the row routine and the four steps from the shape. | ||
| C449 | LD ($C4CB),HL | |||
| C44C | LD HL,($C3DC) | |||
| C44F | LD ($C4CF),HL | |||
| C452 | LD HL,($C3E1) | |||
| C455 | LD ($C4D4),HL | |||
| C458 | LD HL,($C3EA) | |||
| C45B | LD ($C513),HL | |||
| C45E | LD HL,($C3F0) | |||
| C461 | LD ($C519),HL | |||
| C464 | POP HL | Restore the screen address. | ||
| DrawBlockShapeThree_Rows | C465 | PUSH BC | Remember the column count and both addresses. | |
| C466 | PUSH HL | |||
| C467 | PUSH DE | |||
| C468 | LD B,$00 | Take the row count. | ||
|
The edges are changed only when a single row remains, and only for an edge choice other than zero.
|
||||
| DrawBlockShapeThree_Columns | C46A | PUSH BC | Remember the row count. | |
| C46B | DEC B | Change the edges only when a single row remains. | ||
| C46C | JR NZ,DrawBlockShapeThree_Draw | |||
| C46E | LD A,$00 | Read the edge choice. | ||
| C470 | AND A | Leave the edges as they are when the choice is zero. | ||
| C471 | JR Z,DrawBlockShapeThree_Draw | |||
| C473 | RRA | The low bit of the choice selects the wide edges. | ||
| C474 | JR C,DrawBlockShapeThree_Wide | |||
| C476 | LD A,($C502) | Read the running total of steps. | ||
| C479 | RRA | Use the narrow edges only when that total is odd. | ||
| C47A | JR NC,DrawBlockShapeThree_Draw | |||
| C47C | LD (IY+$06),$08 | Set the edges to 08. | ||
| C480 | LD A,$08 | |||
| C482 | LD ($C688),A | |||
| C485 | LD ($C69A),A | |||
| C488 | LD ($C6B5),A | |||
| C48B | ADD A,$06 | |||
| C48D | LD ($C72A),A | |||
| C490 | JR DrawBlockShapeThree_Draw | |||
| DrawBlockShapeThree_Wide | C492 | LD (IY+$06),$18 | Set the edges to 18. | |
| C496 | LD B,A | |||
| C497 | LD A,$18 | |||
| C499 | LD ($C688),A | |||
| C49C | LD ($C69A),A | |||
| C49F | LD ($C6B5),A | |||
| C4A2 | ADD A,$06 | |||
| C4A4 | LD ($C72A),A | |||
| C4A7 | RR B | A choice of three also sets the edges to 10 and lengthens the rows. | ||
| C4A9 | JR NC,DrawBlockShapeThree_Draw | |||
| C4AB | LD (IY+$06),$10 | |||
| C4AF | LD A,$10 | |||
| C4B1 | LD ($C688),A | |||
| C4B4 | LD ($C69A),A | |||
| C4B7 | LD ($C6B5),A | |||
| C4BA | ADD A,$06 | |||
| C4BC | LD ($C72A),A | |||
| C4BF | LD A,($C5E9) | |||
| C4C2 | ADD A,$0E | |||
| C4C4 | LD ($C5E9),A | |||
| C4C7 | LD ($C739),A | |||
| DrawBlockShapeThree_Draw | C4CA | CALL DrawBlockRow | Draw this row. The routine is patched. | |
| C4CD | EXX | Step both addresses on by the shape's row steps. | ||
| C4CE | LD BC,$0000 | |||
| C4D1 | ADD HL,BC | |||
| C4D2 | EX DE,HL | |||
| C4D3 | LD BC,$0000 | |||
| C4D6 | ADD HL,BC | |||
| C4D7 | EX DE,HL | |||
| C4D8 | POP BC | Repeat for the remaining rows. | ||
| C4D9 | DJNZ DrawBlockShapeThree_Columns | |||
| C4DB | POP HL | Restore the screen address. | ||
| C4DC | LD (IY+$06),$18 | Put the edges back to 18. | ||
| C4E0 | LD A,$18 | |||
| C4E2 | LD ($C6B5),A | |||
| C4E5 | LD ($C688),A | |||
| C4E8 | LD ($C69A),A | |||
| C4EB | ADD A,$06 | |||
| C4ED | LD ($C72A),A | |||
| C4F0 | LD A,$00 | A choice of three shortens the row count again. | ||
| C4F2 | CP $03 | |||
| C4F4 | JR NZ,DrawBlockShapeThree_0 | |||
| C4F6 | LD A,($C5E9) | |||
| C4F9 | SUB $0E | |||
| C4FB | LD ($C5E9),A | |||
| C4FE | LD ($C739),A | |||
| DrawBlockShapeThree_0 | C501 | LD A,$00 | Add this column's steps to the running total. | |
| C503 | ADD A,$00 | |||
| C505 | LD ($C502),A | |||
| C508 | RRA | Shorten the remaining rows when the total overflows. | ||
| C509 | JR C,DrawBlockShapeThree_1 | |||
| C50B | LD A,($C469) | |||
| C50E | DEC A | |||
| C50F | LD ($C469),A | |||
| DrawBlockShapeThree_1 | C512 | LD BC,$0000 | Step the screen address on by the column step. | |
| C515 | ADD HL,BC | |||
| C516 | EX DE,HL | |||
| C517 | POP HL | Restore the sprite address and step it on too. | ||
| C518 | LD BC,$0000 | |||
| C51B | ADD HL,BC | |||
| C51C | POP BC | Repeat for the remaining columns. | ||
| C51D | DEC B | |||
| C51E | JP NZ,DrawBlockShapeThree_Rows | |||
| C521 | RET | Return. | ||
| Prev: C3F7 | Up: Map | Next: C522 |