| Gyruss | Routines |
| Prev: ACDF | Up: Map | Next: AD49 |
|
Used by the routines at stage_completed, next_frame_upl_sprites, start_screen, initial_game_loop and explode.
|
||||
| upload_sprite_data | ACF9 | LD DE,(sat_vdp_address) | VDP address of sprite allocation table | |
| ACFD | LD HL,allocated_sprites | Get number of allocated sprites | ||
| AD00 | LD A,(HL) | ... | ||
| AD01 | LD B,A | Store in B | ||
| upload_sprite_data_0 | AD02 | PUSH BC | Save counter | |
| AD03 | INC HL | Next allocation | ||
| AD04 | LD A,(HL) | Get sprite index | ||
| AD05 | ADD A,A | * 2 | ||
| AD06 | ADD A,A | * 4 | ||
| AD07 | LD C,A | |||
| AD08 | ADD A,A | * 8 | ||
| AD09 | ADD A,C | * 12 (may overflow?) | ||
| AD0A | PUSH HL | Save sprite allocation table address | ||
| AD0B | LD HL,$700A | First y address in sprite data table | ||
| AD0E | RST $08 | Add A to HL | ||
| AD0F | LD BC,$0004 | Write 4 bytes for each sprite | ||
| AD12 | PUSH DE | Save destination | ||
| AD13 | CALL $1FDF | WRITE_VRAM | ||
| AD16 | POP HL | Restore destination | ||
| AD17 | LD BC,$0004 | Add 4 to destination | ||
| AD1A | ADD HL,BC | ... | ||
| AD1B | EX DE,HL | ... | ||
| AD1C | POP HL | Restore sprite allocation table address | ||
| AD1D | POP BC | Restore counter | ||
| AD1E | DJNZ upload_sprite_data_0 | Loop for each sprite | ||
| AD20 | LD A,$D0 | End marker byte | ||
| AD22 | RST $10 | Write VDP byte | ||
| AD23 | LD A,(allocated_sprites) | Get number of allocation sprites | ||
| AD26 | CP $05 | Is it < 5 | ||
| AD28 | RET C | Then return | ||
|
Rotate sprite allocation table
|
||||
| AD29 | SUB $04 | |||
| AD2B | LD C,A | Number of sprites above 4 | ||
| AD2C | LD B,$00 | |||
| AD2E | PUSH BC | |||
| AD2F | LD HL,$7185 | From 2nd entry of allocation table | ||
| AD32 | LD DE,buffer | To buffer | ||
| AD35 | LD BC,$0002 | Copy 2 bytes | ||
| AD38 | LDIR | |||
| AD3A | LD DE,$7185 | From 4th to 2nd entry of allocation table | ||
| AD3D | POP BC | Copy number of sprites above 4 bytes | ||
| AD3E | LDIR | |||
| AD40 | LD HL,buffer | From buffer to end of allocation table | ||
| AD43 | LD BC,$0002 | Copy 2 bytes | ||
| AD46 | LDIR | |||
| AD48 | RET | |||
| Prev: ACDF | Up: Map | Next: AD49 |