Compare commits
1 Commits
guiSRAM
...
incrementP
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54381896c3 |
@@ -2,11 +2,9 @@ package de.darkress.pic16f84sim;
|
|||||||
|
|
||||||
import de.darkress.pic16f84sim.commands.Command;
|
import de.darkress.pic16f84sim.commands.Command;
|
||||||
import de.darkress.pic16f84sim.decoder.CommandDecoder;
|
import de.darkress.pic16f84sim.decoder.CommandDecoder;
|
||||||
import de.darkress.pic16f84sim.gui.SramTable;
|
|
||||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||||
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
class Main
|
class Main
|
||||||
@@ -21,14 +19,5 @@ class Main
|
|||||||
{
|
{
|
||||||
program.get(ProgramCounter.getPc()).execute();
|
program.get(ProgramCounter.getPc()).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
SramTable table = new SramTable();
|
|
||||||
JFrame frame = new JFrame("Table Example");
|
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
||||||
frame.add(table.getTable());
|
|
||||||
frame.pack();
|
|
||||||
frame.setVisible(true);
|
|
||||||
//table.setValueAt("test", 15, 7);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.darkress.pic16f84sim.commands;
|
package de.darkress.pic16f84sim.commands;
|
||||||
|
|
||||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||||
|
|
||||||
public class Andlw extends LiteralCommandUtils implements Command
|
public class Andlw extends LiteralCommandUtils implements Command
|
||||||
{
|
{
|
||||||
@@ -18,5 +19,6 @@ public class Andlw extends LiteralCommandUtils implements Command
|
|||||||
checkZeroBit(result);
|
checkZeroBit(result);
|
||||||
|
|
||||||
Memory.workingRegister = result % 256;
|
Memory.workingRegister = result % 256;
|
||||||
|
ProgramCounter.incPC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ public class Decfsz extends FileRegisterCommandUtils implements Command
|
|||||||
|
|
||||||
if((result % 256) == 0)
|
if((result % 256) == 0)
|
||||||
{
|
{
|
||||||
Nop nop = new Nop();
|
ProgramCounter.incPC();
|
||||||
nop.execute(); // TODO: What happens if an interrupt gets triggered during the nop execution?
|
|
||||||
}
|
}
|
||||||
ProgramCounter.incPC();
|
ProgramCounter.incPC();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ public class Incfsz extends FileRegisterCommandUtils implements Command
|
|||||||
|
|
||||||
if((result % 256) == 0)
|
if((result % 256) == 0)
|
||||||
{
|
{
|
||||||
Nop nop = new Nop();
|
ProgramCounter.incPC();
|
||||||
nop.execute(); // TODO: What happens if an interrupt gets triggered during the nop execution?
|
|
||||||
}
|
}
|
||||||
ProgramCounter.incPC();
|
ProgramCounter.incPC();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.darkress.pic16f84sim.commands;
|
package de.darkress.pic16f84sim.commands;
|
||||||
|
|
||||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||||
|
|
||||||
public class Iorlw extends LiteralCommandUtils implements Command
|
public class Iorlw extends LiteralCommandUtils implements Command
|
||||||
{
|
{
|
||||||
@@ -18,5 +19,6 @@ public class Iorlw extends LiteralCommandUtils implements Command
|
|||||||
checkZeroBit(result);
|
checkZeroBit(result);
|
||||||
|
|
||||||
Memory.workingRegister = result % 256;
|
Memory.workingRegister = result % 256;
|
||||||
|
ProgramCounter.incPC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.darkress.pic16f84sim.commands;
|
package de.darkress.pic16f84sim.commands;
|
||||||
|
|
||||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||||
|
|
||||||
public class Sublw extends LiteralCommandUtils implements Command
|
public class Sublw extends LiteralCommandUtils implements Command
|
||||||
{
|
{
|
||||||
@@ -41,5 +42,6 @@ public class Sublw extends LiteralCommandUtils implements Command
|
|||||||
checkDigitCarryBit(literal);
|
checkDigitCarryBit(literal);
|
||||||
|
|
||||||
Memory.workingRegister = result % 256;
|
Memory.workingRegister = result % 256;
|
||||||
|
ProgramCounter.incPC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.darkress.pic16f84sim.commands;
|
package de.darkress.pic16f84sim.commands;
|
||||||
|
|
||||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||||
|
|
||||||
public class Xorlw extends LiteralCommandUtils implements Command
|
public class Xorlw extends LiteralCommandUtils implements Command
|
||||||
{
|
{
|
||||||
@@ -18,5 +19,6 @@ public class Xorlw extends LiteralCommandUtils implements Command
|
|||||||
checkZeroBit(result);
|
checkZeroBit(result);
|
||||||
|
|
||||||
Memory.workingRegister = result % 256;
|
Memory.workingRegister = result % 256;
|
||||||
|
ProgramCounter.incPC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
package de.darkress.pic16f84sim.gui;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.geom.Dimension2D;
|
|
||||||
|
|
||||||
public class SramTable
|
|
||||||
{
|
|
||||||
private final int rows = 32;
|
|
||||||
private final int columns = 8;
|
|
||||||
private Object[][] data = new Object[rows][columns];
|
|
||||||
|
|
||||||
public JTable getTable()
|
|
||||||
{
|
|
||||||
return table;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JTable table = new JTable(data, createColumns());
|
|
||||||
|
|
||||||
public SramTable()
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
for (int i = 0; i < rows; i++) {
|
|
||||||
for (int j = 0; j < columns; j++) {
|
|
||||||
data[i][j] = Integer.toHexString(count).toUpperCase();
|
|
||||||
table.getColumnModel().getColumn(j).setPreferredWidth(30);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object[] createColumns(){
|
|
||||||
Object[] columnNames = new Object[columns];
|
|
||||||
for (int j = 0; j < columns; j++) {
|
|
||||||
columnNames[j] = j;
|
|
||||||
}
|
|
||||||
return columnNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void table() {
|
|
||||||
// Create a scroll pane and add the table to it
|
|
||||||
JScrollPane scrollPane = new JScrollPane(table);
|
|
||||||
|
|
||||||
// Create a panel and add the scroll pane to it
|
|
||||||
JPanel panel = new JPanel();
|
|
||||||
panel.add(scrollPane);
|
|
||||||
|
|
||||||
// Create a frame and add the panel to it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user