Prev: B69E Up: Map Next: B716
B6D6: Draw a masked bitmap at (E,D)
Used by the routines at draw_hero_car, draw_smoke and draw_crash.
Input
B Height (in rows)
C (byte width - 1) if flipping, 0 if not
D Vertical position (rows)
E Horizontal position (pixels)
HL Address of bitmap data
B' Non-zero to draw the sprite flipped horizontally
C' Horizontal start offset within the sprite
D' Not an input. B714 zeroes it as the high byte of the stride
E' Sprite row stride in bytes
draw_masked_sprite_rel_car B6D6 LD A,($A22A) Subtract car_y from vertical position
B6D9 NEG
B6DB ADD A,D
B6DC LD D,A
This entry point is used by the routines at draw_scene_objects and draw_debris.
draw_masked_sprite B6DD LD A,E Divide E by 8
B6DE AND $F8
B6E0 RRCA
B6E1 RRCA
B6E2 RRCA
B6E3 LD E,A
B6E4 LD A,D A' = D
B6E5 EX AF,AF'
B6E6 LD A,D D = (D & $0F) + $F0
B6E7 AND $0F
B6E9 ADD A,$F0
B6EB LD D,A
B6EC EX AF,AF' Preserve A & save carry flag?
B6ED AND $70 E += (A & $70) * 2
B6EF ADD A,A
B6F0 ADD A,E
B6F1 LD E,A
B6F2 PUSH DE
B6F3 LD E,C E = C -- byte width
B6F4 SLA E E <<= 1
B6F6 EXX
B6F7 POP HL
B6F8 LD A,E A = E
B6F9 SRL B B >>= 1
B6FB EX AF,AF' Preserve carry flag (flip flag)
B6FC ADD HL,BC HL += BC
B6FD EX AF,AF' Restore carry flag (flip flag)
B6FE JP C,plot_masked_sprite_flipped_entrypt2
This entry point is used by the routine at draw_object_right.
plot_masked_sprite_by_width B701 LD IX,$B729 Point IX at pms_jumptable
B705 CPL A = ~A + 9 == (8 - A)
B706 ADD A,$09
B708 RLCA This multiplies by six - the length of each load-mask-store step in the plotter core.
B709 LD C,A
B70A RLCA
B70B ADD A,C
B70C LD C,A Add that to IX
B70D LD B,$00
B70F ADD IX,BC
B711 LD B,$0F B' = 15 -- Set mask used by scanline calculation in plot_masked_sprite
B713 EXX
B714 LD D,$00 D = 0 -- Clear top byte of source data stride; fall through into plot_masked_sprite
FALL THROUGH
Prev: B69E Up: Map Next: B716