0% found this document useful (0 votes)
61 views14 pages

Reserved: Machine Instructions and Programs

This unit discusses machine instructions and programs. It covers addressing modes like register, absolute, immediate, indirect and others. The unit also explains assembly language, basic input/output, subroutines, and encoding of machine instructions. The objectives are to understand addressing modes, how data is represented in assembly language, input/output activities controlled by programs, subroutine calls and returns, and machine instruction and program execution.

Uploaded by

Juan
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)
61 views14 pages

Reserved: Machine Instructions and Programs

This unit discusses machine instructions and programs. It covers addressing modes like register, absolute, immediate, indirect and others. The unit also explains assembly language, basic input/output, subroutines, and encoding of machine instructions. The objectives are to understand addressing modes, how data is represented in assembly language, input/output activities controlled by programs, subroutine calls and returns, and machine instruction and program execution.

Uploaded by

Juan
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/ 14

UNIT

02

D
E
Machine Instructions

V
and Programs

R
E
S
Names of Sub-Units
E
Introduction to Machine Instructions and Programs, Addressing Modes, Assembly Language, Basic
R
Input and Output Operations, Subroutines, Additional Instructions, Encoding of Machine Instructions.
T

Overview
H

This unit begins by discussing the machine instructions and programs. Next, the unit discusses the
addressing modes and assembly language. Further the unit explains the basic input and output
IG

operations. This unit also discusses the subroutines. Towards the end, the unit discusses the encoding
of machine instructions.
R

Learning Objectives
Y

In this unit, you will learn to:


P

aa Explain the different addressing modes


O

aa Define the machine instructions, data, and programmes are represented in assembly language.
aa Discuss the Input/Output activities that are controlled by a programme
C

aa Explain the branching and subroutine call and return actions


aa Describe the as machine instructions and programme execution
JGI JAIN
DEEMED-TO-BE UNIVERSITY
Computer Organization and Architecture

Learning Outcomes

At the end of this unit, you would:


aa Assess the knowledge about the different addressing modes
aa Examine the role of machine instructions, data, and programmes in assembly language
aa Evaluate the Input/Output activities
aa Analyse the subroutine call and return actions

D
aa Assess the machine instructions and programme execution

E
Pre-Unit Preparatory Material

V
http://www.mhhe.com/engcs/electrical/hamacher/5e/graphics/ch02_025-102.pdf

R
aa

E
2.1 Introduction

S
Machine instructions and operand addressing information are represented by symbolic names in
assembly language. The instruction set architecture (ISA) of a CPU refers to the whole instruction set.
E
Machine instructions and operand addressing techniques that are common in commercial processors.
We need to provide a sufficient amount of instructions and addressing techniques to present complete,
R
realistic programmes for simple tasks. The assembly language is used to specify these generic
programmes.
T

2.2  Addressing Modes


H

We’ve now looked at a few simple assembly language applications. A programme, in general, works with
data stored in the computer’s memory. These records can be arranged in a number of ways. We can keep
IG

track of pupils’ names by writing them down on a list. We may organise this information in the form of a
table if we wish to connect information with each name, such as phone numbers or grades in particular
courses. Data structures are used by programmers to represent the data utilised in computations. Lists,
linked lists, arrays, queues, and other data structures are examples.
R

Constants, local and global variables, pointers, and arrays are often used in high-level programming
Y

languages. The compiler must be able to implement these structures utilising the capabilities given in
the instruction set of the machine on which the programme will be run when converting a high-level
P

language programme into assembly language. Addressing modes relate to the many methods in which
an operand’s location is stated in an instruction.
O

The generic addressing modes are shown in Table 1:


C

Table 1: Generic Addressing Modes


Name Assembles Syntax Addressing function
Immediate #value Operand=Value
Register Ri EA=Ri
Absolute (Direct) LOC EA=LOC
Indirect (Ri) EA=(Ri)

2 
UNIT 02: Machine Instructions and Programs JGI JAIN
DEEMED-TO-BE UNIVERSITY

Name Assembles Syntax Addressing function


Immediate #value Operand=Value
(LOC) EA=(LOC)
Index X(Ri) EA=[Ri]+X
Base with Index (Ri,Rj) EA=[Ri]+[Rj]
Base with index and offset X(Ri, Rj) EA=[Ri]+[Rj]÷X
Relative X(PC) EA\[PC]÷X

D
Auto increment (Ri)+ EA=[Ri]; Increment Ri
Auto decrement =(Ri) Decrement Ri EA=[Ri]

E
The description of these addressing modes is as follows:

V
zz Register mode: The operand is the contents of a processor register; the register’s name (address) is
specified in the instruction.

R
Instruction Register

E
Register Data

S
zz Absolute mode: The operand is stored in memory, and the location’s address is specified directly in
E
the instruction. (This mode is known as Direct in various assembly languages.)
R
Move LOC,R2
zz Immediate mode: The operand is given explicitly in the instruction.
T

For example, the instruction

Move 200 immediate, R0


H

Register R0 with the value 200. Obviously, the Immediate mode is only used to express a source
IG

operand’s value. In assembly languages, using a subscript to signify the Immediate mode is not
acceptable. The use of the sharp sign (#) in front of a value to signal that it is to be used as an
immediate operand is a frequent convention.
R

As a result, we write the instruction in the following format:


Y

Move #200,R0
In high-level language applications, constant values are commonly employed. Consider the following
P

example:
O

A=B+6
holds the value of 6. This statement can be compiled as follows, assuming A and B have been declared
C

as variables and can be accessed using the Absolute mode:

Move B,R1
Add #6,R1
Move R1,A
In assembly language, constants are also used to increment a counter, test for a bit pattern, and
so on.

 3
JGI JAIN
DEEMED-TO-BE UNIVERSITY
Computer Organization and Architecture

zz Indirect mode: The contents of a register or memory location whose address is specified in the
instruction are the operand’s effective address.
Indirect method is divided into two types based on the availability of effective address:
1. Register indirect: In this method, the effective address is kept in the register, and the matching
register name is kept in the instruction’s address field. To access the data, one register reference
and one memory reference are required.
2. Memory Indirect: In this method, the effective address is stored in memory, and the matching
memory address is stored in the instruction’s address field. To access the data, two memory

D
references are necessary.
zz Index mode: By adding a constant value to the contents of a register, the operand’s effective address

E
is produced.

V
Example: MOV AX, [SI +05]
Relative mode: The Index mode determines the effective address by utilising the programme counter

R
zz
instead of the general-purpose register Ri.

E
zz Auto increment mode: The contents of a register provided in the instruction are the operand’s
effective address. The contents of this register are automatically increased to refer to the next item

S
in a list after accessing the operand.

E
Add R1, (R2)+ // OR
R1 = R1 +M[R2]
R
R2 = R2 + d
Auto decrement mode: The contents of a register provided in the instruction are decremented
T

zz
automatically before being utilised as the operand’s effective address.
H

Add R1,-(R2) //OR


IG

R2 = R2-d
R1 = R1 + M[R2]
R

2.3  Assembly Language


Y

Patterns of 0s and 1s are used to represent machine instructions. When discussing or planning plans, such
tendencies are difficult to cope with. As a result, we refer to the patterns by symbolic names. To describe
P

the matching binary code patterns, we have so far utilised common terms like Move, Add, Increment,
and Branch for the instruction operations. Such phrases are usually substituted with abbreviations
O

called mnemonics, such as MOV, ADD, INC, and BR, when creating programmes for a certain machine.
We use the notation R3 to refer to register 3 and LOC to refer to a memory location in the same way. A
C

programming language, gen, is made up of a comprehensive collection of such symbolic names and
rules for their use. A programming language, often known as an assembly language, is made up of a
comprehensive collection of such symbolic names and rules for their use. The syntax of the language is
a set of rules for employing mnemonics in the definition of full instructions and programmes.
A programme called an assembler can automatically transform programmes written in an assembly
language into a series of machine instructions. The assembler programme is one of the utility
applications included in the system software. The assembler, like any other programme, is stored in
the computer’s memory as a series of machine instructions. A user programme is typically typed into

4 
UNIT 02: Machine Instructions and Programs JGI JAIN
DEEMED-TO-BE UNIVERSITY

a computer through the keyboard and saved in memory or on a magnetic drive. At this stage, the
user programme is nothing more than a series of alphanumeric characters on a line. When you run
the assembler programme, it reads the user programme, analyses it, and then creates the machine
language programme you want. The latter comprises patterns of 0s and 1s that indicate the computer’s
instructions to be performed. A source programme is the user programme in its original alphanumeric
text format, while an object programme is the constructed machine language programme.
A computer’s assembly language may or may not be case sensitive, that is, it may or may not differentiate
between capital and lower case letters. To increase the readability of the text, we will use capital letters
to designate all names and labels in our examples. We’ll write a Move instruction as follows:

D
MOVE R0,SUM

E
The binary pattern, or OP code, representing the operation executed by the instruction is represented by
the mnemonic MOVE. This mnemonic is translated into binary OP code that the computer understands

V
by the assembler. At least one blank space character follows the OP-code mnemonic. Then comes the
information that defines the operands. The source operand in our case is in register R0. There are no

R
blanks between this information and the specification of the destination operand, which is separated
from the source operand by a comma. The destination operand is in the memory location SUM, which is

E
represented by its binary address.

S
Because there are numerous different ways to define operand locations, the assembly language must
declare which one is being utilised. To represent the Absolute mode, a numerical number or a word
E
used alone, such as SUM in the previous command, might be used. An immediate operand is generally
R
denoted by a sharp sign. As a result, the directive is:
ADD #5,R3
T

adds the number 5 to the contents of register R3 and returns the result to R3. The sharp symbol isn’t
the only technique to indicate that the mode is Immediate. The desired addressing mode is specified in
H

the OP code mnemonic in various assembly languages. In this example, distinct OP-code mnemonics
are used for different addressing modes for the same instruction. The preceding Add instruction, for
IG

example, might be expressed as:


ADDI 5,R3
R

The suffix I indicate that the source operand is supplied in the Immediate addressing mode in the
mnemonic ADDI. Indirect addressing is often defined by placing parentheses around the name or
Y

symbol indicating the operand’s pointer. If the number 5 is to be stored in a memory location whose
address is maintained in register R2, for example, the desired action can be expressed as:
P

MOVE #5,(R2)
O

MOVEI 5,(R2)
C

2.3.1  Assembler Directives


The assembly language allows the programmer to provide extra information needed to transform
the source programme into the object programme in addition to providing a system for expressing
instructions in a programme. We’ve already established that any names used in a programme must be
given numerical values. Assume that the number 200 is represented by the term SUM. This information
may be sent to the assembly programme with a statement like:
SUM EQU 200

 5
JGI JAIN
DEEMED-TO-BE UNIVERSITY
Computer Organization and Architecture

2.3.2  Assembly and Execution of Programs


Before a source programme written in assembly language can be run, it must first be assembled into
a machine language object programme. The assembler programme does this by replacing all symbols
indicating operations and addressing modes with binary codes used in machine instructions, as well as
all names and labels with their real values.
Starting at the location specified in the ORIGIN assembler directives, the assembler assigns addresses to
instructions and data blocks. It also inserts constants specified in DATAWORD instructions and reserves
memory space when RESERVE directives are sent.

D
2.4 Basic Input and Output Operations

E
An efficient mode of communication between the central system and the outside environment is provided

V
by a computer’s I/O subsystem. It is in charge of the computer system’s entire input-output operations.

R
2.4.1  Peripheral Devices

E
Peripheral devices are input or output devices that are connected to a computer. These devices, which
are regarded to be part of a computer system, are designed to read information into or out of the

S
memory unit in response to commands from the CPU. Peripherals are another name for these gadgets.
For example: Keyboards, display units and printers are common peripheral devices.
E
There are three types of peripherals:
R
1. Input peripherals: These devices allow users to enter data from the outside world into the computer.
For instance, a keyboard, a mouse, and so on.
T

2. Output peripherals: These devices allow data to be sent from the computer to the outside world. For
instance, a printer, a monitor, and so on.
H

3. Peripherals for input and output: Allows both input (from the outside world to the computer) and
output (from the computer to the outside world) (from computer to the outside world). For instance,
IG

a touch screen.
R

2.4.2  Programmed I/O


I/O instructions written in a computer programme result in programmed I/O instructions. The
Y

program’s command triggers the transmission of each data item. Typically, the software is in charge
of data transmission between the CPU and peripherals. Transferring data through programmed I/O
P

necessitates the CPU’s continual supervision of the peripherals.


O

2.4.3  Interrupt Initiated I/O


C

The CPU remains in the programme loop in the programmed I/O technique until the I/O unit indicates
that it is ready for data transfer. This is a time-consuming procedure since it wastes the processor’s
time.
Interrupt started I/O can be used to solve this problem. The interface creates an interrupt when it
determines that the peripheral is ready for data transmission. When the CPU receives an interrupt
signal, it stops what it’s doing and handles the I/O transfer before returning to its prior processing
activity.

6 
UNIT 02: Machine Instructions and Programs JGI JAIN
DEEMED-TO-BE UNIVERSITY

2.4.4 Direct Memory Access


The speed of transmission would be improved by removing the CPU from the pipeline and allowing the
peripheral device to control the memory buses directly. DMA is the name for this method.
The interface transfers data to and from memory through the memory bus in this case. A DMA controller
is responsible for data transmission between peripherals and the memory unit.
DMA is used by many hardware systems, including disc drive controllers, graphics cards, network cards,
and sound cards, among others. In multicore CPUs, it’s also utilised for intra-chip data transmission.
In DMA, the CPU would start the transfer, perform other tasks while it was running, and then get an

D
interrupt from the DMA controller when the transfer was finished.

E
2.5 Subroutines

V
In a given programme, it’s common to have to repeat a subtask several times with various data values.
A subroutine is a term used to describe such a subtask.

R
It is feasible to include the block of instructions that make up a subroutine at any point in the programme

E
where it is required. However, to save memory, just one copy of the instructions that make up the
subroutine is stored in memory, and any programme that needs to utilise it simply branches to the

S
beginning of the subroutine. We say that a programme is invoking a subroutine when it branches to it.
Call is the name of the instruction that conducts this branch action.
E
The calling programme must continue execution once a subroutine has been run, commencing
R
immediately after the instruction that called the function. By performing a Return instruction, the
subroutine is said to return to the programme that called it. Because the subroutine may be called from
several locations in a calling programme, it must be possible to return to the correct position. While
T

the Call instruction is being executed, the updated PC points to the place where the calling programme
resumes execution. As a result, the Call instruction must preserve the contents of the PC in order to
H

return to the caller application correctly.


IG

The subroutine linkage technique is the mechanism through which a computer allows you to call and
return from subroutines. The most basic way of linking subroutines is to save the return address in a
specified place, which may be a register devoted to this function. The link register is a type of register. The
R

Return instruction returns to the caller programme by branching indirectly through the link register
after the subroutine has completed its work.
Y

The Call instruction is a special branch instruction that does the following tasks:
In the link register, save the contents of the PC.
P

zz

zz Go to the address given in the instruction’s target address.


O

Return is a special branch instruction that performs the following operation:


C

zz Make a branch to the link register’s address.

2.6  Additional Instructions


So far, we’ve covered Move, Load, Store, Clear, Add, Subtract, Increment, Decrement, Branch, Testbit,
Compare, Call, and Return commands. We were able to build routines to demonstrate machine
instruction sequencing, including branching and the subroutine structure, using these 13 instructions
and the addressing modes. The fundamental memory-mapped I/O operations were also shown. Move
can be used in place of Store, while Add and Subtract can be used in place of Increment and Decrement,

 7
JGI JAIN
DEEMED-TO-BE UNIVERSITY
Computer Organization and Architecture

respectively. A Move instruction with a zero immediate operand can also be used to replace Clear. As a
result, simply 8 instructions would have sufficed for our needs. However, considerable redundancy in
real machine instruction sets is not uncommon. Certain basic procedures may typically be carried out
in a variety of ways. Some options could be more effective than others. We’ll go over a couple more key
instructions that are included in most instruction sets in this section.
zz Logic Instructions: The basic building blocks of digital circuits are logic operations such as AND, OR,
and NOT applied to individual bits. It’s also useful to be able to conduct logic operations in software,
which is done using instructions that apply these operations separately and in parallel to all bits of
a word or byte. For instance, consider the instruction.

D
Not dst

E
zz Shift and Rotate Instructions: Many applications demand that the bits of an operand be shifted
right or left by a certain amount of bit positions. Whether the operand is a signed integer or some

V
more generic binary-coded information determines the specifics of how the shifts are executed. We
employ a logical shift for generic operands. We utilise an arithmetic shift for a number, which keeps

R
the integer’s sign.
zz Logical Shifts: Two logical shift instructions are required, one for left (LShiftL) and the other for

E
right (LShiftR) (LShiftR). These instructions shift an operand across a number of bit locations given
in the instruction’s count operand. A logical left shift instruction might have several different forms.

S
LShiftL count,dst

2.7 Encoding of Machine Instructions


E
R
A number of helpful instructions and addressing modes have been implemented. These instructions
define the steps that the processor circuitry must do in order to complete the tasks. We’ve referred to
T

them as “machine instructions” on several occasions. Actually, the format in which the instructions were
provided is similar to that used in assembly languages, with the exception that we attempted to avoid
H

using acronyms for the various processes, which are difficult to remember and are likely to be peculiar
to a certain commercial processor. An instruction must be encoded in a compact binary pattern in order
IG

to be executed in a processor. Machine instructions are the correct term for such encoded instructions.
Assembly instructions are those that employ symbolic names and acronyms.
The assembler software is used to transform the language instructions into machine instructions. We’ve
R

seen instructions for adding, subtracting, moving, shifting, rotating, and branching. These instructions
can employ a variety of operands, including 32-bit and 8-bit integers, as well as 8-bit ASCII-encoded
Y

characters. An encoded binary pattern known as the OP code for the given instruction can be used to
specify the type of operation to be performed and the type of operands to be used. Assume that 8 bits are
P

set aside for this purpose, allowing you 256 distinct ways to define various instructions. The remaining
24 bits are used to specify the remaining information.
O

Let’s look at a few examples. The directive is:


C

Add R1, R2
In addition to the OP code, the registers R1 and R2 must be specified. If the CPU has 16 registers, each one
requires four bits to identify. For each operand, additional bits are required to signal that the Register
addressing mode is being utilised.
The Instruction is:
Move 24(R0), R5

8 
UNIT 02: Machine Instructions and Programs JGI JAIN
DEEMED-TO-BE UNIVERSITY

16 bits are needed to represent the OP code and the two registers, as well as a few bits to indicate that
the source operand utilises Index addressing mode and that the index value is 24.
The instructions for the shift is:
LShiftR #2, R0
The move instruction is:
Move #$3A, R1

D
In addition to the 18 bits needed to describe the OP code, the addressing modes, and the register, the
immediate values 2 and #$3A must be specified. The size of the immediate operand is thus limited to

E
what can be expressed in 14 bits. Consider next the branch instruction:
Branch >0 LOOP

V
The OP code is 8 bits again, leaving 24 bits to define the branch offset. Because the offset is a two-

R
symbol integer, the branch target address must be within 223 bytes of the branch instruction’s position.
An alternative addressing mode, such as Absolute or Register Indirect, must be used to branch to an

E
instruction beyond this range. Jump instructions are branch instructions that make advantage of these
modes.

S
In all these examples, the instructions can be encoded in a 32-bit word, as shown in Figure 1:
E
R
8 7 7 10
OP code Source Dest Other info
T

(a) Own-word instruction


H

OP code Source Dest Other info


IG

Memory address/Immediate operand

(b) Two-word instruction


R

OP code Ri Rj Other info


Y

(c) Three-operand instruction


P

Figure 1: Encoding Instruction of 32 bit Word


O

Depicts a possible format. There is an 8-bit Op-code field and two 7-bit fields for specifying the source
and destination operands. The 7-bit field identifies the addressing mode and the register involved (if
C

any). The “Other info” field allows us to specify the additional information that may be needed, such as
an index value or an immediate operand.
But what if we wish to use the Absolute addressing mode to specify a memory operand?
The instruction
Move R2, LOC

 9
JGI JAIN DEEMED-TO-BE UNIVERSITY
Computer Organization and Architecture

The OP code, the addressing modes, and the register all require 18 bits. This leaves 14 bits to express the
LOC-related address, which is plainly insufficient.
And #$FF000000. R2
In which case, the second word gives a full 32-bit immediate operand. If we wish to use the Absolute
addressing mode to provide two operands for an instruction, we can do so. for example
Move LOC1, LOC2
The operands’ 32-bit addresses must then be represented using two extra words. This method yields

D
instructions of varying lengths, depending on the number of operands and addressing modes employed.
We may create fairly complicated instructions using several words, which are quite similar to operations

E
in high-level programming languages. The name “complex instruction set computer” (CISC) has been
applied to processors that employ this sort of instruction set. The requirement that an instruction take

V
up just one word has resulted in a type of computer called as a limited instruction set computer (RISC).
Other constraints imposed by the RISC method include the need that all data modification is done on

R
operands existing in processor registers. Because of this limitation, the above addition would need a
two-instruction sequence:

E
Move (R3), R1

S
Add R1, R2
E
Only a part of a 32-bit word is required if the Add instruction only needs to identify the two registers.
As a result, we may be able to give a more powerful command with three operands:
R
Add R1, R2, R3
T

Which performs the operation,


R3= [R1] + [R2]
H
IG

Conclusion 2.8 Conclusion

zz Machine instructions and operand addressing information are represented by symbolic names in
R

assembly language.
zz The assembly language is used to specify these generic programmes.
Y

zz Data structures are used by programmers to represent the data utilised in computations.
P

zz Constants, local and global variables, pointers, and arrays are often used in high-level programming
languages.
O

zz Addressing modes relate to the many methods in which an operand’s location is stated in an
instruction.
C

zz A programme called an assembler can automatically transform programmes written in an assembly


language into a series of machine instructions.
zz The assembler programme is one of the utility applications included in the system software.
zz An efficient mode of communication between the central system and the outside environment is
provided by a computer’s I/O subsystem. It is in charge of the computer system’s entire input-output
operations.

10 
UNIT 02: Machine Instructions and Programs JGI JAIN
DEEMED-TO-BE UNIVERSITY

zz Peripheral devices are input or output devices that are connected to a computer.
zz I/O instructions written in a computer programme result in programmed I/O instructions.
zz The CPU remains in the programme loop in the programmed I/O technique until the I/O unit
indicates that it is ready for data transfer.
zz The speed of transmission would be improved by removing the CPU from the pipeline and allowing
the peripheral device to control the memory buses directly. DMA is the name for this method.
zz An instruction must be encoded in a compact binary pattern in order to be executed in a processor.
Machine instructions are the correct term for such encoded instructions.

D
zz The assembler software is used to transform the language instructions into machine instructions.

E
zz An encoded binary pattern known as the OP code for the given instruction can be used to specify the
type of operation to be performed and the type of operands to be used.

V
2.9 Glossary

R
Indirect mode: The contents of a register or memory location whose address is specified in the

E
zz
instruction are the operand’s effective address.

S
zz Index mode: By adding a constant value to the contents of a register, the operand’s effective address
is produced.
zz
E
Relative mode: The Index mode determines the effective address by utilising the programme counter
R
instead of the general-purpose register Ri.
zz Auto increment mode: The contents of a register provided in the instruction are the operand’s
effective address. The contents of this register are automatically increased to refer to the next item
T

in a list after accessing the operand.


H

zz Auto decrement mode: The contents of a register provided in the instruction are decremented
automatically before being utilised as the operand’s effective address.
IG

zz Register mode: The operand is the contents of a processor register; the register’s name (address) is
specified in the instruction.
zz Absolute mode: The operand is stored in memory, and the location’s address is specified directly in
R

the instruction.
Immediate mode: The operand is given explicitly in the instruction.
Y

zz
P

2.10  Self-Assessment Questions


O

A. Multiple Choice Questions


C

1. The field for the operation code can be found in __________.


a. programming language instruction b. assembly language instruction
c. machine language instruction d. none of the mentioned
2. Which of the following are the elements of a machine language instruction format?
a. Operand field b. Operation code field
c. Operation code field & operand field d. none of the mentioned Microeconomics

 11
JGI JAIN
DEEMED-TO-BE UNIVERSITY
Computer Organization and Architecture

3. The one-byte instruction has a length of __________.


a. 2 bytes b. 1 byte
c. 3 bytes d. 4 bytes
4. The ‘register to register’ instruction format has a length of __________.
a. 2 bytes b. 1 byte
c. 3 bytes d. 4 bytes
5. In a computer instruction format, the R/M field provides __________.

D
a. another register b. another memory location
c. other operands d. all of the mentioned

E
6. In a machine instruction format, S-bit is the __________.

V
a. status bit b. sign bit

R
c. sign extension bit d. none of the mentioned
7. The bit that the ‘REP’ instruction uses is __________.

E
a. W-bit b. S-bit

S
c. V-bit d. Z-bit

a. 8 bits
E
8. The operand is of __________ if a W-bit value is ‘1’.
b. 4 bits
R
c. 16 bits d. 2 bits
9. In which of the following mode the operand is stored in memory, and the location’s address is
T

specified directly in the instruction?


H

a. Autodecrement mode
b. Register mode
IG

c. Absolute mode
d. Immediate mode
R

10. Instructions that transfer control to a preset address or an address specified in the instruction are
referred to as.
Y

a. sequential control flow instructions


b. control transfer instructions
P

c. sequential control flow & control transfer instructions


O

d. none of the mentioned


11. JUMP is a command that belongs to __________.
C

a. sequential control flow instructions b. control transfer instructions


c. branch instructions d. control transfer & branch instructions
12. The address mode instruction MOV AX, 0005H corresponds to __________.
a. register b. direct
c. immediate d. register relative

12 
UNIT 02: Machine Instructions and Programs JGI JAIN
DEEMED-TO-BE UNIVERSITY

13. The instruction, MOV AX, 1234H is an example of __________.


a. register addressing mode b. direct addressing mode
c. immediate addressing mode d. based indexed addressing mode
14. The instruction, MOV AX, [2500H] is an example of __________.
a. immediate addressing mode b. direct addressing mode
c. indirect addressing mode d. register addressing mode
15. The instruction, MOV AX,[BX] is an example of __________.

D
a. direct addressing mode b. register addressing mode
c. register relative addressing mode d. register indirect addressing mode

E
V
B. Essay Type Questions
1. Addressing modes relate to the many methods in which an operand’s location is stated in an

R
instruction. Discuss the different types of addressing modes.
2. What do you understand by assembly language?

E
3. Peripheral devices are input or output devices that are connected to a computer. Discuss the different

S
types of peripheral devices.
4. Write the brief note on direct memory access. E
5. Discuss the shift and rotate instructions.
R
2.11  Answers AND HINTS FOR Self-Assessment Questions
T
H

A. Answers to Multiple Choice Questions


IG

Q. No. Answer
1. c.  branch instructions
2. c.  Operation code field & operand field
R

3. b.  1 byte
Y

4. a.  2 bytes
5. d.  all of the mentioned
P

6. c.  sign extension bit


O

7. d. Z-bit
8. c.  16 bits
C

9. c.  Absolute mode


10. b.  control transfer instructions
11. d.  control transfer & branch instructions
12. c. immediate
13. c.  immediate addressing mode
14. b.  direct addressing mode

 13
JGI JAINDEEMED-TO-BE UNIVERSITY
Computer Organization and Architecture

Q. No. Answer
15. d.  register indirect addressing mode

B. Hints for Essay Type Questions


1. Different types of addressing modes are as follows:
 Register mode: The operand is the contents of a processor register; the register’s name (address)
is specified in the instruction.
Absolute mode: The operand is stored in memory, and the location’s address is specified directly

D

in the instruction. (This mode is known as Direct in various assembly languages.)

E
Refer to Section Addressing Modes
2. A programming language, gen, is made up of a comprehensive collection of such symbolic names

V
and rules for their use. A programming language, often known as an assembly language, is made
up of a comprehensive collection of such symbolic names and rules for their use. Refer to Section

R
Assembly Language

E
3. There are three types of peripherals:
Input peripherals: These devices allow users to enter data from the outside world into the

S

computer. For instance, a keyboard, a mouse, and so on.
Refer to Section Basic Input and Output Operations E
4. The speed of transmission would be improved by removing the CPU from the pipeline and allowing
R
the peripheral device to control the memory buses directly. DMA is the name for this method. The
interface transfers data to and from the memory through the memory bus in this case. A DMA
controller is responsible for data transmission between peripherals and the memory unit. Refer to
T

Section Basic Input and Output Operations


H

5. Many applications demand that the bits of an operand be shifted right or left by a certain amount
of bit positions. Whether the operand is a signed integer or some more generic binary-coded
IG

information determines the specifics of how the shifts are executed. We employ a logical shift for
generic operands. We utilise an arithmetic shift for a number, which keeps the integer’s sign. Refer
to Section Additional Instructions
R

@ 2.12  Post-Unit Reading Material


Y

https://www.studocu.com/in/document/psg-college-of-technology/computer-architecture/m-
P

zz
morris-mano-solution-manual-computer-system-architecture/10775236
O

zz https://www.educba.com/what-is-assembly-language/
C

2.13  Topics for Discussion Forums

zz Discuss with the classmates about the manner in which sequences of instructions are transferred
from memory into the processor.

14 

You might also like