Clear all

[Solved] CS401 Assignment 2 (Practical) Fall 2021

Joined: 3 years ago
Posts: 6751
Topic starter  

Computer Architecture and Assembly Language Programming Practical (CS401P)

Assignment No. 2

Total marks = 20

Deadline Date: 04 January 2022

Please carefully read the following instructions before attempting assignment.


It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after the due date.
  • The submitted assignment does not open or file is corrupt.
  • Strict action will be taken if submitted solution is copied from any other student or from the internet.


You should concern the recommended books to clarify your concepts as handouts are not sufficient.

You are supposed to submit your assignment in .zip or rar format.

Any other formats like scan images, PDF, doc, docx, ppt and bmp etc. will not be accepted.

Lectures covered: 1-6

Topics covered: Indirect Addressing


No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning). Hence refrain from uploading assignment in the last hour of the deadline. It is recommended to upload your solution file at least two days before its closing date.

If you find confusion in the assignment (Question statement), please contact your instructor before the deadline. After the deadline, no queries will be entertained in this regard.

For any query, feel free to email at [email protected]

Write an assembly language program that sort digits from your VU id using selection sort:

  • First store numbers of your VUID in the memory variable(array).
  • Sort VUID in the ascending order using selection sort.
  • After sorting each number write back to same variable declared initially.
  • At the end of program the sorted id must be stored in memory.

Note: Save the .asm file with first four digits of your VUID.asm. You must use your own VUID otherwise assignment will not be accepted.

Submission details:

Following are required in a single zipped file

  • Assembly language program.
  • GIF showing complete process of assembling and debugging.


 “Best of luck”






; sorting a list of ten numbers using bubble sort

[org 0x0100]

                        jmp start

vuid: dw 6, 5, 7, 4, 9, 1, 4, 8, 2, 0

swap: db 0

start:                mov di, 0                     ; set index to zero

                        mov byte [swap], 0     ; set swap flag to no swaps

check:              mov ax, [vuid+di]       ; move the digit of vuid in the ax

                        cmp ax, [vuid+di+2]   ; compare the digit of vuid with its next digit

                        jbe noswap                  ; jump to noswap, if there is no need of swapping 

                        mov bx, [vuid+di+2]   ; move second digit in bx

                        mov [vuid+di+2], ax   ; swap first digit  in second

                        mov [vuid+di], bx       ; swap second digit in first

                        mov byte [swap], 1     ; set the flag that a swap has been done

noswap:           add di, 2                      ; add 2 in bx

                        cmp di, 18                   ; check if we are at last index

                        jne check                     ; if not compare next two

                        cmp byte [swap], 1     ; check if a swap has been done

                        je start             ; if yes make another pass

end:                 mov ax, 0x4c00                      ; terminate program

                        int 0x21

Students kindly share assignment files in relevant subject timely for discussion/solution.
or directly share with us " Click here"
QueryVU Telegram Groups subject wise Join Now
QueryVU WhatsApp groups subject wise Join Now