]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Support mismatched CPUs without crashing. (Loaded program probably still crashes..)
authorToni Wilen <twilen@winuae.net>
Wed, 8 May 2019 17:57:19 +0000 (20:57 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 8 May 2019 17:57:19 +0000 (20:57 +0300)
utilities/stateload/asm.S
utilities/stateload/main.c

index 8fd03e2ef8e0e67040cedb3b86006ce730530dfd..8b72d42c1efb6372bbac101c1d47b09462b59ad6 100644 (file)
@@ -31,6 +31,7 @@ _killsystem:
        move.l 8(sp),a0 | uaestate
        move.l a6,a1
        move.l 4,a6
+       move.w 0x128(a6),(a0) | AttFlags
        move.l sp,d1
        move.l a5,a0
        lea .super(pc),a5
@@ -94,12 +95,15 @@ _runit:
        bsr _set_custom_final
 
        | restore CPU state
+       move.w (a4),d1
        move.l CPU_CHUNK(a4),a0
        move.l 4+4+60+4+2+2+4(a0),SP
        move.l 4+4+60+4+2+2(a0),a1 | USP
        move.l a1,USP
        cmp.l #68020,(a0)
        bcs .cpu68010
+       btst #1,d1
+       beq .cpu68010
        lea 4+4+60+4+2+2+4+4+2+4+4+4+4(a0),a1
        move.l (a1)+,d0
        movec d0,CAAR
@@ -110,6 +114,8 @@ _runit:
 .cpu68010:
        cmp.l #68010,(a0)
        bcs .cpu68000
+       btst #0,d1
+       beq .cpu68000   
        lea 4+4+60+4+2+2+4+4+2+4(a0),a1
        move.l (a1)+,d0
        movec d0,DFC
@@ -117,8 +123,11 @@ _runit:
        movec d0,SFC
        move.l (a1)+,d0
        movec d0,VBR
-       move.w #0x0020,-(sp) | Format 0, Trap #0
 .cpu68000:
+       btst #0,d1
+       beq .nocpu68010
+       move.w #0x0020,-(sp) | Format 0, Trap #0
+.nocpu68010:
        move.l 4+4+60(a0),-(sp) | PC
        move.w 4+4+60+4+2+2+4+4(a0),-(sp) | SR
        movem.l 4+4(a0),d0-d7/a0-a6
index bc64e87765be02a6d02acca3af1c93b837a18849..e66bce35e4c7007b0cf1e2847384a7e6ae66b5a1 100644 (file)
@@ -785,7 +785,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, size >> 10);
+               printf("ERROR: Required address space %08x-%08x not found in this system.\n", addr, addr + size - 1);
                st->errors++;
                return 0;
        }