public abstract class CPUCore extends java.lang.Object implements Clockable
Constructor and Description |
---|
CPUCore() |
Modifier and Type | Method and Description |
---|---|
Context |
getContext()
Obtain the context currently running in the core
|
abstract <T> T |
getRegister(int number)
Obtain the value of a given register
|
abstract java.lang.Object[] |
getRegisters()
Obtain the core's register array
|
abstract void |
handleInterrupt(Interrupt interrupt)
Handle an interrupt
|
void |
load(Context context)
Load context to the core
|
abstract void |
setRegisters(int register,
java.lang.Object... values)
Set the value of a sequence of registers
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDescription, tick
public void load(Context context)
context
- The contextpublic Context getContext()
public abstract void handleInterrupt(Interrupt interrupt) throws java.lang.Exception
interrupt
- The interrupt to handlejava.lang.Exception
public abstract void setRegisters(int register, java.lang.Object... values) throws InvalidRegisterException
register
- The initial register to affectvalues
- The values to storeInvalidRegisterException
- Thrown if the sequence of registers to affect goes beyond the number of registers supported by the CPU corepublic abstract java.lang.Object[] getRegisters()
public abstract <T> T getRegister(int number) throws InvalidRegisterException
number
- The number of the register to readInvalidRegisterException
- Thrown if number is not a valid register