From: Toni Wilen Date: Thu, 9 May 2019 15:48:00 +0000 (+0300) Subject: Start CIA timers as late as possible, make sure blitter is finished when taking over... X-Git-Tag: 4300~212 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=f7d9bc4a636370f290f6179889313abc39b0f873;p=francis%2Fwinuae.git Start CIA timers as late as possible, make sure blitter is finished when taking over the system. Ignore BLTCON0L. --- diff --git a/utilities/stateload/asm.S b/utilities/stateload/asm.S index 8b72d42c..4b299371 100644 --- a/utilities/stateload/asm.S +++ b/utilities/stateload/asm.S @@ -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! diff --git a/utilities/stateload/main.c b/utilities/stateload/main.c index e66bce35..44fd6585 100644 --- a/utilities/stateload/main.c +++ b/utilities/stateload/main.c @@ -2,7 +2,7 @@ /* Real hardware UAE state file loader */ /* Copyright 2019 Toni Wilen */ -#define VER "0.4" +#define VER "0.5" #include #include @@ -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);