Prev: 59234 Up: Map Next: 59396
59271: Print Sprite/ Update Buffer
Input
A Sprite ID
B Vertical position
C Horizontal position
D Height
E Width
PrintSpriteUpdateBuffer 59271 LD HL,(23606) Stash the current *CHARS on the stack.
59274 PUSH HL
59275 LD HL,33656 Write 33656 (Graphics_RoomScaffolding_Empty) to *CHARS.
59278 LD (23606),HL
59281 LD A,E Write E to *ActiveSpriteWidth.
59282 LD (62261),A
PrintSpriteUpdateBuffer_Loop 59285 LD A,(62261) Restore *ActiveSpriteWidth back to E.
59288 LD E,A
59289 PUSH BC Stash the co-ordinates and width/ height on the stack temporarily.
59290 PUSH DE
59291 CALL ConvertCoordinateToBufferOffset Call ConvertCoordinateToBufferOffset.
59294 CALL 3545 Call CL_SET.
59297 POP DE Restore the width/ height and the co-ordinates from the stack.
59298 POP BC
PrintSpriteUpdateBuffer_0 59299 PUSH DE Stash DE on the stack.
59300 LD HL,(62256) Increment *BufferRoomPointer by one.
59303 INC HL
59304 LD (62256),HL
59307 DEC HL Decrease HL by one.
59308 LD DE,41412 HL+=BufferRoom.
59311 ADD HL,DE
59312 LD A,(HL) A=*HL.
59313 POP DE Restore DE from the stack.
59314 CP 0 Jump to PrintSpriteUpdateBuffer_1 if A is not equal to 0.
59316 JR NZ,PrintSpriteUpdateBuffer_1
59318 LD A,32 A=32.
59320 CALL PrintColourCharacter Call PrintColourCharacter.
59323 JR PrintSpriteUpdateBuffer_2 Jump to PrintSpriteUpdateBuffer_2.
PrintSpriteUpdateBuffer_1 59325 PUSH AF Stash AF and AF on the stack.
59326 PUSH AF
59327 AND %10000000 Keep only bit 7.
59329 CALL NZ,PrintSpriteUpdateBuffer_4 Call PrintSpriteUpdateBuffer_4 not zero.
59332 POP AF Restore AF from the stack.
59333 AND %01111111 Keep only bits 0-6.
59335 RST 16
59336 POP AF Restore AF from the stack.
59337 JR Z,PrintSpriteUpdateBuffer_2 Jump to PrintSpriteUpdateBuffer_2 if {} is zero.
59339 PUSH HL Stash HL on the stack.
59340 LD HL,33656 Write 33656 (Graphics_RoomScaffolding_Empty) to *CHARS.
59343 LD (23606),HL
59346 POP HL Restore HL from the stack.
PrintSpriteUpdateBuffer_2 59347 PUSH DE Stash DE and HL on the stack.
59348 PUSH HL
59349 LD HL,(62256) HL=*BufferRoomPointer.
59352 DEC HL Decrease HL by one.
59353 LD DE,42212 HL+=BufferRoomAttributes.
59356 ADD HL,DE
59357 LD A,(HL) Jump to PrintSpriteUpdateBuffer_3 if *HL is equal to 0.
59358 CP 0
59360 JR Z,PrintSpriteUpdateBuffer_3
59362 LD DE,22528 DE=22528 (attribute buffer location).
59365 LD HL,(62256) HL=*BufferRoomPointer.
59368 DEC HL Decrease HL by one.
59369 ADD HL,DE HL+=DE.
59370 LD (HL),A Write A to *HL.
PrintSpriteUpdateBuffer_3 59371 POP HL Restore HL and DE from the stack.
59372 POP DE
59373 DEC E Decrease E by one.
59374 JR NZ,PrintSpriteUpdateBuffer_0 Jump to PrintSpriteUpdateBuffer_0 until E is zero.
59376 DEC D Decrease D by one.
59377 JR Z,PrintSpriteUpdateBuffer_Housekeeping Jump to PrintSpriteUpdateBuffer_Housekeeping if D is zero.
59379 DEC B Decrease B by one.
59380 JR PrintSpriteUpdateBuffer_Loop Jump to PrintSpriteUpdateBuffer_Loop.
PrintSpriteUpdateBuffer_Housekeeping 59382 POP HL Restore the original value of *CHARS from the stack.
59383 LD (23606),HL
59386 RET Return.
PrintSpriteUpdateBuffer_4 59387 PUSH HL Stash HL on the stack.
59388 LD HL,34424 Write 34424 (Graphics_Barrels) to *CHARS.
59391 LD (23606),HL
59394 POP HL Restore HL from the stack.
59395 RET Return.
Prev: 59234 Up: Map Next: 59396