jl and jg?
ok i have this problem in mind i wanted to try but i cant figure out whats wrong with my code..the program lets you input a string of integers then press another input as target..The target is then cmp to the string..the output should place lesser values on the string based on the specifed target ex.
string: 12456
target: 2
output: 1
.model small
.stack
.data
.code
start:
push 0ah ; push linefeed indication of stack
start1:
mov ah,1
int 21h
push ax ; data place at stack
cmp al,0dh
je out1 ; will jump if equal to cmp al,0dh
jne start1 ; will jump if not equal to cmp al,0dh
out1:
mov ah,2
mov dl,0ah ;linefeed
int 21h
target:
pop bx
mov ah,1
int 21h
tests:
cmp al,bl
jl out2
out2:
pop bx
mov ah,2
mov dl,al
int 21h
cmp al,0ah
jne tests
je fin
fin:
mov ah,4ch
int 21h
end start
need help...im just wondering how come it wont workout the way i wanted it to workout..
jingo1126
Junior Poster in Training
57 posts since Aug 2009
Reputation Points: 10
Solved Threads: 1
Not to cloud the issue, but first you need to deterimine if you are working with signed versus unsigned data? You need to use a different compare based upon the type of data you're using!
Above & Below --> Unsigned
Less & Greater --> Signed
Unsigned:
JA, JNBE Jump if above (>)
JAE JNB (>=)
JBE, JNA (<=)
JB, JNAE (<_
Signed:
JG, JNLE (>)
JGE, JNL (>=)
JLE, JNG (<=)
JL, JNGE (<)
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99