![]() |
Routines |
| Prev: A630 | Up: Map | Next: A6D3 |
|
Used by the routine at DrawDirectionGauge.
Draws the ball at the tip of the needle of a direction gauge into the buffer at F517 using self-modifying versions of the sprite drawing code at DrawShiftedRows. The ball is drawn from six pairs of mask and picture values at NeedleTipShapes (or the shifted version at A6DF), which are taken from the stack. The value of DrawingPosition selects the version by bit 0, and the table of shifts to use by bits 1-2.
|
||||||||
| DrawNeedleTip | A692 | LD ($5CDA),SP | Save the stack pointer. | |||||
| A696 | LD A,($5CDC) | Fetch the position of the tip of the needle from DrawingPosition. | ||||||
| A699 | LD SP,$A6D3 | Point the stack at the shape of the ball. | ||||||
| A69C | BIT 0,A | Jump to DrawNeedleTip_Shift if bit 0 of the position is reset. | ||||||
| A69E | JR Z,DrawNeedleTip_Shift | |||||||
| A6A0 | LD SP,$A6DF | Point the stack at the shifted shape of the ball. | ||||||
| DrawNeedleTip_Shift | A6A3 | AND %00000110 | Use bits 1-2, the shift in pixels. | |||||
| A6A5 | JR Z,DrawNeedleTip_Unshifted | Jump to DrawNeedleTip_Unshifted if the ball is not to be shifted. | ||||||
| A6A7 | EX DE,HL | Exchange DE and HL, so that DE is the address in the buffer. | ||||||
| A6A8 | ADD A,$F8 | Add F8 to make the high byte of the address of the shift table. | ||||||
| A6AA | LD H,A | Set the high byte of HL to select the shift table. | ||||||
| A6AB | LD A,$08 | Set the number of bytes to step back to the next row to 08... | ||||||
| A6AD | LD ($B530),A | ...in the operand of the instruction at B52F. | ||||||
| A6B0 | LD A,$06 | Set the counter of rows to 06... | ||||||
| A6B2 | EX AF,AF' | ...and store it in the alternate A. | ||||||
| A6B3 | LD BC,$B518 | Set BC to the address of the code at B518. | ||||||
| A6B6 | LD ($B534),BC | Patch the jump at B533 to go there. | ||||||
| A6BA | LD ($B539),BC | Patch the jump at B538 to go there. | ||||||
| A6BE | LD A,(DE) | Fetch the byte of the buffer. | ||||||
| A6BF | JP DrawShiftedRows_One | Jump to B518 to draw the ball. | ||||||
| DrawNeedleTip_Unshifted | A6C2 | LD A,$F9 | Set the low byte of the operand of the instruction at B4DB to F9... | |||||
| A6C4 | LD ($B4DC),A | ...to make the offset to the next row FFF9. | ||||||
| A6C7 | LD B,$06 | Set the counter of rows to 06. | ||||||
| A6C9 | LD DE,$B4D5 | Point DE at the code at B4D5. | ||||||
| A6CC | LD ($B4E1),DE | Patch the jump at B4E0 to go there. | ||||||
| A6D0 | JP DrawUnshiftedRows_One | Jump to B4D5 to draw the ball. | ||||||
| Prev: A630 | Up: Map | Next: A6D3 |