Addressing
Mode Simulator
This applet
simulates an ISA level of a calculator with these properties:
Like all the calculators,
memory is divided into cells consecutively indexed from 0 to 9 and six registers
(R[0] - R[5])
with general application (used to store local variables and operations'intermediate
results).
- Implemented Instructions:
What a calculator may do is defined
by its Instruction-Set. An ISA efficiency is influenced by the instructions
format.Every instruction contains the Opcode and other informations likeas
where the operators are and where the results will be stored in. In thissimulation
let's consider variable instructions lenghts and formats as follow:

Addressing Modes determinate how
instructions select their operators (operator is a destination of a result
too!). Theese modalities have a different way to do to reach registers or
memory cells:
- Immediate: The instruction index part contains operatoritself,
rather than informations on where the operator is. It is called Immediate
because it's read directly from memory at the same time the instruction is
read, so its immediately available. It doesn't request addictional memory
references; but an immediate operator could be only a constant type and the
values number is limited by the frame dimensions.
- Direct: Indicates an operator by its memory address, it's
used to reach variables stored into memory whom indexes are known at compilation
time; instruction will always rech the same memory location.
- Register: Register's addressing mode is the same of theDirect
one; it indicates a register index rather than a memory address. Becauseof
the importance of the registers, in most cases this addressing mode isused
by all calculators.
- Indirect: With this mode the specified operator is stored
in memory or it's going to a memory location, but its address is in a register.
When an index is used in this way it's called pointer; this addressing mode
could reach a memory location without paying the price of having a full memory
address into the instruction.
- Index: Operator is reached by a pointer in a register and
an offset. This mode is used to refer memory from a memory pointer in a register
and an offset into the instruction; or from an offset in a register and a
pointer into the instruction.
- Based-Indexed: This addressing mode works like the Index
one, but in this case offset and pointer are stored into two registers the
first one is called index the second one is called base; so memory is addressed
from two registers.
- INC - INC(op) Increases by 1 specified operator. Op could be into memory
or into a register.
- ZER - ZER(op) set to 0 specified operator. Op could be into memoryor
into a register.
- LOAD - LOAD(dest, src) This instruction is used to load in a memory
location, content of a register. "dest" is an in-memory operator, "src" is
into a register.
- STORE - STORE(src, dest) It's re reverse of Load, "src" is in a memory
location, "dest" specifies a register.
- MOVE - MOVE(dest, src) It's used to copy into dest (register)the content
of src which could be a register or an immediate variable.
- ADD - ADD(dest, op1, op2) Executes addiction between op1 and op2, and
stores result into dest..
- SUB - SUB(dest, op1, op2) Subtract op2 from op1and store result into
dest.
- MUL - MUL(dest, op1, op2) Multiplies op1 to op2 into dest.
- MOD - MOD(dest, op1, op2) Stores into dest the rest of the division
between op1 and op2.
- AND - AND(dest, op1, op2) Stores into dest the And bit to bit operation
between op1 and op2.
click the little
changer-man to start simulation
Download Applet
Download Code
