Prev: E762 Up: Map Next: E804
E787: Print Sprite/ Update Buffer
Input
A Sprite ID
B Vertical position
C Horizontal position
D Height
E Width
PrintSpriteUpdateBuffer E787 LD HL,($5C36) Stash the current *CHARS on the stack.
E78A PUSH HL
E78B LD HL,$8378 Write 8378 (Graphics_RoomScaffolding_Empty) to *CHARS.
E78E LD ($5C36),HL
E791 LD A,E Write E to *ActiveSpriteWidth.
E792 LD ($F335),A
PrintSpriteUpdateBuffer_Loop E795 LD A,($F335) Restore *ActiveSpriteWidth back to E.
E798 LD E,A
E799 PUSH BC Stash the co-ordinates and width/ height on the stack temporarily.
E79A PUSH DE
E79B CALL ConvertCoordinateToBufferOffset Call ConvertCoordinateToBufferOffset.
E79E CALL $0DD9 Call CL_SET.
E7A1 POP DE Restore the width/ height and the co-ordinates from the stack.
E7A2 POP BC
PrintSpriteUpdateBuffer_0 E7A3 PUSH DE Stash DE on the stack.
E7A4 LD HL,($F330) Increment *BufferRoomPointer by one.
E7A7 INC HL
E7A8 LD ($F330),HL
E7AB DEC HL Decrease HL by one.
E7AC LD DE,$A1C4 HL+=BufferRoom.
E7AF ADD HL,DE
E7B0 LD A,(HL) A=*HL.
E7B1 POP DE Restore DE from the stack.
E7B2 CP $00 Jump to PrintSpriteUpdateBuffer_1 if A is not equal to 00.
E7B4 JR NZ,PrintSpriteUpdateBuffer_1
E7B6 LD A,$20 A=20.
E7B8 CALL PrintColourCharacter Call PrintColourCharacter.
E7BB JR PrintSpriteUpdateBuffer_2 Jump to PrintSpriteUpdateBuffer_2.
PrintSpriteUpdateBuffer_1 E7BD PUSH AF Stash AF and AF on the stack.
E7BE PUSH AF
E7BF AND %10000000 Keep only bit 7.
E7C1 CALL NZ,PrintSpriteUpdateBuffer_4 Call PrintSpriteUpdateBuffer_4 not zero.
E7C4 POP AF Restore AF from the stack.
E7C5 AND %01111111 Keep only bits 0-6.
E7C7 RST $10
E7C8 POP AF Restore AF from the stack.
E7C9 JR Z,PrintSpriteUpdateBuffer_2 Jump to PrintSpriteUpdateBuffer_2 if {} is zero.
E7CB PUSH HL Stash HL on the stack.
E7CC LD HL,$8378 Write 8378 (Graphics_RoomScaffolding_Empty) to *CHARS.
E7CF LD ($5C36),HL
E7D2 POP HL Restore HL from the stack.
PrintSpriteUpdateBuffer_2 E7D3 PUSH DE Stash DE and HL on the stack.
E7D4 PUSH HL
E7D5 LD HL,($F330) HL=*BufferRoomPointer.
E7D8 DEC HL Decrease HL by one.
E7D9 LD DE,$A4E4 HL+=BufferRoomAttributes.
E7DC ADD HL,DE
E7DD LD A,(HL) Jump to PrintSpriteUpdateBuffer_3 if *HL is equal to 00.
E7DE CP $00
E7E0 JR Z,PrintSpriteUpdateBuffer_3
E7E2 LD DE,$5800 DE=5800 (attribute buffer location).
E7E5 LD HL,($F330) HL=*BufferRoomPointer.
E7E8 DEC HL Decrease HL by one.
E7E9 ADD HL,DE HL+=DE.
E7EA LD (HL),A Write A to *HL.
PrintSpriteUpdateBuffer_3 E7EB POP HL Restore HL and DE from the stack.
E7EC POP DE
E7ED DEC E Decrease E by one.
E7EE JR NZ,PrintSpriteUpdateBuffer_0 Jump to PrintSpriteUpdateBuffer_0 until E is zero.
E7F0 DEC D Decrease D by one.
E7F1 JR Z,PrintSpriteUpdateBuffer_Housekeeping Jump to PrintSpriteUpdateBuffer_Housekeeping if D is zero.
E7F3 DEC B Decrease B by one.
E7F4 JR PrintSpriteUpdateBuffer_Loop Jump to PrintSpriteUpdateBuffer_Loop.
PrintSpriteUpdateBuffer_Housekeeping E7F6 POP HL Restore the original value of *CHARS from the stack.
E7F7 LD ($5C36),HL
E7FA RET Return.
PrintSpriteUpdateBuffer_4 E7FB PUSH HL Stash HL on the stack.
E7FC LD HL,$8678 Write 8678 (Graphics_Barrels) to *CHARS.
E7FF LD ($5C36),HL
E802 POP HL Restore HL from the stack.
E803 RET Return.
Prev: E762 Up: Map Next: E804