Prev: EA60 Up: Map Next: EC65
EBE0: Print an animinated object on screen
Used by the routines at 8751, 8B34, 8D7F, 8EDD, 952F, 968D, 96D9, CB93 and CDC4.
EBE0 LD A,($ECDE) Get the X co-ordinate at ECDE.
Get the position and work out what frame number should be used, shifting the bits to the desired location.
EBE3 AND $07 Take the first three bits to get the frame number.
EBE5 CP $04 Is it greater than 4?
EBE7 JR C,$EBEE Skip the next bit if it is.
EBE9 CALL $ECA2 Shift the sprite to the left and move forward.
EBEC JR $EBF5
EBEE CP $00 Is the frame 0?
EBF0 JR Z,$EBE9 Skip the next bit if it is.
EBF2 CALL $EC6F Shift the sprite to the right.
Now work out where on screen should be updated.
EBF5 LD A,($ECDE) Get the co-ordinates
EBF8 DEC A Put the top five bits in HL.
EBF9 AND $F8
EBFB SRL A
EBFD SRL A
EBFF SRL A
EC01 LD L,A
EC02 LD H,$00
EC04 LD ($ED14),HL Store this as the next offset to use.
EC07 LD A,($ECDF) Get the Y co-ordinate at ECDF.
EC0A LD D,$00 Store this in DE.
EC0C LD E,A
EC0D LD HL,$EA60 Add the base offset for the screen address table in EA60.
EC10 ADD HL,DE
EC11 ADD HL,DE
EC12 LD ($ECE2),HL Store this as the pointer to the screen that should be updated.
Copy the bytes from the working buffer onto screen.
EC15 LD DE,$ECE4 Point DE at the working buffer at ECE4.
EC18 LD B,$10 16 cells to copy.
EC1A PUSH BC
EC1B LD HL,($ECE2) Get the pointer to the screen address to update.
EC1E LD A,(HL) Get the actual screen address in HL.
EC1F INC HL
EC20 LD H,(HL)
EC21 LD L,A
EC22 PUSH DE Remember DE which points at the working buffer.
EC23 LD DE,($ED14) Get the offset to use.
EC27 ADD HL,DE Add this to get the actual screen address to use in HL.
EC28 POP DE Restore DE.
EC29 LD B,$03 3 cells to copy.
EC2B EX DE,HL Copy the cells from the buffer to screen.
EC2C LD A,(HL)
EC2D EX DE,HL
EC2E LD (HL),A
EC2F CALL $EC59 Merge the bytes.
EC32 INC HL Move to the next cell.
EC33 INC DE
EC34 DJNZ $EC2B Loop back if there is more to do.
EC36 LD HL,($ECE2) Move to the previous screen address.
EC39 DEC HL
EC3A DEC HL
EC3B LD ($ECE2),HL
EC3E POP BC Loop back if there are more cells to copy.
EC3F DJNZ $EC1A
EC41 LD A,($ECDF) Point HL at the next pointer to the screen address table.
EC44 AND $F8
EC46 SRL A
EC48 SRL A
EC4A SRL A
EC4C SUB $17
EC4E NEG
EC50 LD L,A
EC51 LD H,$00
EC53 LD B,$05
EC55 ADD HL,HL
EC56 DJNZ $EC55 Loop back until all the cells have been copied.
EC58 RET
Prev: EA60 Up: Map Next: EC65