#!/usr/bin/env python3
# hwSymbols.py - C64 hardware register and KERNAL symbol names used by the renderer.
VIC = {
 0xD000:"VIC_SPR0_X",0xD001:"VIC_SPR0_Y",0xD002:"VIC_SPR1_X",0xD003:"VIC_SPR1_Y",0xD004:"VIC_SPR2_X",0xD005:"VIC_SPR2_Y",
 0xD006:"VIC_SPR3_X",0xD007:"VIC_SPR3_Y",0xD008:"VIC_SPR4_X",0xD009:"VIC_SPR4_Y",0xD00A:"VIC_SPR5_X",0xD00B:"VIC_SPR5_Y",
 0xD00C:"VIC_SPR6_X",0xD00D:"VIC_SPR6_Y",0xD00E:"VIC_SPR7_X",0xD00F:"VIC_SPR7_Y",0xD010:"VIC_SPR_HI_X",0xD011:"VIC_CTRL1",
 0xD012:"VIC_RASTER",0xD013:"VIC_LPEN_X",0xD014:"VIC_LPEN_Y",0xD015:"VIC_SPR_ENA",0xD016:"VIC_CTRL2",0xD017:"VIC_SPR_EXP_Y",
 0xD018:"VIC_MEM_PTR",0xD019:"VIC_IRQ_FLAG",0xD01A:"VIC_IRQ_MASK",0xD01B:"VIC_SPR_PRIO",0xD01C:"VIC_SPR_MCOLOR",0xD01D:"VIC_SPR_EXP_X",
 0xD01E:"VIC_SPR_SPR_COLL",0xD01F:"VIC_SPR_BG_COLL",0xD020:"VIC_BORDER",0xD021:"VIC_BG0",0xD022:"VIC_BG1",0xD023:"VIC_BG2",0xD024:"VIC_BG3",
 0xD025:"VIC_SPR_MC0",0xD026:"VIC_SPR_MC1",0xD027:"VIC_SPR0_COLOR",0xD028:"VIC_SPR1_COLOR",0xD029:"VIC_SPR2_COLOR",0xD02A:"VIC_SPR3_COLOR",
 0xD02B:"VIC_SPR4_COLOR",0xD02C:"VIC_SPR5_COLOR",0xD02D:"VIC_SPR6_COLOR",0xD02E:"VIC_SPR7_COLOR",
}
SID = {}
for v in range(3):
    b = 0xD400 + v*7
    SID.update({b:f"SID_V{v+1}_FREQ_LO", b+1:f"SID_V{v+1}_FREQ_HI", b+2:f"SID_V{v+1}_PW_LO", b+3:f"SID_V{v+1}_PW_HI",
                b+4:f"SID_V{v+1}_CTRL", b+5:f"SID_V{v+1}_AD", b+6:f"SID_V{v+1}_SR"})
SID.update({0xD415:"SID_FILT_LO",0xD416:"SID_FILT_HI",0xD417:"SID_FILT_CTRL",0xD418:"SID_VOLUME",0xD419:"SID_POT_X",0xD41A:"SID_POT_Y",
            0xD41B:"SID_OSC3_RANDOM",0xD41C:"SID_ENV3"})
CIA = {
 0xDC00:"CIA1_PRA",0xDC01:"CIA1_PRB",0xDC02:"CIA1_DDRA",0xDC03:"CIA1_DDRB",0xDC04:"CIA1_TA_LO",0xDC05:"CIA1_TA_HI",0xDC06:"CIA1_TB_LO",
 0xDC07:"CIA1_TB_HI",0xDC08:"CIA1_TOD_10TH",0xDC09:"CIA1_TOD_SEC",0xDC0A:"CIA1_TOD_MIN",0xDC0B:"CIA1_TOD_HR",0xDC0C:"CIA1_SDR",0xDC0D:"CIA1_ICR",
 0xDC0E:"CIA1_CRA",0xDC0F:"CIA1_CRB",
 0xDD00:"CIA2_PRA",0xDD01:"CIA2_PRB",0xDD02:"CIA2_DDRA",0xDD03:"CIA2_DDRB",0xDD04:"CIA2_TA_LO",0xDD05:"CIA2_TA_HI",0xDD06:"CIA2_TB_LO",
 0xDD07:"CIA2_TB_HI",0xDD08:"CIA2_TOD_10TH",0xDD09:"CIA2_TOD_SEC",0xDD0A:"CIA2_TOD_MIN",0xDD0B:"CIA2_TOD_HR",0xDD0C:"CIA2_SDR",0xDD0D:"CIA2_ICR",
 0xDD0E:"CIA2_CRA",0xDD0F:"CIA2_CRB",
}
KERNAL = {
 0xFF81:"KERNAL_CINT",0xFF84:"KERNAL_IOINIT",0xFF87:"KERNAL_RAMTAS",0xFF8A:"KERNAL_RESTOR",0xFF8D:"KERNAL_VECTOR",0xFF90:"KERNAL_SETMSG",
 0xFF93:"KERNAL_SECOND",0xFF96:"KERNAL_TKSA",0xFF99:"KERNAL_MEMTOP",0xFF9C:"KERNAL_MEMBOT",0xFF9F:"KERNAL_SCNKEY",0xFFA2:"KERNAL_SETTMO",
 0xFFA5:"KERNAL_ACPTR",0xFFA8:"KERNAL_CIOUT",0xFFAB:"KERNAL_UNTLK",0xFFAE:"KERNAL_UNLSN",0xFFB1:"KERNAL_LISTEN",0xFFB4:"KERNAL_TALK",
 0xFFB7:"KERNAL_READST",0xFFBA:"KERNAL_SETLFS",0xFFBD:"KERNAL_SETNAM",0xFFC0:"KERNAL_OPEN",0xFFC3:"KERNAL_CLOSE",0xFFC6:"KERNAL_CHKIN",
 0xFFC9:"KERNAL_CHKOUT",0xFFCC:"KERNAL_CLRCHN",0xFFCF:"KERNAL_CHRIN",0xFFD2:"KERNAL_CHROUT",0xFFD5:"KERNAL_LOAD",0xFFD8:"KERNAL_SAVE",
 0xFFDB:"KERNAL_SETTIM",0xFFDE:"KERNAL_RDTIM",0xFFE1:"KERNAL_STOP",0xFFE4:"KERNAL_GETIN",0xFFE7:"KERNAL_CLALL",0xFFEA:"KERNAL_UDTIM",
 0xFFED:"KERNAL_SCREEN",0xFFF0:"KERNAL_PLOT",0xFFF3:"KERNAL_IOBASE",
}
# 1541 drive-side registers / ROM entry points (for the drive code listing)
DRIVE = {
 0x1800:"VIA1_PRB_SERIAL",0x1801:"VIA1_PRA",0x1802:"VIA1_DDRB",0x1803:"VIA1_DDRA",0x1805:"VIA1_T1C_HI",0x180C:"VIA1_PCR",0x180D:"VIA1_IFR",0x180E:"VIA1_IER",
 0x1C00:"VIA2_PRB_DISK_CTRL",0x1C01:"VIA2_PRA_DATA",0x1C02:"VIA2_DDRB",0x1C03:"VIA2_DDRA",0x1C05:"VIA2_T1C_HI",0x1C0C:"VIA2_PCR",0x1C0D:"VIA2_IFR",0x1C0E:"VIA2_IER",
 0xD042:"ROM_INIT_DRIVE",0xF5E9:"ROM_DATA_CHECKSUM",0xF78F:"ROM_BIN_TO_GCR",0xF8E0:"ROM_GCR_TO_BIN",0xF934:"ROM_MAKE_HEADER_GCR",0xFFFC:"ROM_RESET_VECTOR",
}
def c64Symbols():
    d = {}
    d.update(VIC); d.update(SID); d.update(CIA); d.update(KERNAL)
    d[0xD800] = "COLOR_RAM"
    d[0x0000] = "CPU_DDR"
    d[0x0001] = "CPU_PORT"
    return d
