I want to print out the word 'hi' on the screen but pop ecx is not working . When I change it to mov ecx, esp then the word 'hi' is printing.
Can someone explain me why pop ecx is not working?
global _start
section .bss
output resb 2
section .text
_start:
mov ecx, 0x6968
mov [output], ecx
mov ecx, [output]
push ecx
display:
mov eax, 0x4
mov ebx, 0x1
pop ecx
mov edx, 2
int 0x80
xor eax, eax
mov eax, 0x1
xor ebx, ebx
int 0x80
The write system call expects an address. You should replace
mov ecx, [output]withmov ecx, output(notice the missing brackets) to load the address. Then it should work with thepush/popas-is.PS: next time please review your question and fix the formatting if you see it's broken.