Prev: E9E2 Up: Map Next: EB05
EA93: Print Sprite
Input
A Sprite ID
B Vertical co-ordinate
C Horizontal co-ordinate
D Height (in character blocks)
E Width (in character blocks)
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_0 EA9C LD A,C Jump to PrintSprite_3 if C is lower than 02.
EA9D CP $02
EA9F JP C,PrintSprite_3
EAA2 LD A,($F335) E=*ActiveSpriteWidth.
EAA5 LD E,A
EAA6 LD A,C Jump to PrintSprite_5 if C is higher than 22.
EAA7 CP $22
EAA9 JP NC,PrintSprite_5
PrintSprite_1 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_2 EAB2 LD A,($F336) Increment *ActiveSpriteID by one.
EAB5 INC A
EAB6 LD ($F336),A
EAB9 CALL PrintColourCharacter Call PrintColourCharacter.
EABC LD A,C Call PrintSprite_4 if C is equal to 02.
EABD CP $02
EABF CALL Z,PrintSprite_4
EAC2 DEC C Decrease C by one.
EAC3 DEC E Decrease E by one.
EAC4 JR NZ,PrintSprite_2 Jump to PrintSprite_2 until E is zero.
EAC6 POP BC Restore BC from the stack.
EAC7 DEC D Decrease D by one.
EAC8 JR Z,PrintSprite_3 Jump to PrintSprite_3 if D is zero.
EACA DEC B Decrease B by one.
EACB JR PrintSprite_0 Jump to PrintSprite_0.
PrintSprite_3 EACD POP HL Restore HL from the stack.
EACE RET Return.
PrintSprite_4 EACF DEC E Decrease E by one.
EAD0 PUSH AF Stash AF on the stack.
EAD1 INC E Increment E by one.
EAD2 LD A,($F336) Increment *ActiveSpriteID by one.
EAD5 INC A
EAD6 LD ($F336),A
EAD9 POP AF Restore AF from the stack.
EADA RET Z Return if *ActiveSpriteID is zero.
EADB DEC E Decrease E by one.
EADC JR PrintSprite_4 Jump to PrintSprite_4.
PrintSprite_5 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_3 Jump to PrintSprite_3 if E is zero.
EAE9 DEC C Decrease C by one.
EAEA LD A,C Jump to PrintSprite_1 if C is higher than 22.
EAEB CP $22
EAED JR NC,PrintSprite_1
EAEF JR PrintSprite_5 Jump to PrintSprite_5.
EAF1 LD B,$18 Clear the bottom 18 lines using CL_LINE.
EAF3 CALL $0E44
EAF6 LD BC,$0640 BC=0640.
EAF9 LD HL,$A1C4 HL=BufferRoom.
PrintSprite_6 EAFC XOR A Write 00 to *HL.
EAFD LD (HL),A
EAFE INC HL Increment HL by one.
EAFF DEC BC Decrease BC by one.
EB00 LD A,B Jump to PrintSprite_6 until BC is zero.
EB01 OR C
EB02 JR NZ,PrintSprite_6
EB04 RET Return.
Prev: E9E2 Up: Map Next: EB05