Compare commits
1 Commits
pinoutInCl
...
bsfInstruc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91807e7983 |
@@ -14,7 +14,7 @@ class Main
|
|||||||
ArrayList<Command> program = new ArrayList<>();
|
ArrayList<Command> program = new ArrayList<>();
|
||||||
Memory.workingRegister = 0x01;
|
Memory.workingRegister = 0x01;
|
||||||
Memory.setRegister(0x14, 0xA5); //240 << 224
|
Memory.setRegister(0x14, 0xA5); //240 << 224
|
||||||
program.add(CommandDecoder.decode(0x1114));
|
program.add(CommandDecoder.decode(0x1594));
|
||||||
for(int i = 0; i < program.size(); i++)
|
for(int i = 0; i < program.size(); i++)
|
||||||
{
|
{
|
||||||
program.get(ProgramCounter.getPc()).execute();
|
program.get(ProgramCounter.getPc()).execute();
|
||||||
|
|||||||
26
de/darkress/pic16f84sim/commands/Bsf.java
Normal file
26
de/darkress/pic16f84sim/commands/Bsf.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package de.darkress.pic16f84sim.commands;
|
||||||
|
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||||
|
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||||
|
|
||||||
|
public class Bsf extends BitOrientedCommandUtils implements Command
|
||||||
|
{
|
||||||
|
private final int address;
|
||||||
|
private int bitPlacement;
|
||||||
|
|
||||||
|
public Bsf(int input)
|
||||||
|
{
|
||||||
|
address = input & 0x007F;
|
||||||
|
bitPlacement = checkBitPlacement(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute()
|
||||||
|
{
|
||||||
|
int result = Memory.getRegister(address);
|
||||||
|
result |= (1 << bitPlacement);
|
||||||
|
|
||||||
|
Memory.setRegister(address, result);
|
||||||
|
ProgramCounter.incPC();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,8 +59,7 @@ public class CommandDecoder
|
|||||||
case 0x1000:
|
case 0x1000:
|
||||||
return new Bcf(input);
|
return new Bcf(input);
|
||||||
case 0x1400:
|
case 0x1400:
|
||||||
//bsf();
|
return new Bsf(input);
|
||||||
break;
|
|
||||||
case 0x1800:
|
case 0x1800:
|
||||||
//btfsc();
|
//btfsc();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user