]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
ussload 1.0
authorToni Wilen <twilen@winuae.net>
Mon, 13 May 2019 14:15:57 +0000 (17:15 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 13 May 2019 14:15:57 +0000 (17:15 +0300)
utilities/stateload/header.h
utilities/stateload/main.c
utilities/stateload/readme.txt

index 381cf2558b66f7d175aea2637f803babe8cb1df9..f24326f6dbc099934bbd5b5b7afcaea6614fd547 100644 (file)
@@ -69,5 +69,6 @@ struct uaestate
        UBYTE usemaprom;
        UBYTE debug;
        UBYTE testmode;
+       UBYTE nowait;
 };
 
index 503ce94484fc2567b0d37638f65cfe6480d377f9..cbb6d515ea8a38c62b1a04b098ee36b9312f3f5d 100644 (file)
@@ -2,7 +2,7 @@
 /* Real hardware UAE state file loader */
 /* Copyright 2019 Toni Wilen */
 
-#define VER "0.7"
+#define VER "1.0"
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -25,7 +25,7 @@
 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[] =
 {
@@ -843,7 +843,7 @@ static void find_extra_ram(struct uaestate *st)
        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
@@ -870,7 +870,7 @@ static ULONG check_ram(UBYTE *cname, UBYTE *chunk, WORD index, ULONG addr, ULONG
        }
        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;
        }
@@ -896,7 +896,7 @@ static ULONG check_ram(UBYTE *cname, UBYTE *chunk, WORD index, ULONG addr, ULONG
                }
                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;
 }
@@ -929,11 +929,13 @@ static void check_rom(UBYTE *p, struct uaestate *st)
        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);
@@ -1077,11 +1079,11 @@ static int parse_pass_1(FILE *f, struct uaestate *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);
                }
@@ -1230,20 +1232,21 @@ static void take_over(struct uaestate *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();
@@ -1266,9 +1269,10 @@ int main(int argc, char *argv[])
        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");
@@ -1294,6 +1298,8 @@ int main(int argc, char *argv[])
                        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"))
index f061cb88ce1019230d4cc7472cedb2e202acecb0..ecb59c6b19e03211728a5637932d753324d3c86e 100644 (file)
@@ -1,49 +1,66 @@
 
-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