Details


Execution of all OpCodes is conditional:
Bit 15..13 are used to control a 74151_like multiplexer
for Flag testing.

If the selected condition is TRUE, the OpCode will be executed.
If the condition is FALSE, the CPU will reject/skip the OpCode,
and execute a NOP instead.
000 (Default) means, the OpCode will always be executed.
001 is used to test a signal from a periphal device outside the CPU
(and may be used for emulating an Interrupt).
The six combinations left can be used to test, if one of the three Flags
N, Z, C are 0 or 1, allowing us to implement things like conditional
jumps, branches, and returns.
Note, that MT15 doesn't have a V_Flag
(for detecting overflow in signed integer calculations).

Bit 12..10 selects the addressing mode.
MT15 instructions always take two words (4 Bytes) of program memory.
The first word contains the OpCode, while the second word may contain
a parameter (immediate value, address, etc.).
Regardless if the second word is used or not:
all OpCodes have the same size in memory.

000 and 001 indicate immediate addressing, means that the second word
is passed directly into the ALU (together with a register like ACC or PC),
skipping all further steps of address calculation.
110 indicates absolute addressing, means that the second word points
to a location in memory, that contains the data to be read/written.
111 selects indirect adressing, the second word points to a location in
memory, that contains the address of the memory lacation to be read/written
(we will need this when implementing a stack.)
It's also possible to select a location in memory by adding a register
with the second word, allowing us the use of PC relative code (or data
or pointers), or to use ACC as an offset for fetching a new value to be
written into PC from a table.

Bit 9 is used for selecting the register to be connected
to the ALU during data calculation:

0 selects ACC, 1 PC.

Bit 8..7 select, what to do with the ALU result after data
calculation.

00 means, the result isn't stored (although it will modify the Flags).
This is useful for comparing a register with memory, or to test a word
in memory for 0 or negative (0x8000..0xffff).
The result could also be written to ACC (mostly used), into PC (for jumps,
branches and returns), or back to memory.
Yes, it is possible to increment/decrement/clear/shift a location in memory
without modifying ACC !

Bit 6 indicates, that Flags should be modified by the result of
the data calculation.

When implementing a stack, there may be a need to increment or decrement
a location in memory (used as a stack_pointer), without affecting the
Flag status.

Bit 5..4 control the ALU carry_input during data calculation.
The input can be forced to 0 (as for ADD), or to 1 (what will increment
a word passed through the ALU).
It's also possible to connect the Carry_Flag (C_Flag) to the ALU input,
for things like ADC and SBC.

Bit 3..0 are used to control the ALU during data calculation.
Like to select, if the word from a register or the word from memory
should be passed through, incremented/decremented, shifted etc.
Warning: Bit 3=1 indicates an arithmetic operation, means the Flags
N,Z,C are modified. Bit 3=0 may affect only the Flags N and Z.
s So take care when using CLR... better use SET with c_in=1.


[HOME] [UP]/ [BACK] [1] [2] [3] [4] [5] [6] [7] [8] [NEXT]

(c) Dieter Mueller 2005