Close

Immediate loads

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

All the instructions laid out in systematic manner

pavelPavel 10/23/2022 at 08:430 Comments

Loading hard coded value into one of the registers.

The instruction is 2 words (32bit).

There are 2 types of this instruction - one for loading a word (16bit) into General Purpose Register, and other for loading a double word (32bit value in range 0x00000000 - 0x01ffffff) into a pair of Memory Pointer registers.

Here are layouts:

                     Instruction words:
                     bits of word #1      bits of word #2
Mnemonic:            FEDC BA98 7654 3210  FEDC BA98 7654 3210
LDir rX 0xffff       0010 0ddd xxxx xxxx  vvvv vvvv vvvv vvvv
LDim MP 0x01ffffff   0010 1ddv vvvv vvvv  vvvv vvvv vvvv vvvv

d - bits of register address (X or MP)
v - bits of data value to be loaded
x - "don't care" bits - have no effect on result
rX - General Purpose Register #X
MP - Memory Pointer register pair, one of Program Counter (PC), Stack Pointer (SP),
 Frame Pointer (FP) and Base Pointer (BP)

There are no corresponding Store Immediate instructions, as it is has no practical use -- the write will be into program area at address that cannot be readily predicted and utilized at code writing time.

General layout of instruction types

Discussions