[Debug This] : 8086 Assembly Level Program to Find The Greatest Number

fasihxkhatib

Distinguished
Aug 25, 2011
74
0
18,580
0
data segment
ARR db 01h,03h,02h,04h,05h,09h,01h
data ends
code segment
assume cs:code,ds:~data --just to avoid the smiley
start:
MOV AX,data
MOV DS,AX
MOV CX,0006H --Load CX with 6 as there will be 6 comparisons b/w 7 numbers
MOV SI,offset ARR --point to the variable ARR
MOV AL,[SI] --load the first number 01H in AL register
loop_start: --label to mark the beginning of the loop
INC SI --point to the second number in ARR
CMP AL,[SI]
JB swap
LOOP loop_start

swap:
MOV AL,[SI]
LOOP loop_start

int 3
code ends
end start


[QUESTION] :
do you think that this is the right code to find the largest of the given number?
This is my own program and it didnt work well when I executed it. Dont know whats going wrong.
HELP ASAP :)
 

Ijack

Distinguished
That doesn't answer my question. I don't care what assembler you used.

You say it didn't work well when you executed it. So what result did you get?

The easiest way to discover faults in this sort of program is to run it under a debugger. Single-step it and see what is happening.
 
Thread starter Similar threads Forum Replies Date
C Apps General Discussion 1
A Apps General Discussion 10
C Apps General Discussion 1
S Apps General Discussion 3
G Apps General Discussion 1
X Apps General Discussion 9
A Apps General Discussion 8
N Apps General Discussion 2
F Apps General Discussion 1
I Apps General Discussion 3
N Apps General Discussion 1
memadmax Apps General Discussion 4
S Apps General Discussion 3
L Apps General Discussion 1
L Apps General Discussion 8
callumparker666 Apps General Discussion 6
wolfram23 Apps General Discussion 3
L Apps General Discussion 2
A Apps General Discussion 9
T Apps General Discussion 2

ASK THE COMMUNITY