diff --git a/src/main/kc/include/mos6569.h b/src/main/kc/include/mos6569.h index 06d06e402..5af767969 100644 --- a/src/main/kc/include/mos6569.h +++ b/src/main/kc/include/mos6569.h @@ -1,68 +1,138 @@ // MOS 6567 / 6569 Video Interface Chip (VIC II) // http://archive.6502.org/datasheets/mos_6567_vic_ii_preliminary.pdf +// https://dustlayer.com/vic-ii/2013/4/22/when-visibility-matters +// http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt struct MOS6569_VICII { - char SPRITE0_X; - char SPRITE0_Y; - char SPRITE1_X; - char SPRITE1_Y; - char SPRITE2_X; - char SPRITE2_Y; - char SPRITE3_X; - char SPRITE3_Y; - char SPRITE4_X; - char SPRITE4_Y; - char SPRITE5_X; - char SPRITE5_Y; - char SPRITE6_X; - char SPRITE6_Y; - char SPRITE7_X; - char SPRITE7_Y; - char SPRITES_XMSB; - char CONTROL1; - char RASTER; - char LIGHTPEN_X; - char LIGHTPEN_Y; - char SPRITES_ENABLE; - char CONTROL2; - char SPRITES_EXPAND_Y; - char MEMORY; - char IRQ_STATUS; - char IRQ_ENABLE; - char SPRITES_PRIORITY; - char SPRITES_MC; - char SPRITES_EXPAND_X; - char SPRITES_COLLISION; - char SPRITES_BG_COLLISION; - // $D020 Border Color - char BORDER_COLOR; - // $D021 Background Color 0 - char BG_COLOR; - // $D022 Background Color 1 - char BG_COLOR1; - // $D023 Background Color 2 - char BG_COLOR2; - // $D024 Background Color 3 - char BG_COLOR3; - // $D025 Sprite multicolor 0 - char SPRITES_MCOLOR1; - // $D026 Sprite multicolor 1 - char SPRITES_MCOLOR2; - // $D027 Color Sprite 0 - char SPRITE0_COLOR; - // $D028 Color Sprite 1 - char SPRITE1_COLOR; - // $D029 Color Sprite 2 - char SPRITE2_COLOR; - // $D02a Color Sprite 3 - char SPRITE3_COLOR; - // $D02b Color Sprite 4 - char SPRITE4_COLOR; - // $D02c Color Sprite 5 - char SPRITE5_COLOR; - // $D02d Color Sprite 6 - char SPRITE6_COLOR; - // $D02e Color Sprite 7 - char SPRITE7_COLOR; + // $D000 X-Coordinate Sprite#0 + char SPRITE0_X; + // $D001 Y-Coordinate Sprite#0 + char SPRITE0_Y; + // $D002 X-Coordinate Sprite#1 + char SPRITE1_X; + // $D003 Y-Coordinate Sprite#1 + char SPRITE1_Y; + // $D004 X-Coordinate Sprite#2 + char SPRITE2_X; + // $D005 Y-Coordinate Sprite#2 + char SPRITE2_Y; + // $D006 X-Coordinate Sprite#3 + char SPRITE3_X; + // $D007 Y-Coordinate Sprite#3 + char SPRITE3_Y; + // $D008 X-Coordinate Sprite#4 + char SPRITE4_X; + // $D009 Y-Coordinate Sprite#4 + char SPRITE4_Y; + // $D00A X-Coordinate Sprite#5 + char SPRITE5_X; + // $D00B Y-Coordinate Sprite#5 + char SPRITE5_Y; + // $D00C X-Coordinate Sprite#6 + char SPRITE6_X; + // $D00D Y-Coordinate Sprite#6 + char SPRITE6_Y; + // $D00E X-Coordinate Sprite#7 + char SPRITE7_X; + // $D00F Y-Coordinate Sprite#7 + char SPRITE7_Y; + // $D010 Bit#9 for Sprite X-Coordinates + char SPRITES_XMSB; + // $D011 Control Register #1 + // - Bit#0-#2: YSCROLL Screen Soft Scroll Vertical + // - Bit#3: RSEL Switch betweem 25 or 24 visible rows + // - Bit#4: DEN Switch VIC-II output on/off + // - Bit#5: BMM Turn Bitmap Mode on/off + // - Bit#6: ECM Turn Extended Color Mode on/off + // - Bit#7: RST8 9th Bit for $D012 Rasterline counter + // Initial Value: %10011011 + char CONTROL1; + // $D012 RASTER Raster counter + char RASTER; + // $D013 LPX Light pen X + // When Reading:Return current Rasterline + // When Writing:Define Rasterline for Interrupt triggering + char LIGHTPEN_X; + // $D014 LPY Light pen Y + char LIGHTPEN_Y; + // $D015 Sprite enabled + // If a bit is set high the corresponding Sprite is enabled on Screen + char SPRITES_ENABLE; + // $D016 Control register 2 + // - Bit#0-#2: XSCROLL Screen Soft Scroll Horizontal + // - Bit#3: CSEL Switch betweem 40 or 38 visible columns + // - Bit#4: MCM Turn Multicolor Mode on/off + // - Bit#5-#7: not used + // Initial Value: %00001000 + char CONTROL2; + // $D017 Sprite Y expansion + // If a bit is set high, the corresponding Sprite will be stretched vertically x2 + char SPRITES_EXPAND_Y; + // $D018 VIC-II base addresses + // - Bit#0: not used + // - Bit#1-#3: CB Address Bits 11-13 of the Character Set (*2048) + // - Bit#4-#7: VM Address Bits 10-13 of the Screen RAM (*1024) + // Initial Value: %00010100 + char MEMORY; + // $D019 Interrupt Status Register + // - Bit#0: IRST Interrupt by Rasterline triggered when high + // - Bit#1: IMBC Interrupt by Spite-Background collision triggered when high + // - Bit#2: IMMC Interrupt by Sprite-Sprite collision triggered when high + // - Bit#3: ILP Interrupt by Lightpen impulse triggered when high + // - Bit#4-#6: not used + // - Bit#7: IRQ If set high at least one of the Interrupts above were triggered + char IRQ_STATUS; + // $D01A Interrupt Enable Register + // - Bit#0: ERST Request Interrupt by Rasterline by setting high + // - Bit#1: EMBC Request Interrupt by Spite-Background collision by setting high + // - Bit#2: EMMC Request Interrupt by Sprite-Sprite collision by setting high + // - Bit#3: ELP Request Interrupt by Lightpen impulse by setting high + // - Bit#4-#7: not used + char IRQ_ENABLE; + // $D01B Sprite data priority + // If a bit is set high, the Background overlays the corresponding Sprite, if set low, the Sprite overlays Background. + char SPRITES_PRIORITY; + // $D01C Sprite multicolor + // If a bit is set high, the the corresponding Sprite is a Multicolor-Sprite + char SPRITES_MC; + // $D01D Sprite X expansion + // If a bit is set high, the corresponding Sprite will be stretched horizontally x2 + char SPRITES_EXPAND_X; + // $D01E Sprite-sprite collision + // If two sprites collide, then corresponding Bits involved in the collision are set to high. + char SPRITES_COLLISION; + // $D01F Sprite-data collision + // If a sprite collides with the background, then its Bit is set to high. + char SPRITES_BG_COLLISION; + // $D020 Border Color + char BORDER_COLOR; + // $D021 Background Color 0 + char BG_COLOR; + // $D022 Background Color 1 + char BG_COLOR1; + // $D023 Background Color 2 + char BG_COLOR2; + // $D024 Background Color 3 + char BG_COLOR3; + // $D025 Sprite multicolor 0 + char SPRITES_MCOLOR1; + // $D026 Sprite multicolor 1 + char SPRITES_MCOLOR2; + // $D027 Color Sprite#0 + char SPRITE0_COLOR; + // $D028 Color Sprite#1 + char SPRITE1_COLOR; + // $D029 Color Sprite#2 + char SPRITE2_COLOR; + // $D02a Color Sprite#3 + char SPRITE3_COLOR; + // $D02b Color Sprite#4 + char SPRITE4_COLOR; + // $D02c Color Sprite#5 + char SPRITE5_COLOR; + // $D02d Color Sprite#6 + char SPRITE6_COLOR; + // $D02e Color Sprite#7 + char SPRITE7_COLOR; }; // Positions of the border (in sprite positions)