![]() |
Routines |
| Prev: BD19 | Up: Map | Next: BDA6 |
|
Used by the routine at Draw_Sprites.
|
||||||||||||
|
Look up the sprite graphic data address. Each frame is 20 bytes.
|
||||||||||||
| Draw_3Wide_Sprite_Column | BD5E | LD ($BD82),A | Self-modify the shift jump offset at BD82. | |||||||||
| BD61 | PUSH HL | Stash the screen buffer address on the stack. | ||||||||||
| BD62 | LD DE,$AB3B | Point DE at Sprite_01 (3-wide sprite frame table base). | ||||||||||
| BD65 | LD L,(IX+$03) | Load the frame ID from *IX+03 and decrement to make it zero-indexed. | ||||||||||
| BD68 | DEC L | |||||||||||
| BD69 | LD H,$00 | Multiply the frame index by 20 and add to the table base to get the graphic data address. | ||||||||||
| BD6B | ADD HL,HL | |||||||||||
| BD6C | ADD HL,HL | |||||||||||
| BD6D | ADD HL,HL | |||||||||||
| BD6E | ADD HL,HL | |||||||||||
| BD6F | ADD HL,HL | |||||||||||
| BD70 | ADD HL,DE | |||||||||||
| BD71 | EX DE,HL | Exchange so DE points to the sprite graphic data. | ||||||||||
| BD72 | POP HL | Restore the screen buffer address from the stack. | ||||||||||
|
Draw two column pairs, each 10 pixels tall, covering three screen columns. C holds a mask of 07 used to detect character cell boundaries for screen address adjustment.
|
||||||||||||
| BD73 | LD B,$02 | Set the column pair counter to 02 in B. | ||||||||||
| Draw_3Wide_Column_Loop | BD75 | LD C,$07 | Set the row boundary mask to 07 in C. | |||||||||
| Draw_3Wide_Sprite_Column_0 | BD77 | PUSH BC | Stash the column pair counter and screen buffer address on the stack. | |||||||||
| BD78 | PUSH HL | |||||||||||
| BD79 | LD B,$10 | Set the row counter to 10 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 | BD7B | PUSH DE | Stash the graphic data pointer and screen buffer address on the stack. | |||||||||
| BD7C | PUSH HL | |||||||||||
|
Read the sprite data byte and shift it into a 16-bit value in HL.
The shift amount at BD82 was self-modified on entry to control the horizontal pixel alignment.
|
||||||||||||
| BD7D | LD A,(DE) | Load the graphic byte from *DE. | ||||||||||
| BD7E | LD L,A | Transfer sprite byte to HL (clearing the high byte). | ||||||||||
| BD7F | LD H,$00 | |||||||||||
| BD81 | JR Shift_3Wide_Fine | Jump into the shift sequence (self-modified offset controls the number of shifts applied). | ||||||||||
| Shift_3Wide_Extra | BD83 | ADD HL,HL | Shift HL left one position (extra shift). | |||||||||
| Shift_3Wide_Fine | BD84 | ADD HL,HL | Shift HL left seven positions; the total shift spreads the graphic byte across H and L. | |||||||||
| BD85 | ADD HL,HL | |||||||||||
| BD86 | ADD HL,HL | |||||||||||
| BD87 | ADD HL,HL | |||||||||||
| BD88 | ADD HL,HL | |||||||||||
| BD89 | ADD HL,HL | |||||||||||
| BD8A | ADD HL,HL | |||||||||||
|
OR the shifted sprite data onto the screen buffer across two adjacent columns.
|
||||||||||||
| BD8B | POP DE | Restore the screen buffer address into DE, keeping a copy on the stack. | ||||||||||
| BD8C | PUSH DE | |||||||||||
| BD8D | EX DE,HL | Exchange so HL=screen buffer address, DE=shifted sprite data. | ||||||||||
| BD8E | LD A,D | OR the high byte of the shifted data onto the first screen column at *HL. | ||||||||||
| BD8F | OR (HL) | |||||||||||
| BD90 | LD (HL),A | |||||||||||
| BD91 | INC L | Advance to the next column and OR the low byte onto the second screen column at *HL. | ||||||||||
| BD92 | LD A,E | |||||||||||
| BD93 | OR (HL) | |||||||||||
| BD94 | LD (HL),A | |||||||||||
| BD95 | POP HL | Restore the screen buffer address and graphic data pointer from the stack. | ||||||||||
| BD96 | POP DE | |||||||||||
|
Move down one pixel row in the screen buffer and check for a character cell boundary crossing.
|
||||||||||||
| BD97 | INC H | Move down one pixel row in the screen buffer. | ||||||||||
| BD98 | LD A,H | Test if we've crossed a character cell boundary (every 08 rows). | ||||||||||
| BD99 | AND C | |||||||||||
| BD9A | 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.
|
||||||||||||
| BD9D | INC DE | Advance the sprite data pointer. | ||||||||||
| BD9E | DJNZ Draw_3Wide_Row_Loop | Decrease the row counter and loop back to Draw_3Wide_Row_Loop until all 10 rows are drawn. | ||||||||||
|
Move to the next column in the screen buffer and loop.
|
||||||||||||
| BDA0 | POP HL | Restore the screen buffer address and column pair counter from the stack. | ||||||||||
| BDA1 | POP BC | |||||||||||
| BDA2 | INC L | Move one byte to the right in the screen buffer. | ||||||||||
| BDA3 | 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. | ||||||||||
| BDA5 | RET | Return. | ||||||||||
| Prev: BD19 | Up: Map | Next: BDA6 |