![]() |
Routines |
| Prev: E9E2 | Up: Map | Next: EB05 |
|
Used by the routines at AllTreasureCollected, Handler_Explosion, Handler_Bomb, Handler_DisappearingFloors, Handler_Items, Handler_UnlockDoor, Handler_KeysAndLockedDoors and Handler_PortHole.
Prints a rectangular sprite, clipping at the screen edges. Goldfish-game clone is GoldfishGame_PrintSprite.
|
||||||||||||||||
| PrintSprite | EA93 | PUSH HL | Stash HL on the stack. | |||||||||||||
| EA94 | DEC A | Decrease A by one. | ||||||||||||||
| EA95 | LD ($F336),A | Write A to *ActiveSpriteID. | ||||||||||||||
| EA98 | LD A,E | Write E to *ActiveSpriteWidth. | ||||||||||||||
| EA99 | LD ($F335),A | |||||||||||||||
| PrintSprite_RowLoop | EA9C | LD A,C | Jump to PrintSprite_RestoreSource if C is lower than 02. | |||||||||||||
| EA9D | CP $02 | |||||||||||||||
| EA9F | JP C,PrintSprite_RestoreSource | |||||||||||||||
| EAA2 | LD A,($F335) | E=*ActiveSpriteWidth. | ||||||||||||||
| EAA5 | LD E,A | |||||||||||||||
| EAA6 | LD A,C | Jump to PrintSprite_NextRow if C is higher than 22. | ||||||||||||||
| EAA7 | CP $22 | |||||||||||||||
| EAA9 | JP NC,PrintSprite_NextRow | |||||||||||||||
| PrintSprite_OffRight | EAAC | PUSH BC | Stash BC and DE on the stack. | |||||||||||||
| EAAD | PUSH DE | |||||||||||||||
| EAAE | CALL $0DD9 | Call CL_SET. | ||||||||||||||
| EAB1 | POP DE | Restore DE from the stack. | ||||||||||||||
| PrintSprite_AdvanceTile | EAB2 | LD A,($F336) | Increment *ActiveSpriteID by one. | |||||||||||||
| EAB5 | INC A | |||||||||||||||
| EAB6 | LD ($F336),A | |||||||||||||||
| EAB9 | CALL PrintColourCharacter | Print this colour character using PrintColourCharacter. | ||||||||||||||
| EABC | LD A,C | Call PrintSprite_SkipColumn if the print column is the right-edge column (02). | ||||||||||||||
| EABD | CP $02 | |||||||||||||||
| EABF | CALL Z,PrintSprite_SkipColumn | |||||||||||||||
| EAC2 | DEC C | Move one column right. | ||||||||||||||
| EAC3 | DEC E | Decrease the remaining width and loop back to PrintSprite_AdvanceTile until this row is done. | ||||||||||||||
| EAC4 | JR NZ,PrintSprite_AdvanceTile | |||||||||||||||
| EAC6 | POP BC | Restore the print position from the stack. | ||||||||||||||
| EAC7 | DEC D | Return if every row is printed. | ||||||||||||||
| EAC8 | JR Z,PrintSprite_RestoreSource | |||||||||||||||
| EACA | DEC B | Move one row down and loop back to PrintSprite_RowLoop. | ||||||||||||||
| EACB | JR PrintSprite_RowLoop | |||||||||||||||
| PrintSprite_RestoreSource | EACD | POP HL | Restore HL from the stack. | |||||||||||||
| EACE | RET | Return. | ||||||||||||||
|
The print column has reached the right-hand screen edge; skip the rest of this row.
|
||||||||||||||||
| PrintSprite_SkipColumn | EACF | DEC E | Test whether this is the last remaining tile. | |||||||||||||
| EAD0 | PUSH AF | |||||||||||||||
| EAD1 | INC E | |||||||||||||||
| EAD2 | LD A,($F336) | Advance the sprite ID past the tile being skipped. | ||||||||||||||
| EAD5 | INC A | |||||||||||||||
| EAD6 | LD ($F336),A | |||||||||||||||
| EAD9 | POP AF | Return if that was the last tile in the row. | ||||||||||||||
| EADA | RET Z | |||||||||||||||
| EADB | DEC E | Skip one remaining tile and loop back to PrintSprite_SkipColumn. | ||||||||||||||
| EADC | JR PrintSprite_SkipColumn | |||||||||||||||
| PrintSprite_NextRow | EADE | LD A,($F336) | Increment *ActiveSpriteID by one. | |||||||||||||
| EAE1 | INC A | |||||||||||||||
| EAE2 | LD ($F336),A | |||||||||||||||
| EAE5 | DEC E | Decrease E by one. | ||||||||||||||
| EAE6 | JP Z,PrintSprite_RestoreSource | Jump to PrintSprite_RestoreSource if E is zero. | ||||||||||||||
| EAE9 | DEC C | Decrease C by one. | ||||||||||||||
| EAEA | LD A,C | Jump to PrintSprite_OffRight if C is higher than 22. | ||||||||||||||
| EAEB | CP $22 | |||||||||||||||
| EAED | JR NC,PrintSprite_OffRight | |||||||||||||||
| EAEF | JR PrintSprite_NextRow | Jump to PrintSprite_NextRow. | ||||||||||||||
|
Clear the play area and the room buffer.
|
||||||||||||||||
| EAF1 | LD B,$18 | Clear the bottom 18 lines using CL_LINE. | ||||||||||||||
| EAF3 | CALL $0E44 | |||||||||||||||
| EAF6 | LD BC,$0640 | Point HL at BufferRoom and set the fill count. | ||||||||||||||
| EAF9 | LD HL,$A1C4 | |||||||||||||||
| PrintSprite_ClearBufferLoop | EAFC | XOR A | Write 00 to the next byte and loop back until the room buffer is clear. | |||||||||||||
| EAFD | LD (HL),A | |||||||||||||||
| EAFE | INC HL | |||||||||||||||
| EAFF | DEC BC | |||||||||||||||
| EB00 | LD A,B | |||||||||||||||
| EB01 | OR C | |||||||||||||||
| EB02 | JR NZ,PrintSprite_ClearBufferLoop | |||||||||||||||
| EB04 | RET | Return. | ||||||||||||||
| Prev: E9E2 | Up: Map | Next: EB05 |