Changed codingstyle from c style to java style
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/hamcrest-core-1.3.jar
Normal file
BIN
lib/hamcrest-core-1.3.jar
Normal file
Binary file not shown.
BIN
lib/junit-4.13.2.jar
Normal file
BIN
lib/junit-4.13.2.jar
Normal file
Binary file not shown.
@@ -28,6 +28,7 @@ public class MyControlModel implements ActionListener {
|
||||
JCheckBox oWDTEnabled;
|
||||
JComboBox<String> oQuarzIntervals;
|
||||
ArrayList<JMenuItem> oMenuItems;
|
||||
ArrayList<JCheckBox> oPorts;
|
||||
|
||||
ConcurrentLinkedQueue<Integer> qCommandsForModel;
|
||||
ConcurrentLinkedQueue<MyModelData> qDataForModel;
|
||||
@@ -48,6 +49,7 @@ public class MyControlModel implements ActionListener {
|
||||
oBreakpoints = oMyView.getGUITestFileTable().getCheckboxes();
|
||||
oWDTEnabled = oMyView.getGUITime().getWDTEnableCheckbox();
|
||||
oQuarzIntervals = oMyView.getGUITime().getQuarzComboBox();
|
||||
oPorts = oMyView.getGUIPorts().getPorts();
|
||||
oMenuItems = oMyView.getGUIMenuBar().getMenuItems();
|
||||
addActionListeners();
|
||||
}
|
||||
@@ -200,6 +202,7 @@ public class MyControlModel implements ActionListener {
|
||||
qDataForModel.add(oMyModelData);
|
||||
}
|
||||
|
||||
//Menuitems
|
||||
int i = 0;
|
||||
for (JMenuItem oMenuItem : oMenuItems) {
|
||||
if (e.getSource() == oMenuItem) {
|
||||
@@ -277,8 +280,128 @@ public class MyControlModel implements ActionListener {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
//Ports checked/unchecked?
|
||||
i = 0;
|
||||
for (JCheckBox oPort : oPorts) {
|
||||
if (e.getSource() == oPort) {
|
||||
switch (i) {
|
||||
case 0: {
|
||||
//RA0
|
||||
oPIC.getRam().set_RA0(oPort.isSelected());
|
||||
}break;
|
||||
case 1: {
|
||||
//RA1
|
||||
oPIC.getRam().set_RA1(oPort.isSelected());
|
||||
}break;
|
||||
case 2: {
|
||||
//RA2
|
||||
oPIC.getRam().set_RA2(oPort.isSelected());
|
||||
}break;
|
||||
case 3: {
|
||||
//RA3
|
||||
oPIC.getRam().set_RA3(oPort.isSelected());
|
||||
}break;
|
||||
case 4: {
|
||||
//RA4
|
||||
oPIC.getRam().set_RA4_T0CKI(oPort.isSelected());
|
||||
}break;
|
||||
case 5: {
|
||||
//TRISA0
|
||||
oPIC.getRam().set_TRISA0(oPort.isSelected());
|
||||
}break;
|
||||
case 6: {
|
||||
//TRISA1
|
||||
oPIC.getRam().set_TRISA1(oPort.isSelected());
|
||||
}break;
|
||||
case 7: {
|
||||
//TRISA2
|
||||
oPIC.getRam().set_TRISA2(oPort.isSelected());
|
||||
}break;
|
||||
case 8: {
|
||||
//TRISA3
|
||||
oPIC.getRam().set_TRISA3(oPort.isSelected());
|
||||
}break;
|
||||
case 9: {
|
||||
//TRISA4
|
||||
oPIC.getRam().set_TRISA4(oPort.isSelected());
|
||||
}break;
|
||||
case 10: {
|
||||
//RB0
|
||||
oPIC.getRam().set_RB0_INT(oPort.isSelected());
|
||||
}break;
|
||||
case 11: {
|
||||
//RB1
|
||||
oPIC.getRam().set_RB1(oPort.isSelected());
|
||||
}break;
|
||||
case 12: {
|
||||
//RB2
|
||||
oPIC.getRam().set_RB2(oPort.isSelected());
|
||||
}break;
|
||||
case 13: {
|
||||
//RB3
|
||||
oPIC.getRam().set_RB3(oPort.isSelected());
|
||||
}break;
|
||||
case 14: {
|
||||
//RB4
|
||||
oPIC.getRam().set_RB4(oPort.isSelected());
|
||||
}break;
|
||||
case 15: {
|
||||
//RB5
|
||||
oPIC.getRam().set_RB5(oPort.isSelected());
|
||||
}break;
|
||||
case 16: {
|
||||
//RB6
|
||||
oPIC.getRam().set_RB6(oPort.isSelected());
|
||||
}break;
|
||||
case 17: {
|
||||
//RB7
|
||||
oPIC.getRam().set_RB7(oPort.isSelected());
|
||||
}break;
|
||||
case 18: {
|
||||
//TRISB0
|
||||
oPIC.getRam().set_TRISB0(oPort.isSelected());
|
||||
}break;
|
||||
case 19: {
|
||||
//TRISB1
|
||||
oPIC.getRam().set_TRISB1(oPort.isSelected());
|
||||
}break;
|
||||
case 20: {
|
||||
//TRISB2
|
||||
oPIC.getRam().set_TRISB2(oPort.isSelected());
|
||||
}break;
|
||||
case 21: {
|
||||
//TRISB3
|
||||
oPIC.getRam().set_TRISB3(oPort.isSelected());
|
||||
}break;
|
||||
case 22: {
|
||||
//TRISB4
|
||||
oPIC.getRam().set_TRISB4(oPort.isSelected());
|
||||
}break;
|
||||
case 23: {
|
||||
//TRISB5
|
||||
oPIC.getRam().set_TRISB5(oPort.isSelected());
|
||||
}break;
|
||||
case 24: {
|
||||
//TRISB6
|
||||
oPIC.getRam().set_TRISB6(oPort.isSelected());
|
||||
}break;
|
||||
case 25: {
|
||||
//TRISB7
|
||||
oPIC.getRam().set_TRISB7(oPort.isSelected());
|
||||
}break;
|
||||
}
|
||||
//Send changes to model
|
||||
oMyModelData.setPIC(oPIC);
|
||||
qDataForModel.add(oMyModelData);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds action listeners to all elements of view which are referrenced.
|
||||
*/
|
||||
private void addActionListeners() {
|
||||
if (oBreakpoints != null) {
|
||||
for (JCheckBox oBreakpoint : oBreakpoints) {
|
||||
@@ -301,6 +424,10 @@ public class MyControlModel implements ActionListener {
|
||||
oMenuItem.addActionListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (oPorts != null) {
|
||||
for (JCheckBox oCheckbox : oPorts) {
|
||||
oCheckbox.addActionListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package Model.InterruptHandling;
|
||||
|
||||
public class InterruptServiceHandler extends Thread {
|
||||
import Model.Microcontroller.PIC;
|
||||
|
||||
public InterruptServiceHandler() {}
|
||||
public class InterruptServiceHandler {
|
||||
|
||||
public void run() {
|
||||
private PIC oPIC;
|
||||
|
||||
public InterruptServiceHandler(PIC oPIC) {
|
||||
this.oPIC = oPIC;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -155,20 +155,17 @@ public class PIC {
|
||||
* AND’ed with the eight bit literal 'k'. The
|
||||
* result is placed in the W register.
|
||||
*/
|
||||
public void ANDLW(int eightK)
|
||||
{
|
||||
public void ANDLW(int eightK) {
|
||||
int wRegValue = get_WRegister();
|
||||
int result = wRegValue & eightK;
|
||||
|
||||
//If result is zero.
|
||||
if (result == 0)
|
||||
{
|
||||
if (result == 0) {
|
||||
Ram.set_Zeroflag(true);
|
||||
}
|
||||
|
||||
//If result is not zero.
|
||||
else
|
||||
{
|
||||
else {
|
||||
Ram.set_Zeroflag(false);
|
||||
}
|
||||
|
||||
@@ -177,8 +174,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -194,8 +192,7 @@ public class PIC {
|
||||
* stored in the W register. If ’d’ is 1 the result is
|
||||
* stored back in register ’f’.
|
||||
*/
|
||||
public void ADDWF(int destinationBit, int registerFileAddress)
|
||||
{
|
||||
public void ADDWF(int destinationBit, int registerFileAddress) {
|
||||
//Get Value of
|
||||
int wRegValue = get_WRegister();
|
||||
//Get Value of RAM-Bank-RP0Bit Address.
|
||||
@@ -205,33 +202,28 @@ public class PIC {
|
||||
int result = wRegValue + regFileAddrValue;
|
||||
|
||||
//If result is zero.
|
||||
if (result == 0)
|
||||
{
|
||||
if (result == 0) {
|
||||
Ram.set_Zeroflag(true);
|
||||
}
|
||||
|
||||
//If result is not zero.
|
||||
else
|
||||
{
|
||||
else {
|
||||
Ram.set_Zeroflag(false);
|
||||
}
|
||||
|
||||
//If result is greater than 255.
|
||||
if (result > 255)
|
||||
{
|
||||
if (result > 255) {
|
||||
result &= 255;
|
||||
Ram.set_Carryflag(true);
|
||||
}
|
||||
|
||||
//If result is smaller than 0.
|
||||
else if (result < 0)
|
||||
{
|
||||
else if (result < 0) {
|
||||
result &= 255;
|
||||
Ram.set_Carryflag(true);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
Ram.set_Carryflag(false);
|
||||
}
|
||||
|
||||
@@ -239,33 +231,30 @@ public class PIC {
|
||||
int dcResult = (wRegValue & 15) + (regFileAddrValue & 15);
|
||||
|
||||
//If the result is greater than 15, DC-Flag is set true.
|
||||
if (dcResult > 15)
|
||||
{
|
||||
if (dcResult > 15) {
|
||||
Ram.set_Digitcarryflag(true);
|
||||
}
|
||||
|
||||
//If the result is smaller or equal to 15, DC-Flag is set false.
|
||||
else
|
||||
{
|
||||
else {
|
||||
Ram.set_Digitcarryflag(false);
|
||||
}
|
||||
|
||||
//If the destinationbit is 0, the result is written into the
|
||||
if (destinationBit == 0)
|
||||
{
|
||||
if (destinationBit == 0) {
|
||||
setWRegister(result);
|
||||
}
|
||||
|
||||
//If the destinationbit is 1, the result is written into the RAM.
|
||||
else
|
||||
{
|
||||
else {
|
||||
Ram.set_Element_X_Of_Bank_Y_To_Z(registerFileAddress, Ram.get_RP0Bit(), result);
|
||||
}
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -281,8 +270,7 @@ public class PIC {
|
||||
* ter. If 'd' is 1 the result is stored back in
|
||||
* register 'f'.
|
||||
*/
|
||||
public void ANDWF(int destinationBit, int registerFileAddress)
|
||||
{
|
||||
public void ANDWF(int destinationBit, int registerFileAddress) {
|
||||
//Get Value of
|
||||
int wRegValue = get_WRegister();
|
||||
//Get Value of RAM-Bank-RP0Bit Address.
|
||||
@@ -292,33 +280,30 @@ public class PIC {
|
||||
int result = wRegValue & regFileAddrValue;
|
||||
|
||||
//If result is zero.
|
||||
if (result == 0)
|
||||
{
|
||||
if (result == 0) {
|
||||
Ram.set_Zeroflag(true);
|
||||
}
|
||||
|
||||
//If result is not zero.
|
||||
else
|
||||
{
|
||||
else {
|
||||
Ram.set_Zeroflag(false);
|
||||
}
|
||||
|
||||
//If the destinationbit is 0, the result is written into the
|
||||
if (destinationBit == 0)
|
||||
{
|
||||
if (destinationBit == 0) {
|
||||
setWRegister(result);
|
||||
}
|
||||
|
||||
//If the destinationbit is 1, the result is written into the RAM.
|
||||
else
|
||||
{
|
||||
else {
|
||||
Ram.set_Element_X_Of_Bank_Y_To_Z(registerFileAddress, Ram.get_RP0Bit(), result);
|
||||
}
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -331,8 +316,7 @@ public class PIC {
|
||||
*
|
||||
* Bit ’b’ in register ’f’ is cleared .
|
||||
*/
|
||||
public void BCF(int bitaddress, int registerFileAddress)
|
||||
{
|
||||
public void BCF(int bitaddress, int registerFileAddress) {
|
||||
//Get bitmask to clear bit in fileaddress.
|
||||
int bitMask = bitMaskClearBitArray[bitaddress];
|
||||
//Get Value of RAM-Bank-RP0Bit Address.
|
||||
@@ -347,8 +331,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -366,29 +351,28 @@ public class PIC {
|
||||
* executed instead, making this a 2TCY
|
||||
* instruction.
|
||||
*/
|
||||
public void BTFSC(int bitaddress, int registerFileAddress)
|
||||
{
|
||||
public void BTFSC(int bitaddress, int registerFileAddress) {
|
||||
//Get bitmask to AND with fileaddress to get bit.
|
||||
int bitMask = bitMaskSetBitArray[bitaddress];
|
||||
//Get Value of RAM-Bank-RP0Bit Address.
|
||||
int regFileAddrValue = Ram.get_Value_Of_Bank_RP0_Bit_Of_Element_At_Adress(Ram.get_RP0Bit(), registerFileAddress);
|
||||
|
||||
//If bit at bitaddress is 1, next instruction is executed.
|
||||
if ((bitMask & regFileAddrValue) == bitMask)
|
||||
{
|
||||
if ((bitMask & regFileAddrValue) == bitMask) {
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
}
|
||||
|
||||
//If bit at bitaddress is 0, next instruction will be replaced by a NOP.
|
||||
else
|
||||
{
|
||||
else {
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
//Execute NOP.
|
||||
NOP();
|
||||
}
|
||||
@@ -418,8 +402,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -446,16 +431,18 @@ public class PIC {
|
||||
if ((bitMask & regFileAddrValue) != bitMask) {
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
}
|
||||
|
||||
//If bit at bitaddress is 1, next instruction will be replaced by a NOP.
|
||||
else {
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
//Execute NOP.
|
||||
NOP();
|
||||
}
|
||||
@@ -484,8 +471,9 @@ public class PIC {
|
||||
Ram.set_Programcounter(elevenK + ((Ram.get_PCLATH() & 0b11000) << 8));
|
||||
|
||||
//Increment TMR0 if internal instruction cycle assigned to TMR0.
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b11111111);
|
||||
@@ -506,8 +494,9 @@ public class PIC {
|
||||
Ram.set_Zeroflag(true);
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -528,8 +517,9 @@ public class PIC {
|
||||
Ram.set_Zeroflag(true);
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -555,8 +545,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -603,8 +594,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -644,16 +636,18 @@ public class PIC {
|
||||
if (regFileAddrValue != 0) {
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
}
|
||||
|
||||
//If the dekremented value equals zero, a NOP is executed and the other instruction will be dismissed.
|
||||
else {
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
NOP();
|
||||
}
|
||||
|
||||
@@ -703,8 +697,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -727,8 +722,9 @@ public class PIC {
|
||||
Ram.set_Programcounter(elevenK + ((Ram.get_PCLATH() & 0b11000) << 8));
|
||||
|
||||
//Increment TMR0 if internal instruction cycle assigned to TMR0.
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -777,8 +773,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -831,8 +828,9 @@ public class PIC {
|
||||
else {
|
||||
///Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Call NOP.
|
||||
NOP();
|
||||
@@ -870,8 +868,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -913,8 +912,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -935,8 +935,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -975,8 +976,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -995,8 +997,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b11111111);
|
||||
@@ -1013,8 +1016,9 @@ public class PIC {
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b11111111);
|
||||
@@ -1042,8 +1046,9 @@ public class PIC {
|
||||
//Write returnAddress into programcounter.
|
||||
Ram.set_Programcounter(returnAddress);
|
||||
//Increment TMR0 if assigned to TMR0.
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1059,8 +1064,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1088,8 +1094,9 @@ public class PIC {
|
||||
//Write returnAddress into programcounter.
|
||||
Ram.set_Programcounter(returnAddress);
|
||||
//Increment TMR0 if assigned to TMR0.
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1112,8 +1119,9 @@ public class PIC {
|
||||
//Write returnAddress into programcounter.
|
||||
Ram.set_Programcounter(returnAddress);
|
||||
//Increment TMR0 if assigned to TMR0.
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1170,8 +1178,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1227,8 +1236,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1252,8 +1262,9 @@ public class PIC {
|
||||
//Not implemented
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1310,8 +1321,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1349,8 +1361,7 @@ public class PIC {
|
||||
int dcResult = (regFileAddrValue & 15) + (wRegValue & 15) + 1;
|
||||
|
||||
//If the result is greater than 15, DC-Flag is set true.
|
||||
if (dcResult > 15)
|
||||
{
|
||||
if (dcResult > 15) {
|
||||
Ram.set_Digitcarryflag(true);
|
||||
}
|
||||
|
||||
@@ -1387,8 +1398,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1426,8 +1438,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1453,8 +1466,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1486,8 +1500,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
@@ -1531,8 +1546,9 @@ public class PIC {
|
||||
|
||||
//Increment programcounter and TMR0 if assigned to TMR0.
|
||||
Ram.inkrement_Programcounter(1, 0); //Kind of call
|
||||
if (Ram.get_T0CS() == false)
|
||||
if (Ram.get_T0CS() == false) {
|
||||
Ram.increment_TMR0();
|
||||
}
|
||||
|
||||
//Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM.
|
||||
Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111);
|
||||
|
||||
@@ -241,41 +241,24 @@ public class RAM {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns value of TMR0.
|
||||
*/
|
||||
public synchronized int get_TMR0() {
|
||||
return bank0[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets PCL to value.
|
||||
* @param value PCL is set to.
|
||||
*/
|
||||
public synchronized void set_PCL(int value) {
|
||||
bank0[2] = value;
|
||||
bank1[2] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns value of PCL
|
||||
*/
|
||||
public synchronized int get_PCL() {
|
||||
return bank0[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets STATUS-register to value.
|
||||
* @param value STATUS-register is set to.
|
||||
*/
|
||||
public synchronized void set_STATUS(int value) {
|
||||
bank0[3] = value;
|
||||
bank1[3] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns STATUS-register.
|
||||
*/
|
||||
public synchronized int get_STATUS() {
|
||||
return bank0[3];
|
||||
}
|
||||
@@ -513,7 +496,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b11111110;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -528,7 +510,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b11111101;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -543,7 +524,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b11111011;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -558,7 +538,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b11110111;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -573,7 +552,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b11101111;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -588,7 +566,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b11011111;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -603,7 +580,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b10111111;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -618,7 +594,6 @@ public class RAM {
|
||||
} else {
|
||||
status &= 0b01111111;
|
||||
}
|
||||
|
||||
set_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -677,7 +652,6 @@ public class RAM {
|
||||
} else {
|
||||
portA &= 0b11111110;
|
||||
}
|
||||
|
||||
set_PORTA(portA);
|
||||
}
|
||||
|
||||
@@ -700,7 +674,6 @@ public class RAM {
|
||||
} else {
|
||||
portA &= 0b11111101;
|
||||
}
|
||||
|
||||
set_PORTA(portA);
|
||||
}
|
||||
|
||||
@@ -723,7 +696,6 @@ public class RAM {
|
||||
} else {
|
||||
portA &= 0b11111011;
|
||||
}
|
||||
|
||||
set_PORTA(portA);
|
||||
}
|
||||
|
||||
@@ -746,292 +718,182 @@ public class RAM {
|
||||
} else {
|
||||
portA &= 0b11110111;
|
||||
}
|
||||
|
||||
set_PORTA(portA);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RA3()
|
||||
{
|
||||
{
|
||||
return (get_PORTA() & 0b00001000) == 8;
|
||||
}
|
||||
public synchronized boolean get_RA3() {
|
||||
return (get_PORTA() & 0b00001000) == 8;
|
||||
}
|
||||
|
||||
//External Clockimpulse for Timer0
|
||||
public synchronized void set_RA4_T0CKI(boolean value)
|
||||
{
|
||||
public synchronized void set_RA4_T0CKI(boolean value) {
|
||||
int portA = get_PORTA();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portA |= 0b00010000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portA &= 0b11101111;
|
||||
}
|
||||
|
||||
set_PORTA(portA);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RA4_T0CKI()
|
||||
{
|
||||
{
|
||||
return (get_PORTA() & 0b00010000) == 16;
|
||||
}
|
||||
public synchronized boolean get_RA4_T0CKI() {
|
||||
return (get_PORTA() & 0b00010000) == 16;
|
||||
}
|
||||
|
||||
//Bank0 PortB
|
||||
public synchronized void set_RB0_INT(boolean value)
|
||||
{
|
||||
public synchronized void set_RB0_INT(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b00000001;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b11111110;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB0_INT()
|
||||
{
|
||||
{
|
||||
return (get_PORTB() & 0b00000001) == 1;
|
||||
}
|
||||
public synchronized boolean get_RB0_INT() {
|
||||
return (get_PORTB() & 0b00000001) == 1;
|
||||
}
|
||||
|
||||
public synchronized void set_RB1(boolean value)
|
||||
{
|
||||
public synchronized void set_RB1(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b00000010;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b11111101;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB1()
|
||||
{
|
||||
{
|
||||
return (get_PORTB() & 0b00000010) == 2;
|
||||
}
|
||||
public synchronized boolean get_RB1() {
|
||||
return (get_PORTB() & 0b00000010) == 2;
|
||||
}
|
||||
|
||||
public synchronized void set_RB2(boolean value)
|
||||
{
|
||||
public synchronized void set_RB2(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b00000100;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b11111011;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB2()
|
||||
{
|
||||
public synchronized boolean get_RB2() {
|
||||
return (get_PORTB() & 0b00000100) == 4;
|
||||
}
|
||||
|
||||
public synchronized void set_RB3(boolean value)
|
||||
{
|
||||
public synchronized void set_RB3(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b00001000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b11110111;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB3()
|
||||
{
|
||||
{
|
||||
return (get_PORTB() & 0b00001000) == 8;
|
||||
}
|
||||
public synchronized boolean get_RB3() {
|
||||
return (get_PORTB() & 0b00001000) == 8;
|
||||
}
|
||||
|
||||
public synchronized void set_RB4(boolean value)
|
||||
{
|
||||
public synchronized void set_RB4(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b00010000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b11101111;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB4()
|
||||
{
|
||||
{
|
||||
return (get_PORTB() & 0b00010000) == 16;
|
||||
}
|
||||
public synchronized boolean get_RB4() {
|
||||
return (get_PORTB() & 0b00010000) == 16;
|
||||
}
|
||||
|
||||
public synchronized void set_RB5(boolean value)
|
||||
{
|
||||
public synchronized void set_RB5(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b00100000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b11011111;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB5()
|
||||
{
|
||||
{
|
||||
return (get_PORTB() & 0b00100000) == 32;
|
||||
}
|
||||
public synchronized boolean get_RB5() {
|
||||
return (get_PORTB() & 0b00100000) == 32;
|
||||
}
|
||||
|
||||
public synchronized void set_RB6(boolean value)
|
||||
{
|
||||
public synchronized void set_RB6(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b01000000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b10111111;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB6()
|
||||
{
|
||||
{
|
||||
return (get_PORTB() & 0b01000000) == 64;
|
||||
}
|
||||
public synchronized boolean get_RB6() {
|
||||
return (get_PORTB() & 0b01000000) == 64;
|
||||
}
|
||||
|
||||
public synchronized void set_RB7(boolean value)
|
||||
{
|
||||
public synchronized void set_RB7(boolean value) {
|
||||
int portB = get_PORTB();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
portB |= 0b10000000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
portB &= 0b01111111;
|
||||
}
|
||||
|
||||
set_PORTB(portB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RB7()
|
||||
{
|
||||
{
|
||||
return (get_PORTB() & 0b10000000) == 128;
|
||||
}
|
||||
public synchronized boolean get_RB7() {
|
||||
return (get_PORTB() & 0b10000000) == 128;
|
||||
}
|
||||
|
||||
//Bank0 INTCON
|
||||
public synchronized void set_RBIF(boolean value)
|
||||
{
|
||||
public synchronized void set_RBIF(boolean value) {
|
||||
int intcon = get_INTCON();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
intcon |= 0b00000001;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
intcon &= 0b11111110;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RBIF()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b00000001) == 1;
|
||||
}
|
||||
public synchronized boolean get_RBIF() {
|
||||
return (get_INTCON() & 0b00000001) == 1;
|
||||
}
|
||||
|
||||
public synchronized void set_INTF(boolean value)
|
||||
{
|
||||
public synchronized void set_INTF(boolean value) {
|
||||
int intcon = get_INTCON();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
intcon |= 0b00000010;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
intcon &= 0b11111101;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_INTF()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b00000010) == 2;
|
||||
}
|
||||
public synchronized boolean get_INTF() {
|
||||
return (get_INTCON() & 0b00000010) == 2;
|
||||
}
|
||||
|
||||
public synchronized void set_T0IF(boolean value)
|
||||
{
|
||||
public synchronized void set_T0IF(boolean value) {
|
||||
int intcon = get_INTCON();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
intcon |= 0b00000100;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
intcon &= 0b11111011;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_T0IF()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b00000100) == 4;
|
||||
}
|
||||
public synchronized boolean get_T0IF() {
|
||||
return (get_INTCON() & 0b00000100) == 4;
|
||||
}
|
||||
|
||||
public synchronized void set_RBIE(boolean value) {
|
||||
@@ -1041,177 +903,110 @@ public class RAM {
|
||||
} else {
|
||||
intcon &= 0b11110111;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RBIE()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b00001000) == 8;
|
||||
}
|
||||
public synchronized boolean get_RBIE() {
|
||||
return (get_INTCON() & 0b00001000) == 8;
|
||||
}
|
||||
|
||||
public synchronized void set_INTE(boolean value)
|
||||
{
|
||||
public synchronized void set_INTE(boolean value) {
|
||||
int intcon = get_INTCON();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
intcon |= 0b00010000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
intcon &= 0b11101111;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_INTE()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b00010000) == 16;
|
||||
}
|
||||
public synchronized boolean get_INTE() {
|
||||
return (get_INTCON() & 0b00010000) == 16;
|
||||
}
|
||||
|
||||
public synchronized void set_T0IE(boolean value)
|
||||
{
|
||||
public synchronized void set_T0IE(boolean value) {
|
||||
int intcon = get_INTCON();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
intcon |= 0b00100000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
intcon &= 0b11011111;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_T0IE()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b00100000) == 32;
|
||||
}
|
||||
public synchronized boolean get_T0IE() {
|
||||
return (get_INTCON() & 0b00100000) == 32;
|
||||
}
|
||||
|
||||
public synchronized void set_EEIE(boolean value)
|
||||
{
|
||||
public synchronized void set_EEIE(boolean value) {
|
||||
int intcon = get_INTCON();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
intcon |= 0b01000000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
intcon &= 0b10111111;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_EEIE()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b01000000) == 64;
|
||||
}
|
||||
public synchronized boolean get_EEIE() {
|
||||
return (get_INTCON() & 0b01000000) == 64;
|
||||
}
|
||||
|
||||
public synchronized void set_GIE(boolean value)
|
||||
{
|
||||
public synchronized void set_GIE(boolean value) {
|
||||
int intcon = get_INTCON();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
intcon |= 0b10000000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
intcon &= 0b01111111;
|
||||
}
|
||||
|
||||
set_INTCON(intcon);
|
||||
}
|
||||
|
||||
public synchronized boolean get_GIE()
|
||||
{
|
||||
{
|
||||
return (get_INTCON() & 0b10000000) == 128;
|
||||
}
|
||||
public synchronized boolean get_GIE() {
|
||||
return (get_INTCON() & 0b10000000) == 128;
|
||||
}
|
||||
|
||||
//Bank1 OPTION_REG
|
||||
public synchronized void set_PS0(boolean value)
|
||||
{
|
||||
public synchronized void set_PS0(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b00000001;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b11111110;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
public synchronized boolean get_PS0()
|
||||
{
|
||||
{
|
||||
return (get_OPTION() & 0b00000001) == 1;
|
||||
}
|
||||
public synchronized boolean get_PS0() {
|
||||
return (get_OPTION() & 0b00000001) == 1;
|
||||
}
|
||||
|
||||
public synchronized void set_PS1(boolean value)
|
||||
{
|
||||
public synchronized void set_PS1(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b00000010;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b11111101;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
public synchronized boolean get_PS1()
|
||||
{
|
||||
{
|
||||
return (get_OPTION() & 0b00000010) == 2;
|
||||
}
|
||||
public synchronized boolean get_PS1() {
|
||||
return (get_OPTION() & 0b00000010) == 2;
|
||||
}
|
||||
|
||||
public synchronized void set_PS2(boolean value)
|
||||
{
|
||||
public synchronized void set_PS2(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b00000100;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b11111011;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
public synchronized boolean get_PS2()
|
||||
{
|
||||
{
|
||||
return (get_OPTION() & 0b00000100) == 4;
|
||||
}
|
||||
public synchronized boolean get_PS2() {
|
||||
return (get_OPTION() & 0b00000100) == 4;
|
||||
}
|
||||
|
||||
public synchronized int get_TMR0_PrescalerRate() {
|
||||
@@ -1249,115 +1044,73 @@ public class RAM {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public synchronized int get_WDT_PrescalerRate()
|
||||
{
|
||||
public synchronized int get_WDT_PrescalerRate() {
|
||||
int returnValue = 0;
|
||||
|
||||
switch (get_OPTION() & 0b00000111)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
switch (get_OPTION() & 0b00000111) {
|
||||
case 0: {
|
||||
returnValue = 1;
|
||||
}break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
case 1: {
|
||||
returnValue = 2;
|
||||
}break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
case 2: {
|
||||
returnValue = 4;
|
||||
}break;
|
||||
|
||||
case 3:
|
||||
{
|
||||
case 3: {
|
||||
returnValue = 8;
|
||||
}break;
|
||||
|
||||
case 4:
|
||||
{
|
||||
case 4: {
|
||||
returnValue = 16;
|
||||
}break;
|
||||
|
||||
case 5:
|
||||
{
|
||||
case 5: {
|
||||
returnValue = 32;
|
||||
}break;
|
||||
|
||||
case 6:
|
||||
{
|
||||
case 6: {
|
||||
returnValue = 64;
|
||||
}break;
|
||||
|
||||
case 7:
|
||||
{
|
||||
case 7: {
|
||||
returnValue = 128;
|
||||
}break;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public synchronized void set_PSA(boolean value)
|
||||
{
|
||||
public synchronized void set_PSA(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b00001000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b11110111;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
public synchronized boolean get_PSA()
|
||||
{
|
||||
{
|
||||
return (get_OPTION() & 0b00001000) == 8;
|
||||
}
|
||||
public synchronized boolean get_PSA() {
|
||||
return (get_OPTION() & 0b00001000) == 8;
|
||||
}
|
||||
|
||||
public synchronized void set_T0SE(boolean value)
|
||||
{
|
||||
public synchronized void set_T0SE(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b00010000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b11101111;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
public synchronized boolean get_T0SE()
|
||||
{
|
||||
{
|
||||
return (get_OPTION() & 0b00010000) == 16;
|
||||
}
|
||||
public synchronized boolean get_T0SE() {
|
||||
return (get_OPTION() & 0b00010000) == 16;
|
||||
}
|
||||
|
||||
public synchronized void set_T0CS(boolean value)
|
||||
{
|
||||
public synchronized void set_T0CS(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b00100000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b11011111;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
@@ -1365,50 +1118,32 @@ public class RAM {
|
||||
return (get_OPTION() & 0b00100000) == 32;
|
||||
}
|
||||
|
||||
public synchronized void set_INTEDG(boolean value)
|
||||
{
|
||||
public synchronized void set_INTEDG(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b01000000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b10111111;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
public synchronized boolean get_INTEDG()
|
||||
{
|
||||
{
|
||||
return (get_OPTION() & 0b01000000) == 64;
|
||||
}
|
||||
public synchronized boolean get_INTEDG() {
|
||||
return (get_OPTION() & 0b01000000) == 64;
|
||||
}
|
||||
|
||||
public synchronized void set_RBPU(boolean value)
|
||||
{
|
||||
public synchronized void set_RBPU(boolean value) {
|
||||
int option = get_OPTION();
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
option |= 0b10000000;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
option &= 0b01111111;
|
||||
}
|
||||
|
||||
set_OPTION(option);
|
||||
}
|
||||
|
||||
public synchronized boolean get_RBPU()
|
||||
{
|
||||
{
|
||||
return (get_OPTION() & 0b10000000) == 128;
|
||||
}
|
||||
public synchronized boolean get_RBPU() {
|
||||
return (get_OPTION() & 0b10000000) == 128;
|
||||
}
|
||||
|
||||
//Bank1 EECON1
|
||||
@@ -1553,34 +1288,114 @@ public class RAM {
|
||||
return (get_TRISA() & 0b00010000) == 16;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB0(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b00000001;
|
||||
} else {
|
||||
trisB &= 0b11111110;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB0() {
|
||||
return (get_TRISB() & 0b00000001) == 1;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB1(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b00000010;
|
||||
} else {
|
||||
trisB &= 0b11111101;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB1() {
|
||||
return (get_TRISB() & 0b00000010) == 2;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB2(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b00000100;
|
||||
} else {
|
||||
trisB &= 0b11111011;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB2() {
|
||||
return (get_TRISB() & 0b00000100) == 4;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB3(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b00001000;
|
||||
} else {
|
||||
trisB &= 0b11110111;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB3() {
|
||||
return (get_TRISB() & 0b00001000) == 8;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB4(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b00010000;
|
||||
} else {
|
||||
trisB &= 0b11101111;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB4() {
|
||||
return (get_TRISB() & 0b00010000) == 16;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB5(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b00100000;
|
||||
} else {
|
||||
trisB &= 0b11011111;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB5() {
|
||||
return (get_TRISB() & 0b00100000) == 32;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB6(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b01000000;
|
||||
} else {
|
||||
trisB &= 0b10111111;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB6() {
|
||||
return (get_TRISB() & 0b01000000) == 64;
|
||||
}
|
||||
|
||||
public synchronized void set_TRISB7(boolean value) {
|
||||
int trisB = get_TRISB();
|
||||
if (value) {
|
||||
trisB |= 0b10000000;
|
||||
} else {
|
||||
trisB &= 0b01111111;
|
||||
}
|
||||
set_TRISB(trisB);
|
||||
}
|
||||
|
||||
public synchronized boolean get_TRISB7() {
|
||||
return (get_TRISB() & 0b10000000) == 128;
|
||||
}
|
||||
|
||||
@@ -48,22 +48,20 @@ public class STACK
|
||||
* Pops returnAddress from stack. If stack is empty, throws EmptyStackException.
|
||||
* @return
|
||||
*/
|
||||
public int popReturnAdressFromStack()
|
||||
{
|
||||
public int popReturnAdressFromStack() {
|
||||
int adressToReturn = -1;
|
||||
|
||||
if (noObjects(stack))
|
||||
{
|
||||
if (noObjects(stack)) {
|
||||
throw new EmptyStackException();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
stackpointer--;
|
||||
adressToReturn = stack[stackpointer];
|
||||
stack[stackpointer] = -1;
|
||||
}
|
||||
|
||||
if (stackpointer == -1)
|
||||
stackpointer = 7;
|
||||
|
||||
return adressToReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MyModel extends Thread {
|
||||
}
|
||||
//Check if breakpoint is set
|
||||
if (abBreakpoints != null) {
|
||||
if (!abBreakpoints[oPIC.getRam().get_Programcounter()]) {
|
||||
if (!abBreakpoints[oPIC.getRam().get_Programcounter()] && !interruptAcknowledged()) {
|
||||
if(iVisualInterval > 0) {
|
||||
try {
|
||||
Thread.sleep(iVisualInterval * 1000);
|
||||
@@ -123,5 +123,16 @@ public class MyModel extends Thread {
|
||||
abBreakpoints = oMyModelData.getBreakpoints();
|
||||
oPIC.getRuntimer().setQuarzSpeed(oMyModelData.getQuartzInterval());
|
||||
iVisualInterval = oMyModelData.getVisualInterval();
|
||||
qDataToView.add(oPIC);
|
||||
}
|
||||
|
||||
private boolean interruptAcknowledged() {
|
||||
boolean bInterruptAcknowledged = false;
|
||||
|
||||
if (oPIC.getRam().get_GIE()) {
|
||||
|
||||
}
|
||||
|
||||
return bInterruptAcknowledged;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user