Skip to navigation

Elite on the BBC Micro

Utility routines: ZERO [Disc version, Docked]

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: * RES2 calls ZERO * RESET 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 #(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