|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.core.Program.Impression
The Impression class represents a copy of the program that
is suitable for reading and writing during execution without changing the
underlying program. This is used in the Simulator class to
make a private copy of the program so that multiple instances of the program
do not interfere with each other. It basically amounts to a deep copy of
the instructions and data in the program segment.
Simulator| Method Summary | |
Instr |
readInstr(int address)
The readInstr() method reads the instruction at the given byte
address. |
byte |
readProgramByte(int address)
The readProgramByte() method reads a single byte
value from the program (code) segment. |
void |
writeInstr(Instr i,
int address)
The writeInstr() method is used to update an instruction at a
particular address in memory. |
void |
writeProgramByte(byte val,
int address)
The writeProgramByte() method writes a single byte value
to the program (code) segment. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public byte readProgramByte(int address)
readProgramByte() method reads a single byte
value from the program (code) segment.
address - the byte address to read the value from
public void writeProgramByte(byte val,
int address)
writeProgramByte() method writes a single byte value
to the program (code) segment. This write may overwrite instructions
within the program. NO EFFORT IS MADE BY THIS CLASS TO ENSURE CONSISTENCY
OF THE INSTRUCTIONS. THEREFORE SELF MODIFYING CODE DOES NOT BEHAVE
CORRECTLY.
val - the value to write to the locationaddress - the byte address in the program segment to write the value topublic Instr readInstr(int address)
readInstr() method reads the instruction at the given byte
address. No attempt to disassemble raw data into usable instructions is made,
and unaligned accesses will return null. SELF MODIFYING CODE DOES NOT BEHAVE
CORRECTLY NOR DOES ATTEMPTING TO EXECUTE DATA AS CODE.
address - the byte address in the program segment to read from
Instr instance at that address if that address is valid
code from creation of the Program instance; an instance of
Instr.NOP if the address is beyond valid memory; null if the instruction
is misaligned or only raw data is present at that location.
public void writeInstr(Instr i,
int address)
writeInstr() method is used to update an instruction at a
particular address in memory. The address is given as a byte address but is
expected to be aligned on a 2-byte boundary.
This is generally used by the Simulator
to insert probes on instructions, but could be used to achieve self-modifying code.
i - the instruction to writeaddress - the byte address to write the instruction that must be aligned
on a 2-byte boundary.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||