Skip to navigation

Elite on the BBC Micro

Version analysis of TT16

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: TT16 Type: Subroutine Category: Charts Summary: Move the crosshairs on a chart
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

Code variation 1 of 1Related to the Electron version

The Electron has its own unique video system that is controlled by the custom ULA, so unlike the other versions, we don't wait for the vertical sync to prevent flicker.

This variation is blank in the Electron version.

Cassette, Flight, Docked, 6502SP, Master

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

RSS Feed