23 lines
413 B
Java
23 lines
413 B
Java
package hatelace;
|
|
|
|
/** Simple class to represent the Program Counter */
|
|
public class ProgramCounter {
|
|
private int PC;
|
|
|
|
public ProgramCounter() {
|
|
this.PC = 0;
|
|
}
|
|
|
|
public ProgramCounter(int PC) {
|
|
this.PC = PC;
|
|
}
|
|
|
|
public int getPC() {
|
|
return this.PC;
|
|
}
|
|
|
|
public int incPC() {
|
|
this.PC = this.PC + 1 <= 0 ? 0 : this.PC + 1;
|
|
return this.PC;
|
|
}
|
|
}
|