I want to receive an executable file of the assembler program. Originally the code worked, but after adding the section and trying to compile it in nasm and gcc it does not run. Added file is original programm
[bits 32]
; sourceIndex destinationIndex
; esp -> [ret]
extern _printf
extern _exit
section .data
format: db "kajak kajak"
length equ $ - format
db 0xA, 0
section .text
global _main
_main:
getaddr:
; esp -> [format][ret]
mov ecx, length ; ecx = length
shr ecx, 1 ; ecx = ecx >> 1 = ecx /2
jz end ; jump if zero ; jump if ZF = 1
mov esi, [esp] ; esi = *(int*)esp = format
lea edi, [esi+length-1] ; edi = format + length -1
.loop mov al, [esi] ; al = *(char*)esi
mov ah, [edi] ; ah = *(char*)edi
mov [esi], ah ; *(char*)esi= ah
mov [edi], al ; *(char*)edi = al
cmp ah, al ; ah - al
jne notequal ; jump if not equal
inc esi ; esi++
dec edi ; edi--
loop .loop
jp equal ; jump if equal
equal:
call _printf ; printf(format);
message_equal: db "its palindrome",0xA,0x00
getaddr2:
call [ebx + 3*4] ; printf(message_equal)
add esp, 4 ; esp = esp + 4
jmp end
notequal:
call _printf ; printf(format);
message_notequal: db "Its not palindrome",0xA, 0x00
getaddr3:
call _printf ; printf(format);
add esp, 4 ; esp = esp + 4
jmp end
end:
push 0 ; esp -> [00 00 00 00]
call _exit