Skip to navigation

Main game loop: SetScannerAndPause

Name: SetScannerAndPause [Show more] Type: Subroutine Category: Main game loop Summary: Set the scanner update status and delay for 40 empty loops of 256 iterations each (i.e. 10,240 loops)
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * MainGameLoop calls SetScannerAndPause

Arguments: A The new value for scannerUpdate (this routine is only ever called from the main game loop with A = 0, so this sets scannerUpdate to zero to prevent scanner updates)
.SetScannerAndPause STA scannerUpdate \ Set scannerUpdate to the new value in A LDX #40 \ We now perform a delay with a nested loop, so set X \ as an outer loop counter \ \ We use Y as an inner loop counter to count down from \ 255 to 0, though the first loop will depend on the \ initial value of Y, which isn't explicitly set to \ anything before the routine is called .scup1 DEY \ Decrement the inner loop counter in Y BNE scup1 \ Loop back until Y reaches zero DEX \ Decrement the inner loop counter in X BNE scup1 \ Loop back until X reaches zero RTS \ Return from the subroutine EQUB &FF, &FF \ These bytes appear to be unused EQUB &FF, &FF