Skip to navigation

Elite on the BBC Micro and NES

Utility routines: ZERO

[BBC Micro cassette version]

Name: ZERO [Show more] Type: Subroutine Category: Utility routines Summary: Zero-fill pages &9, &A, &B, &C and &D
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: * LOD calls ZERO * RES2 calls ZERO * RESET calls ZERO * SVE calls ZERO

This resets the following workspaces to zero: * 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)
.ZERO 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