Basic read-only cli
This commit is contained in:
41
de/darkress/pic16f84sim/cli/Cli.java
Normal file
41
de/darkress/pic16f84sim/cli/Cli.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package de.darkress.pic16f84sim.cli;
|
||||
|
||||
import de.darkress.pic16f84sim.microcontroller.Cycles;
|
||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||
import de.darkress.pic16f84sim.microcontroller.Stack;
|
||||
import de.darkress.pic16f84sim.microcontroller.Timer;
|
||||
|
||||
public class Cli
|
||||
{
|
||||
public static void showRegisters() {
|
||||
/*
|
||||
System.out.println(Integer.toHexString(Memory.workingRegister) + " " + Cycles.getCycles()); // WReg ProgramCycles
|
||||
System.out.println(Integer.toHexString(Memory.getOption()) + " " + Integer.toHexString(Memory.getRegister(0x03))); // Option Status
|
||||
System.out.println(Integer.toHexString(Memory.getPCLATH()) + " " + Integer.toHexString(Memory.getPCL()) + "\n"); // PCLATH PCL
|
||||
*/
|
||||
printf(Memory.workingRegister, "W-Reg", true);
|
||||
printf(Cycles.getCycles(), "Cycles", false);
|
||||
System.out.printf("%n");
|
||||
printf(Memory.getRegister(0x03), "Status", true);
|
||||
printf(Memory.getOption(), "Option", true);
|
||||
System.out.printf("%n");
|
||||
printf(Memory.getFSR(), "FSR", true);
|
||||
printf(Stack.getStackPointer(), "Stackpointer", true);
|
||||
System.out.printf("%n");
|
||||
printf(Memory.getTimer(), "Timer", true);
|
||||
printf(Timer.getCyclesToTimerIncrease(), "Prescaler", true);
|
||||
System.out.printf("%n");
|
||||
printf(Memory.getPCLATH(), "PCLATH", true);
|
||||
printf(Memory.getPCL(), "PCL", true);
|
||||
System.out.printf("%n");
|
||||
}
|
||||
|
||||
private static void printf(int value, String description, boolean hex) {
|
||||
if(hex) {
|
||||
System.out.printf("%s:\t\t%s\t", description, Integer.toHexString(value));
|
||||
} else {
|
||||
System.out.printf("%s:\t\t%d\t", description, value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user