0% found this document useful (0 votes)
27 views

UA04 - 4.2 Assembly Language

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

UA04 - 4.2 Assembly Language

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

4

Unit 04: 4.2 Assembly Language

Name: Date: Marks: /20

5. A program is written in assembly language.

Paper | 1
(a) The op codes LDM and LDD are used to load a register.
The op code LDM uses immediate addressing, and the op code LDD uses direct addressing.
Describe what happens when the following instructions are run.
LDM #300 ………..……………...………………………………………….…………….………...
………………………..……………...…………………………………….…….………...….……...
LDD 300 ………….……………...………………………………………….…………….………...
………………………..……………...…………………………………….…….………...….…...[2]
(b) Assembly language instructions can be grouped by their purpose.
The following table shows four assembly language instructions.
Tick (✓) one box in each row to indicate the group each instruction belongs to.

Instruction Jump instruction Arithmetic operation Data movement


LDR #3 Load the number 3 to the Index Register
ADD #2 Add 2 to the Accumulator
JPN 22 Move to the instruction at address 22
DEC ACC Subtract 1 from the Accumulator
[3]
(C) The assembly language instructions in the following table use either symbolic addressing or absolute addressing.
Tick (✓) one box in each row to indicate whether the instruction uses symbolic or absolute addressing

Instruction Symbolic Absolute


ADD 90
CMP found
STO 20
[3]
6. The following table shows part of the instruction set for a processor.
The processor has one general purpose register, the Accumulator (ACC) and an Index Register (IX).

© HEGICT 2023 9618 / P1 / Unit Assessment 04 /Summer 2023


5
The following diagram shows the contents of a section of main memory and the Index Register (IX).
(a) Show the contents of the Accumulator (ACC) after each instruction is executed.
IX 0 0 0 0 0 0 1 1
(i) LDM #500
ACC...................................................................[1] Address Main Memory contents
495 13
(ii) LDD 500 496 86

Paper | 1
ACC...................................................................[1] 497 92
498 486
(iii) LDX 500 499 489
ACC...................................................................[1] 500 496
501 497
(iv) LDI 500 502 499
ACC...................................................................[1] 503 502

(b) Each machine code instruction is encoded as 16-bits (8-bit op code followed by an 8-bit operand).
Write the machine code for the following instructions:
LDM #17

LDX #97

[4]
(c) Using an 8-bit operand, state the maximum number of memory locations, in denary, that can be directly
addressed.
………………………..……………...…………………………………….…….………...….…...[1]
(d) Computer scientists often write binary representations in hexadecimal.
(i) Write the hexadecimal representation for this instruction:

………………………..……………...…………………………………….…….………...….…...[2]
A second instruction has been written in hexadecimal as:
05 3F
(ii) Write the equivalent assembly language instruction, with the operand in denary.
………………………..……………...…………………………………….…….………...….…...[1]
(e) Show the contents of the Accumulator after the execution of the instruction:
LDX 501
IX 0 0 0 0 0 0 1 1

ACC:
Explain how you arrived at your answer.
……………………..……………...………………………………………….…………….………...
……………………..……………...………………………………………….…………….………...
………………………..……………...…………………………………….…….………...….…...[2]
(f) Show the contents of the Accumulator after the execution of the instruction:
LDX 503

ACC:

Explain how you arrived at your answer.


……………………..……………...………………………………………….…………….………...
……………………..……………...………………………………………….…………….………...
………………………..……………...…………………………………….…….………...….…...[2]

© HEGICT 2023 9618 / P1 / Unit Assessment 04 /Summer 2023

You might also like