Prev: 39301 Up: Map Next: 39343
39317: 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 39317 LD HL,42496 Point HL at the graphics table at GraphicsTable.
39320 DEC C Decrease the graphic ID by one.
39321 LD B,0 Clear the high byte of the graphic ID.
39323 SLA C Shift C left.
39325 RL B Rotate B left (so BC=BC * 2).
39327 ADD HL,BC Find the entry for the graphic in the table.
39328 LD A,(HL) Fetch the low byte of the address of the graphic.
39329 INC HL Move HL on to the high byte.
39330 LD H,(HL) Fetch the high byte of the address of the graphic.
39331 LD L,A Keep the low byte of the address of the graphic in L.
39332 EX DE,HL Switch DE and HL.
39333 CALL ScreenAddress Call ScreenAddress to get the screen buffer address of the position.
39336 LD A,(DE) Fetch the width.
39337 LD B,A Keep the width in B.
39338 INC DE Move DE on to the next byte.
39339 LD A,(DE) Fetch the height.
39340 LD C,A Keep the height in C.
39341 INC DE Move DE on to the next byte.
39342 RET Return.
Prev: 39301 Up: Map Next: 39343