I'm currently learning about AT&T Assembly, and i'm having a problem with conditional jump. Here's what i'm doing
.section .data
msg_less:
.string "Less than 65"
msg_greaterequal:
.string "Greater than or equal to 65"
.section .bss:
.lcomm input, 2
.section .text
.globl _start
_start:
#Input a char
movl $3, %eax
movl $0, %ebx
movl $input, %ecx
movl $2, %edx
int $0x80
#Output the previous char
subl $1, (input)
movl $4, %eax
movl $1, %ebx
movl $input, %ecx
movl $2, %edx
int $0x80
#Check if the numeric value of the input char is less / greater than or equal to 65
#If input < 65
cmpl $65, (input)
jl .L_less
#Else: input >= 65
movl $4, %eax
movl $1, %ebx
movl $msg_greaterequal, %ecx
movl $28, %edx
int $0x80
jmp .L_End
.L_less:
movl $4, %eax
movl $1, %ebx
movl $msg_less, %ecx
movl $13, %edx
int $0x80
#End
.L_End:
movl $1, %eax
int $0x80
The "Input" and "Print previous char" worked correctly, but the "Check if" always jumps to "Greater than or equal to 65" case regardless of the input
And if i change jl to jge the result will always jump to "Less than 65" case. I don't know what caused this, and how to fix this?