I'm learning assembly in Linux 32bit . the code bellow converts the uppercase string to lowercase .
I have this strange result, when I change the order of registers in mov instructions . for example if I swap the registers name in these instructions the output disappears .
mov ecx, msg
mov edx, msglen
it doesn't work if changed to
mov edx, msg
mov ecx, msglen
so is it a must to have the registers in this order eax ebx ecx edx ... i'm confused (noob)
- this is the code that works
section .data
msg: db "UPPERCASE", 10 ; string
msglen: equ $-msg ; string length
section .bss
section .text
global _start
_start:
mov ebx, msg
mov eax, 9 ; number of iterations equ number of char in str
doloop:
add byte [ebx], 32 ; label doloop
inc ebx
dec eax
jnz doloop
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, msglen
int 80h
mov eax, 1
mov ebx, 0
int 80h