📄 mcodecontrolunit.java
字号:
if ( logicSelect == 0 )
{
// currAddrP1Enabled = true;
nextAddrEnabled = true;
irMapEnabled = false;
}
else if ( logicSelect == 1 )
{
// currAddrP1Enabled = false;
nextAddrEnabled = false;
irMapEnabled = true;
}
else
{
nextAddrEnabled = false;
irMapEnabled = false;
}
}
public byte updateAddressMux()
{
/* if ( logicSelect == 0 )
{
// Current address + 1
addressMux = ( byte ) ( addressRegister + 1 );
}
*/
if ( logicSelect == 0 )
{
// Get address from microcode
int currentMC = microcode[ currentAddress ];
int currentNextAddress = currentMC & ADDR_MASK;
addressMux = ( byte ) currentNextAddress;
}
else if ( logicSelect == 1 )
{
// Get address from IR map
int currentMC = microcode[ currentAddress ];
int currentNextAddress = currentMC & ADDR_MASK;
addressMux = irMap;
}
return ( addressMux );
}
public byte updateAddressRegister()
{
return ( addressRegister = addressMux );
}
public byte updateCurrentAddress()
{
return ( currentAddress = addressRegister );
}
public void actionPerformed( ActionEvent evt )
{
Object eventSource = evt.getSource();
if ( eventSource == closeWindowMenuItem )
{
setVisible( false );
}
}
public int updateCurrentOperations()
{
int currentMC = microcode[ currentAddress ];
currentOperations = currentMC & OPER_MASK;
if ( ( currentOperations & ARPC_MASK ) == ARPC_MASK )
{
currentARPC = true;
}
else
{
currentARPC = false;
}
if ( ( currentOperations & ARDR_MASK ) == ARDR_MASK )
{
currentARDR = true;
}
else
{
currentARDR = false;
}
if ( ( currentOperations & ARPC_MASK ) == ARPC_MASK )
{
currentARPC = true;
}
else
{
currentARPC = false;
}
/* if ( ( currentOperations & ARIN_MASK ) == ARIN_MASK )
{
currentARIN = true;
}
else
{
currentARIN = false;
}
*/
/* if ( ( currentOperations & ARDT_MASK ) == ARDT_MASK )
{
currentARDT = true;
}
else
{
currentARDT = false;
}
*/
if ( ( currentOperations & PCIN_MASK ) == PCIN_MASK )
{
currentPCIN = true;
}
else
{
currentPCIN = false;
}
if ( ( currentOperations & PCDR_MASK ) == PCDR_MASK )
{
currentPCDR = true;
}
else
{
currentPCDR = false;
}
if ( ( currentOperations & DRM_MASK ) == DRM_MASK )
{
currentDRM = true;
}
else
{
currentDRM = false;
}
/* if ( ( currentOperations & DRAC_MASK ) == DRAC_MASK )
{
currentDRAC = true;
}
else
{
currentDRAC = false;
}
*/
if ( ( currentOperations & IRDR_MASK ) == IRDR_MASK )
{
currentIRDR = true;
}
else
{
currentIRDR = false;
}
/* if ( ( currentOperations & RAC_MASK ) == RAC_MASK )
{
currentRAC = true;
}
else
{
currentRAC = false;
}
*/
/* if ( ( currentOperations & ZALU_MASK ) == ZALU_MASK )
{
currentZALU = true;
}
else
{
currentZALU = false;
}
*/
/* if ( ( currentOperations & TRDR_MASK ) == TRDR_MASK )
{
currentTRDR = true;
}
else
{
currentTRDR = false;
}
*/
/* if ( ( currentOperations & ACDR_MASK ) == ACDR_MASK )
{
currentACDR = true;
}
else
{
currentACDR = false;
}
*/
/* if ( ( currentOperations & ACR_MASK ) == ACR_MASK )
{
currentACR = true;
}
else
{
currentACR = false;
}
*/
if ( ( currentOperations & PLUS_MASK ) == PLUS_MASK )
{
currentPLUS = true;
}
else
{
currentPLUS = false;
}
/* if ( ( currentOperations & MINU_MASK ) == MINU_MASK )
{
currentMINU = true;
}
else
{
currentMINU = false;
}
*/
if ( ( currentOperations & ACIN_MASK ) == ACIN_MASK )
{
currentACIN = true;
}
else
{
currentACIN = false;
}
/* if ( ( currentOperations & ACZO_MASK ) == ACZO_MASK )
{
currentACZO = true;
}
else
{
currentACZO = false;
}
*/
if ( ( currentOperations & AND_MASK ) == AND_MASK )
{
currentAND = true;
}
else
{
currentAND = false;
}
/* if ( ( currentOperations & OR_MASK ) == OR_MASK )
{
currentOR = true;
}
else
{
currentOR = false;
}
*/
/* if ( ( currentOperations & XOR_MASK ) == XOR_MASK )
{
currentXOR = true;
}
else
{
currentXOR = false;
}
*/
/* if ( ( currentOperations & NOT_MASK ) == NOT_MASK )
{
currentNOT = true;
}
else
{
currentNOT = false;
}
*/
/* if ( ( currentOperations & MDR_MASK ) == MDR_MASK )
{
currentMDR = true;
}
else
{
currentMDR = false;
}
*/
return ( currentOperations );
}
public void updateCurrentSignals()
{
cpu.setCurrentARLOAD( currentARPC | currentARDR );
// cpu.setCurrentARINC( currentARIN );
cpu.setCurrentPCLOAD( currentPCDR );
cpu.setCurrentPCINC( currentPCIN );
cpu.setCurrentPCBUS( currentARPC );
cpu.setCurrentDRBUS( currentARDR | currentIRDR | currentPCDR |
currentPLUS | currentAND ); // added
// cpu.setCurrentDRHBUS( currentARDT | currentPCDT );
// cpu.setCurrentDRLBUS( currentACDR | currentMDR );
cpu.setCurrentDRLOAD( currentDRM );
// cpu.setCurrentTRLOAD( currentTRDR );
// cpu.setCurrentTRBUS( currentARDT | currentPCDT );
cpu.setCurrentIRLOAD( currentIRDR );
// cpu.setCurrentRLOAD( currentRAC );
// cpu.setCurrentRBUS( currentACR | currentPLUS | currentMINU |
// currentAND | currentOR | currentXOR );
cpu.setCurrentACLOAD( currentPLUS | currentAND );
cpu.setCurrentACINC( currentACIN ); // added
// cpu.setCurrentACBUS( currentDRAC | currentRAC );
cpu.setCurrentALUS( currentAND ); // questionable
// cpu.setCurrentZLOAD( currentPLUS | currentMINU | currentACIN |
// currentACZO | currentAND | currentOR | currentXOR | currentNOT );
// cpu.setCurrentWRITE( currentMDR );
// cpu.setCurrentBUSMEM( currentMDR );
cpu.setCurrentREAD( currentDRM );
cpu.setCurrentMEMBUS( currentDRM );
}
public boolean executeAnimationCycle()
{
if ( ! animUpdCurrAddrDone )
{
animUpdCurrAddrDone = animUpdCurrAddr();
//System.out.println( "DEBUG ==> animUpdCurrAddrDone: " +
// animUpdCurrAddrDone );
}
if ( ! animUpdCurrOperDone )
{
animUpdCurrOperDone = animUpdCurrOper();
//System.out.println( "DEBUG ==> animUpdCurrOperDone: " +
// animUpdCurrOperDone );
}
/* if ( ! animUpdCurrLogSelBTDone )
{
animUpdCurrLogSelBTDone = animUpdCurrLogSelBT();
System.out.println( "DEBUG ==> animUpdCurrLogSelBTDone: " +
m animUpdCurrLogSelBTDone );
}
*/
if ( ! animUpdCurrLogSelCondDone )
{
animUpdCurrLogSelCondDone = animUpdCurrLogSelCond();
//System.out.println( "DEBUG ==> animUpdCurrLogSelCondDone: " +
// animUpdCurrLogSelCondDone );
}
if ( ! animUpdAddrMuxDone && animUpdCurrLogSelCondDone)
{
animUpdAddrMuxDone = animUpdAddrMux();
//System.out.println( "DEBUG ==> animUpdAddrMuxDone: " +
// animUpdAddrMuxDone );
// System.out.println( "DEBUG ==> Just did it" );
}
if ( animUpdCurrAddrDone && animUpdCurrOperDone
&& animUpdCurrLogSelCondDone && animUpdAddrMuxDone )
{
justUpdatedCurrentAddress = false;
animationIndex = 0;
animUpdCurrAddrDone = false;
animUpdCurrOperDone = false;
// animUpdCurrLogSelBTDone = false;
animUpdCurrLogSelCondDone = false;
animUpdAddrMuxDone = false;
// Anim sequence done
return ( true );
}
else
{
animationIndex++;
// Anim sequence not done
return ( false );
}
}
public boolean animUpdCurrAddr()
{
if ( animationIndex == 0 )
{
Point pt = new Point( 143, 145 ); //was 195,150
setDot( 0, true, pt );
}
else if ( animationIndex == 1 )
{
Point pt = new Point( 143, 180 );// was 195,185
setDot( 0, true, pt );
cpu.setCurrentCLK( true );
clkEnabled = true;
updateAddressRegister();
}
else if ( animationIndex == 2 )
{
Point pt = new Point( 143, 215 ); // was 195,220
setDot( 0, true, pt );
}
else if ( animationIndex == 3 )
{
Point pt = new Point( 143, 255 ); // was 195,260
setDot( 0, true, pt );
updateCurrentAddress();
justUpdatedCurrentAddress = true;
}
else if ( animationIndex == 4 )
{
setDot( 0, false, null );
// Animation sequence done
return ( true );
}
// Animation sequence not done
return ( false );
}
public boolean animUpdCurrOper()
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -