# Computer Organization | Basic Computer Instructions

• Difficulty Level : Medium
• Last Updated : 13 Feb, 2020

The basic computer has 16-bit instruction register (IR) which can denote either memory reference or register reference or input-output instruction.

1. Memory Reference – These instructions refer to memory address as an operand. The other operand is always accumulator. Specifies 12-bit address, 3-bit opcode (other than 111) and 1-bit addressing mode for direct and indirect addressing.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

Example –
IR register contains = 0001XXXXXXXXXXXX, i.e. ADD after fetching and decoding of instruction we find out that it is a memory reference instruction for ADD operation.

```Hence, DR ← M[AR]
AC ← AC + DR, SC ← 0```
2. Register Reference – These instructions perform operations on registers rather than memory addresses. The IR(14 – 12) is 111 (differentiates it from memory reference) and IR(15) is 0 (differentiates it from input/output instructions). The rest 12 bits specify register operation.

Example –
IR register contains = 0111001000000000, i.e. CMA after fetch and decode cycle we find out that it is a register reference instruction for complement accumulator.

`Hence, AC ← ~AC`
3. Input/Output – These instructions are for communication between computer and outside environment. The IR(14 – 12) is 111 (differentiates it from memory reference) and IR(15) is 1 (differentiates it from register reference instructions). The rest 12 bits specify I/O operation.

Example –
IR register contains = 1111100000000000, i.e. INP after fetch and decode cycle we find out that it is an input/output instruction for inputing character. Hence, INPUT character from peripheral device.

The set of instructions incorporated in16 bit IR register are:

1. Arithmetic, logical and shift instructions (and, add, complement, circulate left, right, etc)
2. To move information to and from memory (store the accumulator, load the accumulator)
3. Program control instructions with status conditions (branch, skip)
4. Input output instructions (input character, output character)
AND0xxx8xxxAnd memory word to AC
STA3xxxBxxxStore AC content in memory
BUN4xxxCxxxBranch Unconditionally
ISZ6xxxExxxIncrement and skip if 0
CLA7800Clear AC
CLE7400Clear E(overflow bit)
CMA7200Complement AC
CME7100Complement E
CIR7080Circulate right AC and E
CIL7040Circulate left AC and E
INC7020Increment AC
SPA7010Skip next instruction if AC > 0
SNA7008Skip next instruction if AC < 0
SZA7004Skip next instruction if AC = 0
SZE7002Skip next instruction if E = 0
HLT7001Halt computer
INPF800Input character to AC
OUTF400Output character from AC
SKIF200Skip on input flag
SKOF100Skip on output flag
IONF080Interrupt On
IOFF040Interrupt Off
My Personal Notes arrow_drop_up