Created
August 16, 2019 08:09
-
-
Save fsphil/7655a394ec5f953c910e9d9369dced56 to your computer and use it in GitHub Desktop.
29 byte X
This file contains 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
ov = $0D ; == $FF, initial value for the overflow counter | |
* = $0304 - (end - scroll) | |
scroll: jsr $AAD7 | |
loop: lda #$A0 | |
sta $D3E0 - $80, x | |
sta $0400+40*24+39-$80+1, y ; incrementing rower, y finishes with value $80 | |
sta $0400+40*24-$7B-1, x ; decrementing rower, x finishes with value $7b | |
adc ov | |
sta ov | |
dex | |
iny | |
bmi * | |
bcc loop | |
jmp scroll | |
end: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's not just 6502/6510, it also relies on side effects of the KERNAL routines (I think $0d is loaded with #$ff as part of the C64 boot-up process) and it overwrites the $0302/$0303 vector, so the KERNAL never really returns from the LOAD to BASIC but starts the program instead)). It also spams many VIC memory addresses (the VIC appears several times in the memory map at "mirrored addresses"), eventually also hitting the correct addresses $d020/$d021 (which also appear at $d320/$d321) with #$a0 (which the VIC interprets as #$00 (= color code for black), as it only considers the lower four bits).
I guess you already figured that DEX/INY leave the carry bit alone, so the "overflow variable" can be used to determine whether the call to the scrolling routine needs to be executed or skipped.