Close

Miscellaneous instructions

A project log for Instruction Set for ECM-16/TTL homebrew cpu

All the instructions laid out in systematic manner

pavelPavel 10/28/2022 at 08:240 Comments

These are instructions that are more of service nature rather than close related to computation, and couldn't be classified together with them

All of these instructions take one word in memory.

              Instruction bits
Mnemonic:     F E D C  B A 9 8  7 6 5 4  3 2 1 0
SETIM #M      0 0 0 0  0 1 1 1  m m m x  x x x x    Set interrupt mask #M
CLRIM #M      0 0 0 0  0 1 1 0  m m m x  x x x x    Clear interrupt mask #M
SETPR #P      0 0 0 0  0 1 0 1  p p p x  x x x x    Set prefix #
EINT #I       0 0 0 0  0 1 0 0  i i i i  i i i i    Enter interrupt #I
DMA           0 0 0 0  0 0 1 1  x x x x  x x x x    Direct memory access
RESET         0 0 0 0  0 0 1 0  x x x x  x x x x    software cpu reset
HLT           0 0 0 0  0 0 0 1  x x x x  x x x x    halt execution
NOP           0 0 0 0  0 0 0 0  x x x x  x x x x    empty operation

m - bits of interrupt mask number
p - bits of prefix number
i - bits of interrupt number
x - "don't care" bits - have no effect on result
M - number in range 0-7, each defining particular interrupt mask
P - number in range 0-7
I - number in range 0-255, defining entry into particular interrupt service routine

SETPR - sets prefix that lets to Load, Store or Move 2, 4, 8 or 16 consecutive words and Load or Store 1, 2, 4 or 8 consecutive bytes by corresponding instruction. The actual use in assembly language is by alias B1, B2, B4, B8, W2, W4, W8 or W16 that is written right before the applicable instruction.

EINT is an instruction that triggers interrupt from within running program - as example, this may help with interacting with operating system services.

DMA - makes it possible to change memory contents from outside of CPU (using DMA controller, or front panel switches, or something else). When DMA is in effect, clock signal is not propagating into CPU, making it stop. For CPU resuming the work, the DMA controller should switch clock propagation on.

RESET - clears all registers and flags in CPU, and performs startup sequence.

HLT - stops clock signal propagation into CPU. This can be restored by physically pressing on dedicated Resume button, or the CPU can be restarted by Reset button. This can be useful for inserting breaks during program debugging.

NOP - advances PC 1 word, and nothing else. May be used as filler or some timing application.

Discussions