Prev: 63201 Up: Map Next: 63492
63402: Print Sprite
Used by the routine at JumpTable_PrintSprite.
Prints a sprite of width E and height D.
Input
A Sprite ID
B Vertical co-ordinate
C Horizontal co-ordinate
D Height (in character blocks)
E Width (in character blocks)
Print_Sprite 63402 LD L,A Keep the sprite ID minus one in L.
63403 DEC L
63404 LD A,E Store the width in *Print_Width.
63405 LD (25622),A
Print_Sprite_Target 63408 LD A,(25622) Reload the remaining width from *Print_Width.
63411 LD E,A
63412 LD A,(25625) Jump to Print_Sprite_Branch if this row is inside *ClipWindow.
63415 CP B
63416 JR NC,Print_Sprite_Branch
Print_Sprite_Continue 63418 LD A,(25622) Skip down until the row is inside the clip window.
63421 ADD A,L
63422 LD L,A
63423 DEC D
63424 RET Z
63425 DEC B
63426 LD A,(25625)
63429 CP B
63430 JR NZ,Print_Sprite_Continue
Print_Sprite_Branch 63432 LD A,(25626) Return if this row is below *ClipWindow_MaximumRow.
63435 CP B
63436 RET NC
63437 LD A,(25628) Return if this column is past *25628.
63440 CP C
63441 RET NC
63442 PUSH BC Jump to Print_Sprite_Branch3 if this column is inside *ClipWindow_MinimumColumn.
63443 LD A,(25627)
63446 CP C
63447 JR NC,Print_Sprite_Branch3
Print_Sprite_Branch2 63449 INC L Skip left until the column is inside the clip window.
63450 DEC E
63451 JR Z,Print_Sprite_Skip
63453 DEC C
63454 CP C
63455 JR C,Print_Sprite_Branch2
Print_Sprite_Branch3 63457 CALL Set_PrintPosition Call Set_PrintPosition.
63460 INC L Call Print_Character with the next glyph.
63461 LD A,L
63462 CALL Print_Character
63465 CALL Write_Tile Call Write_Tile.
63468 DEC C Move left one column and loop back to Print_Sprite_Branch3 until the row is done.
63469 LD A,(25628)
63472 CP C
63473 JR NC,Print_Sprite_Branch4
63475 DEC E
63476 JR NZ,Print_Sprite_Branch3
Print_Sprite_Skip 63478 POP BC Restore the position from the stack.
63479 DEC D Return if the remaining height is zero.
63480 RET Z
63481 DEC B Move up one row.
63482 JR Print_Sprite_Target Jump to Print_Sprite_Target.
Print_Sprite_Branch4 63484 DEC E Jump to Print_Sprite_Skip if the remaining width is zero.
63485 JR Z,Print_Sprite_Skip
63487 LD A,L Advance the glyph past the clipped cells.
63488 ADD A,E
63489 LD L,A
63490 JR Print_Sprite_Skip Jump to Print_Sprite_Skip.
View the equivalent code in Booty.
Prev: 63201 Up: Map Next: 63492