Preview

Bubble Sort Using Assembly Language

Satisfactory Essays
Open Document
Open Document
328 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Bubble Sort Using Assembly Language
TITLE PAGE

Course Number: ECE-5590ES/ E&C-ENGR 429
Laboratory: Bubble Sort
Date: 04/08/2013
Due Date: 04/15/2013
Student Number: 16146570
Student Name: Vinay Vasanth

OBJECTIVE: The objective of the lab session is to write an assembly level language program to sort an array of decimal numbers in ascending order.

EQUIPMENTS AND SOFTWARE PACKAGES:
PC, PCB with HCS12 Microcontroller and MINI IDE software.
THEORY:
HCS12 microcontroller is an 8bit microcontroller, manufactured by Free scale Semiconductors. It has three 8bit registers (A, B, CCR) and four 16bit pointers(X, Y, SP, PC).
A bubble sort algorithm loops through a set of data items. Comparing items and switching them if they are in the wrong order. This process is repeated until the list is sorted. It is called a bubble sort because the smaller items “bubble up” towards the top of the list.

PROCEDURE: 1. Open the mini IDE software.
2. Type the ALP in the mini IDE text editor or in the Note pad and Load the ALP.
3. Turn on the board by connecting +5v power supply and ground terminal.
4. Build the Program using build option and check for any errors (correct if any) (this step generates a source file with extension .s19).
5. Now load the program using the Load instruction and download option available in the dropdown menu in terminal command.
6. Now verify the result by noting the values in different memory locations and comparing it with the expected result.
7. Finish.
Program:
ORG $0900
ARRAY: DC.B 7,6,1,3,9,1,8,2,4,3,5
COUNT1: EQU $0871
COUNT2: EQU $0872
ORG $0800
LDAA #10
STAA COUNT2
BACK: LDX #$0900
LDY #$0901
LDAA #10
STAA COUNT1
CLRA
AGAIN: LDAA 0, X
CMPA 0,Y
BCC LOOP
INX
INY
DEC COUNT1
BNE AGAIN
DEC COUNT2
BNE BACK
SWI
LOOP: LDAA 0,X
PSHA
PULB
LDAA 0,Y
STAB 0,Y
STAA 0,X
INX
INY
DEC COUNT1
BNE AGAIN
DEC COUNT2
BNE BACK
SWI
Result:
MD 0900
0900 01 01 02 03 03 04 05 06 07 08 09……………

Conclusion:

You May Also Find These Documents Helpful

  • Good Essays

    Nt1420 Unit 6

    • 1145 Words
    • 5 Pages

    INSTRUCTIONS: 1. THERE ARE SIX (6) QUESTIONS IN THIS PAPER. 2. ANSWER FIVE (5) QUESTIONS ONLY. Question 1 Arrays are used when storing a large number of values. You are required to create an array named a and answer the following questions regarding array manipulation. a. Write a method fillRandom(int[] a, int min, int max), fill the array a with a random integer value. (Note: Math.random() returns a double in the range of 0.0 and 1.0, therefore it is cast to an integer number, between the minimum and maximum value). [6 marks] b. Write the Bubble sort method to sort array a into descending order. [10 marks] c. In the quicksort, an algorithm an element is chosen from the unsorted list. This element is called the…

    • 1145 Words
    • 5 Pages
    Good Essays
  • Good Essays

    It/210 Final Exam

    • 1235 Words
    • 5 Pages

    4. The calculation should be executed only after all the valid input values are provided.…

    • 1235 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    B. Write Code inside the main method and test it by compiling (F9) and running (Shift + F6) your code.…

    • 2338 Words
    • 10 Pages
    Powerful Essays
  • Powerful Essays

    Mat 540 Week 4 Paper

    • 1775 Words
    • 8 Pages

    * Provide a set of values that will test the normal operation of this program segment. Defend your choices.…

    • 1775 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    pt1420 exam review

    • 738 Words
    • 3 Pages

    1 - Design the Program2 - Write the Code3 - Correct Syntax Errors4 - Test the Executable Code…

    • 738 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Sheet01

    • 1045 Words
    • 5 Pages

    1. Find the total amount of the memory in units requested, for each of the following CPUs, given the size of the address buses: a) 16-bit address bus. (in K) b) 24-bit address bus. (in megs) c) 32-bit address bus. (in megabytes and gigabytes) d) 48-bit address bus. (in megabytes, gigabytes, and terabytes)…

    • 1045 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The individual operations used in a computer program are often grouped into logical units called _____________.…

    • 4265 Words
    • 23 Pages
    Satisfactory Essays
  • Satisfactory Essays

    CS 220 – Programming w/ Data Structures: You have missed one assignment and one quiz. Your instructor has extended your assignment due date to this Sunday, April 10. Your instructor has also let you to take your Quiz # 2 during his office hours during this week. Let me know if you need additional support to study for this quiz. Your grade to date in this class is 30.2/37 81.62% B.…

    • 354 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Sorting Algorithm

    • 12285 Words
    • 83 Pages

    in a row, the first n of them filled with a soda drink while the remaining n…

    • 12285 Words
    • 83 Pages
    Better Essays
  • Good Essays

    CHAPTER07

    • 5365 Words
    • 46 Pages

    It is invalid since more than one array is dimensioned by a single Dim statement.…

    • 5365 Words
    • 46 Pages
    Good Essays
  • Satisfactory Essays

    Java Heap Size Problem

    • 406 Words
    • 2 Pages

    3. Repeat step 2 on gui.bat also located in the directory the tool was installed to.…

    • 406 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    lab1_32x32_registerfile

    • 1009 Words
    • 7 Pages

    For this lab1 you are to construct a 32 by 32 register file using Verilog HDL. The…

    • 1009 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    Geoserver Developer

    • 3041 Words
    • 13 Pages

    4.1 Check out source code . . . . . . . . . . .…

    • 3041 Words
    • 13 Pages
    Satisfactory Essays
  • Powerful Essays

    C Program

    • 2161 Words
    • 9 Pages

    // This file is a good place to add code for any additional processing that is…

    • 2161 Words
    • 9 Pages
    Powerful Essays
  • Satisfactory Essays

    Embedde

    • 339 Words
    • 2 Pages

    The program is a native 32bit application that runs under the Windows 95, 98, NT 4, 2000 and XP operating systems.…

    • 339 Words
    • 2 Pages
    Satisfactory Essays