Skip to content

Instantly share code, notes, and snippets.

@yupferris
Created September 10, 2017 20:09
Show Gist options
  • Save yupferris/7aeaa90b58d0eabff08fcba7672d1dd2 to your computer and use it in GitHub Desktop.
Save yupferris/7aeaa90b58d0eabff08fcba7672d1dd2 to your computer and use it in GitHub Desktop.
VIC pseudocode (not necessarily accurate/rigorous, but useful enough to explain stuff)
// Sometime outside of display area..
VCBASE := 0
VIDEO_COLOR_BUFFER := 0
for RASTER in 0..312 {
for line_cycle in 0..63 {
badline_condition := (RASTER & 0x07) == (YSCROLL & 0x07)
if (badline_condition) {
MODE = MODE_DISPLAY
}
BA := line_cycle >= 12 && line_cycle <= 54 && badline_condition
if (line_cycle == 14) {
VC := VCBASE
VMLI := 0
if (badline_condition) {
RC := 0
}
}
if (line_cycle >= 15 && line_cycle <= 54) {
// c-access
if (badline_condition) {
VIDEO_COLOR_BUFFER[VMLI] := (COLOR_MEM[VC] << 8) | SCREEN_MEM[VC]
}
// g-access
DISPLAY := VIDEO_COLOR_BUFFER[VMLI]
VC := VC + 1
VMLI := VMLI + 1
}
if (line_cycle == 58 && RC == 7) {
MODE := MODE_IDLE
VCBASE := VC
badline_condition := (RASTER & 0x07) == (YSCROLL & 0x07)
if (badline_condition) {
MODE = MODE_DISPLAY
}
if (MODE == MODE_DISPLAY) {
RC := RC + 1
}
}
badline_condition := (RASTER & 0x07) == (YSCROLL & 0x07)
if (badline_condition) {
MODE = MODE_DISPLAY
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment