[go: up one dir, main page]

0% found this document useful (0 votes)
66 views13 pages

Assembly Programming Problem Set Hints

The document provides hints for Problem Set 3, which includes three problems related to assembly language programming. Problem 1 involves rotating a 16-bit register without carry, while Problem 2 requires sorting an array of ten 8-bit numbers in ascending order using a bubble sort algorithm. Problem 3 focuses on sorting an array from external memory in descending order, with specific instructions for accessing external memory.

Uploaded by

V Prakash Singh
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)
66 views13 pages

Assembly Programming Problem Set Hints

The document provides hints for Problem Set 3, which includes three problems related to assembly language programming. Problem 1 involves rotating a 16-bit register without carry, while Problem 2 requires sorting an array of ten 8-bit numbers in ascending order using a bubble sort algorithm. Problem 3 focuses on sorting an array from external memory in descending order, with specific instructions for accessing external memory.

Uploaded by

V Prakash Singh
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

Problem Set 3 Hints

Feb,01 2021
Problem 1
Treat thh register R4(MSB) and R3 of the Register Bank 1 as a
16-bit register and rotate them 2 places to left with out involving
carry.

Figure: Figure for Problem 1

Problem Set 3 Hints


Problem 1 : Hint (Rotate One bit left)

S1 Load the lower 8-bits (value in R3) into A register.

S2 Rotate left along with carry. Use RLC

S3 Load the upper 8-bits (value in R4) into A register.

S4 Rotate left along with carry. Use RLC

S5 Store the result in A to R4. (We got upper 8 bits correctly)

S6 Load the lower 8-bits (value in R3) into A register.

S7 Rotate left along with carry. Use RLC

S5 Store the result in A to R3. (We got lower 8 bits correctly)

Problem Set 3 Hints


Problem 1: Example

Figure: Pseudocode

Problem Set 3 Hints


Problem 2

Write a program to sort an array of ten 8 bit numbers available in


internal RAM 40h and onwards in ascending order.

After ordering, lowest value must appear at 40h.

Problem Set 3 Hints


Problem 2: Bubble Sort Algorithm

Iterate for the number of elements.

In the first iteration, start with the first element and compare the
current element with the next element of the array.

If the current element is greater than the next element of the array,
swap the two elements.

If the current element is less than the next element, move to the
next element until the end of array. The largest element among the
unsorted elements is placed at the end.

The same process is repeated in the remaining iterations. In each


iteration, the comparison takes place up to the last unsorted element.

Problem Set 3 Hints


Problem 2: Pseudocode

Problem Set 3 Hints


Problem 2: Assembly Language Programming

Figure: Assembly Language Program

Problem Set 3 Hints


Problem 2: Assembly Language Programming

Figure: Assembly Language Program

Problem Set 3 Hints


Problem 2: Assembly Language Programming

Figure: Assembly Language Program

Problem Set 3 Hints


Problem 2: Solution

Problem Set 3 Hints


Problem 2: Test Result

Problem Set 3 Hints Figure: Test Results for Problem 2


Problem 3

Write a program to sort an array starting from external memory


location 2000H in descending order.

Number of data elements is stored on external memory location


1FFFH.
HINT Use MOVX,DPTR for external memory access.

Problem Set 3 Hints

You might also like