Skip to navigation


Charts: TT16

[6502 Second Processor version]

Name: TT16 [Show more] Type: Subroutine Category: Charts Summary: Move the crosshairs on a chart
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * TT102 calls TT16

Move the chart crosshairs by the amount in X and Y.
Arguments: X The amount to move the crosshairs in the x-axis Y The amount to move the crosshairs in the y-axis
.TT16 TXA \ Push the change in X onto the stack (let's call this PHA \ the x-delta) DEY \ Negate the change in Y and push it onto the stack TYA \ (let's call this the y-delta) EOR #&FF PHA JSR WSCAN \ Call WSCAN to wait for the vertical sync, so the whole \ screen gets drawn and we can move the crosshairs with \ no screen flicker JSR TT103 \ Draw small crosshairs at coordinates (QQ9, QQ10), \ which will erase the crosshairs currently there PLA \ Store the y-delta in QQ19+3 and fetch the current STA QQ19+3 \ y-coordinate of the crosshairs from QQ10 into A, ready LDA QQ10 \ for the call to TT123 JSR TT123 \ Call TT123 to move the selected system's galactic \ y-coordinate by the y-delta, putting the new value in \ QQ19+4 LDA QQ19+4 \ Store the updated y-coordinate in QQ10 (the current STA QQ10 \ y-coordinate of the crosshairs) STA QQ19+1 \ This instruction has no effect, as QQ19+1 is \ overwritten below, both in TT103 and TT105 PLA \ Store the x-delta in QQ19+3 and fetch the current STA QQ19+3 \ x-coordinate of the crosshairs from QQ10 into A, ready LDA QQ9 \ for the call to TT123 JSR TT123 \ Call TT123 to move the selected system's galactic \ x-coordinate by the x-delta, putting the new value in \ QQ19+4 LDA QQ19+4 \ Store the updated x-coordinate in QQ9 (the current STA QQ9 \ x-coordinate of the crosshairs) STA QQ19 \ This instruction has no effect, as QQ19 is overwritten \ below, both in TT103 and TT105 \ Now we've updated the coordinates of the crosshairs, \ fall through into TT103 to redraw them at their new \ location