mirror of
https://github.com/captain-amygdala/pistorm.git
synced 2026-04-13 23:43:49 +00:00
[WIP] Add Z3 Fast autoconf support
This commit is contained in:
@@ -7,10 +7,11 @@ map type=rom address=0xF80000 size=0x80000 file=kick.rom ovl=0
|
||||
|
||||
# Map 128MB of Fast RAM at 0x8000000.
|
||||
map type=ram address=0x08000000 size=128M id=cpu_slot_ram
|
||||
# 128MB of Z3 Fast at the first proper address
|
||||
# Map 128MB of Z3 Fast. Note that the address here is not actually used, as it gets auto-assigned by Kickstart itself.
|
||||
# Enabling Z3 fast requires a Kickstart that actually supports Zorro III, for instance from an A3000 or A4000.
|
||||
#map type=ram address=0x10000000 size=128M id=z3_autoconf_fast
|
||||
# Max 8MB of Z2 Fast can be mapped due to addressing space limitations, but for instance 2+4MB can be chained to leave 2MB for something else.
|
||||
map type=ram address=0x200000 size=8M id=z2_autoconf_fast
|
||||
#map type=ram address=0x200000 size=8M id=z2_autoconf_fast
|
||||
#map type=ram address=0x200000 size=2M id=z2_autoconf_fast
|
||||
#map type=ram address=0x400000 size=4M id=z2_autoconf_fast
|
||||
|
||||
|
||||
@@ -22,13 +22,20 @@ static unsigned char ac_a314_rom[] = {
|
||||
0xa, 0x3, 0x1, 0x4, 0x0, 0x0, 0x0, 0x0 // 18/.../26, serial
|
||||
};
|
||||
|
||||
int ac_current_pic = 0;
|
||||
int ac_pic_count = 0;
|
||||
int ac_done = 0;
|
||||
int ac_type[AC_PIC_LIMIT];
|
||||
int ac_index[AC_PIC_LIMIT];
|
||||
int ac_z2_current_pic = 0;
|
||||
int ac_z2_pic_count = 0;
|
||||
int ac_z2_done = 0;
|
||||
int ac_z2_type[AC_PIC_LIMIT];
|
||||
int ac_z2_index[AC_PIC_LIMIT];
|
||||
unsigned int ac_base[AC_PIC_LIMIT];
|
||||
|
||||
int ac_z3_current_pic = 0;
|
||||
int ac_z3_pic_count = 0;
|
||||
int ac_z3_done = 0;
|
||||
int ac_z3_type[AC_PIC_LIMIT];
|
||||
int ac_z3_index[AC_PIC_LIMIT];
|
||||
|
||||
|
||||
unsigned char get_autoconf_size(int size) {
|
||||
if (size == 8 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_8MB;
|
||||
@@ -40,12 +47,180 @@ unsigned char get_autoconf_size(int size) {
|
||||
return AC_MEM_SIZE_64KB;
|
||||
}
|
||||
|
||||
unsigned int autoconfig_read_memory_8(struct emulator_config *cfg, unsigned int address_) {
|
||||
unsigned char *rom = NULL;
|
||||
int address = address_ - AC_BASE;
|
||||
unsigned char get_autoconf_size_ext(int size) {
|
||||
if (size == 16 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_EXT_16MB;
|
||||
if (size == 32 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_EXT_32MB;
|
||||
if (size == 64 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_EXT_64MB;
|
||||
if (size == 128 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_EXT_128MB;
|
||||
if (size == 256 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_EXT_256MB;
|
||||
if (size == 512 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_EXT_512MB;
|
||||
if (size == 1024 * SIZE_MEGA)
|
||||
return AC_MEM_SIZE_EXT_1024MB;
|
||||
else
|
||||
return AC_MEM_SIZE_EXT_64MB;
|
||||
}
|
||||
|
||||
unsigned int autoconfig_read_memory_z3_8(struct emulator_config *cfg, unsigned int address_) {
|
||||
int address = address_ - AC_Z3_BASE;
|
||||
int index = ac_z3_index[ac_z3_current_pic];
|
||||
unsigned char val = 0;
|
||||
|
||||
switch(ac_type[ac_current_pic]) {
|
||||
if ((address & 0xFF) >= AC_Z3_REG_RES50 && (address & 0xFF) <= AC_Z3_REG_RES7C)
|
||||
val = 0;
|
||||
else {
|
||||
switch(address & 0xFF) {
|
||||
case AC_Z3_REG_ER_TYPE:
|
||||
val |= BOARDTYPE_Z3;
|
||||
if (cfg->map_type[index] == MAPTYPE_RAM)
|
||||
val |= BOARDTYPE_FREEMEM;
|
||||
if (cfg->map_size[index] > 8 * SIZE_MEGA)
|
||||
val |= get_autoconf_size_ext(cfg->map_size[index]);
|
||||
else
|
||||
val |= get_autoconf_size(cfg->map_size[index]);
|
||||
// Pre-invert this value, since it's the only value not physically complemented
|
||||
// for Zorro III.
|
||||
val ^= 0xFF;
|
||||
break;
|
||||
case AC_Z3_REG_ER_PRODUCT:
|
||||
// 1.1... maybe...
|
||||
val = 0x11;
|
||||
break;
|
||||
case AC_Z3_REG_ER_FLAGS:
|
||||
if (cfg->map_type[index] == MAPTYPE_RAM)
|
||||
val |= Z3_FLAGS_MEMORY;
|
||||
if (cfg->map_size[index] > 8 * SIZE_MEGA)
|
||||
val |= Z3_FLAGS_EXTENSION;
|
||||
val |= Z3_FLAGS_RESERVED;
|
||||
// Bottom four bits are zero, useless unles you want really odd RAM sizes.
|
||||
break;
|
||||
// Manufacturer ID low/high bytes.
|
||||
case AC_Z3_REG_MAN_LO:
|
||||
val = PISTORM_MANUF_ID & 0x00FF;
|
||||
break;
|
||||
case AC_Z3_REG_MAN_HI:
|
||||
val = (PISTORM_MANUF_ID >> 8);
|
||||
break;
|
||||
case AC_Z3_REG_SER_BYTE0:
|
||||
case AC_Z3_REG_SER_BYTE1:
|
||||
case AC_Z3_REG_SER_BYTE2:
|
||||
case AC_Z3_REG_SER_BYTE3:
|
||||
// Expansion board serial assigned by manufacturer.
|
||||
val = 0;
|
||||
break;
|
||||
case AC_Z3_REG_INIT_DIAG_VEC_LO:
|
||||
case AC_Z3_REG_INIT_DIAG_VEC_HI:
|
||||
// 16-bit offset to boot ROM in assigned memory range.
|
||||
val = 0;
|
||||
break;
|
||||
// Additional reserved/unused registers.
|
||||
case AC_Z3_REG_ER_RES03:
|
||||
case AC_Z3_REG_ER_RES0D:
|
||||
case AC_Z3_REG_ER_RES0E:
|
||||
case AC_Z3_REG_ER_RES0F:
|
||||
case AC_Z3_REG_ER_Z2_INT:
|
||||
default:
|
||||
val = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//printf("Read byte %d from Z3 autoconf for PIC %d (%.2X).\n", address, ac_z3_current_pic, val);
|
||||
return (address & 0x100) ? (val << 4) ^ 0xF0 : (val & 0xF0) ^ 0xF0;
|
||||
}
|
||||
|
||||
int nib_latch = 0;
|
||||
|
||||
void autoconfig_write_memory_z3_8(struct emulator_config *cfg, unsigned int address_, unsigned int value) {
|
||||
int address = address_ - AC_Z3_BASE;
|
||||
int index = ac_z3_index[ac_z3_current_pic];
|
||||
unsigned char val = (unsigned char)value;
|
||||
int done = 0;
|
||||
|
||||
switch(address & 0xFF) {
|
||||
case AC_Z3_REG_WR_ADDR_LO:
|
||||
if (nib_latch) {
|
||||
ac_base[ac_z3_current_pic] = (ac_base[ac_z3_current_pic] & 0xFF0F0000) | ((val & 0xF0) << 16);
|
||||
nib_latch = 0;
|
||||
}
|
||||
else
|
||||
ac_base[ac_z3_current_pic] = (ac_base[ac_z3_current_pic] & 0xFF000000) | (val << 16);
|
||||
break;
|
||||
case AC_Z3_REG_WR_ADDR_HI:
|
||||
if (nib_latch) {
|
||||
ac_base[ac_z3_current_pic] = (ac_base[ac_z3_current_pic] & 0x0FFF0000) | ((val & 0xF0) << 24);
|
||||
nib_latch = 0;
|
||||
}
|
||||
ac_base[ac_z3_current_pic] = (ac_base[ac_z3_current_pic] & 0x00FF0000) | (val << 24);
|
||||
done = 1;
|
||||
break;
|
||||
case AC_Z3_REG_WR_ADDR_NIB_LO:
|
||||
ac_base[ac_z3_current_pic] = (ac_base[ac_z3_current_pic] & 0xFFF00000) | ((val & 0xF0) << 12);
|
||||
nib_latch = 1;
|
||||
break;
|
||||
case AC_Z3_REG_WR_ADDR_NIB_HI:
|
||||
ac_base[ac_z3_current_pic] = (ac_base[ac_z3_current_pic] & 0xF0FF0000) | ((val & 0xF0) << 20);
|
||||
nib_latch = 1;
|
||||
break;
|
||||
case AC_Z3_REG_SHUTUP:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
nib_latch = 0;
|
||||
printf("Address of Z3 autoconf RAM assigned to $%.8x\n", ac_base[ac_z3_current_pic]);
|
||||
cfg->map_offset[index] = ac_base[ac_z3_current_pic];
|
||||
ac_z3_current_pic++;
|
||||
if (ac_z3_current_pic == ac_z3_pic_count)
|
||||
ac_z3_done = 1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void autoconfig_write_memory_z3_16(struct emulator_config *cfg, unsigned int address_, unsigned int value) {
|
||||
int address = address_ - AC_Z3_BASE;
|
||||
int index = ac_z3_index[ac_z3_current_pic];
|
||||
unsigned short val = (unsigned short)value;
|
||||
int done = 0;
|
||||
//if (index || done || address || cfg || val || value) {}
|
||||
|
||||
switch(address & 0xFF) {
|
||||
case AC_Z3_REG_WR_ADDR_HI:
|
||||
// This is, as far as I know, the only regiter it should write a 16-bit value to.
|
||||
ac_base[ac_z3_current_pic] = (ac_base[ac_z3_current_pic] & 0x00000000) | (val << 16);
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
printf("Unknown WORD write to Z3 autoconf address $%.2X", address & 0xFF);
|
||||
//stop_cpu_emulation();
|
||||
break;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
printf("Address of Z3 autoconf RAM assigned to $%.8x\n", ac_base[ac_z3_current_pic]);
|
||||
cfg->map_offset[index] = ac_base[ac_z3_current_pic];
|
||||
ac_z3_current_pic++;
|
||||
if (ac_z3_current_pic == ac_z3_pic_count)
|
||||
ac_z3_done = 1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int autoconfig_read_memory_8(struct emulator_config *cfg, unsigned int address_) {
|
||||
unsigned char *rom = NULL;
|
||||
int address = address_ - AC_Z2_BASE;
|
||||
unsigned char val = 0;
|
||||
|
||||
switch(ac_z2_type[ac_z2_current_pic]) {
|
||||
case ACTYPE_MAPFAST_Z2:
|
||||
rom = ac_fast_ram_rom;
|
||||
break;
|
||||
@@ -59,11 +234,11 @@ unsigned int autoconfig_read_memory_8(struct emulator_config *cfg, unsigned int
|
||||
|
||||
|
||||
if ((address & 1) == 0 && (address / 2) < (int)sizeof(ac_fast_ram_rom)) {
|
||||
if (ac_type[ac_current_pic] == ACTYPE_MAPFAST_Z2 && address / 2 == 1)
|
||||
val = get_autoconf_size(cfg->map_size[ac_index[ac_current_pic]]);
|
||||
if (ac_z2_type[ac_z2_current_pic] == ACTYPE_MAPFAST_Z2 && address / 2 == 1)
|
||||
val = get_autoconf_size(cfg->map_size[ac_z2_index[ac_z2_current_pic]]);
|
||||
else
|
||||
val = rom[address / 2];
|
||||
//printf("Read byte %d from autoconf for PIC %d (%.2X).\n", address/2, ac_current_pic, val);
|
||||
//printf("Read byte %d from Z2 autoconf for PIC %d (%.2X).\n", address/2, ac_z2_current_pic, val);
|
||||
}
|
||||
val <<= 4;
|
||||
if (address != 0 && address != 2 && address != 40 && address != 42)
|
||||
@@ -73,14 +248,14 @@ unsigned int autoconfig_read_memory_8(struct emulator_config *cfg, unsigned int
|
||||
}
|
||||
|
||||
void autoconfig_write_memory_8(struct emulator_config *cfg, unsigned int address_, unsigned int value) {
|
||||
int address = address_ - AC_BASE;
|
||||
int address = address_ - AC_Z2_BASE;
|
||||
int done = 0;
|
||||
|
||||
unsigned int *base = NULL;
|
||||
|
||||
switch(ac_type[ac_current_pic]) {
|
||||
switch(ac_z2_type[ac_z2_current_pic]) {
|
||||
case ACTYPE_MAPFAST_Z2:
|
||||
base = &ac_base[ac_current_pic];
|
||||
base = &ac_base[ac_z2_current_pic];
|
||||
break;
|
||||
case ACTYPE_A314:
|
||||
//base = &a314_base;
|
||||
@@ -90,7 +265,7 @@ void autoconfig_write_memory_8(struct emulator_config *cfg, unsigned int address
|
||||
}
|
||||
|
||||
if (!base) {
|
||||
printf("Failed to set up the base for autoconfig PIC %d.\n", ac_current_pic);
|
||||
//printf("Failed to set up the base for autoconfig PIC %d.\n", ac_z2_current_pic);
|
||||
done = 1;
|
||||
}
|
||||
else {
|
||||
@@ -100,8 +275,8 @@ void autoconfig_write_memory_8(struct emulator_config *cfg, unsigned int address
|
||||
*base &= 0xff0fffff;
|
||||
*base |= (value & 0xf0) << (20 - 4);
|
||||
|
||||
if (ac_type[ac_current_pic] == ACTYPE_MAPFAST_Z2) { // fast ram
|
||||
//a314_set_mem_base_size(*base, cfg->map_size[ac_index[ac_current_pic]]);
|
||||
if (ac_z2_type[ac_z2_current_pic] == ACTYPE_MAPFAST_Z2) { // fast ram
|
||||
//a314_set_mem_base_size(*base, cfg->map_size[ac_index[ac_z2_current_pic]]);
|
||||
}
|
||||
done = 1;
|
||||
} else if (address == 0x4c) { // shut up
|
||||
@@ -110,10 +285,10 @@ void autoconfig_write_memory_8(struct emulator_config *cfg, unsigned int address
|
||||
}
|
||||
|
||||
if (done) {
|
||||
//printf("Address of Z2 autoconf RAM changed to %.8x\n", ac_base[ac_current_pic]);
|
||||
cfg->map_offset[ac_index[ac_current_pic]] = ac_base[ac_current_pic];
|
||||
ac_current_pic++;
|
||||
if (ac_current_pic == ac_pic_count)
|
||||
ac_done = 1;
|
||||
printf("Address of Z2 autoconf RAM assigned to $%.8x\n", ac_base[ac_z2_current_pic]);
|
||||
cfg->map_offset[ac_z2_index[ac_z2_current_pic]] = ac_base[ac_z2_current_pic];
|
||||
ac_z2_current_pic++;
|
||||
if (ac_z2_current_pic == ac_z2_pic_count)
|
||||
ac_z2_done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#define AC_BASE 0xE80000
|
||||
#define AC_Z2_BASE 0xE80000
|
||||
#define AC_Z3_BASE 0xFF000000
|
||||
#define AC_SIZE (64 * 1024)
|
||||
#define AC_PIC_LIMIT 8
|
||||
|
||||
@@ -11,6 +12,15 @@
|
||||
#define AC_MEM_SIZE_2MB 6
|
||||
#define AC_MEM_SIZE_4MB 7
|
||||
|
||||
#define AC_MEM_SIZE_EXT_16MB 0
|
||||
#define AC_MEM_SIZE_EXT_32MB 1
|
||||
#define AC_MEM_SIZE_EXT_64MB 2
|
||||
#define AC_MEM_SIZE_EXT_128MB 3
|
||||
#define AC_MEM_SIZE_EXT_256MB 4
|
||||
#define AC_MEM_SIZE_EXT_512MB 5
|
||||
#define AC_MEM_SIZE_EXT_1024MB 6
|
||||
#define AC_MEM_SIZE_EXT_RES 7
|
||||
|
||||
enum autoconf_types {
|
||||
ACTYPE_MAPFAST_Z2,
|
||||
ACTYPE_MAPFAST_Z3,
|
||||
@@ -18,5 +28,58 @@ enum autoconf_types {
|
||||
ACTYPE_NUM,
|
||||
};
|
||||
|
||||
enum autoconfg_z3_regs {
|
||||
AC_Z3_REG_ER_TYPE = 0x00,
|
||||
AC_Z3_REG_ER_PRODUCT = 0x04,
|
||||
AC_Z3_REG_ER_FLAGS = 0x08,
|
||||
AC_Z3_REG_ER_RES03 = 0x0C,
|
||||
AC_Z3_REG_MAN_HI = 0x10,
|
||||
AC_Z3_REG_MAN_LO = 0x14,
|
||||
AC_Z3_REG_SER_BYTE0 = 0x18,
|
||||
AC_Z3_REG_SER_BYTE1 = 0x1C,
|
||||
AC_Z3_REG_SER_BYTE2 = 0x20,
|
||||
AC_Z3_REG_SER_BYTE3 = 0x24,
|
||||
AC_Z3_REG_INIT_DIAG_VEC_HI = 0x28,
|
||||
AC_Z3_REG_INIT_DIAG_VEC_LO = 0x2C,
|
||||
AC_Z3_REG_ER_RES0C = 0x30,
|
||||
AC_Z3_REG_ER_RES0D = 0x34,
|
||||
AC_Z3_REG_ER_RES0E = 0x38,
|
||||
AC_Z3_REG_ER_RES0F = 0x3C,
|
||||
AC_Z3_REG_ER_Z2_INT = 0x40,
|
||||
AC_Z3_REG_WR_ADDR_HI = 0x44,
|
||||
AC_Z3_REG_WR_ADDR_NIB_HI = 0x46,
|
||||
AC_Z3_REG_WR_ADDR_LO = 0x48,
|
||||
AC_Z3_REG_WR_ADDR_NIB_LO = 0x4A,
|
||||
AC_Z3_REG_SHUTUP = 0x4C,
|
||||
AC_Z3_REG_RES50 = 0x50,
|
||||
AC_Z3_REG_RES54 = 0x54,
|
||||
AC_Z3_REG_RES58 = 0x58,
|
||||
AC_Z3_REG_RES5C = 0x5C,
|
||||
AC_Z3_REG_RES60 = 0x60,
|
||||
AC_Z3_REG_RES64 = 0x64,
|
||||
AC_Z3_REG_RES68 = 0x68,
|
||||
AC_Z3_REG_RES6C = 0x6C,
|
||||
AC_Z3_REG_RES70 = 0x70,
|
||||
AC_Z3_REG_RES74 = 0x74,
|
||||
AC_Z3_REG_RES78 = 0x78,
|
||||
AC_Z3_REG_RES7C = 0x7C,
|
||||
};
|
||||
|
||||
#define BOARDTYPE_Z3 0x80
|
||||
#define BOARDTYPE_Z2 (0x80|0x40)
|
||||
#define BOARDTYPE_FREEMEM 0x20
|
||||
#define BOARDTYPE_BOOTROM 0x10
|
||||
|
||||
#define Z3_FLAGS_MEMORY 0x80
|
||||
#define Z3_FLAGS_NOSHUTUP 0x40
|
||||
#define Z3_FLAGS_EXTENSION 0x20
|
||||
#define Z3_FLAGS_RESERVED 0x10
|
||||
|
||||
#define PISTORM_MANUF_ID 0xDEBE
|
||||
|
||||
unsigned int autoconfig_read_memory_8(struct emulator_config *cfg, unsigned int address);
|
||||
void autoconfig_write_memory_8(struct emulator_config *cfg, unsigned int address, unsigned int value);
|
||||
|
||||
unsigned int autoconfig_read_memory_z3_8(struct emulator_config *cfg, unsigned int address_);
|
||||
void autoconfig_write_memory_z3_8(struct emulator_config *cfg, unsigned int address_, unsigned int value);
|
||||
void autoconfig_write_memory_z3_16(struct emulator_config *cfg, unsigned int address_, unsigned int value);
|
||||
|
||||
@@ -7,44 +7,87 @@
|
||||
int handle_register_read_amiga(unsigned int addr, unsigned char type, unsigned int *val);
|
||||
int handle_register_write_amiga(unsigned int addr, unsigned int value, unsigned char type);
|
||||
|
||||
extern int ac_done;
|
||||
extern int ac_pic_count;
|
||||
extern int ac_type[AC_PIC_LIMIT];
|
||||
extern int ac_index[AC_PIC_LIMIT];
|
||||
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];
|
||||
|
||||
const char *z2_autoconf_id = "z2_autoconf_fast";
|
||||
const char *z2_autoconf_zap_id = "^2_autoconf_fast";
|
||||
extern int ac_z3_pic_count;
|
||||
extern int ac_z3_done;
|
||||
extern int ac_z3_type[AC_PIC_LIMIT];
|
||||
extern int ac_z3_index[AC_PIC_LIMIT];
|
||||
|
||||
char *z2_autoconf_id = "z2_autoconf_fast";
|
||||
char *z2_autoconf_zap_id = "^2_autoconf_fast";
|
||||
char *z3_autoconf_id = "z3_autoconf_fast";
|
||||
char *z3_autoconf_zap_id = "^3_autoconf_fast";
|
||||
|
||||
extern const char *op_type_names[OP_TYPE_NUM];
|
||||
|
||||
int custom_read_amiga(struct emulator_config *cfg, unsigned int addr, unsigned int *val, unsigned char type) {
|
||||
if (!ac_done && addr >= AC_BASE && addr < AC_BASE + AC_SIZE) {
|
||||
if (ac_pic_count == 0) {
|
||||
ac_done = 1;
|
||||
if (!ac_z2_done && addr >= AC_Z2_BASE && addr < AC_Z2_BASE + AC_SIZE) {
|
||||
if (ac_z2_pic_count == 0) {
|
||||
ac_z2_done = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type == OP_TYPE_BYTE) {
|
||||
//printf("Read from autoconf area.\n");
|
||||
*val = autoconfig_read_memory_8(cfg, addr);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!ac_z3_done && addr >= AC_Z3_BASE && addr < AC_Z3_BASE + AC_SIZE) {
|
||||
if (ac_z3_pic_count == 0) {
|
||||
ac_z3_done = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type == OP_TYPE_BYTE) {
|
||||
*val = autoconfig_read_memory_z3_8(cfg, addr);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("Unexpected %s read from Z3 autoconf addr %.X\n", op_type_names[type], addr - AC_Z3_BASE);
|
||||
//stop_emulation();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int custom_write_amiga(struct emulator_config *cfg, unsigned int addr, unsigned int val, unsigned char type) {
|
||||
if (cfg || addr || val || type) {}
|
||||
if (!ac_done && addr >= AC_BASE && addr < AC_BASE + AC_SIZE) {
|
||||
if (!ac_z2_done && addr >= AC_Z2_BASE && addr < AC_Z2_BASE + AC_SIZE) {
|
||||
if (type == OP_TYPE_BYTE) {
|
||||
if (ac_pic_count == 0) {
|
||||
ac_done = 1;
|
||||
if (ac_z2_pic_count == 0) {
|
||||
ac_z2_done = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Write to Z2 autoconf area.\n");
|
||||
autoconfig_write_memory_8(cfg, addr, val);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ac_z3_done && addr >= AC_Z3_BASE && addr < AC_Z3_BASE + AC_SIZE) {
|
||||
if (type == OP_TYPE_BYTE) {
|
||||
if (ac_z3_pic_count == 0) {
|
||||
ac_z3_done = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//printf("Write to autoconf area.\n");
|
||||
autoconfig_write_memory_8(cfg, addr, val);
|
||||
autoconfig_write_memory_z3_8(cfg, addr, val);
|
||||
return 1;
|
||||
}
|
||||
else if (type == OP_TYPE_WORD) {
|
||||
autoconfig_write_memory_z3_16(cfg, addr, val);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("Unexpected %s write to Z3 autoconf addr %.X\n", op_type_names[type], addr - AC_Z3_BASE);
|
||||
//stop_emulation();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -54,9 +97,10 @@ int setup_platform_amiga(struct emulator_config *cfg) {
|
||||
if (cfg) {}
|
||||
printf("Performing setup for Amiga platform.\n");
|
||||
// Look for Z2 autoconf Fast RAM by id
|
||||
int index = get_named_mapped_item(cfg, "z2_autoconf_fast");
|
||||
int index = get_named_mapped_item(cfg, z2_autoconf_id);
|
||||
more_z2_fast:;
|
||||
if (index != -1) {
|
||||
// "Zap" config items as they are processed.
|
||||
cfg->map_id[index][0] = '^';
|
||||
int resize_data = 0;
|
||||
if (cfg->map_size[index] > 8 * SIZE_MEGA) {
|
||||
@@ -79,20 +123,41 @@ int setup_platform_amiga(struct emulator_config *cfg) {
|
||||
cfg->map_data[index] = (unsigned char *)malloc(cfg->map_size[index]);
|
||||
}
|
||||
printf("%dMB of Z2 Fast RAM configured at $%lx\n", cfg->map_size[index] / SIZE_MEGA, cfg->map_offset[index]);
|
||||
ac_type[ac_pic_count] = ACTYPE_MAPFAST_Z2;
|
||||
ac_index[ac_pic_count] = index;
|
||||
ac_pic_count++;
|
||||
printf("AAAAHH!\n");
|
||||
ac_z2_type[ac_z2_pic_count] = ACTYPE_MAPFAST_Z2;
|
||||
ac_z2_index[ac_z2_pic_count] = index;
|
||||
ac_z2_pic_count++;
|
||||
}
|
||||
else
|
||||
printf("No Z2 Fast RAM configured.\n");
|
||||
index = get_named_mapped_item(cfg, "z2_autoconf_fast");
|
||||
|
||||
index = get_named_mapped_item(cfg, z2_autoconf_id);
|
||||
if (index != -1)
|
||||
goto more_z2_fast;
|
||||
|
||||
for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i ++) {
|
||||
// Restore any "zapped" autoconf items so they can be reinitialized if needed.
|
||||
if (cfg->map_id[i] && strcmp(cfg->map_id[i], z2_autoconf_zap_id) == 0) {
|
||||
cfg->map_id[i][0] = 'z';
|
||||
cfg->map_id[i][0] = z2_autoconf_id[0];
|
||||
}
|
||||
}
|
||||
|
||||
index = get_named_mapped_item(cfg, z3_autoconf_id);
|
||||
more_z3_fast:;
|
||||
if (index != -1) {
|
||||
cfg->map_id[index][0] = '^';
|
||||
printf("%dMB of Z3 Fast RAM configured at $%lx\n", cfg->map_size[index] / SIZE_MEGA, cfg->map_offset[index]);
|
||||
ac_z3_type[ac_z3_pic_count] = ACTYPE_MAPFAST_Z3;
|
||||
ac_z3_index[ac_z3_pic_count] = index;
|
||||
ac_z3_pic_count++;
|
||||
}
|
||||
else
|
||||
printf("No Z3 Fast RAM configured.\n");
|
||||
index = get_named_mapped_item(cfg, z3_autoconf_id);
|
||||
if (index != -1)
|
||||
goto more_z3_fast;
|
||||
for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i ++) {
|
||||
if (cfg->map_id[i] && strcmp(cfg->map_id[i], z3_autoconf_zap_id) == 0) {
|
||||
cfg->map_id[i][0] = z3_autoconf_id[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user