]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Start CIA timers as late as possible, make sure blitter is finished when taking over...
authorToni Wilen <twilen@winuae.net>
Thu, 9 May 2019 15:48:00 +0000 (18:48 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 9 May 2019 15:48:00 +0000 (18:48 +0300)
utilities/stateload/asm.S
utilities/stateload/main.c

index 8b72d42c1efb6372bbac101c1d47b09462b59ad6..4b299371495fe2aec99ea4cd3a890d63f862b12b 100644 (file)
@@ -75,16 +75,12 @@ _runit:
        and.w #511,d0
        cmp.w #258,d0
        bne .wait1
-.wait2:
-       move.l 4(a6),d0
-       lsr.l #8,d0
-       and.w #511,d0
-       bne .wait2
 
        move.w #0x1234,0xfc0004
 
        | restore possible side-effect causing
        | custom bits as late as possible
+
        move.l CIAA_CHUNK(a4),(sp)
        clr.l 4(sp)
        bsr _set_cia_final
@@ -128,10 +124,38 @@ _runit:
        beq .nocpu68010
        move.w #0x0020,-(sp) | Format 0, Trap #0
 .nocpu68010:
+
+       move.l CIAA_CHUNK(a4),a1
+       move.b 15(a1),d6
+       swap d6
+       move.b 14(a1),d6
+       move.l CIAB_CHUNK(a4),a1
+       move.b 15(a1),d7
+       swap d7
+       move.b 14(a1),d7
+
        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
-       
+       movem.l 4+4(a0),d0-d5
+       movem.l 4+4+8*4+4+4(a0),a2-a6
+
        move.w #0x1234,0xfc0000
+
+       lea 0xbfde00,a1
+
+       | wait line 0
+.wait2:
+       tst.b 0xdff005
+       bne .wait2
+
+       | start timers
+       move.b d6,0xbfee01-0xbfde00(a1)
+       swap d6
+       move.b d6,0xbfef01-0xbfde00(a1)
+       move.b d7,(a1)
+       swap d7
+       move.b d7,0x100(a1)
+       
+       movem.l 4+4+6*4(a0),d6-d7/a0-a1
        
        rte | GO! GO! GO!
index e66bce35e4c7007b0cf1e2847384a7e6ae66b5a1..44fd658519a28c15f00185fd6f2d8a298bc45f66 100644 (file)
@@ -2,7 +2,7 @@
 /* Real hardware UAE state file loader */
 /* Copyright 2019 Toni Wilen */
 
-#define VER "0.4"
+#define VER "0.5"
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -49,7 +49,7 @@ static const char *const unsupportedchunknames[] =
        "ZCRM", "PRAM",
        "A3K1", "A3K2",
        "BORO", "P96 ",
-       "FSYS",
+       "FSYC",
        NULL
 };
 
@@ -232,6 +232,7 @@ static void set_custom(UBYTE *p)
                        case 0x3c:
                        case 0x3e:
                        case 0x58:
+                       case 0x5a:
                        case 0x5e:
                        case 0x68:
                        case 0x6a:
@@ -306,6 +307,9 @@ static void set_cia(UBYTE *p, ULONG num)
        cia->ciaicr = 0x7f;
        c->intreq = 0x7fff;
        
+       p[14] &= ~CIACRAF_LOAD;
+       p[15] &= ~CIACRAF_LOAD;
+       
        UBYTE flags = p[16 + 1 + 2 * 2 + 3 + 3];
        
        cia->ciapra = p[0];
@@ -359,8 +363,6 @@ void set_cia_final(UBYTE *p, ULONG num)
 {
        volatile struct CIA *cia = (volatile struct CIA*)(num ? 0xbfd000 : 0xbfe001);
        UBYTE dummy = cia->ciaicr;
-       cia->ciacra = p[14] & ~CIACRAF_LOAD;
-       cia->ciacrb = p[15] & ~CIACRBF_LOAD;
        cia->ciaicr = p[16] | CIAICRF_SETCLR;   
 }
 
@@ -1163,6 +1165,9 @@ static void take_over(struct uaestate *st)
                WaitTOF();      
        }
        
+       OwnBlitter();
+       WaitBlit();
+       
        // No turning back!
        extern void *killsystem(UBYTE*, struct uaestate*, ULONG);
        killsystem(tempsp + TEMP_STACK_SIZE, tempst, (ULONG)processstate - (ULONG)module + (ULONG)newcode);