![]() |
Routines |
| Prev: B4C0 | Up: Map | Next: B540 |
|
Draws the rows of a sprite that is shifted by one to three pixels, using the stack pointer to read the sprite data. The shifted bytes are found in the tables that start at the page in H, and one more byte than the width is drawn. There are four entry points, which are for widths of four, three, two and one bytes. The address in the table at RowRoutineTable is the entry point for the width.
|
||||||||||||||
| DrawShiftedRows | B4E8 | POP BC | Draw one byte of the shifted sprite. | |||||||||||
| B4E9 | LD L,C | |||||||||||||
| B4EA | AND (HL) | |||||||||||||
| B4EB | LD L,B | |||||||||||||
| B4EC | XOR (HL) | |||||||||||||
| B4ED | CPL | |||||||||||||
| B4EE | LD (DE),A | |||||||||||||
| B4EF | INC DE | |||||||||||||
| B4F0 | INC H | |||||||||||||
| B4F1 | LD L,C | |||||||||||||
| B4F2 | LD A,(DE) | |||||||||||||
| B4F3 | AND (HL) | |||||||||||||
| B4F4 | LD L,B | |||||||||||||
| B4F5 | XOR (HL) | |||||||||||||
| B4F6 | CPL | |||||||||||||
| B4F7 | DEC H | |||||||||||||
| DrawShiftedRows_Three | B4F8 | POP BC | Draw one byte of the shifted sprite. | |||||||||||
| B4F9 | LD L,C | |||||||||||||
| B4FA | AND (HL) | |||||||||||||
| B4FB | LD L,B | |||||||||||||
| B4FC | XOR (HL) | |||||||||||||
| B4FD | CPL | |||||||||||||
| B4FE | LD (DE),A | |||||||||||||
| B4FF | INC DE | |||||||||||||
| B500 | INC H | |||||||||||||
| B501 | LD L,C | |||||||||||||
| B502 | LD A,(DE) | |||||||||||||
| B503 | AND (HL) | |||||||||||||
| B504 | LD L,B | |||||||||||||
| B505 | XOR (HL) | |||||||||||||
| B506 | CPL | |||||||||||||
| B507 | DEC H | |||||||||||||
|
This entry point is used by the routine at DrawBlockBytes.
|
||||||||||||||
| DrawShiftedRows_Two | B508 | POP BC | Draw one byte of the shifted sprite. | |||||||||||
| B509 | LD L,C | |||||||||||||
| B50A | AND (HL) | |||||||||||||
| B50B | LD L,B | |||||||||||||
| B50C | XOR (HL) | |||||||||||||
| B50D | CPL | |||||||||||||
| B50E | LD (DE),A | |||||||||||||
| B50F | INC DE | |||||||||||||
| B510 | INC H | |||||||||||||
| B511 | LD L,C | |||||||||||||
| B512 | LD A,(DE) | |||||||||||||
| B513 | AND (HL) | |||||||||||||
| B514 | LD L,B | |||||||||||||
| B515 | XOR (HL) | |||||||||||||
| B516 | CPL | |||||||||||||
| B517 | DEC H | |||||||||||||
|
This entry point is used by the routine at DrawNeedleTip.
|
||||||||||||||
| DrawShiftedRows_One | B518 | POP BC | Draw one byte of the shifted sprite. | |||||||||||
| B519 | LD L,C | |||||||||||||
| B51A | AND (HL) | |||||||||||||
| B51B | LD L,B | |||||||||||||
| B51C | XOR (HL) | |||||||||||||
| B51D | CPL | |||||||||||||
| B51E | LD (DE),A | |||||||||||||
| B51F | INC DE | |||||||||||||
| B520 | INC H | |||||||||||||
| B521 | LD L,C | |||||||||||||
| B522 | LD A,(DE) | |||||||||||||
| B523 | AND (HL) | |||||||||||||
| B524 | LD L,B | |||||||||||||
| B525 | XOR (HL) | |||||||||||||
| B526 | CPL | |||||||||||||
| B527 | DEC H | |||||||||||||
|
The row count is held in the alternate accumulator. The width subtracted below, and the two jumps, are patched before the routine is entered.
|
||||||||||||||
| DrawShiftedRows_Store | B528 | LD (DE),A | Write the prepared byte. | |||||||||||
| B529 | EX AF,AF' | Count a row, and finish when none remain. | ||||||||||||
| B52A | DEC A | |||||||||||||
| B52B | JR Z,DrawShiftedRows_Return | |||||||||||||
| B52D | EX AF,AF' | Bring the sprite byte back. | ||||||||||||
| B52E | LD A,E | Step back by the patched width. | ||||||||||||
| B52F | SUB $00 | |||||||||||||
| B531 | LD E,A | |||||||||||||
| B532 | LD A,(DE) | Read the first byte of the next row. | ||||||||||||
| DrawShiftedRows_Step | B533 | JP NC,DrawShiftedRows_Step | Stay on this page if the step did not borrow. | |||||||||||
| B536 | DEC D | Move to the previous page and read its byte. | ||||||||||||
| B537 | LD A,(DE) | |||||||||||||
| DrawShiftedRows_Patched | B538 | JP DrawShiftedRows_Patched | Draw the next row. The target is patched. | |||||||||||
| DrawShiftedRows_Return | B53B | LD SP,($5CDA) | Restore the stack pointer. | |||||||||||
| B53F | RET | Return. | ||||||||||||
| Prev: B4C0 | Up: Map | Next: B540 |