Skip to navigation

Revs on the BBC Micro

Extra tracks: HookForward

Name: HookForward [Show more] Type: Subroutine Category: Extra tracks Summary: Move the player forward by an extra segment when edgeSegmentNumber is 10 Deep dive: Secrets of the extra tracks Code hooks in the extra tracks
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ModifyGameCode (Part 3 of 4) calls HookForward

This routine is called from MovePlayerSegment to move the player forward by an extra segment if required.
Arguments: A The value of edgeSegmentNumber
.HookForward CMP #11 \ If edgeSegmentNumber >= 11, then the player is either BCS move1 \ in the same segment, or has moved backwards, so jump \ to move1 \ If we get here then edgeSegmentNumber < 11, so \ edgeSegmentNumber must be 10, so we move the player \ forwards by two segments JSR MovePlayerForward \ Move the player forwards by one segment .move1 JMP MovePlayerForward \ Move the player forwards by one segment, returning \ from the subroutine using a tail call