Prev: 9985 Up: Map Next: 99AF
9995: Get Graphic Details
Finds the details of a graphic from the table at GraphicsTable (the entry is the graphic ID minus one). The first two bytes of the graphic are the width in bytes and the height in lines.
Input
C The graphic ID
DE The position (E is the X position and D is the Y position)
Output
B The width of the graphic
C The height of the graphic
DE The address of the first byte of the graphic after the size
HL The screen buffer address of the position
GetGraphicDetails 9995 LD HL,$A600 Point HL at the graphics table at GraphicsTable.
9998 DEC C Decrease the graphic ID by one.
9999 LD B,$00 Clear the high byte of the graphic ID.
999B SLA C Shift C left.
999D RL B Rotate B left (so BC=BC * 02).
999F ADD HL,BC Find the entry for the graphic in the table.
99A0 LD A,(HL) Fetch the low byte of the address of the graphic.
99A1 INC HL Move HL on to the high byte.
99A2 LD H,(HL) Fetch the high byte of the address of the graphic.
99A3 LD L,A Keep the low byte of the address of the graphic in L.
99A4 EX DE,HL Switch DE and HL.
99A5 CALL ScreenAddress Call ScreenAddress to get the screen buffer address of the position.
99A8 LD A,(DE) Fetch the width.
99A9 LD B,A Keep the width in B.
99AA INC DE Move DE on to the next byte.
99AB LD A,(DE) Fetch the height.
99AC LD C,A Keep the height in C.
99AD INC DE Move DE on to the next byte.
99AE RET Return.
Prev: 9985 Up: Map Next: 99AF