Skip to navigation

Aviator on the BBC Micro

Utility routines: ResetVariable

Name: ResetVariable [Show more] Type: Subroutine Category: Utility routines Summary: Set a 16-bit in the variable workspace to 0
Arguments: X The offset from xTurnHi of the low byte of the variable to zero: * &00 = (xTurnTop xTurnHi) * &02 = (zTurnTop zTurnHi) * &80 = (dxTurnTop dxTurnHi) * &82 = (dzTurnTop dzTurnHi) * &8A = (yVelocityTop yVelocityHi) * &EA = (xRotationHi xRotationLo) * &EC = (zRotationHi zRotationLo) * &EE = (yPlaneHi yPlaneLo) In the case of the two 24-bit variables, X is the offset of the high byte, and we have to zero the low byte manually after the routine call Returns: A A is set to 0
.ResetVariable LDA #0 \ Zero the X-th byte from xTurnHi STA xTurnHi,X STA xTurnTop,X \ Zero the X-th byte from xTurnTop RTS \ Return from the subroutine