Prev: 9924 Up: Map Next: 9970
9962: Draw Graphic
Used by the routine at DrawItemGraphic.
Draws a graphic on the screen. The way that it is drawn depends on bits 5-7 of the attribute, which choose one of the handlers in DrawGraphicHandlers. Bits 0-1 choose how it is mixed with what is already on the screen (see GetBlendInstruction).
Bits 5-7 Handler Orientation
00 DrawGraphic_Upright Upright
01 DrawGraphic_Mirrored Mirrored left to right
02 DrawGraphic_RotatedLeft Rotated a quarter turn anti-clockwise
03 DrawGraphic_Transposed Transposed (flipped along the main diagonal)
04 DrawGraphic_Flipped Flipped top to bottom
05 DrawGraphic_RotatedHalf Rotated a half turn
06 DrawGraphic_TransposedFlipped Transposed (flipped along the other diagonal)
07 DrawGraphic_RotatedRight Rotated a quarter turn clockwise
Input
B The attribute
C The graphic ID
D The Y position
E The X position
DrawGraphic 9962 LD HL,$9970 Point HL at the draw graphic handlers at DrawGraphicHandlers.
This entry point is used by the routine at SetGraphicAttributes.
This is also used by SetGraphicAttributes, with a different table of handlers.
DrawGraphic_Dispatch 9965 PUSH BC Stash the attribute and graphic ID on the stack.
9966 LD A,B Fetch the attribute.
9967 RLCA Rotate A left three times, to move bits 5-7 to bits 0-2.
9968 RLCA
9969 RLCA
996A AND %00000111 Keep only bits 0-2.
996C LD C,A Keep the type of handler in C.
996D JP ProcessAction_Offset Jump to ProcessAction_Offset, which jumps to the handler in the table at HL.
Prev: 9924 Up: Map Next: 9970