Prev: DBB7 Up: Map Next: DC47
DBFD: Draw a mirrored sloped step cut off by the left edge
Used by the routine at step_dispatch.
Reached through step_dispatch (dispatch 11) for a sloped step of a piece running left (directions 4-6 and their ceilings) that hangs over the left edge. Those directions are drawn as mirror images: each byte is looked up in the bit-reversing table bit_reverse_table with B = its page and C = the byte, so the row count lives in B' and the loop switches register sets. HL goes to column 1; INC SP and the first patched JR skip one or two graphic bytes; the second patched JR (displacement 0, $26 or $2A, set by slope_step_at_left_edge) picks how many columns of each row pair are written.
This was code partly typed as data in the first code map.
Input
A Row pairs
HL Screen address
SP The step's graphic
blit_mirrored_left_clip DBFD EXX Row count into B'.
DBFE LD B,A
DBFF EXX
DC00 LD A,L Column 1 of this character row.
DC01 INC A
DC02 INC A
DC03 AND $E0
DC05 INC A
DC06 LD L,A
DC07 LD B,$F9 B = the page of the bit-reversing table.
DC09 EXX Skip one graphic byte...
DC0A INC SP
blit_mirrored_left_clip_0 DC0B JR blit_mirrored_left_clip_0 ...patched: and another (displacement 0) or not (1).
DC0D INC SP The second byte skipped.
blit_mirrored_left_clip_1 DC0E EXX Lower row, column 1, mirrored.
DC0F POP DE
DC10 LD C,E
DC11 LD A,(BC)
DC12 LD (HL),A
blit_mirrored_left_clip_2 DC13 JR blit_mirrored_left_clip_2 Patched: how much more of the row pair is drawn.
DC15 INC L Column 2; up a row; upper row column 2.
DC16 LD C,D
DC17 LD A,(BC)
DC18 LD (HL),A
DC19 DEC H
DC1A POP DE
DC1B LD C,E
DC1C LD A,(BC)
DC1D LD (HL),A
DC1E DEC L
blit_mirrored_left_clip_3 DC1F LD C,D Upper row, column 1.
DC20 LD A,(BC)
DC21 LD (HL),A
blit_mirrored_left_clip_4 DC22 POP DE Pass the rest of the row pair.
DC23 DEC H Up a pixel row, crossing a character row if need be.
DC24 LD A,H
DC25 INC A
DC26 AND $07
DC28 JR NZ,blit_mirrored_left_clip_5
DC2A LD A,L
DC2B SUB $20
DC2D LD L,A
DC2E JR C,blit_mirrored_left_clip_5
DC30 LD A,H
DC31 ADD A,$08
DC33 LD H,A
blit_mirrored_left_clip_5 DC34 EXX Next row pair (counted in B'); done.
DC35 DJNZ blit_mirrored_left_clip_1
DC37 EXX
DC38 JP after_step_drawn
DC3B DEC H One column of a two-byte step: up a row, the upper row's byte.
DC3C JP blit_mirrored_left_clip_3
DC3F DEC H One column of a three-byte step: up a row, the upper row's byte, pass a pair.
DC40 LD C,D
DC41 LD A,(BC)
DC42 LD (HL),A
DC43 POP DE
DC44 JP blit_mirrored_left_clip_4
Prev: DBB7 Up: Map Next: DC47