2021-06-19 20:11:26 +00:00
/// @file
2021-06-19 18:49:14 +00:00
/// C64 DTV version 2 Registers and Constants
2021-06-19 20:28:44 +00:00
///
2021-06-19 18:49:14 +00:00
/// Sources
/// (J) https://www.c64-wiki.com/wiki/C64DTV_Programming_Guide
/// (H) http://dtvhacking.cbm8bit.com/dtv_wiki/images/d/d9/Dtv_registers_full.txt
2018-03-18 15:35:47 +00:00
2020-04-11 19:15:34 +00:00
# include <c64dtv.h>
# include <c64.h>
2018-03-18 15:35:47 +00:00
2021-06-19 18:49:14 +00:00
/// Feature enables or disables the extra C64 DTV features
2024-01-02 18:45:16 +00:00
char * const DTV_FEATURE = ( char * ) 0xd03f ;
2020-04-13 18:00:13 +00:00
const char DTV_FEATURE_ENABLE = 1 ;
const char DTV_FEATURE_DISABLE_TIL_RESET = 2 ;
2018-03-25 21:40:38 +00:00
2021-06-19 18:49:14 +00:00
/// Controls the graphics modes of the C64 DTV
2024-01-02 18:45:16 +00:00
char * const DTV_CONTROL = ( char * ) 0xd03c ;
const char DTV_LINEAR = 0x01 ;
const char DTV_BORDER_OFF = 0x02 ;
const char DTV_HIGHCOLOR = 0x04 ;
const char DTV_OVERSCAN = 0x08 ;
const char DTV_COLORRAM_OFF = 0x10 ;
const char DTV_BADLINE_OFF = 0x20 ;
const char DTV_CHUNKY = 0x40 ;
2018-03-18 15:35:47 +00:00
2021-06-19 18:49:14 +00:00
/// Defines colors for the 16 first colors ($00-$0f)
2024-01-02 18:45:16 +00:00
char * const DTV_PALETTE = ( char * ) 0xd200 ;
2018-03-25 21:40:38 +00:00
2021-06-19 18:49:14 +00:00
/// Default vallues for the palette
2024-01-02 18:45:16 +00:00
char DTV_PALETTE_DEFAULT [ 16 ] = { 0x00 , 0x0f , 0x36 , 0xbe , 0x58 , 0xdb , 0x86 , 0xff , 0x29 , 0x26 , 0x3b , 0x05 , 0x07 , 0xdf , 0x9a , 0x0a } ;
2018-03-26 21:49:07 +00:00
2021-06-19 18:49:14 +00:00
/// Linear Graphics Plane A Counter Control
2024-01-02 18:45:16 +00:00
char * const DTV_PLANEA_START_LO = ( char * ) 0xd03a ;
char * const DTV_PLANEA_START_MI = ( char * ) 0xd03b ;
char * const DTV_PLANEA_START_HI = ( char * ) 0xd045 ;
char * const DTV_PLANEA_STEP = ( char * ) 0xd046 ;
char * const DTV_PLANEA_MODULO_LO = ( char * ) 0xd038 ;
char * const DTV_PLANEA_MODULO_HI = ( char * ) 0xd039 ;
2018-03-25 21:40:38 +00:00
2021-06-19 18:49:14 +00:00
/// Linear Graphics Plane B Counter Control
2024-01-02 18:45:16 +00:00
char * const DTV_PLANEB_START_LO = ( char * ) 0xd049 ;
char * const DTV_PLANEB_START_MI = ( char * ) 0xd04a ;
char * const DTV_PLANEB_START_HI = ( char * ) 0xd04b ;
char * const DTV_PLANEB_STEP = ( char * ) 0xd04c ;
char * const DTV_PLANEB_MODULO_LO = ( char * ) 0xd047 ;
char * const DTV_PLANEB_MODULO_HI = ( char * ) 0xd048 ;
2018-03-25 21:40:38 +00:00
2021-06-19 18:49:14 +00:00
/// Select memory bank where sprite data is fetched from (bits 5:0) - source only (J)
/// Memory address of Sprite RAM is SpriteBank*$10000
2024-01-02 18:45:16 +00:00
char * const DTV_SPRITE_BANK = ( char * ) 0xd04d ;
2018-03-25 21:40:38 +00:00
2021-06-19 18:49:14 +00:00
/// Select memory bank where color data is fetched from (bits 11:0)
/// Memory address of Color RAM is ColorBank*$400
2024-01-02 18:45:16 +00:00
char * const DTV_COLOR_BANK_LO = ( char * ) 0xd036 ;
char * const DTV_COLOR_BANK_HI = ( char * ) 0xd037 ;
2018-03-25 21:40:38 +00:00
2024-01-02 18:45:16 +00:00
const unsigned long DTV_COLOR_BANK_DEFAULT = 0x1d800 ;
2018-03-28 22:37:04 +00:00
2021-06-19 18:49:14 +00:00
/// Selects memory bank for normal VIC color mode and lower data for high color modes. (bits 5:0)
/// Memory address of VIC Graphics is GraphicsBank*$10000
2024-01-02 18:45:16 +00:00
char * const DTV_GRAPHICS_VIC_BANK = ( char * ) 0xd03d ;
2021-06-19 18:49:14 +00:00
/// Selects memory bank for upper data for high color modes. (bits 5:0) - source only (H)
2024-01-02 18:45:16 +00:00
char * const DTV_GRAPHICS_HICOL_BANK = ( char * ) 0xd03e ;
2018-03-25 21:40:38 +00:00
2021-06-19 18:49:14 +00:00
/// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
/// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
/// The actual memory addressed will be $4000*cpuSegmentIdx
2020-04-13 18:00:13 +00:00
void dtvSetCpuBankSegment1 ( char cpuBankIdx ) ;
2018-04-15 18:02:48 +00:00
2021-06-19 18:49:14 +00:00
/// Blitter Source A Start
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCA_LO = ( char * ) 0xd320 ;
char * const DTV_BLITTER_SRCA_MI = ( char * ) 0xd321 ;
char * const DTV_BLITTER_SRCA_HI = ( char * ) 0xd322 ;
2021-06-19 18:49:14 +00:00
/// Blitter Source A Modulo
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCA_MOD_LO = ( char * ) 0xd323 ;
char * const DTV_BLITTER_SRCA_MOD_HI = ( char * ) 0xd324 ;
2021-06-19 18:49:14 +00:00
/// Blitter Source A Line Length
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCA_LIN_LO = ( char * ) 0xd325 ;
char * const DTV_BLITTER_SRCA_LIN_HI = ( char * ) 0xd326 ;
2021-06-19 18:49:14 +00:00
/// Blitter Source A Step ([7:4] integral part, [3:0] fractional part)
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCA_STEP = ( char * ) 0xd327 ;
2021-06-19 18:49:14 +00:00
/// Blitter Source B Start
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCB_LO = ( char * ) 0xd328 ;
char * const DTV_BLITTER_SRCB_MI = ( char * ) 0xd329 ;
char * const DTV_BLITTER_SRCB_HI = ( char * ) 0xd32a ;
2021-06-19 18:49:14 +00:00
/// Blitter Source B Modulo
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCB_MOD_LO = ( char * ) 0xd32b ;
char * const DTV_BLITTER_SRCB_MOD_HI = ( char * ) 0xd32c ;
2021-06-19 18:49:14 +00:00
/// Blitter Source B Line Length
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCB_LIN_LO = ( char * ) 0xd32d ;
char * const DTV_BLITTER_SRCB_LIN_HI = ( char * ) 0xd32e ;
2021-06-19 18:49:14 +00:00
/// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_SRCB_STEP = ( char * ) 0xd32f ;
2021-06-19 18:49:14 +00:00
/// Blitter Destination Start
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_DEST_LO = ( char * ) 0xd330 ;
char * const DTV_BLITTER_DEST_MI = ( char * ) 0xd331 ;
char * const DTV_BLITTER_DEST_HI = ( char * ) 0xd332 ;
2021-06-19 18:49:14 +00:00
/// Blitter Source B Modulo
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_DEST_MOD_LO = ( char * ) 0xd333 ;
char * const DTV_BLITTER_DEST_MOD_HI = ( char * ) 0xd334 ;
2021-06-19 18:49:14 +00:00
/// Blitter Source B Line Length
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_DEST_LIN_LO = ( char * ) 0xd335 ;
char * const DTV_BLITTER_DEST_LIN_HI = ( char * ) 0xd336 ;
2021-06-19 18:49:14 +00:00
/// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_DEST_STEP = ( char * ) 0xd337 ;
2021-06-19 18:49:14 +00:00
/// Blitter Blit Length
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_LEN_LO = ( char * ) 0xd338 ;
char * const DTV_BLITTER_LEN_HI = ( char * ) 0xd339 ;
2021-06-19 18:49:14 +00:00
/// Blitter Control
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_CONTROL = ( char * ) 0xd33a ;
2021-06-19 18:49:14 +00:00
/// Bit[0] Force Start Strobe when set
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_FORCE_START = 0 b00000001 ;
2021-06-19 18:49:14 +00:00
/// Bit[1] Source A Direction Positive when set
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_SRCA_FWD = 0 b00000010 ;
2021-06-19 18:49:14 +00:00
/// Bit[2] Source B Direction Positive when set
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_SRCB_FWD = 0 b00000100 ;
2021-06-19 18:49:14 +00:00
/// Bit[3] Destination Direction Positive when set
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_DEST_FWD = 0 b00001000 ;
2021-06-19 18:49:14 +00:00
/// Bit[4] VIC IRQ Start when set
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_VIC_IRQ = 0 b00010000 ;
2021-06-19 18:49:14 +00:00
/// Bit[5] CIA IRQ Start when set($DCXX CIA)
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_CIA_IRQ = 0 b00100000 ;
2021-06-19 18:49:14 +00:00
/// Bit[6] V Blank Start when set
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_VBLANK = 0 b01000000 ;
2021-06-19 18:49:14 +00:00
/// Bit[7] Blitter IRQ Enable when set
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_IRQ_EN = 0 b10000000 ;
2021-06-19 18:49:14 +00:00
/// Blitter Transparency
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_TRANSPARANCY = ( char * ) 0xd33b ;
2021-06-19 18:49:14 +00:00
/// Bit[0] Disable Channel B.
/// (data into b port of ALU is forced to %00000000. ALU functions as normal)
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_DISABLE_B = 0 b00000001 ;
2021-06-19 18:49:14 +00:00
/// Bit[1] Write Transparent Data when set
2018-04-15 18:02:48 +00:00
//(Data will be written if source a data *IS* %00000000. This can be used with channel b and ALU set to OR to write Data masked by source A.) Cycles will be saved if No writes.
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_WRITE_TRANSPARENT = 0 b00000010 ;
2021-06-19 18:49:14 +00:00
/// Bit[2] Write Non Transparent
/// when set (Data will be written if SourceA fetched data is *NOT* %00000000. This may be used combined with channel b data and/or ALU) Cycles will be Saved if no write. Bit[2]==Bit[1]==0: write in any case
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_WRITE_NONTRANSPARENT = 0 b00000100 ;
2021-06-19 18:49:14 +00:00
/// No transparancy
/// Bit[2]==Bit[1]==0: write in any case
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_TRANSPARANCY_NONE = 0 b00000000 ;
2021-06-19 18:49:14 +00:00
/// Controls the ALU operation
2024-01-02 18:45:16 +00:00
char * DTV_BLITTER_ALU = ( char * ) 0xd33e ;
2021-06-19 18:49:14 +00:00
/// Bit[2:0] Source A right Shift: 000 SourceA Data, 001 LastA[0],SourceA[7:1], ..., 111 LastA[6:0],SourceA[7]
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_SHIFT0 = 0 b00000000 ;
const char DTV_BLIT_SHIFT1 = 0 b00000001 ;
const char DTV_BLIT_SHIFT2 = 0 b00000010 ;
const char DTV_BLIT_SHIFT3 = 0 b00000011 ;
const char DTV_BLIT_SHIFT4 = 0 b00000100 ;
const char DTV_BLIT_SHIFT5 = 0 b00000101 ;
const char DTV_BLIT_SHIFT6 = 0 b00000110 ;
const char DTV_BLIT_SHIFT7 = 0 b00000111 ;
2021-06-19 18:49:14 +00:00
/// Bit[5:3] Minterms/ALU
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_AND = 0 b00000000 ;
const char DTV_BLIT_NAND = 0 b00001000 ;
const char DTV_BLIT_NOR = 0 b00010000 ;
const char DTV_BLIT_OR = 0 b00011000 ;
const char DTV_BLIT_XOR = 0 b00100000 ;
const char DTV_BLIT_XNOR = 0 b00101000 ;
const char DTV_BLIT_ADD = 0 b00110000 ;
const char DTV_BLIT_SUB = 0 b00111000 ;
2021-06-19 18:49:14 +00:00
/// Blitter Control 2
2024-01-02 18:45:16 +00:00
char * const DTV_BLITTER_CONTROL2 = ( char * ) 0xd33f ;
2021-06-19 18:49:14 +00:00
/// Bit[0] Clear Blitter IRQ
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_CLEAR_IRQ = 0 b00000001 ;
2021-06-19 18:49:14 +00:00
/// Bit[1] Source A Continue
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_SRCA_CONT = 0 b00000010 ;
2021-06-19 18:49:14 +00:00
/// Bit[2] Source B Continue
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_SRCB_CONT = 0 b00000100 ;
2021-06-19 18:49:14 +00:00
/// Bit[3] Destination Continue
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_DEST_CONT = 0 b00001000 ;
2021-06-19 18:49:14 +00:00
/// Bit[0] Busy when set (When reading)
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_STATUS_BUSY = 0 b00000001 ;
2021-06-19 18:49:14 +00:00
/// Bit[1] IRQ when set (When reading)
2024-01-02 18:45:16 +00:00
const char DTV_BLIT_STATUS_IRQ = 0 b00000010 ;