![]() |
Routines |
| Prev: 50518 | Up: Map | Next: 50729 |
|
Draws one row of a block into the screen buffer. A row outside the view is left undrawn. The tile is the word at 26222 indexed by the patched row count, and FlipBlockData flips it when its top bit differs. Two masked bytes are drawn, then the routine steps up one screen row, for the height of the row.
|
||||||||||
|
The position arrives in the alternate registers. A row whose page, column or size is outside the view is left undrawn.
|
||||||||||
| DrawBlockRow | 50586 | PUSH HL | Take the position from the alternate registers. | |||||||
| 50587 | PUSH DE | |||||||||
| 50588 | EXX | |||||||||
| 50589 | POP DE | |||||||||
| 50590 | POP HL | |||||||||
| 50591 | LD A,H | Return unless the row is on the drawable page. | ||||||||
| 50592 | CP 128 | |||||||||
| 50594 | RET NZ | |||||||||
| 50595 | LD A,L | Return when the column is past the view. | ||||||||
| 50596 | CP 177 | |||||||||
| 50598 | RET NC | |||||||||
| 50599 | ADD A,(IY+5) | Return when the row size does not reach the view. | ||||||||
| 50602 | CP 192 | |||||||||
| 50604 | RET C | |||||||||
| 50605 | LD A,D | Return unless the other address is on the same page. | ||||||||
| 50606 | CP 128 | |||||||||
| 50608 | RET NZ | |||||||||
| 50609 | LD H,E | Keep the row. | ||||||||
| 50610 | LD B,(IY+6) | Take the shape's position byte as the height. | ||||||||
| 50613 | LD A,E | Start with no column offset. | ||||||||
| 50614 | LD C,0 | |||||||||
| 50616 | SUB B | The row starts above the view when it is below that position. | ||||||||
| 50617 | JR C,DrawBlockRow_Above | |||||||||
| 50619 | CP 120 | A row at 120 or beyond is off the view. | ||||||||
| 50621 | RET NC | |||||||||
| 50622 | LD A,H | Shorten a row that starts above the drawable page. | ||||||||
| 50623 | SUB 127 | |||||||||
| 50625 | JR C,DrawBlockRow_Tile | |||||||||
| 50627 | LD C,A | Shorten the height by four times that overflow. | ||||||||
| 50628 | SLA C | |||||||||
| 50630 | SLA C | |||||||||
| 50632 | NEG | |||||||||
| 50634 | ADD A,B | |||||||||
| 50635 | LD B,A | |||||||||
| 50636 | LD H,127 | Start the row at 127. | ||||||||
| 50638 | JR DrawBlockRow_Tile | |||||||||
| DrawBlockRow_Above | 50640 | LD B,H | Use the whole height when the row starts above the position. | |||||||
| 50641 | INC B | |||||||||
| DrawBlockRow_Tile | 50642 | LD A,L | A column of 176 needs no extra offset. | |||||||
| 50643 | CP 176 | |||||||||
| 50645 | JR Z,DrawBlockRow_Draw | |||||||||
| 50647 | LD A,(IY+5) | A row size of 16 is not drawn. | ||||||||
| 50650 | CP 16 | |||||||||
| 50652 | RET Z | |||||||||
| 50653 | LD A,(IY+6) | The offset is four times the position byte. | ||||||||
| 50656 | ADD A,A | |||||||||
| 50657 | ADD A,A | |||||||||
| 50658 | ADD A,C | |||||||||
| 50659 | LD C,A | |||||||||
| DrawBlockRow_Draw | 50660 | LD A,H | Keep the row number. | |||||||
| 50661 | LD HL,26222 | Look the tile up. The index and its high byte are patched. | ||||||||
| 50664 | LD E,0 | |||||||||
| 50666 | LD D,0 | |||||||||
| 50668 | ADD HL,DE | Add the index. | ||||||||
| 50669 | LD E,A | Keep the row number. | ||||||||
| 50670 | LD A,(HL) | Read the tile address. | ||||||||
| 50671 | INC HL | |||||||||
| 50672 | LD H,(HL) | |||||||||
| 50673 | LD L,A | |||||||||
| 50674 | LD A,0 | Compare the tile with the patched top bit. | ||||||||
| 50676 | XOR (HL) | |||||||||
| 50677 | CALL NZ,FlipBlockData | Flip the tile when they differ. | ||||||||
| 50680 | LD A,L | Add the column offset to the tile address. | ||||||||
| 50681 | ADD A,C | |||||||||
| 50682 | LD L,A | |||||||||
| 50683 | JR NC,DrawBlockRow_Offset | |||||||||
| 50685 | INC H | Count the carry in the high byte. | ||||||||
| DrawBlockRow_Offset | 50686 | INC HL | Remember the stack and read the tile through it. | |||||||
| 50687 | LD (23770),SP | |||||||||
| 50691 | LD SP,HL | |||||||||
| 50692 | EX DE,HL | Turn the row number into a screen address, 24 bytes per row. | ||||||||
| 50693 | ADD HL,HL | |||||||||
| 50694 | ADD HL,HL | |||||||||
| 50695 | ADD HL,HL | |||||||||
| 50696 | LD E,L | |||||||||
| 50697 | LD D,H | |||||||||
| 50698 | ADD HL,HL | |||||||||
| 50699 | ADD HL,DE | |||||||||
| 50700 | LD DE,(23739) | Add the strip address. | ||||||||
| 50704 | ADD HL,DE | |||||||||
|
This entry point is used by the routine at DrawBlockBytes.
|
||||||||||
| DrawBlockRow_Loop | 50705 | POP DE | Draw one byte of the row. | |||||||
| 50706 | LD A,E | |||||||||
| 50707 | CPL | |||||||||
| 50708 | AND (HL) | |||||||||
| 50709 | OR D | |||||||||
| 50710 | LD (HL),A | |||||||||
| 50711 | INC HL | |||||||||
| 50712 | POP DE | Draw the other byte of the row. | ||||||||
| 50713 | LD A,E | |||||||||
| 50714 | CPL | |||||||||
| 50715 | AND (HL) | |||||||||
| 50716 | OR D | |||||||||
| 50717 | LD (HL),A | |||||||||
| 50718 | LD DE,65511 | Step up to the next row of the screen. | ||||||||
| 50721 | ADD HL,DE | |||||||||
| 50722 | DJNZ DrawBlockRow_Loop | Repeat for the remaining rows. | ||||||||
| 50724 | LD SP,(23770) | Restore the stack pointer. | ||||||||
| 50728 | RET | Return. | ||||||||
| Prev: 50518 | Up: Map | Next: 50729 |