Bubble sort on array on Assembly Language

For the 1st error you forgot to type a comma between the register and the immediate.

For the 2nd and 3rd errors the CH and CL registers cannot be used for addressing memory. Use SI, DI, or BX instead.

Since your array is defined as words you must treat it as such!
Change

mov dh,[ARR+ch]
mov dl,[ARR+cl]

into something like (depends on other choices you make)

mov ax,[ARR+si]
mov dx,[ARR+di]

Please note that you placed the array amidst the instructions. This will crash your program as soon as you manage to compile it. Either place the array in a separate data segment of your program or jump over this line.

start:
 mov ax,code
 mov ds,ax
 jmp start2
ARR:   dw 1,2,4,3,6,5,9
start2:
 mov ch,0h

Leave a Comment