![]() |
Routines |
| Prev: 48409 | Up: Map | Next: 48550 |
|
Used by the routine at Draw_Sprites.
|
||||||||||||
|
Look up the sprite graphic data address. Each frame is 32 bytes.
|
||||||||||||
| Draw_3Wide_Sprite_Column | 48478 | LD (48514),A | Self-modify the shift jump offset at 48514. | |||||||||
| 48481 | PUSH HL | Stash the screen buffer address on the stack. | ||||||||||
| 48482 | LD DE,43835 | Point DE at Sprite_01 (3-wide sprite frame table base). | ||||||||||
| 48485 | LD L,(IX+3) | Load the frame ID from *IX+3 and decrement to make it zero-indexed. | ||||||||||
| 48488 | DEC L | |||||||||||
| 48489 | LD H,0 | Multiply the frame index by 32 and add to the table base to get the graphic data address. | ||||||||||
| 48491 | ADD HL,HL | |||||||||||
| 48492 | ADD HL,HL | |||||||||||
| 48493 | ADD HL,HL | |||||||||||
| 48494 | ADD HL,HL | |||||||||||
| 48495 | ADD HL,HL | |||||||||||
| 48496 | ADD HL,DE | |||||||||||
| 48497 | EX DE,HL | Exchange so DE points to the sprite graphic data. | ||||||||||
| 48498 | POP HL | Restore the screen buffer address from the stack. | ||||||||||
|
Draw two column pairs, each 16 pixels tall, covering three screen columns. C holds a mask of 7 used to detect character cell boundaries for screen address adjustment.
|
||||||||||||
| 48499 | LD B,2 | Set the column pair counter to 2 in B. | ||||||||||
| Draw_3Wide_Column_Loop | 48501 | LD C,7 | Set the row boundary mask to 7 in C. | |||||||||
| Draw_3Wide_Sprite_Column_0 | 48503 | PUSH BC | Stash the column pair counter and screen buffer address on the stack. | |||||||||
| 48504 | PUSH HL | |||||||||||
| 48505 | LD B,16 | Set the row counter to 16 in B. | ||||||||||
|
For each row, read a byte of sprite data, shift it left by the self-modified amount and OR the resulting two bytes across two adjacent screen buffer columns.
|
||||||||||||
| Draw_3Wide_Row_Loop | 48507 | PUSH DE | Stash the graphic data pointer and screen buffer address on the stack. | |||||||||
| 48508 | PUSH HL | |||||||||||
|
Read the sprite data byte and shift it into a 16-bit value in HL.
The shift amount at 48514 was self-modified on entry to control the horizontal pixel alignment.
|
||||||||||||
| 48509 | LD A,(DE) | Load the graphic byte from *DE. | ||||||||||
| 48510 | LD L,A | Transfer sprite byte to HL (clearing the high byte). | ||||||||||
| 48511 | LD H,0 | |||||||||||
| 48513 | JR Shift_3Wide_Fine | Jump into the shift sequence (self-modified offset controls the number of shifts applied). | ||||||||||
| Shift_3Wide_Extra | 48515 | ADD HL,HL | Shift HL left one position (extra shift). | |||||||||
| Shift_3Wide_Fine | 48516 | ADD HL,HL | Shift HL left seven positions; the total shift spreads the graphic byte across H and L. | |||||||||
| 48517 | ADD HL,HL | |||||||||||
| 48518 | ADD HL,HL | |||||||||||
| 48519 | ADD HL,HL | |||||||||||
| 48520 | ADD HL,HL | |||||||||||
| 48521 | ADD HL,HL | |||||||||||
| 48522 | ADD HL,HL | |||||||||||
|
OR the shifted sprite data onto the screen buffer across two adjacent columns.
|
||||||||||||
| 48523 | POP DE | Restore the screen buffer address into DE, keeping a copy on the stack. | ||||||||||
| 48524 | PUSH DE | |||||||||||
| 48525 | EX DE,HL | Exchange so HL=screen buffer address, DE=shifted sprite data. | ||||||||||
| 48526 | LD A,D | OR the high byte of the shifted data onto the first screen column at *HL. | ||||||||||
| 48527 | OR (HL) | |||||||||||
| 48528 | LD (HL),A | |||||||||||
| 48529 | INC L | Advance to the next column and OR the low byte onto the second screen column at *HL. | ||||||||||
| 48530 | LD A,E | |||||||||||
| 48531 | OR (HL) | |||||||||||
| 48532 | LD (HL),A | |||||||||||
| 48533 | POP HL | Restore the screen buffer address and graphic data pointer from the stack. | ||||||||||
| 48534 | POP DE | |||||||||||
|
Move down one pixel row in the screen buffer and check for a character cell boundary crossing.
|
||||||||||||
| 48535 | INC H | Move down one pixel row in the screen buffer. | ||||||||||
| 48536 | LD A,H | Test if we've crossed a character cell boundary (every 8 rows). | ||||||||||
| 48537 | AND C | |||||||||||
| 48538 | CALL Z,Adjust_Screen_Address | Call Adjust_Screen_Address to adjust the screen buffer address if a character cell boundary was crossed. | ||||||||||
|
Move to the next sprite data byte and loop.
|
||||||||||||
| 48541 | INC DE | Advance the sprite data pointer. | ||||||||||
| 48542 | DJNZ Draw_3Wide_Row_Loop | Decrease the row counter and loop back to Draw_3Wide_Row_Loop until all 16 rows are drawn. | ||||||||||
|
Move to the next column in the screen buffer and loop.
|
||||||||||||
| 48544 | POP HL | Restore the screen buffer address and column pair counter from the stack. | ||||||||||
| 48545 | POP BC | |||||||||||
| 48546 | INC L | Move one byte to the right in the screen buffer. | ||||||||||
| 48547 | DJNZ Draw_3Wide_Sprite_Column_0 | Decrease the column pair counter and loop back to Draw_3Wide_Column_Loop until both column pairs are drawn. | ||||||||||
| 48549 | RET | Return. | ||||||||||
| Prev: 48409 | Up: Map | Next: 48550 |