"rom",
"ram",
"register",
- "ram (no alloc)",
+ "ram_noalloc",
+ "wtcram",
};
const char *config_item_names[CONFITEM_NUM] = {
cfg->map_high[index] = addr + size;
cfg->map_mirror[index] = mirr_addr;
if (strlen(map_id)) {
+ if (cfg->map_id[index]) {
+ free(cfg->map_id[index]);
+ }
cfg->map_id[index] = (char *)malloc(strlen(map_id) + 1);
strcpy(cfg->map_id[index], map_id);
}
printf("[CFG] Adding %d byte (%d MB) RAM mapping %s...\n", size, size / 1024 / 1024, map_id);
cfg->map_data[index] = (unsigned char *)filename;
break;
+ case MAPTYPE_RAM_WTC:
+ printf("[CFG] Allocating %d bytes for Write-Through Cached RAM mapping (%.1f MB)...\n", size, (float)size / 1024.0f / 1024.0f);
+ goto alloc_mapram;
+ break;
case MAPTYPE_RAM:
printf("[CFG] Allocating %d bytes for RAM mapping (%d MB)...\n", size, size / 1024 / 1024);
+alloc_mapram:
cfg->map_data[index] = (unsigned char *)malloc(size);
if (!cfg->map_data[index]) {
printf("[CFG] ERROR: Unable to allocate memory for mapped RAM!\n");
goto mapping_failed;
}
memset(cfg->map_data[index], 0x00, size);
+ if (type == MAPTYPE_RAM_WTC) {
+ // This may look a bit weird, but it adds a read range for the WTC RAM. Writes still go through to the mapped read/write functions.
+ m68k_add_rom_range(cfg->map_offset[index], cfg->map_high[index], cfg->map_data[index]);
+ }
break;
case MAPTYPE_ROM:
in = fopen(filename, "rb");
MAPTYPE_RAM,
MAPTYPE_REGISTER,
MAPTYPE_RAM_NOALLOC,
+ MAPTYPE_RAM_WTC,
MAPTYPE_NUM,
} map_types;
loopcycles 300
# Set the platform to Amiga to enable all the registers and stuff.
platform amiga
-# Uncomment to let reads/writes through from/to the RTC memory range
+# Uncommenting the below this long comment DISABLES RTC emulation, letting reads/writes through to the RTC memory range.
+# There is no need to uncomment it unless you are either using a CDTV, you want to use a physical RTC source present
+# inside the computer, such as on a trapdoor memory expansion board, or if you have a physical A314 intalled, since the
+# A314 uses the RTC address range to communicate with the Amiga, and enabling RTC emulation # blocks this communication completely.
+# DO NOT UNCOMMENT THE LINE BELOW UNLESS YOU'VE READ AND UNDERSTOOD THE FIVE LINES ABOVE THIS ONE.
#setvar enable_rtc_emulation 0
# Uncomment to enable RTG
#setvar rtg
# Uncomment to enable A314 emulation
#setvar a314
+# Please take note:
+# At the time of writing this (22 Jun 2021), the mouse and keyboard forwarding (for Amiga only) is by no means perfect.
+# It works properly in Workbench, and in a number of games and applications, but it does not work for everything.
+# Do not rely on the mouse and keyboard forwarding as your only means of input for the host computer.
+
# Forward keyboard events to host system, defaults to off unless toggle key is pressed, toggled off using F12.
# Syntax: keyboard [grab key] [grab|nograb] [autoconnect|noautoconnect]
# "grab" steals the keyboard from the Pi so Amiga/etc. input is not sent to the Pi
--- /dev/null
+# CPU type is by default 68EC020, try 68000 or 68010 if EC020 doesn't work with the ROM.
+# (CPU support on classic Macs seem to be severely limited by the system ROM used, and later ROMs are needed for any 32-bit CPU.)
+cpu 68EC020
+
+# Map any size ROM to a the (max) 512KB KB system ROM default address with OVL enabled.
+# (From what I could tell, the ROM was mirrored across this entire 512KB space regardless of physical capacity.)
+map type=rom address=0x400000 size=512K file=system.rom ovl=0 id=sysrom
+
+# Map X KB/MB of RAM starting at $0. The type of this RAM map is "wtcram", which is short for Write Through Cache RAM.
+# It appears that the Mac Classic sound/video chips can't write to RAM, only read from it, so this should be sufficient
+# unless there's something I've missed. Only uncomment one of these lines at any time, depending on how much physical RAM is installed.
+#map type=wtcram address=0x0 size=128K id=sysram
+#map type=wtcram address=0x0 size=256K id=sysram
+#map type=wtcram address=0x0 size=512K id=sysram
+#map type=wtcram address=0x0 size=1M id=sysram
+#map type=wtcram address=0x0 size=2M id=sysram
+#map type=wtcram address=0x0 size=2560K id=sysram
+#map type=wtcram address=0x0 size=4M id=sysram
+
+# Number of instructions to run every main loop.
+loopcycles 300
+# Set the platform to Mac68k to enable all the registers and stuff.
+platform mac68k
+
+#setvar iscsi
+# ... Just kidding!
+#setvar iscsi0 system.hdf
+#setvar iscsi1 simcity2000.hdf
+
+# No keyboard/mouse forwarding is available for Mac68k, and uncommenting any of these lines won't do anything.
+# Forward keyboard events to host system, defaults to off unless toggle key is pressed, toggled off using F12.
+# Syntax: keyboard [grab key] [grab|nograb] [autoconnect|noautoconnect]
+# "grab" steals the keyboard from the Pi so Amiga/etc. input is not sent to the Pi
+# (also helps prevent sending any ctrl-alt-del to the Amiga from resetting the Pi)
+#
+# "autoconnect" connects the keyboard to the Amiga/etc. on startup
+#keyboard k nograb noautoconnect
+# Select a specific filename for the keyboard event source.
+# This is typically /dev/input/event1 or event0, but it may be event3 with for instance a wireless keyboard.
+# Use ls /dev/input/event* to check which event files are available and try until you find the one that works.
+#kbfile /dev/input/event1
+# Forward mouse events to host system, defaults to off unless toggle key is pressed on the Pi.
+# Syntax is mouse [device] [toggle key] [autoconnect|noautoconnect]
+# (see "keyboard" above for autoconnect description)
+#mouse /dev/input/mice m noautoconnect
goto read_value;
break;
case MAPTYPE_RAM:
+ case MAPTYPE_RAM_WTC:
+ case MAPTYPE_RAM_NOALLOC:
read_addr = cfg->map_data[i] + (addr - cfg->map_offset[i]);
goto read_value;
break;
return -1;
read_value:;
- //printf("Read value from %.8X\n", addr);
switch(type) {
case OP_TYPE_BYTE:
*val = read_addr[0];
}
inline int handle_mapped_write(struct emulator_config *cfg, unsigned int addr, unsigned int value, unsigned char type) {
+ int res = -1;
unsigned char *write_addr = NULL;
for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i++) {
else if (CHKRANGE_ABS(addr, cfg->map_offset[i], cfg->map_high[i])) {
switch(cfg->map_type[i]) {
case MAPTYPE_ROM:
- return 1;
+ res = 1;
break;
case MAPTYPE_RAM:
+ case MAPTYPE_RAM_NOALLOC:
write_addr = cfg->map_data[i] + (addr - cfg->map_offset[i]);
+ res = 1;
+ goto write_value;
+ break;
+ case MAPTYPE_RAM_WTC:
+ write_addr = cfg->map_data[i] + (addr - cfg->map_offset[i]);
+ res = -1;
goto write_value;
break;
case MAPTYPE_REGISTER:
}
}
- return -1;
+ return res;
write_value:;
- //printf("Write value to %.8X\n", addr);
switch(type) {
case OP_TYPE_BYTE:
write_addr[0] = (unsigned char)value;
- return 1;
+ return res;
break;
case OP_TYPE_WORD:
((short *)write_addr)[0] = htobe16(value);
- return 1;
+ return res;
break;
case OP_TYPE_LONGWORD:
((int *)write_addr)[0] = htobe32(value);
- return 1;
+ return res;
break;
case OP_TYPE_MEM:
return -1;
break;
}
- return 1;
+ // This should never actually happen.
+ return res;
}