Prev: 50758 Up: Map Next: 50948
50885: 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 50997. A span that reaches 127 is shortened. The height is given to both row counts, and the row becomes a strip address.
DrawBlockSpan 50885 LD A,L The span starts above the position byte.
50886 SUB B
50887 JR NC,DrawBlockSpan_Upper
50889 LD B,L Use the whole span when it does.
50890 INC B
50891 JR DrawBlockSpan_Draw
DrawBlockSpan_Upper 50893 LD A,L Shorten a span that starts at 127 or beyond.
50894 SUB 127
50896 JR C,DrawBlockSpan_Draw
50898 LD C,A Shorten the height by that overflow.
50899 ADD A,H
50900 LD H,A
50901 LD A,C
50902 NEG
50904 ADD A,B
50905 RET Z Nothing to draw when the height falls to zero.
50906 LD B,A The height is what remains, and the row starts at 127.
50907 LD L,127
DrawBlockSpan_Draw 50909 LD A,B Give the height to both row counts.
50910 LD (51092),A
50913 LD (51110),A
50916 LD C,H The column offset is four times the row's high byte.
50917 SLA C
50919 SLA C
50921 LD H,0 Turn the row into a screen address, 24 bytes per row.
50923 ADD HL,HL
50924 ADD HL,HL
50925 ADD HL,HL
50926 LD E,L
50927 LD D,H
50928 ADD HL,HL
50929 ADD HL,DE
50930 LD DE,58809 Add the base just before the screen buffer.
50933 ADD HL,DE
50934 LD (23739),HL Keep that as the strip address.
50937 LD A,(50775) Read the column limit.
50940 AND %11111000 Use its top five bits.
50942 ADD A,16 Add 16 to make the limit passed to the tile.
50944 LD B,A
50945 JP DrawBlockRowData_Tile Draw the tile.
Prev: 50758 Up: Map Next: 50948