Skip to navigation


Version analysis of RESET

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

Code variations between these versions are shown below.

Name: RESET Type: Subroutine Category: Start and end Summary: Reset most variables
Reset our ship and various controls, recharge shields and energy, and then fall through into RES2 to reset the stardust and the ship workspace at INWK. In this subroutine, this means zero-filling the following locations: * Pages &9, &A, &B, &C and &D

Code variation 1 of 7A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

* BETA to BETA+6, which covers the following:
* BETA to BETA+8, which covers the following:
* BETA, BET1 - Set pitch to 0 * XC, YC - Set text cursor to (0, 0) * QQ22 - Set hyperspace counters to 0 * ECMA - Turn E.C.M. off

Code variation 2 of 7A variation in the comments only

This variation is blank in the Cassette, 6502 Second Processor, Master and Electron versions.

* ALP1, ALP2 - Set roll signs to 0
It also sets QQ12 to &FF, to indicate we are docked, recharges the shields and energy banks, and then falls through into RES2.

Code variation 3 of 7A variation in the comments only

This variation is blank in the Disc (flight), Disc (docked), 6502 Second Processor and Master versions.

Other entry points: RES4 Reset the shields and energy banks, then fall through into RES2 to reset the stardust and the ship workspace at INWK
.RESET

Code variation 4 of 7A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

JSR ZERO \ Zero-fill pages &9, &A, &B, &C and &D, which clears \ the ship data blocks, the ship line heap, the ship \ slots for the local bubble of universe, and various \ flight and ship status variables
JSR ZERO \ Reset the ship slots for the local bubble of universe, \ and various flight and ship status variables

Code variation 5 of 7Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

LDX #6 \ Set up a counter for zeroing BETA through BETA+6
LDX #8 \ Set up a counter for zeroing BETA through BETA+8
.SAL3

 STA BETA,X             \ Zero the X-th byte after BETA

 DEX                    \ Decrement the loop counter

 BPL SAL3               \ Loop back for the next byte to zero

Code variation 6 of 7Specific to an individual platform

This variation is blank in the Cassette, Disc (flight), Disc (docked), 6502 Second Processor and Electron versions.

STX JSTGY \ X is now negative - i.e. &FF - so this sets JSTGY to \ &FF to set the joystick Y-channel to the default \ direction

Code variation 7 of 7Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

STX QQ12 \ X is now negative - i.e. &FF - so this sets QQ12 to \ &FF to indicate we are docked \ We now fall through into RES4 to restore shields and \ energy, and reset the stardust and ship workspace at \ INWK .RES4 LDA #&FF \ Set A to &FF so we can fill up the shields and energy \ bars with a full charge
TXA \ X is now negative - i.e. &FF - so this sets A and QQ12 STA QQ12 \ to &FF to indicate we are docked
TXA \ X is now negative - i.e. &FF - so this sets A to &FF
 LDX #2                 \ We're now going to recharge both shields and the
                        \ energy bank, which live in the three bytes at FSH,
                        \ ASH (FSH+1) and ENERGY (FSH+2), so set a loop counter
                        \ in X for 3 bytes

.REL5

 STA FSH,X              \ Set the X-th byte of FSH to &FF to charge up that
                        \ shield/bank

 DEX                    \ Decrement the loop counter

 BPL REL5               \ Loop back to REL5 until we have recharged both shields
                        \ and the energy bank

                        \ Fall through into RES2 to reset the stardust and ship
                        \ workspace at INWK