Skip to navigation


Version analysis of ZERO

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

Code variations between these versions are shown below.

Name: ZERO Type: Subroutine Category: Utility routines

Code variation 1 of 3A variation in the comments only

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

Summary: Zero-fill pages &9, &A, &B, &C and &D
Summary: Reset the local bubble of universe and ship status

This resets the following workspaces to zero:

Code variation 2 of 3A variation in the comments only

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

* The ship data blocks ascending from K% at &0900 * The ship line heap descending from WP at &0D40 * WP workspace variables from FRIN to de, which include the ship slots for the local bubble of universe, and various flight and ship status variables (only a portion of the LSX/LSO sun line heap is cleared)
* WP workspace variables from FRIN to de, which include the ship slots for the local bubble of universe, and various flight and ship status variables (only a portion of the LSX/LSO sun line heap is cleared)
* UP workspace variables from FRIN to de, which include the ship slots for the local bubble of universe, and various flight and ship status variables
* The ship data blocks ascending from K% at &0900 * The ship line heap descending from WP at &0BE0 * WP workspace variables from FRIN to de, which include the ship slots for the local bubble of universe, and various flight and ship status variables (only a portion of the LSO space station line heap is cleared)
.ZERO

Code variation 3 of 3Specific to an individual platform

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

LDX #&D \ Point X to page &D .ZEL JSR ZES1 \ Call ZES1 to zero-fill the page in X DEX \ Decrement X to point to the next page CPX #9 \ If X is > 9 (i.e. is &A, &B or &C), then loop back BNE ZEL \ up to clear the next page \ Then fall through into ZES1 with X set to 9, so we \ clear page &9 too
LDX #(de-FRIN) \ We're going to zero the UP workspace variables from \ FRIN to de, so set a counter in X for the correct \ number of bytes LDA #0 \ Set A = 0 so we can zero the variables .ZEL2 STA FRIN,X \ Zero the X-th byte of FRIN to de DEX \ Decrement the loop counter BPL ZEL2 \ Loop back to zero the next variable until we have done \ them all RTS \ Return from the subroutine
LDX #&B \ Point X to page &B JSR ZES1 \ Call ZES1 to zero-fill the page in X DEX \ Decrement X to point to the next page (&A) JSR ZES1 \ Call ZES1 to zero-fill the page in X DEX \ Decrement X to point to the next page \ Then fall through into ZES1 with X set to 9, so we \ clear page &9 too