/* Real hardware UAE state file loader */
/* Copyright 2019 Toni Wilen */
-#define VER "0.7"
+#define VER "1.0"
#include <stdio.h>
#include <stdarg.h>
extern struct GfxBase *GfxBase;
extern struct DosLibrary *DosBase;
-static const UBYTE *const version = "$VER: uaestateload " VER " (" REVDATE ")";
+static const UBYTE *const version = "$VER: ussload " VER " (" REVDATE ")";
static const char *const chunknames[] =
{
Permit();
}
-static ULONG check_ram(UBYTE *cname, UBYTE *chunk, WORD index, ULONG addr, ULONG offset, ULONG chunksize, ULONG flags, struct uaestate *st)
+static ULONG check_ram(UBYTE *ramname, UBYTE *cname, UBYTE *chunk, WORD index, ULONG addr, ULONG offset, ULONG chunksize, ULONG flags, struct uaestate *st)
{
ULONG size;
if (flags & 1) // compressed
}
Permit();
if (!found) {
- printf("ERROR: Required address space %08x-%08x not found in this system.\n", addr, addr + size - 1);
+ printf("ERROR: Required RAM address space %08x-%08x not found in this system.\n", addr, addr + size - 1);
st->errors++;
return 0;
}
}
return 1;
}
- printf("ERROR: Not enough memory available (Chunk '%s', %luk required).\n", cname, size >> 10);
+ printf("ERROR: Not enough %s RAM available. %luk required.\n", ramname, size >> 10);
st->errors++;
return 0;
}
while (*path++);
int mismatch = ver != rver || rev != rrev;
- if (st->debug || mismatch)
+ if (mismatch)
+ printf("- WARNING: ROM version mismatch: %d.%d. System ROM: %d.%d\n", ver, rev, rver, rrev);
+ if (st->debug)
printf("ROM %08lx-%08lx %d.%d (CRC=%08x).\n", start, start + len - 1, ver, rev, crc32);
if (mismatch) {
- printf("- '%s'\n", path);
- printf("- WARNING: KS ROM version mismatch.\n");
+ if (st->debug)
+ printf("- '%s'\n", path);
st->romver = ver;
st->romrev = rev;
WORD mr = has_maprom(st);
}
st->agastate = aga;
} else if (!strcmp(cname, "CRAM")) {
- check_ram(cname, b, MB_CHIP, 0x000000, offset, size, flags, st);
+ check_ram("Chip", cname, b, MB_CHIP, 0x000000, offset, size, flags, st);
} else if (!strcmp(cname, "BRAM")) {
- check_ram(cname, b, MB_SLOW, 0xc00000, offset, size, flags, st);
+ check_ram("Slow", cname, b, MB_SLOW, 0xc00000, offset, size, flags, st);
} else if (!strcmp(cname, "FRAM")) {
- check_ram(cname, b, MB_FAST, 0x200000, offset, size, flags, st);
+ check_ram("Fast", cname, b, MB_FAST, 0x200000, offset, size, flags, st);
} else if (!strcmp(cname, "ROM ")) {
check_rom(b, st);
}
return;
}
- if (st->debug) {
- printf("Code=%08lx Stack=%08lx Data=%08lx. Press RETURN!\n", newcode, tempsp, tempst);
- } else {
- printf("Change floppy disk(s) now if needed. Press RETURN to start.\n");
+ if (!st->nowait) {
+ if (st->debug) {
+ printf("Code=%08lx Stack=%08lx Data=%08lx. Press RETURN!\n", newcode, tempsp, tempst);
+ } else {
+ printf("Change floppy disk(s) now if needed. Press RETURN to start.\n");
+ }
+ UBYTE b;
+ fread(&b, 1, 1, stdin);
+ Delay(100); // So that key release gets processed by AmigaOS
}
if (SysBase->LibNode.lib_Version >= 37) {
flushcache();
}
- UBYTE b;
- fread(&b, 1, 1, stdin);
- Delay(100); // So that key release gets processed by AmigaOS
-
if (GfxBase->LibNode.lib_Version >= 37) {
LoadView(NULL);
WaitTOF();
UBYTE cname[5];
struct uaestate *st;
- printf("ussload v" VER " (" REVTIME " " REVDATE ")\n");
+ printf("ussload v" VER " (" REVDATE " " REVTIME ")\n");
if (argc < 2) {
- printf("Syntax: ussload <statefile.uss> (parameters).\n");
+ printf("Syntax: ussload <statefile.uss> (parameters)\n");
+ printf("- nowait = don't wait for return key.\n");
printf("- debug = enable debug output.\n");
printf("- test = test mode.\n");
printf("- nomaprom = do not use map rom.\n");
st->debug = 1;
if (!stricmp(argv[i], "test"))
st->testmode = 1;
+ if (!stricmp(argv[i], "nowait"))
+ st->nowait = 1;
if (!stricmp(argv[i], "nomaprom"))
st->usemaprom = 0;
if (!stricmp(argv[i], "nocache"))
-ussload: load UAE state files on real hardware.
+ussload is UAE state save file (*.uss) loader designed for real hardware.
-Supported hardware configurations:
+Supported state file hardware configurations:
-- Common 68000 A500 configurations. (chip ram, "slow" ram and fast ram supported)
-- A1200 68020 configuration ("slow" ram and fast ram is also supported)
+Common OCS/ECS 68000 A500 configurations. Chip RAM, "Slow" RAM and
+Fast RAM supported.
+Basic A1200 68020 configuration. "Slow" RAM and Fast RAM is also
+supported.
Information:
-CPU should match statefile config but it only causes warning. Mismatched CPU most likely won't work but it is fully supported by ussload.
-RAM config must match and at least one RAM address space must be 512k larger.
-Both compressed and uncompressed statefiles are supported.
-HD compatible (statefile is completely loaded before system take over)
-KS ROM does not need to match if loaded program has already completely taken over the system.
-All, even ancient statefiles should be supported, confirmed with UAE 0.8.22 created statefile.
-Floppy state restore is not tested but at least motor state and track number is restored.
-Statefile restore can for example fail if statefile was saved when blitter was active or program was executing self-modifying code.
+- Compatible with KS 1.2 and newer.
+- CPU should match state file config but 68020 to 68030 most likely works,
+ 68000 to 68020 or 68030 depends on program, 68020 to 68000 rarely works.
+- RAM config must match (can be larger than required) and system must
+ have at least 512k more RAM than state file requires.
+- Both compressed and uncompressed state files are supported.
+- HD compatible (state file is completely loaded before system take over)
+- KS ROM does not need to match if loaded program has already completely
+ taken over the system or supported Map ROM hardware is available.
+- All state files should be supported, at least since UAE 0.8.22.
+- State file restore can for example fail if state file was saved when
+ blitter was active or program was executing self-modifying code.
-RAM config examples:
+Minimum RAM config examples:
-512k chip ram statefile: hardware must have 1M chip or 512k chip+512k "slow" ram or 512k chip+512k real fast.
-512k+512k statefile: hardware must have 1M+512k or 512k+1M or 512k+512k+512k real fast.
+512k Chip RAM state file: hardware must have 1M Chip or 512k Chip+512k
+"Slow" RAM or 512k Chip+512k real Fast.
+512k+512k state file: hardware must have 1M+512k or 512k+1M or
+512k+512k+512k real Fast.
-Note that uncompressed statefiles require at least 1M contiguous extra RAM because all statefile RAM address spaces need to fit in RAM before system take over.
-
-A1200 chip ram only statefiles require at least 1M fast ram.
+Note that uncompressed state files require at least 1M contiguous extra
+RAM because all state file RAM address spaces need to fit in RAM before
+system take over.
+A1200 chip ram only state files usually require at least 1M Fast ram.
Map ROM hardware support:
-Currently ACA500, ACA500plus, ACA1221, ACA1221EC and most ACA123x variants map rom hardware is supported.
-If statefile ROM is not same as hardware ROM, ROM image is automatically loaded from devs:kickstarts and enabled if found.
+Currently ACA500, ACA500plus, ACA1221, ACA1221EC and most ACA123x
+variants Map ROM hardware is supported.
+If state file ROM is not same as hardware ROM, ROM image is automatically
+loaded from DEVS:Kickstarts and enabled if found.
+Check WHDLoad documentation for DEVS:Kickstarts files and naming.
+If A1200 KS 3.0 ROM is missing: manually copy correct ROM to
+DEVS:Kickstarts and name it kick39106.a1200.
Command line parameters:
+- nowait = don't wait for return key.
- debug = show debug information.
-- test = parse and load statefile, exit before system take over.
-- nomaprom = do not use map rom.
+- test = parse and load state file, exit before system take over.
+- nomaprom = do not use Map ROM.
- nocache = disable caches before starting loaded program (68020+ only)
- pal = force PAL mode (ECS/AGA only)
- ntsc = force NTSC mode (ECS/AGA only)
Background colors:
-- purple = map rom copy
-- red = decompressing/copying chip ram state
-- green = decompressing/copying slow ram state
-- blue = decompressing/copying fast ram (0x00200000) state
-- yellow = setting floppy drives (seek rw head)
+- purple = Map ROM copy.
+- red = decompressing/copying Chip Ram state.
+- green = decompressing/copying "Slow" RAM (0x00c00000) state.
+- blue = decompressing/copying Fast RAM (0x00200000) state.
+- yellow = configuring floppy drives (seek rw head, motor state).
+
+Source: https://github.com/tonioni/WinUAE/tree/master/utilities/stateload