You are on page 1of 6

Computer Organization and Assembly Language

Program 8

Ø

Write an assembly language instruction
that gets the highest and the lowest
numbers in a list. The list contains bytesize signed numbers and is stored at
memory location ALPHA. The list is
terminated with a sentinel number FFH
(note that the sentinel is not part of the list).
Place the highest number in memory
location HIGH and the lowest number in
memory location LOW. Assume that there
is at least one element in the list.

Assembly Language Programming Techniques (cont.)

* Property of STI
Page 1 of 6

Computer Organization and Assembly Language

Program 9

Ø

Write an assembly language program that
adds the elements in a list. The list
contains byte-size signed numbers and is
stored at memory location ALPHA. The
number of elements in the list is stored at
byte memory location COUNT. Place the
result in memory location SUM. Assume
that there is at least one element in the list.

Assembly Language Programming Techniques (cont.)

* Property of STI
Page 2 of 6

Computer Organization and Assembly Language

Program 10

Ø

Write an assembly language program that
reads a byte from memory location INPUT.
The program should then examine this byte
to determine which bit is a logic 1. If the
first bit (b0) is a logic 1, then the program
should load 01H to memory location
OUTPUT. If the second bit (b1) is a logic
1, then the program should load 02H to
memory location OUTPUT. And so on and
so forth. If the byte is equal to 00H (there
is no bit equal to logic 1), then the program
should terminate. Assume that only one of
the bits (b0 to b7) can be equal to 1.

Assembly Language Programming Techniques (cont.)

* Property of STI
Page 3 of 6

Computer Organization and Assembly Language

Program 11

Ø

Write an assembly language program that
adds two 32-bit numbers and stores the
result in memory location GAMMA. The
first 32-bit number is located at memory
location ALPHA, while the second 32-bit
number is located at memory location
BETA.

ALPHA:

78H

11H

89H

56H

22H

79H

34H
12H

EEH
FFH

23H
11H

BETA:

Assembly Language Programming Techniques (cont.)

GAMMA:

* Property of STI
Page 4 of 6

Computer Organization and Assembly Language

Program 12

Ø

Write an assembly language program that
adds two 64-bit numbers and stores the
result at memory location GAMMA. The
first 64-bit number is located at memory
location ALPHA, while the second 64-bit
number is located at memory location
BETA.

Assembly Language Programming Techniques (cont.)

* Property of STI
Page 5 of 6

Computer Organization and Assembly Language

Program 13

Ø

Write an assembly language program that
adds two 2-decade BCD numbers and
stores the result at memory location
GAMMA. The first 2-decade BCD number
is located at memory location ALPHA,
while the second 2-decade BCD number is
located at memory location BETA.
Assume that there would not be a carry
from the least significant decimal number
to the most significant decimal number.

Assembly Language Programming Techniques (cont.)

* Property of STI
Page 6 of 6