Prev: B7BA Up: Map Next: B82B
B7F9: Put a room graphic in screen overlaying existing ones
Used by the routine at F233 and indrectly by the routine at B82B.
Input
HL The address of the graphic
D The y co-ordinate
E The x co-ordinate
C The attribute to use
This routine is done when only part of the screen needs updating eg: wall built, safe cracked.
B7F9 PUSH AF Remember main registers.
B7FA PUSH HL
B7FB PUSH BC
B7FC PUSH DE
B7FD EX DE,HL Swap DE and HL.
B7FE PUSH HL Remember the co-ordinates.
B7FF LD D,$FD Point D to the attribute buffer.
B801 LD E,L Put the X co-ordinate minus 3 in E.
B802 LD L,H Put the Y co-ordinate in HL.
B803 LD H,$00
B805 ADD HL,HL Multiple by 16 to get a suitable offset.
B806 ADD HL,HL
B807 ADD HL,HL
B808 ADD HL,HL
B809 ADD HL,HL
B80A ADD HL,DE Add the X co-ordinate.
B80B LD (HL),C Set the attribute here.
B80C POP HL Restore HL with the graphic.
B80D LD DE,$5300 Add on the correct offset for the sprite buffer.
B810 ADD HL,DE
B811 EX DE,HL Swap DE and HL.
B812 LD L,A Put the Y co-ordinate in HL.
B813 LD H,$00
B815 ADD HL,HL Multiply by 8 to get a suitable offset.
B816 ADD HL,HL
B817 ADD HL,HL
B818 LD BC,($B7E9) Put the offset to shift by in BC.
B81C ADD HL,BC Adjust this.
B81D LDI Copy from HL to DE
B81F DEC E Move forward a column.
B820 LD A,E Move down a row.
B821 ADD A,$20
B823 LD E,A
B824 JR NC,$B81D Loop until the whole screen is done.
B826 POP DE Restore main registers and return.
B827 POP BC
B828 POP HL
B829 POP AF
B82A RET
Prev: B7BA Up: Map Next: B82B