23 lines
360 B
Java
23 lines
360 B
Java
![]() |
package hatelace;
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|