slow-to-chip: Fixup agnus detection

Write to VPOSW before reading Agnus id seems to fix cold boot Agnus id read failure

Add "force-move-slow-to-chip" config option to force-disable Agnus check in case issue persists
This commit is contained in:
Matt Harlum 2021-07-15 15:21:14 +02:00 committed by Matt Harlum
parent f9c3b6d64f
commit 0ab099077a
3 changed files with 13 additions and 2 deletions

View File

@ -45,6 +45,7 @@ int cpu_emulation_running = 1;
int swap_df0_with_dfx = 0;
int spoof_df0_id = 0;
int move_slow_to_chip = 0;
int force_move_slow_to_chip = 0;
uint8_t mouse_dx = 0, mouse_dy = 0;
uint8_t mouse_buttons = 0;

View File

@ -61,6 +61,7 @@ extern int mouse_hook_enabled;
extern int swap_df0_with_dfx;
extern int spoof_df0_id;
extern int move_slow_to_chip;
extern int force_move_slow_to_chip;
#define min(a, b) (a < b) ? a : b
#define max(a, b) (a > b) ? a : b
@ -540,6 +541,11 @@ void setvar_amiga(struct emulator_config *cfg, char *var, char *val) {
move_slow_to_chip = 1;
printf("[AMIGA] Slow ram moved to Chip.\n");
}
if CHKVAR("force-move-slow-to-chip") {
force_move_slow_to_chip = 1;
printf("[AMIGA] Forcing slowram move to chip, bypassing Agnus version check.\n");
}
}
void handle_reset_amiga(struct emulator_config *cfg) {
@ -556,8 +562,9 @@ void handle_reset_amiga(struct emulator_config *cfg) {
if (piscsi_enabled)
piscsi_refresh_drives();
if (move_slow_to_chip) {
int agnus_rev = ((ps_read_16(0xDFF004) >> 8) & 0x6F);
if (move_slow_to_chip && !force_move_slow_to_chip) {
ps_write_16(VPOSW,0x00); // Poke poke... wake up Agnus!
int agnus_rev = ((ps_read_16(VPOSR) >> 8) & 0x6F);
if (agnus_rev != 0x20) {
move_slow_to_chip = 0;
printf("[AMIGA] Requested move slow ram to chip but 8372 Agnus not found - Disabling.\n");
@ -610,6 +617,7 @@ void shutdown_platform_amiga(struct emulator_config *cfg) {
swap_df0_with_dfx = 0;
spoof_df0_id = 0;
move_slow_to_chip = 0;
force_move_slow_to_chip = 0;
autoconfig_reset_all();
printf("[AMIGA] Platform shutdown completed.\n");

View File

@ -43,6 +43,8 @@ void adjust_gayle_1200();
#define POTGOR 0xDFF016
#define SERDAT 0xDFF030
#define VPOSR 0xDFF004
#define VPOSW 0xDFF02A
#define DMACON 0xDFF096
#define DMACONR 0xDFF002