| ← B9FC | Map | BB11 → |
BA8B: Blit an object's sprite shifted N pixels, over three columns
|
Blits each row of a sprite shifted right by N pixels across three back-buffer columns, then stamps the dirty counters of the cells it covered. It is entered by a jump.
|
|||
| draw_shifted_body | BA8B | ADD HL,HL | Shift staircase: Eight less N of these ADD HL,HL / ADC A,A pairs run. They shift the row right by N pixels into A:H:L. |
| BA8C | ADC A,A | ||
| BA8D | ADD HL,HL | ||
| BA8E | ADC A,A | ||
| BA8F | ADD HL,HL | ||
| BA90 | ADC A,A | ||
| BA91 | ADD HL,HL | ||
| BA92 | ADC A,A | ||
| BA93 | ADD HL,HL | ||
| BA94 | ADC A,A | ||
| BA95 | ADD HL,HL | ||
| BA96 | ADC A,A | ||
| BA97 | ADD HL,HL | ||
| BA98 | ADC A,A | ||
| BA99 | ADD HL,HL | ||
| BA9A | ADC A,A | ||
|
The shifted row spans three columns. The base column has its leftmost N pixels blank, then comes the middle column, and the rest spills into a third column on the right.
|
|||
| BA9B | LD E,A | OR-blit A, H and L into three consecutive back-buffer columns, then step C back to the base column. | |
| BA9C | LD A,(BC) | ||
| BA9D | OR E | ||
| BA9E | LD (BC),A | ||
| BA9F | INC C | ||
| BAA0 | LD A,(BC) | ||
| BAA1 | OR H | ||
| BAA2 | LD (BC),A | ||
| BAA3 | INC C | ||
| BAA4 | LD A,(BC) | ||
| BAA5 | OR L | ||
| BAA6 | LD (BC),A | ||
| BAA7 | DEC C | ||
| BAA8 | DEC C | ||
| BAA9 | INC B | Step down one pixel row, and carry across the character-cell and third boundaries. | |
| BAAA | LD A,B | ||
| BAAB | AND $07 | ||
| BAAD | JR NZ,draw_shifted_next_row | ||
| BAAF | LD A,C | ||
| BAB0 | AND $E0 | ||
| BAB2 | CP $E0 | ||
| BAB4 | JR Z,draw_shifted_third | ||
| BAB6 | LD A,B | ||
| BAB7 | SUB $08 | ||
| BAB9 | LD B,A | ||
| BABA | LD A,C | ||
| BABB | ADD A,$20 | ||
| BABD | LD C,A | ||
| BABE | JP draw_shifted_next_row | ||
| draw_shifted_third | BAC1 | LD A,C | That row crossed a screen third: wrap the low byte and step into the next third. |
| BAC2 | SUB $E0 | ||
| BAC4 | LD C,A | ||
| draw_shifted_next_row | BAC5 | EX AF,AF' | Loop until all 16 rows are drawn. |
| BAC6 | DEC A | ||
| BAC7 | JR NZ,draw_shifted_row | ||
| BAC9 | LD SP,(draw_sp_save) | Restore SP, then stamp the work buffer's dirty counter for every cell the sprite covered, across all three columns. A sprite flush with a character row covers only two rows of them. | |
| BACD | POP HL | ||
| BACE | LD A,H | ||
| BACF | LD C,H | ||
| BAD0 | AND $18 | ||
| BAD2 | RRCA | ||
| BAD3 | RRCA | ||
| BAD4 | RRCA | ||
| BAD5 | ADD A,WORKBUF_FB/$100 | ||
| BAD7 | LD H,A | ||
| BAD8 | LD A,C | ||
| BAD9 | AND $07 | ||
| BADB | JP NZ,draw_shifted_stamp_low | ||
| BADE | LD (HL),$02 | ||
| BAE0 | INC L | ||
| BAE1 | LD (HL),$02 | ||
| BAE3 | INC L | ||
| BAE4 | LD (HL),$02 | ||
| BAE6 | CALL advance_buffer_row | ||
| BAE9 | LD (HL),$02 | ||
| BAEB | DEC L | ||
| BAEC | LD (HL),$02 | ||
| BAEE | DEC L | ||
| BAEF | LD (HL),$02 | ||
| BAF1 | RET | ||
| draw_shifted_stamp_low | BAF2 | LD (HL),$02 | A sprite that straddles a character row covers three rows of cells. |
| BAF4 | INC L | ||
| BAF5 | LD (HL),$02 | ||
| BAF7 | INC L | ||
| BAF8 | LD (HL),$02 | ||
| BAFA | CALL advance_buffer_row | ||
| BAFD | LD (HL),$02 | ||
| BAFF | DEC L | ||
| BB00 | LD (HL),$02 | ||
| BB02 | DEC L | ||
| BB03 | LD (HL),$02 | ||
| BB05 | CALL advance_buffer_row | ||
| BB08 | LD (HL),$02 | ||
| BB0A | INC L | ||
| BB0B | LD (HL),$02 | ||
| BB0D | INC L | ||
| BB0E | LD (HL),$02 | ||
| BB10 | RET | ||
| ← B9FC | Map | BB11 → |
