woz64/hardware/vic.asm

46 lines
1.4 KiB
NASM
Raw Permalink Normal View History

2020-01-20 07:32:37 +00:00
#importonce
.filenamespace Vic
2023-07-03 04:10:00 +00:00
// VIC registers and constants
// For more information, refer to:
2020-01-20 07:32:37 +00:00
// https://www.c64-wiki.com/wiki/VIC
// https://www.c64-wiki.com/wiki/Page_208-211
2023-07-03 04:10:00 +00:00
// Base address for VIC registers
.label VICREG = $D000
2020-01-20 07:32:37 +00:00
2023-07-03 04:10:00 +00:00
// Control register 2
.label CR2 = $D016
2020-01-20 07:32:37 +00:00
2023-07-03 04:10:00 +00:00
// Interrupt enabled register
.label INTE = $D01A
2020-01-21 02:09:18 +00:00
2023-07-03 04:10:00 +00:00
// Raster counter register
.label RCNT = $D012
2020-01-20 07:32:37 +00:00
* = * "VIC Functions"
2023-07-03 04:10:00 +00:00
// Initialize the VIC registers with values from the tvic array
2020-01-20 07:32:37 +00:00
init: {
2023-07-03 04:10:00 +00:00
ldx #47 // Set index to 47 (the number of bytes in tvic)
load_loop: // Start of loop to load tvic values into VIC registers
lda tvic-1, x // Load the byte from tvic at position x into the accumulator
sta VICREG-1, x // Store the byte in the accumulator into the VIC register at position x
dex // Decrement the index
bne load_loop // If the index is not zero, repeat the loop
rts // Return from subroutine
2020-01-20 07:32:37 +00:00
}
* = * "VIC Init Data"
2023-07-03 04:10:00 +00:00
// Initial values for the VIC registers
2020-01-20 07:32:37 +00:00
tvic:
2023-07-03 04:10:00 +00:00
// The following bytes are loaded into the VIC registers in the init subroutine
2020-01-20 07:32:37 +00:00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $9B, $37, $00, $00, $00, $08, $00
.byte $14, $0F, $00, $00 ,$00, $00, $00, $00
.byte $0E, $06, $01, $02, $03, $04, $00, $01
.byte $02, $03, $04, $05, $06, $07, $4C