some changes... whatever

This commit is contained in:
WickedJack99
2022-04-29 01:30:05 +02:00
parent 0145145fb9
commit 63316a5154
8 changed files with 46 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -145,7 +145,7 @@ public class MyControlModel implements ActionListener {
}
}
oPIC.getEeprom().setProgramLines(aiProgramLines);
abBreakpoints = new boolean[oPIC.getEeprom().getLengthEEPROM()];
abBreakpoints = new boolean[oPIC.getEeprom().getLengthProgramMemory()];
}
private void controlBreakpoints(ActionEvent e) {

View File

@@ -17,6 +17,18 @@ public class EEPROM {
oFile = new File("./eeprom.dat");
}
public void setElementXOfEepromToY(int iX, int iY) {
aiEeprom[iX] = iY;
}
public void setEeprom(int[] aiNewEeprom) {
aiEeprom = aiNewEeprom;
}
public int[] getEeprom() {
return aiEeprom;
}
public void changeEepromLocation(String sLocation) {
oFile = new File(sLocation + "eeprom.dat");
}

View File

@@ -13,21 +13,24 @@ public class PIC {
* Parts of PIC.
* Objects are written with a large starting letter.
*/
private PROGRAMMEMORY Eeprom;
private PROGRAMMEMORY ProgramMemory;
private RAM Ram;
private STACK Stack;
private int WRegister;
private RUNTIMER Runtimer;
private ALU ArithmeticLogicUnit;
private EEPROM Eeprom;
private int iStateMachineWriteEeprom = 0;
public PIC() {
//Initialising objects of PIC.
Eeprom = new PROGRAMMEMORY();
ProgramMemory = new PROGRAMMEMORY();
Ram = new RAM();
Stack = new STACK();
Runtimer = new RUNTIMER(Ram);
WRegister = 0;
ArithmeticLogicUnit = new ALU();
Eeprom = new EEPROM();
}
public synchronized void resetPIC() {
@@ -76,7 +79,7 @@ public class PIC {
}
public synchronized PROGRAMMEMORY getEeprom() {
return Eeprom;
return ProgramMemory;
}
public synchronized STACK getStack() {
@@ -352,6 +355,16 @@ public class PIC {
* Bit b in register f is set.
*/
public void BSF(int bitaddress, int registerFileAddress) {
//TODO have to check bitaddress and registerFileAddress too
if (iStateMachineWriteEeprom == 3) {
iStateMachineWriteEeprom = 4;
} else if (iStateMachineWriteEeprom == 4) {
if (Ram.get_WREN()) {
Eeprom.writeToFile();
}
} else {
iStateMachineWriteEeprom = 0;
}
//Get bitmask to OR with fileaddress to set bit.
int bitMask = bitMaskSetBitArray[bitaddress];
//Get Value of RAM-Bank-RP0Bit Address.
@@ -857,6 +870,12 @@ public class PIC {
* as 0s.
*/
public void MOVLW(int eightK) {
//TODO has to check eightK
if (iStateMachineWriteEeprom == 1) {
iStateMachineWriteEeprom = 2;
} else {
iStateMachineWriteEeprom = 0;
}
//is set to eightK bit literal.
setWRegister(eightK);
@@ -913,6 +932,15 @@ public class PIC {
* Move data from W register to file register
*/
public void MOVWF(int registerFileAddress) {
//TODO has to check registerFileAddress
if (iStateMachineWriteEeprom == 0) {
iStateMachineWriteEeprom = 1;
} else if (iStateMachineWriteEeprom == 2) {
iStateMachineWriteEeprom = 3;
} else {
iStateMachineWriteEeprom = 0;
}
//Data from is moved to fileregister.
Ram.set_Element_X_Of_Bank_Y_To_Z(registerFileAddress, Ram.get_RP0Bit(), get_WRegister(), false);
@@ -1158,7 +1186,7 @@ public class PIC {
public void SLEEP() {
//pause running (no Thread.sleep()!!!)
//Not implemented
//Increment programcounter and TMR0 if assigned to TMR0.
Ram.inkrement_Programcounter(1);
if (Ram.get_T0CS() == false) {

View File

@@ -77,7 +77,7 @@ public class PROGRAMMEMORY
/**
* Returns length of EEPROM
*/
public int getLengthEEPROM() {
public int getLengthProgramMemory() {
return eepromLength;
}