At Westonci.ca, we make it easy to get the answers you need from a community of informed and experienced contributors. Discover detailed solutions to your questions from a wide network of experts on our comprehensive Q&A platform. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.

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

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 I class=

Sagot :

We appreciate your visit. Hopefully, the answers you found were beneficial. Don't hesitate to come back for more information. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.