Skip to navigation

Revs on the BBC Micro

Workspaces: Stack variables

Name: Stack variables [Show more] Type: Workspace Address: &0100 to &0175 Category: Workspaces Summary: Variables that share page 1 with the stack
Context: See this workspace in context in the source code References: No direct references to this workspace in this source file
ORG &0100 .positionNumber SKIP 0 \ Position numbers to show in the first column of the \ driver table .carStatus SKIP 20 \ Each car's status byte \ \ * Bit 0 = update this carStatus byte when applying \ tactics in the ProcessOvertaking routine \ \ * Clear = do update carStatus \ \ * Set = do not update carStatus \ \ * Bit 4 = affects driving around corners for visible \ cars (see BuildVisibleCar) \ \ * Clear = set carSteering to the segment's \ steering line in segmentSteering when \ going fast enough (carSpeedHi >= 50) \ \ * Set = do not set carSteering in the \ BuildVisibleCar routine (and use the \ value set by ProcessOvertaking instead) \ \ * Bit 6 = acceleration status \ \ * Clear = do not acclerate car \ \ * Set = acclerate car \ \ * Bit 7 = braking status \ \ * Clear = do not apply brakes \ \ * Set = apply brakes .carSteering SKIP 20 \ Contains the steering to apply to each car \ \ * Bits 0-5 = the amount of steering as a positive \ value (0 to 31) \ \ * Bit 6 = controls whether to apply steering in the \ MoveCars routine \ \ * Clear = always apply steering \ \ * Set = only apply steering if there is enough \ room on the track \ \ * Bit 7 = the direction of the steering \ \ * Clear = steer left \ \ * Set = steer right \ \ The steering is stored as a sign-magnitude number, \ where the sign is in bit 7 and the magnitude is in \ bits 0-5 \ \ The amount of steering is stored in terms of the \ change in racing line, where the width of the track is \ 256, so steering by 26 would steer the car sideways by \ 10% of the track width .driverSpeed SKIP 20 \ The average speed of this driver in the race (88 to \ 162) \ \ The speed for each driver depends on a number of \ factors, and is calculated in the SetDriverSpeed \ routine \ \ Indexed by driver number (0 to 19) .driversInOrder SKIP 20 \ A list of driver numbers in order \ \ For example, during a race, this contains the race \ position of each driver in the race (i.e. first place, \ second place etc.) \ \ It is also used to sort drivers by lap time and points \ for the driver table \ \ Indexed by driver number (0 to 19) \ \ Gets set in InitialiseDrivers to the number of each \ driver, so the initial order is driver number .carSpeedHi SKIP 20 \ High byte of each car's forward speed \ \ Stored as an 8-bit value (carSpeedHi carSpeedLo) .carProgress SKIP 20 \ Lowest byte of each car's progress through the segment \ it's in \ \ This is effectively a fractional part of the car's \ progress throught the segment, with 0 being the start \ of the segment and 255 the end of the segment \ \ When this byte rolls over, we increment the car's \ segment number in (objectSegmentHi objectSegmentLo) to \ move on to the next segment .carRacingLine SKIP 20 \ Each car's position on the track in the x-axis \ \ This determines how far each car is to the left or \ right on the track - i.e. it's the car's racing line \ \ * 0 is full right \ \ * 128 is the centre line \ \ * 255 is full left \ \ Bit 7 is therefore set if the car is in the left half \ the track, and clear for the right half .objectStatus SKIP 24 \ Various status flags for each object \ \ * Bits 0-3 = the object type \ \ * Bit 6: 0 = the car is still racing \ 1 = the car has finished the race \ \ * Bit 7: 0 = object is visible \ 1 = object is hidden \ \ Set to &80 in ResetVariables .carSectionSpeed SKIP 20 \ Set to the driver speed for the next track section, \ which is taken from the track data and used to set the \ section's maximum speed for non-player drivers \ \ Only applies to sections with bit 7 of the flag byte \ set, in which case carSectionSpeed is set to the \ trackDriverSpeed value from the preceding track \ section \ \ Set to 255 in ResetVariables, which means no minimum \ speed