Docsity

Computer Systems Assignment: Converting Assembler to Machine Language, Exams of Computer Communication Systems

Toggle sidebar
bg1
Converting Assembly Code to
Machine Language
Program 1 to Convert to Machine Language
Assembler Program
The assembler program is designed to compute the expression R0 = 2 + 3.
It consists of the following instructions:
@2: This instruction loads the value 2 into the A register.
D=A: This instruction sets the D register to the value stored in the A
register, which is 2.
@3: This instruction loads the value 3 into the A register.
D=D+A: This instruction adds the values in the A and D registers (2 and
3, respectively) and stores the result (5) in the D register.
@0: This instruction loads the value 0 into the A register.
M=D: This instruction writes the value stored in the D register (5) to the
memory cell at address 0.
Machine Language
The corresponding machine language instructions for the assembler
program are as follows:
0000000000000010: This is the binary representation of the instruction
@2, which loads the value 2 into the A register.
1110110000010000: This is the binary representation of the instruction
D=A, which sets the D register to the value stored in the A register.
0000000000000011: This is the binary representation of the instruction
@3, which loads the value 3 into the A register.
1111010011010000: This is the binary representation of the instruction
D=D+A, which adds the values in the A and D registers and stores the
result in the D register.
0000000000000000: This is the binary representation of the instruction
@0, which loads the value 0 into the A register.
1110001100001000: This is the binary representation of the instruction
M=D, which writes the value stored in the D register to the memory cell
at address 0.
Program 2 to Convert to Machine Language
The text mentions a "Symbol-less version of the Max.asm program", but does
not provide the actual program. Therefore, there is no information to
elaborate on for this part of the document.
1.
2.
3.
4.
5.
6.
1.
2.
3.
4.
5.
6.

Partial preview of the text

Download Computer Systems Assignment: Converting Assembler to Machine Language and more Exams Computer Communication Systems in PDF only on Docsity!

Converting Assembly Code to

Machine Language

Program 1 to Convert to Machine Language

Assembler Program

The assembler program is designed to compute the expression R0 = 2 + 3. It consists of the following instructions:

@2: This instruction loads the value 2 into the A register. D=A: This instruction sets the D register to the value stored in the A register, which is 2. @3: This instruction loads the value 3 into the A register. D=D+A: This instruction adds the values in the A and D registers (2 and 3, respectively) and stores the result (5) in the D register. @0: This instruction loads the value 0 into the A register. M=D: This instruction writes the value stored in the D register (5) to the memory cell at address 0.

Machine Language

The corresponding machine language instructions for the assembler program are as follows:

0000000000000010 : This is the binary representation of the instruction @2, which loads the value 2 into the A register. 1110110000010000 : This is the binary representation of the instruction D=A, which sets the D register to the value stored in the A register. 0000000000000011 : This is the binary representation of the instruction @3, which loads the value 3 into the A register. 1111010011010000 : This is the binary representation of the instruction D=D+A, which adds the values in the A and D registers and stores the result in the D register. 0000000000000000 : This is the binary representation of the instruction @0, which loads the value 0 into the A register. 1110001100001000 : This is the binary representation of the instruction M=D, which writes the value stored in the D register to the memory cell at address 0.

Program 2 to Convert to Machine Language

The text mentions a "Symbol-less version of the Max.asm program", but does not provide the actual program. Therefore, there is no information to elaborate on for this part of the document.