Hi,I am trying to do if statement in Assembly but it doesnt work.Could you help me
putstr is predifine macro

.model Flat
include Cs266.inc
mes1 DB "First Greater"
mes2 DB "Second Greater"
var1 DD 22
var2 DD 9
mov EAX,var1
cmp EAX,var2
jge else
jmp end_if
putstr mes1
JMP exit
putstr mes2

Recommended Answers

All 3 Replies

>>but it doesnt work
What does that mean???

lines 13 and 14 could be both replaced by one line: jl end_if

It prints First Greater Second Greater,instead only one or the other

Most likely because you failed to terminate the two strings on lines 5 and 6. How is putstr() supposed to know where the end of the string is? int 21 uses $ as a string terminator, while C and C++ languages use 0.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.