.ISDK LDA K%+NI%+36 ; 1. Fetch the NEWB flags (byte #36) of the second ship AND #%00000100 ; in the ship data workspace at K%, which is reserved BNE MA62 ; for the sun or the space station (in this case it's ; the latter), and if bit 2 is set, meaning the station ; is hostile, jump down to MA62 to fail docking (so ; trying to dock at a station that we have annoyed does ; not end well) LDA INWK+14 ; 2. If nosev_z_hi < 214, jump down to MA62 to fail CMP #214 ; docking, as the angle of approach is greater than 26 BCC MA62 ; degrees JSR SPS1 ; Call SPS1 to calculate the vector to the planet and ; store it in XX15 LDA XX15+2 ; Set A to the z-axis of the vector ; This version of Elite omits check 3 (which would check ; the sign of the z-axis) CMP #89 ; 4. If z-axis < 89, jump to MA62 to fail docking, as BCC MA62 ; we are not in the 22.0 degree safe cone of approach LDA INWK+16 ; 5. If |roofv_x_hi| < 80, jump to MA62 to fail docking, AND #%01111111 ; as the slot is more than 36.6 degrees from horizontal CMP #80 BCC MA62 .GOIN ; If we arrive here, we just docked successfully JSR stopbd ; Stop playing the docking music (if it is playing) JMP DOENTRY ; Go to the docking bay (i.e. show the ship hangar) .MA62 ; If we arrive here, docking has just failed LDA DELTA ; If the ship's speed is < 5, jump to MA67 to register CMP #5 ; some damage, but not a huge amount BCC MA67 JMP DEATH ; Otherwise we have just crashed into the station, so ; process our deathName: Main flight loop (Part 9 of 16) [Show more] Type: Subroutine Category: Main loop Summary: For each nearby ship: If it is a space station, check whether we are successfully docking with it Deep dive: Program flow of the main game loop Docking checksContext: See this subroutine in context in the source code References: This subroutine is called as follows: * ESCAPE calls via GOIN
The main flight loop covers most of the flight-specific aspects of Elite. This section covers the following: * Process docking with a space station For details on the various docking checks in this routine, see the deep dive on "Docking checks".
Other entry points: GOIN We jump here from part 3 of the main flight loop if the docking computer is activated by pressing "C"
[X]
Subroutine DEATH (category: Start and end)
Display the death screen
[X]
Subroutine DOENTRY (category: Flight)
Dock at the space station, show the ship hangar and work out any mission progression
[X]
Workspace K% (category: Workspaces)
Ship data blocks and ship line heaps
[X]
Label MA62 is local to this routine
[X]
Label MA67 in subroutine Main flight loop (Part 10 of 16)
[X]
Configuration variable NI% = 37
The number of bytes in each ship's data block (as stored in INWK and K%)
[X]
Subroutine SPS1 (category: Maths (Geometry))
Calculate the vector to the planet and store it in XX15
[X]
Subroutine stopbd (category: Sound)
Stop playing the docking music