X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=platforms%2Famiga%2Famiga-platform.c;h=b284789d51b247848ad1d509b8eeba9007df95c1;hb=9d0a0975fd359760f8a3eafef630a4146484d433;hp=269acb5aa25909a274bf990f2bb53af86149c458;hpb=3bf2b2c823bd14988a7c3821de31e89f506d853f;p=pistorm diff --git a/platforms/amiga/amiga-platform.c b/platforms/amiga/amiga-platform.c index 269acb5..b284789 100644 --- a/platforms/amiga/amiga-platform.c +++ b/platforms/amiga/amiga-platform.c @@ -6,6 +6,7 @@ #include "amiga-autoconf.h" #include "amiga-registers.h" #include "../shared/rtc.h" +#include "hunk-reloc.h" #include "piscsi/piscsi.h" #include "piscsi/piscsi-enums.h" #include "net/pi-net.h" @@ -16,11 +17,13 @@ int handle_register_read_amiga(unsigned int addr, unsigned char type, unsigned i int handle_register_write_amiga(unsigned int addr, unsigned int value, unsigned char type); int init_rtg_data(); +extern int ac_z2_current_pic; extern int ac_z2_done; extern int ac_z2_pic_count; extern int ac_z2_type[AC_PIC_LIMIT]; extern int ac_z2_index[AC_PIC_LIMIT]; +extern int ac_z3_current_pic; extern int ac_z3_pic_count; extern int ac_z3_done; extern int ac_z3_type[AC_PIC_LIMIT]; @@ -42,6 +45,10 @@ extern unsigned char cdtv_sram[32 * SIZE_KILO]; static uint8_t rtg_enabled = 0, piscsi_enabled = 0, pinet_enabled = 0; +extern uint32_t piscsi_base; + +extern void stop_cpu_emulation(uint8_t disasm_cur); + inline int custom_read_amiga(struct emulator_config *cfg, unsigned int addr, unsigned int *val, unsigned char type) { if (!ac_z2_done && addr >= AC_Z2_BASE && addr < AC_Z2_BASE + AC_SIZE) { if (ac_z2_pic_count == 0) { @@ -70,6 +77,13 @@ inline int custom_read_amiga(struct emulator_config *cfg, unsigned int addr, uns } } + if (addr >= piscsi_base && addr < piscsi_base + (64 * SIZE_KILO)) { + //printf("[Amiga-Custom] %s read from PISCSI base @$%.8X.\n", op_type_names[type], addr); + //stop_cpu_emulation(1); + *val = handle_piscsi_read(addr, type); + return 1; + } + return -1; } @@ -108,6 +122,12 @@ inline int custom_write_amiga(struct emulator_config *cfg, unsigned int addr, un } } + if (addr >= piscsi_base && addr < piscsi_base + (64 * SIZE_KILO)) { + //printf("[Amiga-Custom] %s write to PISCSI base @$%.8x: %.8X\n", op_type_names[type], addr, val); + handle_piscsi_write(addr, val, type); + return 1; + } + return -1; } @@ -118,10 +138,6 @@ void adjust_ranges_amiga(struct emulator_config *cfg) { cfg->custom_low = 0; // Set up the min/max ranges for mapped reads/writes - if (gayle_emulation_enabled) { - cfg->mapped_low = GAYLEBASE; - cfg->mapped_high = GAYLEBASE + GAYLESIZE; - } for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i++) { if (cfg->map_type[i] != MAPTYPE_NONE) { if ((cfg->map_offset[i] != 0 && cfg->map_offset[i] < cfg->mapped_low) || cfg->mapped_low == 0) @@ -158,6 +174,9 @@ void adjust_ranges_amiga(struct emulator_config *cfg) { else cfg->custom_low = min(cfg->custom_low, PISCSI_OFFSET); cfg->custom_high = max(cfg->custom_high, PISCSI_UPPER); + if (piscsi_base != 0) { + cfg->custom_low = min(cfg->custom_low, piscsi_base); + } } if (pinet_enabled) { if (cfg->custom_low == 0) @@ -319,7 +338,7 @@ void setvar_amiga(struct emulator_config *cfg, char *var, char *val) { printf("[AMIGA] PISCSI Interface Enabled.\n"); piscsi_enabled = 1; piscsi_init(); - ac_z2_type[ac_z2_pic_count] = ACTYPE_PSICSI; + ac_z2_type[ac_z2_pic_count] = ACTYPE_PISCSI; ac_z2_pic_count++; adjust_ranges_amiga(cfg); } @@ -373,6 +392,11 @@ void setvar_amiga(struct emulator_config *cfg, char *var, char *val) { void handle_reset_amiga(struct emulator_config *cfg) { ac_z3_done = 0; ac_z2_done = 0; + ac_z2_current_pic = 0; + ac_z3_current_pic = 0; + + if (piscsi_enabled) + piscsi_refresh_drives(); adjust_ranges_amiga(cfg); }