Created
March 10, 2024 22:13
-
-
Save blondie7575/25a914a89b4c0305cddc5945be2b5f3f to your computer and use it in GitHub Desktop.
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
.include "macros.s" | |
NEWVIDEO = $c029 | |
BORDERCOLOR = $e0c034 | |
.org $800 | |
main: | |
NATIVE | |
SHRVIDEO | |
jsr initSCBs | |
; Install scanline interrupt handler | |
sei | |
lda #scanLineInterruptHandler | |
sta $e10029 | |
BITS8 | |
lda #0 ; This code bank | |
sta $e1002b | |
BITS16 | |
cli | |
; Enable a scanline interrupt | |
BITS8 | |
lda $e19d92 ; Enable interrupt on scanline 146 | |
ora #%01000000 | |
sta $e19d92 | |
lda $e0c023 ; Enable scanline interrupts | |
ora #%00000010 | |
sta $e0c023 | |
BITS16 | |
deadlock: | |
jmp deadlock | |
; Initialize all scanline control bytes | |
initSCBs: | |
BITS8 | |
lda #0 | |
ldx #200 ;set all 200 scbs to A | |
initSCBsLoop: | |
dex | |
sta $e19d00,x | |
cpx #0 | |
bne initSCBsLoop | |
BITS16 | |
rts | |
; Minimal possible handler for IRQ.SCAN (vector E1/0028-002B) | |
scanLineInterruptHandler: | |
OP8 ; Interrupt firmware calls us in 8-bit native mode so make sure assembler knows that | |
BITS8 | |
lda #$9F ; Clear scanline interrupt source | |
sta $e0c032 | |
lda BORDERCOLOR ; Set border color | |
eor #$07 | |
sta BORDERCOLOR | |
clc | |
rtl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment