Merge pull request #13 from beeanyew/wip-crap

Z3 Fast RAM + Readme/config update
This commit is contained in:
captain-amygdala
2021-04-10 07:50:43 +02:00
committed by GitHub
5 changed files with 94 additions and 50 deletions

View File

@@ -4,7 +4,7 @@
# Join us on Discord or on Freenode IRC #PiStorm
* There's a Discord server dedicated to the PiStorm, which you can join through this handy invite link: https://discord.com/invite/j6rPtzxaNW
* There's a Discord server dedicated to PiStorm discussion and development, which you can join through this handy invite link: https://discord.com/invite/j6rPtzxaNW
* There's also an IRC channel on the Freenode IRC network, `#PiStorm`, which is bridged with the `#general` channel on Discord.
# Project information
@@ -25,7 +25,7 @@ Since much of the initial work and testing for the PiStorm was done on Amiga com
* Kickstart ROM mapping: 1.3, 2.0, 3.1, anything you might own and have dumped in a byteswapped format. Extended ROM mapping as well for instance with the CDTV extended BIOS.
* An A1200 3.1+ Kickstart ROM is currently recommended, as this one has the most dynamic automatic configuration on boot.
* Fast RAM: Z2, Z3 and CPU local Fast can be mapped for high performance memory available to the CPU only on the PiStorm side of things.
* Virtual SCSI: PiSCSI, a high performance virtual SCSI interface for mapping raw RDB disk images for physical connected to the Pi for use on the Amiga.
* Virtual SCSI: PiSCSI, a high performance virtual SCSI interface for mapping raw RDB disk images or physical storage devices connected to the Pi for use on the Amiga.
* RTG: PiGFX, a virtual RTG board with almost all P96-supported functionality supported and accelerated.
* Some other things: Most likely I forgot something while writing this, but someone will probably tell me about it.

View File

@@ -5,11 +5,12 @@ map type=rom address=0xF80000 size=0x80000 file=kick.rom ovl=0
# Want to map an extended ROM, such as CDTV or CD32?
#map type=rom address=0xF00000 size=0x80000 file=cdtv.rom
# Map 128MB of Fast RAM at 0x8000000.
map type=ram address=0x08000000 size=128M id=cpu_slot_ram
# Map 128MB of Fast RAM at 0x8000000, also known as 32-bit Fast RAM or CPU local Fast RAM.
# Only supported properly on select Kickstarts, such as 3.1+ for Amiga 1200, 3000 and 4000.
#map type=ram address=0x08000000 size=128M id=cpu_slot_ram
# 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
# Enabling Z3 fast requires at least Kickstart 2.0.
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=2M id=z2_autoconf_fast

View File

@@ -86,13 +86,13 @@ unsigned char get_autoconf_size_ext(int size) {
extern void adjust_ranges_amiga(struct emulator_config *cfg);
unsigned int autoconfig_read_memory_z3_8(struct emulator_config *cfg, unsigned int address_) {
int address = address_ - AC_Z3_BASE;
unsigned int autoconfig_read_memory_z3_8(struct emulator_config *cfg, unsigned int address) {
int index = ac_z3_index[ac_z3_current_pic];
unsigned char val = 0;
if ((address & 0xFF) >= AC_Z3_REG_RES50 && (address & 0xFF) <= AC_Z3_REG_RES7C)
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:
@@ -146,6 +146,8 @@ unsigned int autoconfig_read_memory_z3_8(struct emulator_config *cfg, unsigned i
case AC_Z3_REG_ER_RES0E:
case AC_Z3_REG_ER_RES0F:
case AC_Z3_REG_ER_Z2_INT:
val = 0;
break;
default:
val = 0;
break;
@@ -157,8 +159,7 @@ unsigned int autoconfig_read_memory_z3_8(struct emulator_config *cfg, unsigned i
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;
void autoconfig_write_memory_z3_8(struct emulator_config *cfg, unsigned int address, unsigned int value) {
int index = ac_z3_index[ac_z3_current_pic];
unsigned char val = (unsigned char)value;
int done = 0;
@@ -212,8 +213,7 @@ void autoconfig_write_memory_z3_8(struct emulator_config *cfg, unsigned int addr
return;
}
void autoconfig_write_memory_z3_16(struct emulator_config *cfg, unsigned int address_, unsigned int value) {
int address = address_ - AC_Z3_BASE;
void autoconfig_write_memory_z3_16(struct emulator_config *cfg, unsigned int address, unsigned int value) {
int index = ac_z3_index[ac_z3_current_pic];
unsigned short val = (unsigned short)value;
int done = 0;
@@ -243,9 +243,8 @@ void autoconfig_write_memory_z3_16(struct emulator_config *cfg, unsigned int add
return;
}
unsigned int autoconfig_read_memory_8(struct emulator_config *cfg, unsigned int address_) {
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]) {
@@ -281,8 +280,7 @@ unsigned int autoconfig_read_memory_8(struct emulator_config *cfg, unsigned int
return (unsigned int)val;
}
void autoconfig_write_memory_8(struct emulator_config *cfg, unsigned int address_, unsigned int value) {
int address = address_ - AC_Z2_BASE;
void autoconfig_write_memory_8(struct emulator_config *cfg, unsigned int address, unsigned int value) {
int done = 0;
int index = ac_z2_index[ac_z2_current_pic];

View File

@@ -84,6 +84,6 @@ enum autoconfg_z3_regs {
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);
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);

View File

@@ -13,6 +13,15 @@
#include "platforms/shared/rtc.h"
#include "rtg/rtg.h"
//#define DEBUG_AMIGA_PLATFORM
#ifdef DEBUG_AMIGA_PLATFORM
#define DEBUG printf
#else
#define DEBUG(...)
#endif
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);
int init_rtg_data();
@@ -43,22 +52,36 @@ extern unsigned char cdtv_sram[32 * SIZE_KILO];
#define min(a, b) (a < b) ? a : b
#define max(a, b) (a > b) ? a : b
static uint8_t rtg_enabled = 0, piscsi_enabled = 0, pinet_enabled = 0;
uint8_t rtg_enabled = 0, piscsi_enabled = 0, pinet_enabled = 0, kick13_mode = 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) {
ac_z2_done = 1;
if (kick13_mode)
ac_z3_done = 1;
if ((!ac_z2_done || !ac_z3_done) && addr >= AC_Z2_BASE && addr < AC_Z2_BASE + AC_SIZE) {
if (!ac_z2_done && ac_z2_current_pic < ac_z2_pic_count) {
if (type == OP_TYPE_BYTE) {
*val = autoconfig_read_memory_8(cfg, addr - AC_Z2_BASE);
return 1;
}
printf("Unexpected %s read from Z2 autoconf addr %.X\n", op_type_names[type], addr - AC_Z2_BASE);
return -1;
}
if (type == OP_TYPE_BYTE) {
*val = autoconfig_read_memory_8(cfg, addr);
return 1;
if (!ac_z3_done && ac_z3_current_pic < ac_z3_pic_count) {
uint32_t addr_ = addr - AC_Z2_BASE;
if (addr_ & 0x02) {
addr_ = (addr_ - 2) + 0x100;
}
if (type == OP_TYPE_BYTE) {
*val = autoconfig_read_memory_z3_8(cfg, addr_ - AC_Z2_BASE);
return 1;
}
printf("Unexpected %s read from Z3 autoconf addr %.X\n", op_type_names[type], addr - AC_Z2_BASE);
return -1;
}
}
if (!ac_z3_done && addr >= AC_Z3_BASE && addr < AC_Z3_BASE + AC_SIZE) {
@@ -68,13 +91,11 @@ inline int custom_read_amiga(struct emulator_config *cfg, unsigned int addr, uns
}
if (type == OP_TYPE_BYTE) {
*val = autoconfig_read_memory_z3_8(cfg, addr);
*val = autoconfig_read_memory_z3_8(cfg, addr - AC_Z3_BASE);
return 1;
}
else {
printf("Unexpected %s read from Z3 autoconf addr %.X\n", op_type_names[type], addr - AC_Z3_BASE);
//stop_emulation();
}
printf("Unexpected %s read from Z3 autoconf addr %.X\n", op_type_names[type], addr - AC_Z3_BASE);
return -1;
}
if (addr >= piscsi_base && addr < piscsi_base + (64 * SIZE_KILO)) {
@@ -88,16 +109,33 @@ inline int custom_read_amiga(struct emulator_config *cfg, unsigned int addr, uns
}
inline int custom_write_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 (type == OP_TYPE_BYTE) {
if (ac_z2_pic_count == 0) {
ac_z2_done = 1;
return -1;
}
if (kick13_mode)
ac_z3_done = 1;
//printf("Write to Z2 autoconf area.\n");
autoconfig_write_memory_8(cfg, addr, val);
return 1;
if ((!ac_z2_done || !ac_z3_done) && addr >= AC_Z2_BASE && addr < AC_Z2_BASE + AC_SIZE) {
if (!ac_z2_done && ac_z2_current_pic < ac_z2_pic_count) {
if (type == OP_TYPE_BYTE) {
autoconfig_write_memory_8(cfg, addr - AC_Z2_BASE, val);
return 1;
}
printf("Unexpected %s write to Z2 autoconf addr %.X\n", op_type_names[type], addr - AC_Z2_BASE);
return -1;
}
if (!ac_z3_done && ac_z3_current_pic < ac_z3_pic_count) {
uint32_t addr_ = addr - AC_Z2_BASE;
if (addr_ & 0x02) {
addr_ = (addr_ - 2) + 0x100;
}
if (type == OP_TYPE_BYTE) {
autoconfig_write_memory_z3_8(cfg, addr_ - AC_Z2_BASE, val);
return 1;
}
else if (type == OP_TYPE_WORD) {
autoconfig_write_memory_z3_16(cfg, addr_ - AC_Z2_BASE, val);
return 1;
}
printf("Unexpected %s write to Z3 autoconf addr %.X\n", op_type_names[type], addr - AC_Z2_BASE);
return -1;
}
}
@@ -109,11 +147,11 @@ inline int custom_write_amiga(struct emulator_config *cfg, unsigned int addr, un
}
//printf("Write to autoconf area.\n");
autoconfig_write_memory_z3_8(cfg, addr, val);
autoconfig_write_memory_z3_8(cfg, addr - AC_Z3_BASE, val);
return 1;
}
else if (type == OP_TYPE_WORD) {
autoconfig_write_memory_z3_16(cfg, addr, val);
autoconfig_write_memory_z3_16(cfg, addr - AC_Z3_BASE, val);
return 1;
}
else {
@@ -147,7 +185,7 @@ void adjust_ranges_amiga(struct emulator_config *cfg) {
}
}
if (ac_z2_pic_count && !ac_z2_done) {
if (ac_z2_pic_count && (!ac_z2_done || !ac_z3_done)) {
if (cfg->custom_low == 0)
cfg->custom_low = AC_Z2_BASE;
else
@@ -323,7 +361,7 @@ void setvar_amiga(struct emulator_config *cfg, char *var, char *val) {
printf("[AMIGA] CDTV mode enabled.\n");
cdtv_mode = 1;
}
if (strcmp(var, "rtg") == 0) {
if (strcmp(var, "rtg") == 0 && !rtg_enabled) {
if (init_rtg_data()) {
printf("[AMIGA] RTG Enabled.\n");
rtg_enabled = 1;
@@ -332,9 +370,13 @@ void setvar_amiga(struct emulator_config *cfg, char *var, char *val) {
else
printf("[AMIGA} Failed to enable RTG.\n");
}
if (strcmp(var, "kick13") == 0) {
printf("[AMIGA] Kickstart 1.3 mode enabled, Z3 PICs will not be enumerated.\n");
kick13_mode = 1;
}
// PiSCSI stuff
if (strcmp(var, "piscsi") == 0) {
if (strcmp(var, "piscsi") == 0 && !piscsi_enabled) {
printf("[AMIGA] PISCSI Interface Enabled.\n");
piscsi_enabled = 1;
piscsi_init();
@@ -367,7 +409,7 @@ void setvar_amiga(struct emulator_config *cfg, char *var, char *val) {
}
// Pi-Net stuff
if (strcmp(var, "pi-net") == 0) {
if (strcmp(var, "pi-net") == 0 && !pinet_enabled) {
printf("[AMIGA] PI-NET Interface Enabled.\n");
pinet_enabled = 1;
pinet_init(val);
@@ -390,11 +432,14 @@ 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_done = (ac_z2_pic_count == 0);
ac_z3_done = (ac_z3_pic_count == 0);
ac_z2_current_pic = 0;
ac_z3_current_pic = 0;
DEBUG("[AMIGA] Reset handler.\n");
DEBUG("[AMIGA] AC done - Z2: %d Z3: %d.\n", ac_z2_done, ac_z3_done);
if (piscsi_enabled)
piscsi_refresh_drives();