Prev: 949C Up: Map Next: 9565
9542: Sprite plotter for back buffer, up to 64px wide, 15px high, no mask, flips
The back buffer pointer is advanced by the byte width so that the rows fill right to left, then the odd or even width inner loop is chosen as in plot_sprite. Each byte is bit reversed through the flip table before it is stored, which is what mirrors the sprite.
Used by the routines at draw_object_right and draw_hero_car.
Input
A Plot (A + 1) * 8 pixels
HL Address in back buffer to plot at
B' Height in rows
DE' Stride of bitmap data in bytes
HL' Address of bitmap data
plot_sprite_flipped 9542 LD D,$00 Advance the back buffer pointer to the end of the first line, so we can draw in reverse
9544 LD E,A
9545 ADD HL,DE
9546 SRL A Use plot_sprite_flipped_odd if the bottom bit is set (odd widths)
9548 JP C,plot_sprite_flipped_odd
954B LD ($956B),SP Save SP to restore on exit (self modify)
954F LD IX,$9575 IX = Base of jump table
9553 CPL (~A + 5) is (4 - A) is the number of plot operations to skip
9554 ADD A,$05
9556 LD C,A Multiply A by 9: the length of an individual plot operation
9557 RLCA
9558 RLCA
9559 RLCA
955A ADD A,C
955B LD C,A Move result to BC
955C LD B,$00
955E ADD IX,BC Add it to IX to complete the jump target
9560 LD D,$EF Point DE at table of flipped bytes at $EF00
9562 EXX Bank
9563 LD D,$00
FALLTHROUGH
Prev: 949C Up: Map Next: 9565