/8086_Assembly

Assignment of IS224 in SJTU, codes in 8086.

Primary LanguageAssembly

8086 Assembly

This is my assignment of IS224 in SJTU.

1. Quick Sort

Implementation is shown in quick_sort.asm with detailed annotation. I also implemented this algorithm in C and Python. See quicksort.cpp and quicksort.py for details.

Description

The heart of quickSort is the partition algorithm. And I offered two ways to implement partition in C, which are in function divide() and partition(). divide() is faster but harder to implement in Assembly because there are many loops. partition() is easier to implement in Assembly, which is used in my quick_sort.asm.

Hot to Use

Download EMU8086 here. And quick_sort.asm can be run in EMU8086. It may take a while if you sort an array of length 50. You can change numbers to sort in the following part. Don't forget to change the value of r, which is the length of array - 1.

;-----------------------------------------
; array of N integers
arr dw ;N integers
;-----------------------------------------
i dw ? ; for loop
j dw ? ; for loop
p dw 0 ; start of the array (0)
r dw N-1 ; end of the array (length - 1)
q dw ? ; store the partition return
x dw ? ; x is used in partition

TODO 🚩

  • implement divide() in assembly.