How to write if statements in Pep9 Assembly? I want to write this if statement from C in Pep9 Assembly form.
if ( (0 < weight) && (weight <= 1 ) ) {
printf("Light Weight\n");
}
else if((1 < weight) && (weight <= 3)){
printf("Medium Weight\n");
}
But I fail to print the results when the input is more than 1. This is what I have so far:
if: LDWA weight,s ;if(0 < weight)
CPWA limit11,i
BRLT msg1
LDWA weight,s ;if(weight <= 1)
CPWA limit12,i
BRGT msg1
STRO cost1,d
cost1: .ASCII "Low Weight\n\x00"
msg1: .END
if: LDWA weight,s ;if(1 < weight)
CPWA limit21,i
BRLT msg2
LDWA weight,s ;if(weight <= 3)
CPWA limit22,i
BRGT msg2
STRO cost2,d
cost2: .ASCII "Medium Weight
The first if statement works fine. But the second one fails to print anything. Can you please point out where the problem is?