Prev: 46869 Up: Map Next: 47034
46971: Draw Character Item Graphics
Used by the routine at 58397.
Input
A The item ID
DE Screen co-ordinate for printing the item
Stash all the registers.
DrawCharacterItemGraphics 46971 PUSH AF Push AF, HL, BC and DE on the stack.
46972 PUSH HL
46973 PUSH BC
46974 PUSH DE
46975 LD C,E C=E.
46976 LD L,D L=D.
Set B, D and H to 0.
46977 LD D,0 D=0.
46979 LD H,D H=D.
46980 LD B,D B=D.
46981 ADD HL,HL HL*=16.
46982 ADD HL,HL
46983 ADD HL,HL
46984 ADD HL,HL
46985 LD DE,33272 HL+=ScreenBuffer_Locations.
46988 ADD HL,DE
46989 PUSH HL IX=HL.
46990 POP IX
Look up the item graphics data.
46992 LD L,A Create an offset for the item graphics data in HL.
46993 LD H,0
All items are 2x2 (so 2 bytes width * 16 bytes high).
46995 ADD HL,HL HL*=32.
46996 ADD HL,HL
46997 ADD HL,HL
46998 ADD HL,HL
46999 ADD HL,HL
47000 LD DE,33656 HL+=Graphics_Items.
47003 ADD HL,DE
47004 EX DE,HL Switch the DE and HL registers.
Draw the item graphic to the screen.
47005 LD A,16 A=16 (height of items).
DrawPossesions_Loop 47007 LD L,(IX+0) HL=the screen address from IX.
47010 LD H,(IX+1)
47013 ADD HL,BC HL+=BC.
Move onto the next line down.
47014 INC IX Increment IX by two.
47016 INC IX
47018 EX DE,HL Switch the DE and HL registers.
47019 LDI Blit two bytes of item graphics to the screen buffer.
47021 LDI
47023 EX DE,HL Switch the DE and HL registers.
47024 INC BC Increment BC by two.
47025 INC BC
47026 DEC A Decrease A by one.
47027 JR NZ,DrawPossesions_Loop Jump to DrawPossesions_Loop until A is zero.
Restore all the registers and return.
47029 POP DE Restore DE, BC, HL and AF from the stack.
47030 POP BC
47031 POP HL
47032 POP AF
47033 RET Return.
Prev: 46869 Up: Map Next: 47034