Skip to content

Instantly share code, notes, and snippets.

@gnacu
Last active May 30, 2020 13:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnacu/698b846a5178568ca4ed5326e2270063 to your computer and use it in GitHub Desktop.
Save gnacu/698b846a5178568ca4ed5326e2270063 to your computer and use it in GitHub Desktop.
SEI ;Disable interrupts
NOP
NOP
LDA #7F
STA DC0D ;Mask CIA1's interrupt generator
SEI
LDA #08 ;Set the KERNAL's interrupt vector
STA 0315 ;at $0314/$0315
LDA #B0 ;to $08B0.
STA 0314 ;Implemented below.
LDA #00
STA D011 ;Turn off the display
STA D020 ;Set border color to black
JSR 0855 ;Call routine to move data
LDA #3B ;Turn the VIC's display back on
STA D011
CLI ;Enable interrupts
0831:
LDA #00
BNE 0831 ;Enter a tight infinite loop.
SEI ;Disable interrupts
JSR FDA3 ;Initialise SID, CIA and IRQ
JSR FD15 ;Restore default I/O vectors
JSR E5A0 ;Initialize the VIC
LDA #01 ;Use color code "white"
LDX #00
0843:
STA D800,X ;Fill color memory with "white"
STA D900,X
STA DA00,X
STA DB00,X
DEX
BNE 0843
CLI ;Enable interrupts
RTS ;Return to BASIC
;----[ Move Data, Configure VIC and CIAs ]----
0855:
LDX #00
0857:
LDA 8328,X ;Copy color data to color memory
STA D800,X
LDA 8428,X
STA D900,X
LDA 8528,X
STA DA00,X
LDA 8628,X
STA DB00,X
LDA 7F40,X ;Copy multi-color data to screen memory
STA 5C00,X
LDA 8040,X
STA 5D00,X
LDA 8140,X
STA 5E00,X
LDA 8240,X
STA 5F00,X
DEX
BNE 0857
LDA 8710
STA D021 ;Set VIC background color
LDX #01
STX D01A ;Mask VIC raster interrupt
STX 0832 ;Enable the infinite loop above.
BIT DC0D ;Enable CIA1's Interrupts
LDA #2E
STA D012 ;Set VIC raster counter
LDA #78
STA D018 ;Set VIC memory pointers
LDA #02
STA DD00 ;Set VIC memory bank
LDA #D8
STA D016 ;Turn on VIC multi-color mode
RTS
;----[ IRQ Service Routine Wedge ]----
08B0:
LDA #01
STA D019 ;Clear Raster Interrupt
LDA DC01 ;Scan Keyboard Matrix
AND #10 ;Compare with space key column
BNE 08C1 ;Skip if space not pressed
LDA #00
STA 0832 ;Break the infinite loop above
08C1:
JMP EA81 ;Continue KERNAL IRQ routine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment