Autosized Z2 mapping helper.

This commit is contained in:
Toni Wilen 2016-10-04 19:16:22 +03:00
parent 9b184991f4
commit 4c31e22437
5 changed files with 30 additions and 3 deletions

View File

@ -872,8 +872,8 @@ static void REGPARAM2 blizzarde8_bput(uaecptr addr, uae_u32 b)
b &= 0xff;
addr &= 65535;
if (addr == 0x48 && !configured) {
map_banks(&blizzardea_bank, b, blizzardea_bank.allocated_size >> 16, 0);
write_log(_T("Accelerator Z2 board autoconfigured at %02X0000\n"), b);
uae_u32 size = map_banks_z2_autosize(&blizzardea_bank, b);
write_log(_T("Accelerator Z2 board autoconfigured at %02X0000, size %08x\n"), b, size);
configured = 1;
expamem_next (&blizzardea_bank, NULL);
return;
@ -2541,7 +2541,7 @@ bool cpuboard_autoconfig_init(struct autoconfig_info *aci)
blizzardea_bank.baseaddr[i * 2 + 0] = b;
}
} else if (is_csmk1(p)) {
earom_size = 131072;
earom_size = 131072; // really 64k but ea and f0 use same space
f0rom_size = 65536;
for (int i = 0; i < 32768; i++) {
uae_u8 b = 0xff;

View File

@ -2262,6 +2262,21 @@ static void add_expansions(struct uae_prefs *p, int zorro, int *fastmem_nump, in
*fastmem_nump = fastmem_num;
}
uae_u32 expansion_board_size(addrbank *ab)
{
uae_u32 size = 0;
uae_u8 code = (ab->bget(0) & 0xf0) | ((ab->bget(2) & 0xf0) >> 4);
if ((code & 0xc0) == zorroII) {
// Z2
code &= 7;
if (code == 0)
size = 8 * 1024 * 1024;
else
size = 32768 << code;
}
return size;
}
static uae_u8 autoconfig_read(const uae_u8 *autoconfig, int offset)
{
uae_u8 b = (autoconfig[offset] & 0xf0) | (autoconfig[offset + 2] >> 4);

View File

@ -157,6 +157,7 @@ extern bool expansion_can_move(struct uae_prefs *p, int index);
extern bool alloc_expansion_bank(addrbank *bank, struct autoconfig_info *aci);
extern void free_expansion_bank(addrbank *bank);
extern void expansion_map(void);
extern uae_u32 expansion_board_size(addrbank *ab);
extern void uaegfx_install_code (uaecptr);

View File

@ -458,6 +458,7 @@ extern void memory_cleanup(void);
extern void restore_banks(void);
extern void map_banks (addrbank *bank, int first, int count, int realsize);
extern void map_banks_z2(addrbank *bank, int first, int count);
extern uae_u32 map_banks_z2_autosize(addrbank *bank, int first);
extern void map_banks_z3(addrbank *bank, int first, int count);
extern bool validate_banks_z2(addrbank *bank, int start, int size);
extern bool validate_banks_z3(addrbank *bank, int start, int size);

View File

@ -2953,6 +2953,16 @@ void map_banks_z2 (addrbank *bank, int start, int size)
map_banks (bank, start, size, 0);
}
uae_u32 map_banks_z2_autosize(addrbank *bank, int start)
{
uae_u32 size = expansion_board_size(bank);
if (!size) {
error_log(_T("Z2 map_banks(%s) %08x, invalid size!\n"), bank->name, start << 16);
return 0;
}
map_banks_z2(bank, start, size >> 16);
return size;
}
void map_banks_quick (addrbank *bank, int start, int size, int realsize)
{