Prev: 92E1 Up: Map Next: 9542
949C: Sprite plotter for back buffer, up to 64px wide, 15px high, no mask, no flip
Used by the routines at reveal_perp_car, draw_object_right and draw_car.
Input
A Plot (A + 1) * 8 pixels
DE' Stride of bitmap data in bytes
HL Address in back buffer to plot at
HL' Address of bitmap data
plot_sprite 949C SRL A Use ps_odd if the bottom bit is set (odd widths)
949E JP C,ps_odd
94A1 LD IX,$94C8 IX = Base of jump table
94A5 CPL (~A + 5) is (4 - A) is the number of plot operations to skip
94A6 ADD A,$05
94A8 LD C,A Multiply A by 5: the length of an individual plot operation
94A9 RLCA
94AA RLCA
94AB ADD A,C
94AC LD C,A Move result to BC
94AD LD B,$00
94AF ADD IX,BC Add it to IX to complete the jump target
This entry point is used by the routine at draw_object_right.
plot_sprite_entry 94B1 LD ($94BF),SP Save SP to restore later (self modify)
94B5 LD BC,$0F10 B = 15 rows to draw, C = 16, an increment value used later
94B8 EXX Bank
94B9 JR ps_even_body Jump into body of loop
ps_even_loop 94BB EXX Bank
ps_even_continue 94BC DJNZ ps_even_next Next scanline
94BE LD SP,$0000 Restore SP (self modified)
94C1 RET Return
ps_even_next 94C2 ADD HL,DE Calculate address of next bitmap scanline
ps_even_body 94C3 LD SP,HL Put it in SP (so we can use POP for speed)
94C4 EXX Unbank
94C5 LD A,L
94C6 JP (IX) Jump table
ps_jumptable 94C8 POP DE Transfer two bitmap bytes (16 pixels) from the "stack" to screen buffer
94C9 LD (HL),E
94CA INC L
94CB LD (HL),D
94CC INC L
94CD POP DE Transfer another 16 pixels
94CE LD (HL),E
94CF INC L
94D0 LD (HL),D
94D1 INC L
94D2 POP DE Transfer another 16 pixels
94D3 LD (HL),E
94D4 INC L
94D5 LD (HL),D
94D6 INC L
94D7 POP DE Transfer another 16 pixels
94D8 LD (HL),E
94D9 INC L
94DA LD (HL),D
94DB LD L,A Restore HL
94DC LD A,H Save H in A then H--
94DD DEC H
94DE AND B Extract low four bits of row address
94DF JP NZ,ps_even_loop If zero we'll need to handle it below, otherwise just loop
94E2 LD A,H H += 16
94E3 ADD A,C
94E4 LD H,A
94E5 LD A,L Decrement the high three bits of row address
94E6 SUB $20
94E8 LD L,A
94E9 JP NC,ps_even_loop No carry, so finish scanline
94EC LD A,H H -= 16
94ED SUB C Loop back to ps_even_loop
94EE LD H,A
94EF JP ps_even_loop
ps_odd 94F2 INC A Increment A for upcoming calculation
94F3 LD IX,$951A Point IX at start of plot instructions
94F7 CPL (~A + 5) is (4 - A) is the number of plot operations to skip
94F8 ADD A,$05
94FA LD C,A Multiply A by 5: the length of an individual plot operation
94FB RLCA
94FC RLCA
94FD ADD A,C
94FE LD C,A Move result to BC
94FF LD B,$00
9501 ADD IX,BC Add it to IX to complete the jump target
9503 LD ($9511),SP Save SP to restore later (self modify)
9507 LD BC,$0F10 B = 15 rows to draw, C = 16, an increment value used later
950A EXX Bank
950B JR ps_odd_body Jump into body of loop
ps_odd_loop 950D EXX Bank
ps_odd_continue 950E DJNZ ps_odd_next Next scanline
9510 LD SP,$0000 Restore SP (self modified)
9513 RET Return
ps_odd_next 9514 ADD HL,DE Calculate address of next bitmap scanline
ps_odd_body 9515 LD SP,HL Put it in SP (so we can use POP for speed)
9516 EXX Unbank
9517 LD A,L
9518 JP (IX) Jump table
951A POP DE Transfer two bitmap bytes (16 pixels) from the "stack" to screen buffer
951B LD (HL),E
951C INC L
951D LD (HL),D
951E INC L
951F POP DE Transfer another 16 pixels
9520 LD (HL),E
9521 INC L
9522 LD (HL),D
9523 INC L
9524 POP DE Transfer another 16 pixels
9525 LD (HL),E
9526 INC L
9527 LD (HL),D
9528 INC L
9529 POP DE Transfer another 8 pixels
952A LD (HL),E
952B LD L,A Restore HL
952C LD A,H Save H in A then H--
952D DEC H
Decrement the screen address.
952E AND B Extract low four bits of row address
952F JP NZ,ps_odd_loop If zero we'll need to handle it below, otherwise just loop
9532 LD A,H H += 16
9533 ADD A,C
9534 LD H,A
9535 LD A,L Decrement the high three bits of row address
9536 SUB $20
9538 LD L,A
9539 JP NC,ps_odd_loop No carry, so finish scanline
953C LD A,H H -= 16
953D SUB C
953E LD H,A
953F JP ps_odd_loop Loop back to ps_odd_loop
Prev: 92E1 Up: Map Next: 9542