Skip to content

Commit

Permalink
handle MachinePowerFrequency in xcbm2/xcbm5x0, clean up most other if…
Browse files Browse the repository at this point in the history
…def'd code. Should now work as documented :)

git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45182 379a1393-f5fb-40a0-bcee-ef074d9b53f7
  • Loading branch information
mrdudz committed Jun 2, 2024
1 parent f491af5 commit 081dc07
Show file tree
Hide file tree
Showing 25 changed files with 146 additions and 200 deletions.
16 changes: 16 additions & 0 deletions vice/src/arch/gtk3/widgets/settings_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,8 @@ static void machine_model_handler_cbm5x0(int model)
{
video_model_widget_update(video_widget);
cbm2_memory_size_widget_update(ram_widget);
/* synchronize machine power frequency widget */
machine_power_frequency_widget_sync(power_frequency_widget);
}

/** \brief Callback for CBM 6x0/7x0 model changes
Expand All @@ -920,6 +922,8 @@ static void machine_model_handler_cbm6x0(int model)
{
video_model_widget_update(video_widget);
cbm2_memory_size_widget_update(ram_widget);
/* synchronize machine power frequency widget */
machine_power_frequency_widget_sync(power_frequency_widget);
}

/** \brief Set sensitivity of PET Ram9 and RamA widgets
Expand Down Expand Up @@ -1576,6 +1580,12 @@ static GtkWidget *create_cbm5x0_layout(GtkWidget *grid)
cbm2_switches_callback);
gtk_grid_attach(GTK_GRID(grid), switches_widget, 2, 0, 1, 1);

/* machine power frequency */
power_frequency_widget = machine_power_frequency_widget_new();
machine_power_frequency_widget_add_callback(power_frequency_widget,
power_frequency_callback);
gtk_grid_attach(GTK_GRID(grid), power_frequency_widget, 2, 1, 2, 1);

/* SID widget */
sid_widget = sid_model_widget_create(machine_widget);
sid_model_widget_set_callback(sid_widget, sid_model_callback);
Expand Down Expand Up @@ -1628,6 +1638,12 @@ static GtkWidget *create_cbm6x0_layout(GtkWidget *grid)
cbm2_switches_callback);
gtk_grid_attach(GTK_GRID(grid), switches_widget, 2, 0, 1, 1);

/* machine power frequency */
power_frequency_widget = machine_power_frequency_widget_new();
machine_power_frequency_widget_add_callback(power_frequency_widget,
power_frequency_callback);
gtk_grid_attach(GTK_GRID(grid), power_frequency_widget, 2, 1, 2, 1);

/* SID widget */
sid_widget = sid_model_widget_create(machine_widget);
sid_model_widget_set_callback(sid_widget, sid_model_callback);
Expand Down
23 changes: 23 additions & 0 deletions vice/src/arch/sdl/menu_c128hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,22 @@ UI_MENU_DEFINE_TOGGLE(IEEE488)
UI_MENU_DEFINE_TOGGLE(C128FullBanks)
UI_MENU_DEFINE_TOGGLE(Go64Mode)

UI_MENU_DEFINE_RADIO(MachinePowerFrequency)

static const ui_menu_entry_t power_freq_submenu[] = {
{ .string = "50Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)50
},
{ .string = "60Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)60
},
SDL_MENU_LIST_END
};

const ui_menu_entry_t c128_hardware_menu[] = {
{ .string = "Select C128 model",
.type = MENU_ENTRY_SUBMENU,
Expand Down Expand Up @@ -269,6 +285,13 @@ const ui_menu_entry_t c128_hardware_menu[] = {
},
SDL_MENU_ITEM_SEPARATOR,

{ .string = "Power grid frequency",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)power_freq_submenu
},
SDL_MENU_ITEM_SEPARATOR,

{ .string = "VDC settings",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_callback,
Expand Down
38 changes: 38 additions & 0 deletions vice/src/arch/sdl/menu_c64model.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,23 @@ UI_MENU_DEFINE_TOGGLE(IECReset)

UI_MENU_DEFINE_RADIO(KernalRev)

UI_MENU_DEFINE_RADIO(MachinePowerFrequency)

static const ui_menu_entry_t power_freq_submenu[] = {
{ .string = "50Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)50
},
{ .string = "60Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)60
},
SDL_MENU_LIST_END
};


static const ui_menu_entry_t kernal_rev_submenu[] = {
{ .string = "Rev 1",
.type = MENU_ENTRY_RESOURCE_RADIO,
Expand Down Expand Up @@ -381,6 +398,13 @@ const ui_menu_entry_t c64sc_model_menu[] = {
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)kernal_rev_submenu
},
SDL_MENU_ITEM_SEPARATOR,

{ .string = "Power grid frequency",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)power_freq_submenu
},
SDL_MENU_LIST_END
};

Expand Down Expand Up @@ -439,6 +463,13 @@ const ui_menu_entry_t scpu64_model_menu[] = {
.type = MENU_ENTRY_RESOURCE_TOGGLE,
.callback = toggle_IECReset_callback
},
SDL_MENU_ITEM_SEPARATOR,

{ .string = "Power grid frequency",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)power_freq_submenu
},
SDL_MENU_LIST_END
};

Expand Down Expand Up @@ -589,5 +620,12 @@ const ui_menu_entry_t c64_model_menu[] = {
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)kernal_rev_submenu
},
SDL_MENU_ITEM_SEPARATOR,

{ .string = "Power grid frequency",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)power_freq_submenu
},
SDL_MENU_LIST_END
};
21 changes: 21 additions & 0 deletions vice/src/arch/sdl/menu_cbm2hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ static UI_MENU_CALLBACK(select_cbm2_model_callback)
return NULL;
}

UI_MENU_DEFINE_RADIO(MachinePowerFrequency)

static const ui_menu_entry_t power_freq_submenu[] = {
{ .string = "50Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)50
},
{ .string = "60Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)60
},
SDL_MENU_LIST_END
};

static const ui_menu_entry_t cbm2_model_menu[] = {
{ .string = "CBM 610 (PAL)",
.type = MENU_ENTRY_OTHER,
Expand Down Expand Up @@ -236,6 +252,11 @@ const ui_menu_entry_t cbm6x0_7x0_hardware_menu[] = {
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)cia1_model_submenu
},
{ .string = "Power grid frequency",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)power_freq_submenu
},
{ .string = "RAM pattern settings",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_callback,
Expand Down
21 changes: 21 additions & 0 deletions vice/src/arch/sdl/menu_cbm5x0hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ static UI_MENU_CALLBACK(select_cbm2_model_callback)
return NULL;
}

UI_MENU_DEFINE_RADIO(MachinePowerFrequency)

static const ui_menu_entry_t power_freq_submenu[] = {
{ .string = "50Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)50
},
{ .string = "60Hz",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = radio_MachinePowerFrequency_callback,
.data = (ui_callback_data_t)60
},
SDL_MENU_LIST_END
};

static const ui_menu_entry_t cbm5x0_model_menu[] = {
{ .string = "CBM 510 (PAL)",
.type = MENU_ENTRY_OTHER,
Expand Down Expand Up @@ -211,6 +227,11 @@ const ui_menu_entry_t cbm5x0_hardware_menu[] = {
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)cia1_model_submenu
},
{ .string = "Power grid frequency",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_radio_callback,
.data = (ui_callback_data_t)power_freq_submenu
},
{ .string = "RAM pattern settings",
.type = MENU_ENTRY_SUBMENU,
.callback = submenu_callback,
Expand Down
6 changes: 0 additions & 6 deletions vice/src/c64/vsid-resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@
calculated as 65536 * drive_clk / clk_[main machine] */
static int sync_factor;

#if 0
/* Frequency of the power grid in Hz */
static int power_freq = 1;
#endif

/* Name of the character ROM. */
static char *chargen_rom_name = NULL;
Expand Down Expand Up @@ -210,7 +208,6 @@ static int set_sync_factor(int val, void *param)
return 0;
}

#if 0
static int set_power_freq(int val, void *param)
{
int change_timing = 0;
Expand All @@ -234,7 +231,6 @@ static int set_power_freq(int val, void *param)
}
return 0;
}
#endif

static int set_hvsc_root(const char *path, void *param)
{
Expand Down Expand Up @@ -275,10 +271,8 @@ static const resource_string_t resources_string[] = {
static const resource_int_t resources_int[] = {
{ "MachineVideoStandard", MACHINE_SYNC_PAL, RES_EVENT_SAME, NULL,
&sync_factor, set_sync_factor, NULL },
#if 0
{ "MachinePowerFrequency", 50, RES_EVENT_SAME, NULL,
&power_freq, set_power_freq, NULL },
#endif
{ "KernalRev", C64_KERNAL_REV3, RES_EVENT_SAME, NULL,
&kernal_revision, set_kernal_revision, NULL },
{ "Sid2AddressStart", 0xde00, RES_EVENT_SAME, NULL,
Expand Down
8 changes: 0 additions & 8 deletions vice/src/c64dtv/c64dtv-cmdline-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ static const cmdline_option_t cmdline_options[] =
{ "-ntsc", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachineVideoStandard", (void *)MACHINE_SYNC_NTSC,
NULL, "Use NTSC sync factor" },
#if 0
{ "-power50", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachinePowerFrequency", (void *)50,
NULL, "Use 50Hz Power-grid frequency" },
{ "-power60", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachinePowerFrequency", (void *)60,
NULL, "Use 60Hz Power-grid frequency" },
#endif
{ "-kernal", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
NULL, NULL, "KernalName", NULL,
"<Name>", "Specify name of Kernal ROM image" },
Expand Down
4 changes: 0 additions & 4 deletions vice/src/c64dtv/c64dtv-resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ static const resource_string_t resources_string[] = {
static const resource_int_t resources_int[] = {
{ "MachineVideoStandard", MACHINE_SYNC_PAL, RES_EVENT_SAME, NULL,
&sync_factor, set_sync_factor, NULL },
#if 0
{ "MachinePowerFrequency", 0, RES_EVENT_SAME, NULL,
&power_freq, set_power_freq, NULL },
#endif
{ "HummerADC", 0, RES_EVENT_SAME, NULL,
(int *)&c64dtv_hummer_adc_enabled, c64dtv_hummer_adc_set, NULL },
RESOURCE_INT_LIST_END
Expand Down
14 changes: 1 addition & 13 deletions vice/src/c64dtv/c64dtvmodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,7 @@ void dtvmodel_set(int model)
}

resources_set_int("MachineVideoStandard", dtvmodels[model].video);
#if 0
/* Determine the power net frequency for this model. */
switch(dtvmodels[model].video) {
case MACHINE_SYNC_PAL:
case MACHINE_SYNC_PALN:
pf = 50;
break;
default:
pf = 60;
break;
}
resources_set_int("MachinePowerFrequency", pf);
#endif

resources_set_int("DtvRevision", dtvmodels[model].asic);
resources_set_int("HummerADC", dtvmodels[model].hummeradc);
resources_set_int("DTVFlashRevision", dtvmodels[model].rom_revision);
Expand Down
6 changes: 0 additions & 6 deletions vice/src/cbm2/cbm2-resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@

static int sync_factor;

#if 0
/* Frequency of the power grid in Hz */
static int power_freq = 1;
#endif

static char *kernal_rom_name = NULL;
static char *chargen_name = NULL;
Expand Down Expand Up @@ -189,7 +187,6 @@ static int cbm6x0_set_sync_factor(int val, void *param)
return 0;
}

#if 0
static int set_power_freq(int val, void *param)
{
int change_timing = 0;
Expand All @@ -214,7 +211,6 @@ static int set_power_freq(int val, void *param)

return 0;
}
#endif

static const resource_string_t cbm6x0_resources_string[] = {
{ "ChargenName", CBM2_CHARGEN600_NAME, RES_EVENT_NO, NULL,
Expand All @@ -231,10 +227,8 @@ static const resource_string_t cbm6x0_resources_string[] = {
static const resource_int_t cbm6x0_resources_int[] = {
{ "MachineVideoStandard", MACHINE_SYNC_PAL, RES_EVENT_SAME, NULL,
&sync_factor, cbm6x0_set_sync_factor, NULL },
#if 0
{ "MachinePowerFrequency", 50, RES_EVENT_SAME, NULL,
&power_freq, set_power_freq, NULL },
#endif
{ "RamSize", 128, RES_EVENT_SAME, NULL,
&ramsize, set_ramsize, NULL },
{ "ModelLine", LINE_6x0_50HZ, RES_EVENT_SAME, NULL,
Expand Down
2 changes: 1 addition & 1 deletion vice/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ int main_program(int argc, char **argv)

void main_loop_forever(void)
{
log_message(LOG_DEFAULT, "");
log_message(LOG_DEFAULT, "%s", ""); /* ugly hack to produce a blank log line, but not trigger a warning */
log_message(LOG_DEFAULT, "Main CPU: starting at ($FFFC).");

/* This doesn't return. The thread will directly exit when requested. */
Expand Down
2 changes: 1 addition & 1 deletion vice/src/pet/pet-cmdline-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static const cmdline_option_t cmdline_options[] =
{ "-ntsc", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachineVideoStandard", (void *)MACHINE_SYNC_NTSC,
NULL, "Use NTSC sync factor" },
#if 0
#if 0 /* FIXME: do any of the PETs actually use the power grid frequency? */
{ "-power50", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachinePowerFrequency", (void *)50,
NULL, "Use 50Hz Power-grid frequency" },
Expand Down
6 changes: 3 additions & 3 deletions vice/src/pet/pet-resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

static int sync_factor;

#if 0
#if 0 /* FIXME: do any of the PETs actually use the power grid frequency? */
/* Frequency of the power grid in Hz */
static int power_freq = 1;
#endif
Expand Down Expand Up @@ -333,7 +333,7 @@ static int set_sync_factor(int val, void *param)
return 0;
}

#if 0
#if 0 /* FIXME: do any of the PETs actually use the power grid frequency? */
static int set_power_freq(int val, void *param)
{
int change_timing = 0;
Expand Down Expand Up @@ -466,7 +466,7 @@ static const resource_string_t resources_string[] = {
static const resource_int_t resources_int[] = {
{ "MachineVideoStandard", MACHINE_SYNC_PAL, RES_EVENT_SAME, NULL,
&sync_factor, set_sync_factor, NULL },
#if 0
#if 0 /* FIXME: do any of the PETs actually use the power grid frequency? */
{ "MachinePowerFrequency", 50, RES_EVENT_SAME, NULL,
&power_freq, set_power_freq, NULL },
#endif
Expand Down
8 changes: 0 additions & 8 deletions vice/src/plus4/plus4-cmdline-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ static const cmdline_option_t cmdline_options[] =
{ "-ntsc", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachineVideoStandard", (void *)MACHINE_SYNC_NTSC,
NULL, "Use NTSC sync factor" },
#if 0
{ "-power50", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachinePowerFrequency", (void *)50,
NULL, "Use 50Hz Power-grid frequency" },
{ "-power60", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "MachinePowerFrequency", (void *)60,
NULL, "Use 60Hz Power-grid frequency" },
#endif
{ "-kernal", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
NULL, NULL, "KernalName", NULL,
"<Name>", "Specify name of Kernal ROM image" },
Expand Down
Loading

0 comments on commit 081dc07

Please sign in to comment.