![]() |
Routines |
| Prev: 59874 | Up: Map | Next: 60165 |
|
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 | 60051 | PUSH HL | Stash HL on the stack. | |||||||||||||
| 60052 | DEC A | Decrease A by one. | ||||||||||||||
| 60053 | LD (62262),A | Write A to *ActiveSpriteID. | ||||||||||||||
| 60056 | LD A,E | Write E to *ActiveSpriteWidth. | ||||||||||||||
| 60057 | LD (62261),A | |||||||||||||||
| PrintSprite_RowLoop | 60060 | LD A,C | Jump to PrintSprite_RestoreSource if C is lower than 2. | |||||||||||||
| 60061 | CP 2 | |||||||||||||||
| 60063 | JP C,PrintSprite_RestoreSource | |||||||||||||||
| 60066 | LD A,(62261) | E=*ActiveSpriteWidth. | ||||||||||||||
| 60069 | LD E,A | |||||||||||||||
| 60070 | LD A,C | Jump to PrintSprite_NextRow if C is higher than 34. | ||||||||||||||
| 60071 | CP 34 | |||||||||||||||
| 60073 | JP NC,PrintSprite_NextRow | |||||||||||||||
| PrintSprite_OffRight | 60076 | PUSH BC | Stash BC and DE on the stack. | |||||||||||||
| 60077 | PUSH DE | |||||||||||||||
| 60078 | CALL 3545 | Call CL_SET. | ||||||||||||||
| 60081 | POP DE | Restore DE from the stack. | ||||||||||||||
| PrintSprite_AdvanceTile | 60082 | LD A,(62262) | Increment *ActiveSpriteID by one. | |||||||||||||
| 60085 | INC A | |||||||||||||||
| 60086 | LD (62262),A | |||||||||||||||
| 60089 | CALL PrintColourCharacter | Print this colour character using PrintColourCharacter. | ||||||||||||||
| 60092 | LD A,C | Call PrintSprite_SkipColumn if the print column is the right-edge column (2). | ||||||||||||||
| 60093 | CP 2 | |||||||||||||||
| 60095 | CALL Z,PrintSprite_SkipColumn | |||||||||||||||
| 60098 | DEC C | Move one column right. | ||||||||||||||
| 60099 | DEC E | Decrease the remaining width and loop back to PrintSprite_AdvanceTile until this row is done. | ||||||||||||||
| 60100 | JR NZ,PrintSprite_AdvanceTile | |||||||||||||||
| 60102 | POP BC | Restore the print position from the stack. | ||||||||||||||
| 60103 | DEC D | Return if every row is printed. | ||||||||||||||
| 60104 | JR Z,PrintSprite_RestoreSource | |||||||||||||||
| 60106 | DEC B | Move one row down and loop back to PrintSprite_RowLoop. | ||||||||||||||
| 60107 | JR PrintSprite_RowLoop | |||||||||||||||
| PrintSprite_RestoreSource | 60109 | POP HL | Restore HL from the stack. | |||||||||||||
| 60110 | RET | Return. | ||||||||||||||
|
The print column has reached the right-hand screen edge; skip the rest of this row.
|
||||||||||||||||
| PrintSprite_SkipColumn | 60111 | DEC E | Test whether this is the last remaining tile. | |||||||||||||
| 60112 | PUSH AF | |||||||||||||||
| 60113 | INC E | |||||||||||||||
| 60114 | LD A,(62262) | Advance the sprite ID past the tile being skipped. | ||||||||||||||
| 60117 | INC A | |||||||||||||||
| 60118 | LD (62262),A | |||||||||||||||
| 60121 | POP AF | Return if that was the last tile in the row. | ||||||||||||||
| 60122 | RET Z | |||||||||||||||
| 60123 | DEC E | Skip one remaining tile and loop back to PrintSprite_SkipColumn. | ||||||||||||||
| 60124 | JR PrintSprite_SkipColumn | |||||||||||||||
| PrintSprite_NextRow | 60126 | LD A,(62262) | Increment *ActiveSpriteID by one. | |||||||||||||
| 60129 | INC A | |||||||||||||||
| 60130 | LD (62262),A | |||||||||||||||
| 60133 | DEC E | Decrease E by one. | ||||||||||||||
| 60134 | JP Z,PrintSprite_RestoreSource | Jump to PrintSprite_RestoreSource if E is zero. | ||||||||||||||
| 60137 | DEC C | Decrease C by one. | ||||||||||||||
| 60138 | LD A,C | Jump to PrintSprite_OffRight if C is higher than 34. | ||||||||||||||
| 60139 | CP 34 | |||||||||||||||
| 60141 | JR NC,PrintSprite_OffRight | |||||||||||||||
| 60143 | JR PrintSprite_NextRow | Jump to PrintSprite_NextRow. | ||||||||||||||
|
Clear the play area and the room buffer.
|
||||||||||||||||
| 60145 | LD B,24 | Clear the bottom 24 lines using CL_LINE. | ||||||||||||||
| 60147 | CALL 3652 | |||||||||||||||
| 60150 | LD BC,1600 | Point HL at BufferRoom and set the fill count. | ||||||||||||||
| 60153 | LD HL,41412 | |||||||||||||||
| PrintSprite_ClearBufferLoop | 60156 | XOR A | Write 0 to the next byte and loop back until the room buffer is clear. | |||||||||||||
| 60157 | LD (HL),A | |||||||||||||||
| 60158 | INC HL | |||||||||||||||
| 60159 | DEC BC | |||||||||||||||
| 60160 | LD A,B | |||||||||||||||
| 60161 | OR C | |||||||||||||||
| 60162 | JR NZ,PrintSprite_ClearBufferLoop | |||||||||||||||
| 60164 | RET | Return. | ||||||||||||||
| Prev: 59874 | Up: Map | Next: 60165 |