Created
August 24, 2019 13:21
-
-
Save spacekitcat/735f02430096393ed68e5ec8c2007af3 to your computer and use it in GitHub Desktop.
Creates a time delay on the 6502. Easy to adapt the intervals or even parameterise the subroutine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Written for the CA65 assembler and tested on a NES emulator | |
.zeropage | |
counter_lsb: .res 1 | |
counter_msb: .res 1 | |
.proc RateLimit | |
lda #$EE ; Most Significant Byte 'interval' | |
sta counter_msb | |
LOOP_MSB: | |
lda #$00 ; Least Significant Byte 'interval' | |
sta counter_lsb | |
LOOP_LSB: | |
inc counter_lsb | |
lda counter_lsb | |
bne LOOP_LSB | |
inc counter_msb | |
lda counter_msb | |
bne LOOP_MSB | |
rts | |
.endproc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment