Professional Documents
Culture Documents
Week 2 Lab
Week 2 Lab
Week 2 Lab
Objectives
Introduction
Machine language programming was the first generation programming language. This
programming language codes are only in zeros and ones. Due to the drawbacks of first
generation language such as time consuming, lengthy programs etc, resulted in
Assembly language programming. This programming language used symbolic names
instead of zeros and ones as in machine language one. The drawbacks of machine
language became the advantages of assembly language programming.
Page 1 of 6
There are six registers in Wombat 1 machine:
acc – refers to accumulator. All computation are done in accumulator. Reading a
value from file or console will be stored in accumulator. To write to the file or
console, a value must be loaded to the accumulator.
pc – program counter. It contains address main memory location that contains
the next instruction to be executed.
mar – memory address register. This is for transferring data to memory.
mdr – memory data register. This is for transferring data to and from memory.
ir – instruction register. The instruction is decoded in this register. Instructions
consist of opcode and operand but this two are combined as one instruction. In
order to separate opcode and operand, an instruction must be decoded.
status – status register. This is used for halting the machine. It consists of halt-bit
which can be set to zero or one.
In addition to the registers, the machine also consists of the main memory. This is where
the instructions are stored. Figure 3 illustrates the main memory.
Page 2 of 6
Figure 3: Main memory
This lab will focus on only machine language programming. The Wombat 1 machine has
12 instructions which is shown in the following figure:
Page 3 of 6
This is the
implementation
of machine
instruction
Existing “load”
machine
instruction
Existing
micro
instruction
Page 4 of 6
Figure 6: Fetch Sequence
Instruction
Comments after
semi colon
Figure 7: Machine language program
Page 5 of 6
An instruction is 16 bit long on wombat machine. Out of those 16 bits, first 4 bits is the
opcode and the 12 bits is operand. For example, the first instruction is
0011000000000000. The opcode is 0011 and operand is 000000000000. 0011
represents 3 which is the “read” machine instruction. Likewise every instruction will
have opcode and operand.
Tasks to perform:
1. Load the machine instruction in the file named “sample”. Go to File menu, click
on LOAD RAM.
2. Select the file “Sample”. The machine codes will be loaded in RAM. Check the
RAM for this.
3. Go to Execute menu, select “Run”. Enter values from the console.
Page 6 of 6