![]() |
Routines |
| Prev: 53391 | Up: Map | Next: 53536 |
|
Used by the routine at PrintSprite.
Draws the lines of a sprite one after the other. For each line the code jumps into the unrolled code, at a place that depends on the width of the sprite, and that is set by the jump that is changed by PrintSprite. The code for a sprite that is not on a byte boundary takes a pair of bytes off the stack, which are the mask and the data, shifts them across the two bytes of the buffer that they fall into with the table of shifted bytes in H, and keeps what is left of the second byte to go with the next pair. A sprite on a byte boundary jumps into DrawAlignedColumns instead.
|
||||
|
Jump into the unrolled columns.
|
||||
| DrawLines | 53433 | EX AF,AF' | Copy A to A'. | |
| 53434 | LD A,(BC) | Fetch the first byte of the buffer. | ||
| DrawLines_Jump | 53435 | JR DrawLines_Jump | Jump into the unrolled columns. | |
|
The patched jump at DrawLines_Jump lands here when the sprite is five columns wide.
|
||||
| DrawLines_FirstPair | 53437 | POP DE | Draw the first pair of a sprite that has five. | |
| 53438 | LD L,E | |||
| 53439 | AND (HL) | |||
| 53440 | LD L,D | |||
| 53441 | XOR (HL) | |||
| 53442 | CPL | |||
| 53443 | LD (BC),A | |||
| 53444 | INC BC | |||
| 53445 | INC H | |||
| 53446 | LD L,E | |||
| 53447 | LD A,(BC) | |||
| 53448 | AND (HL) | |||
| 53449 | LD L,D | |||
| 53450 | XOR (HL) | |||
| 53451 | CPL | |||
| 53452 | DEC H | |||
| 53453 | POP DE | Draw the second pair of a sprite that has four or five. | ||
| 53454 | LD L,E | |||
| 53455 | AND (HL) | |||
| 53456 | LD L,D | |||
| 53457 | XOR (HL) | |||
| 53458 | CPL | |||
| 53459 | LD (BC),A | |||
| 53460 | INC BC | |||
| 53461 | INC H | |||
| 53462 | LD L,E | |||
| 53463 | LD A,(BC) | |||
| 53464 | AND (HL) | |||
| 53465 | LD L,D | |||
| 53466 | XOR (HL) | |||
| 53467 | CPL | |||
| 53468 | DEC H | |||
| 53469 | POP DE | Draw the third pair of a sprite that has three or more. | ||
| 53470 | LD L,E | |||
| 53471 | AND (HL) | |||
| 53472 | LD L,D | |||
| 53473 | XOR (HL) | |||
| 53474 | CPL | |||
| 53475 | LD (BC),A | |||
| 53476 | INC BC | |||
| 53477 | INC H | |||
| 53478 | LD L,E | |||
| 53479 | LD A,(BC) | |||
| 53480 | AND (HL) | |||
| 53481 | LD L,D | |||
| 53482 | XOR (HL) | |||
| 53483 | CPL | |||
| 53484 | DEC H | |||
| 53485 | POP DE | Draw the fourth pair of a sprite that has two or more. | ||
| 53486 | LD L,E | |||
| 53487 | AND (HL) | |||
| 53488 | LD L,D | |||
| 53489 | XOR (HL) | |||
| 53490 | CPL | |||
| 53491 | LD (BC),A | |||
| 53492 | INC BC | |||
| 53493 | INC H | |||
| 53494 | LD L,E | |||
| 53495 | LD A,(BC) | |||
| 53496 | AND (HL) | |||
| 53497 | LD L,D | |||
| 53498 | XOR (HL) | |||
| 53499 | CPL | |||
| 53500 | DEC H | |||
| 53501 | POP DE | Draw the last pair. | ||
| 53502 | LD L,E | |||
| 53503 | AND (HL) | |||
| 53504 | LD L,D | |||
| 53505 | XOR (HL) | |||
| 53506 | CPL | |||
| 53507 | LD (BC),A | |||
| 53508 | INC BC | |||
| 53509 | INC H | |||
| 53510 | LD L,E | |||
| 53511 | LD A,(BC) | |||
| 53512 | AND (HL) | |||
| 53513 | LD L,D | |||
| 53514 | XOR (HL) | |||
| 53515 | CPL | |||
| 53516 | DEC H | |||
| 53517 | LD (BC),A | Write the last byte of the line. | ||
|
This entry point is used by the routine at DrawAlignedColumns.
Step on to the next line. The aligned columns jump here after their last column.
|
||||
| DrawLines_Next | 53518 | LD A,C | Fetch C. | |
| DrawLines_Step | 53519 | ADD A,0 | Add the step, which is changed for the width of the sprite. | |
| 53521 | LD C,A | Copy it to C. | ||
| 53522 | LD A,B | Fetch B. | ||
| 53523 | ADC A,0 | Add 0 with carry. | ||
| 53525 | LD B,A | Copy it to B. | ||
| 53526 | EX AF,AF' | Fetch A'. | ||
| 53527 | DEC A | Decrement A. | ||
| 53528 | JP NZ,DrawLines | Jump to DrawLines if it is not zero. | ||
| 53531 | LD SP,(23305) | Fetch SavedStackPointer and return. | ||
| 53535 | RET | |||
|
View the equivalent code in;
|
||||
| Prev: 53391 | Up: Map | Next: 53536 |