View Single Post
Old 12 February 2019, 15:51   #172
bloodline
Registered User
 
bloodline's Avatar
 
Join Date: Jan 2017
Location: London, UK
Posts: 433
I have done very quick rewrite based upon Toni's comments.

The operation is now 2 (even) cycle, and locks out forbidden registers, freezing operation if a write attempt is made. A call to copjmp1 resets the copperCycle variable to 0 (as well as the copperPC to cop1loc), thus restarting the copper.

The copper and blitplane DMA now work! -edit - As a bonus, both Kick1.2 and Kick1.3 now work... Kick 3 just seems to get stuck in a loop.

Time to try and get the floppy working again... It was this which prompted the rewrite.

Toni, you added a command line option to save out the Raw MFM image to one of the WinUAE beta's for me, would that option be possible as a GUI feature? Cheers.

Code:
int copperExecute(){    
    if((chipset.dmaconr & 0x280) != 0x280){
        return 0;
    }
    
    switch(internal.copperCycle){
        case 0:
            internal.IR2 = 0; // DEbug clear the IR2 reg
            internal.IR1 = internal.chipramW[internal.copperPC>>1];
            internal.IR1 = (internal.IR1 <<8) | (internal.IR1 >>8);
            internal.copperPC += 2;
            internal.copperCycle = 1;
            
            if( (internal.IR1 & 0x1) == 0x1){
                internal.copperCycle = 2;
            }
            return 1;
            break;
            
        case 1:
            internal.IR2 = internal.chipramW[internal.copperPC>>1];
            internal.copperPC += 2;
            
            internal.IR1 = (internal.IR1 >> 1) & 255;   //  divide by 2 and mask out bad bits... 
            
            if(internal.IR1<0x20){internal.copperCycle = 4;return 0;};         //pause copper until ned vbl
            if(internal.IR1<0x40){internal.copperCycle = 4;return 0;};         //as above, but will add in a COPCON test later
            
            //Move
            internal.IR2 = (internal.IR2 <<8) | (internal.IR2 >>8);
            putChipReg16[internal.IR1](internal.IR2);
            internal.copperCycle = 0;
            return 1;
            break;
            
        case 2:
            internal.IR2 = internal.chipramW[internal.copperPC>>1];
            internal.copperPC += 2;
            
            internal.IR2 = (internal.IR2 <<8) | (internal.IR2 >>8);
            
            internal.copperCycle = 3;
            
            //Skip
            if( (internal.IR2 & 1) == 1){
                
                if( chipset.vhposr >= internal.IR1){
                    internal.copperPC +=4;
                }
                internal.copperCycle = 0;
            }
            
            return 1;
            break;
            
        case 3:
            
            //Wait
            if( chipset.vhposr >= internal.IR1){
                internal.copperCycle = 0;
            }
            
            break;
        case 4:
            //Copper operation frozen until next VBL
            break;
    }
    
    return 0;
}

Last edited by bloodline; 13 February 2019 at 14:51.
bloodline is offline  
 
Page generated in 0.04765 seconds with 11 queries