Im trying code in Assembly, and i have a little problem. My program stoped with SIGSEV segmentation fault. GDB stops at
cmpb %bl, 0x41
in check_loop. Program just check every single char and modify it when it is lowercase, great or other
.bss
.comm textin, 512
.comm textout, 512
.text
.global main
main:
movq $SYSREAD, %rax
movq $STDIN, %rdi
movq $textin, %rsi
movq $BUFLEN, %rdx
syscall
CALL changing
changing:
movl $0, %edi
jmp check_loop
check_loop:
movb textin(,%edi,1),%bl
cmpb %bl, 0x41
jl other
cmpb %bl, 0x5A
jl great
cmpb %bl, 0x61
jl other
cmpb %bl, 0x7a
jg other
lower:
addb %bl, 0x06
movb %bl,textout(,%edi,1)
jmp isEND
great:
addb %bl, 0x08
movb %bl,textout(,%edi,1)
jmp isEND
other:
movb %bl,textout(,%edi,1)
jmp isEND
isEND:
incl %edi
cmpl %eax, %edi
jl check_loop
ret