Prev: C646 Up: Map Next: C704
C6C5: Draw Block Span
Used by the routine at DrawOverlappedBlock.
Draws the part of a block that falls inside the view, then draws its tile with C735. A span that reaches 7F is shortened. The height is given to both row counts, and the row becomes a strip address.
DrawBlockSpan C6C5 LD A,L The span starts above the position byte.
C6C6 SUB B
C6C7 JR NC,DrawBlockSpan_Upper
C6C9 LD B,L Use the whole span when it does.
C6CA INC B
C6CB JR DrawBlockSpan_Draw
DrawBlockSpan_Upper C6CD LD A,L Shorten a span that starts at 7F or beyond.
C6CE SUB $7F
C6D0 JR C,DrawBlockSpan_Draw
C6D2 LD C,A Shorten the height by that overflow.
C6D3 ADD A,H
C6D4 LD H,A
C6D5 LD A,C
C6D6 NEG
C6D8 ADD A,B
C6D9 RET Z Nothing to draw when the height falls to zero.
C6DA LD B,A The height is what remains, and the row starts at 7F.
C6DB LD L,$7F
DrawBlockSpan_Draw C6DD LD A,B Give the height to both row counts.
C6DE LD ($C794),A
C6E1 LD ($C7A6),A
C6E4 LD C,H The column offset is four times the row's high byte.
C6E5 SLA C
C6E7 SLA C
C6E9 LD H,$00 Turn the row into a screen address, 18 bytes per row.
C6EB ADD HL,HL
C6EC ADD HL,HL
C6ED ADD HL,HL
C6EE LD E,L
C6EF LD D,H
C6F0 ADD HL,HL
C6F1 ADD HL,DE
C6F2 LD DE,$E5B9 Add the base just before the screen buffer.
C6F5 ADD HL,DE
C6F6 LD ($5CBB),HL Keep that as the strip address.
C6F9 LD A,($C657) Read the column limit.
C6FC AND %11111000 Use its top five bits.
C6FE ADD A,$10 Add 10 to make the limit passed to the tile.
C700 LD B,A
C701 JP DrawBlockRowData_Tile Draw the tile.
Prev: C646 Up: Map Next: C704