![]() |
Routines |
| Prev: D0B9 | Up: Map | Next: D120 |
|
Entered by the JR in SPRITE_ROW, as many 16-byte units from the end as the sprite is wide. H is the first of the two pages BUILD_LOOKUP_TBLS built for this shift. The tables hold complements, so each byte is ANDed with the complement of the mask shifted, and XORed with the complement of the image shifted and complemented again -- which comes to the buffer byte cleared under the shifted mask with the shifted image put in. Page H gives the part of a mask or image byte that stays in the current buffer byte, which is finished and stored; page H + 1 the part that falls into the next, which is begun and left in A for the next unit. The byte the last unit begins is stored after the fifth.
Then, for both runs, BC steps up to the next row by the amount patched into the ADD below, and the loop goes round until A' runs out. The real stack pointer comes back from SAVED_SP, and the RET is the return from CALC_PIXEL_XY_AND_RENDER.
|
||||||||||||||
| SPRITE_SHIFTED_RUN | D0BD | POP DE | The first unit: the buffer byte cleared under the mask and with the image put in, shifted right, and stored | |||||||||||
| D0BE | LD L,E | |||||||||||||
| D0BF | AND (HL) | |||||||||||||
| D0C0 | LD L,D | |||||||||||||
| D0C1 | XOR (HL) | |||||||||||||
| D0C2 | CPL | |||||||||||||
| D0C3 | LD (BC),A | |||||||||||||
| D0C4 | INC BC | |||||||||||||
| D0C5 | INC H | The bits that fall out, into the next buffer byte, left in A | ||||||||||||
| D0C6 | LD L,E | |||||||||||||
| D0C7 | LD A,(BC) | |||||||||||||
| D0C8 | AND (HL) | |||||||||||||
| D0C9 | LD L,D | |||||||||||||
| D0CA | XOR (HL) | |||||||||||||
| D0CB | CPL | |||||||||||||
| D0CC | DEC H | |||||||||||||
| D0CD | POP DE | Four more units the same | ||||||||||||
| D0CE | LD L,E | |||||||||||||
| D0CF | AND (HL) | |||||||||||||
| D0D0 | LD L,D | |||||||||||||
| D0D1 | XOR (HL) | |||||||||||||
| D0D2 | CPL | |||||||||||||
| D0D3 | LD (BC),A | |||||||||||||
| D0D4 | INC BC | |||||||||||||
| D0D5 | INC H | |||||||||||||
| D0D6 | LD L,E | |||||||||||||
| D0D7 | LD A,(BC) | |||||||||||||
| D0D8 | AND (HL) | |||||||||||||
| D0D9 | LD L,D | |||||||||||||
| D0DA | XOR (HL) | |||||||||||||
| D0DB | CPL | |||||||||||||
| D0DC | DEC H | |||||||||||||
| D0DD | POP DE | |||||||||||||
| D0DE | LD L,E | |||||||||||||
| D0DF | AND (HL) | |||||||||||||
| D0E0 | LD L,D | |||||||||||||
| D0E1 | XOR (HL) | |||||||||||||
| D0E2 | CPL | |||||||||||||
| D0E3 | LD (BC),A | |||||||||||||
| D0E4 | INC BC | |||||||||||||
| D0E5 | INC H | |||||||||||||
| D0E6 | LD L,E | |||||||||||||
| D0E7 | LD A,(BC) | |||||||||||||
| D0E8 | AND (HL) | |||||||||||||
| D0E9 | LD L,D | |||||||||||||
| D0EA | XOR (HL) | |||||||||||||
| D0EB | CPL | |||||||||||||
| D0EC | DEC H | |||||||||||||
| D0ED | POP DE | |||||||||||||
| D0EE | LD L,E | |||||||||||||
| D0EF | AND (HL) | |||||||||||||
| D0F0 | LD L,D | |||||||||||||
| D0F1 | XOR (HL) | |||||||||||||
| D0F2 | CPL | |||||||||||||
| D0F3 | LD (BC),A | |||||||||||||
| D0F4 | INC BC | |||||||||||||
| D0F5 | INC H | |||||||||||||
| D0F6 | LD L,E | |||||||||||||
| D0F7 | LD A,(BC) | |||||||||||||
| D0F8 | AND (HL) | |||||||||||||
| D0F9 | LD L,D | |||||||||||||
| D0FA | XOR (HL) | |||||||||||||
| D0FB | CPL | |||||||||||||
| D0FC | DEC H | |||||||||||||
| D0FD | POP DE | |||||||||||||
| D0FE | LD L,E | |||||||||||||
| D0FF | AND (HL) | |||||||||||||
| D100 | LD L,D | |||||||||||||
| D101 | XOR (HL) | |||||||||||||
| D102 | CPL | |||||||||||||
| D103 | LD (BC),A | |||||||||||||
| D104 | INC BC | |||||||||||||
| D105 | INC H | |||||||||||||
| D106 | LD L,E | |||||||||||||
| D107 | LD A,(BC) | |||||||||||||
| D108 | AND (HL) | |||||||||||||
| D109 | LD L,D | |||||||||||||
| D10A | XOR (HL) | |||||||||||||
| D10B | CPL | |||||||||||||
| D10C | DEC H | |||||||||||||
| D10D | LD (BC),A | Store the last spilled byte | ||||||||||||
|
This entry point is used by the routine at SPRITE_ALIGNED_RUN.
|
||||||||||||||
| SPRITE_NEXT_ROW | D10E | LD A,C | BC up a row: the ADD's operand patched by CALC_PIXEL_XY_AND_RENDER to 33 less the bytes a row touches | |||||||||||
| D10F | ADD A,$00 | |||||||||||||
| D111 | LD C,A | |||||||||||||
| D112 | LD A,B | |||||||||||||
| D113 | ADC A,$00 | |||||||||||||
| D115 | LD B,A | |||||||||||||
| D116 | EX AF,AF' | The next row, until the height runs out | ||||||||||||
| D117 | DEC A | |||||||||||||
| D118 | JP NZ,SPRITE_ROW | |||||||||||||
| D11B | LD SP,(SAVED_SP) | The real stack pointer back; return from CALC_PIXEL_XY_AND_RENDER | ||||||||||||
| D11F | RET | |||||||||||||
| Prev: D0B9 | Up: Map | Next: D120 |