Prev: B715 Up: Map Next: B7BA
B77B: Draw Character Item Graphics
Used by the routine at E41D.
Input
A The item ID
DE Screen co-ordinate for printing the item
Stash all the registers.
DrawCharacterItemGraphics B77B PUSH AF Push AF, HL, BC and DE on the stack.
B77C PUSH HL
B77D PUSH BC
B77E PUSH DE
B77F LD C,E C=E.
B780 LD L,D L=D.
Set B, D and H to 00.
B781 LD D,$00 D=00.
B783 LD H,D H=D.
B784 LD B,D B=D.
B785 ADD HL,HL HL*=10.
B786 ADD HL,HL
B787 ADD HL,HL
B788 ADD HL,HL
B789 LD DE,$81F8 HL+=ScreenBuffer_Locations.
B78C ADD HL,DE
B78D PUSH HL IX=HL.
B78E POP IX
Look up the item graphics data.
B790 LD L,A Create an offset for the item graphics data in HL.
B791 LD H,$00
All items are 2x2 (so 02 bytes width * 10 bytes high).
B793 ADD HL,HL HL*=20.
B794 ADD HL,HL
B795 ADD HL,HL
B796 ADD HL,HL
B797 ADD HL,HL
B798 LD DE,$8378 HL+=Graphics_Items.
B79B ADD HL,DE
B79C EX DE,HL Switch the DE and HL registers.
Draw the item graphic to the screen.
B79D LD A,$10 A=10 (height of items).
DrawPossesions_Loop B79F LD L,(IX+$00) HL=the screen address from IX.
B7A2 LD H,(IX+$01)
B7A5 ADD HL,BC HL+=BC.
Move onto the next line down.
B7A6 INC IX Increment IX by two.
B7A8 INC IX
B7AA EX DE,HL Switch the DE and HL registers.
B7AB LDI Blit two bytes of item graphics to the screen buffer.
B7AD LDI
B7AF EX DE,HL Switch the DE and HL registers.
B7B0 INC BC Increment BC by two.
B7B1 INC BC
B7B2 DEC A Decrease A by one.
B7B3 JR NZ,DrawPossesions_Loop Jump to DrawPossesions_Loop until A is zero.
Restore all the registers and return.
B7B5 POP DE Restore DE, BC, HL and AF from the stack.
B7B6 POP BC
B7B7 POP HL
B7B8 POP AF
B7B9 RET Return.
Prev: B715 Up: Map Next: B7BA