This might be a dumb question but I'm new to assembly programming and I've converted a .asm
file containing the following assembly source code to a .exe
file. The code was taken from https://www.tutorialspoint.com/assembly_programming/assembly_memory_management.htm by the way.
section .text global _main ;must be declared for using gcc_main: ;tell linker entry point mov eax, 45 ;sys_brk xor ebx, ebx int 80h add eax, 16384 ;number of bytes to be reserved mov ebx, eax mov eax, 45 ;sys_brk int 80h cmp eax, 0 jl exit ;exit, if error mov edi, eax ;EDI = highest available address sub edi, 4 ;pointing to the last DWORD mov ecx, 4096 ;number of DWORDs allocated xor eax, eax ;clear eax std ;backward rep stosd ;repete for entire allocated area cld ;put DF flag to normal state mov eax, 4 mov ebx, 1 mov ecx, msg mov edx, len int 80h ;print a messageexit: mov eax, 1 xor ebx, ebx int 80hsection .datamsg db "Allocated 16 kb of memory!", 10len equ $ - msg
I then ran the following codes in the command line and got no confirmation output:command line NASM and GCC commands
If I run it in an online compiler, I'm getting a confirmation message "Allocated 16 kb of memory!", whereas no message was prompted in the command line. Am I missing something? or what should I add. How will a know if 16kb was allocated? I've fiddled with this previous query but I still don't know how: Create an exe file in assembly with NASM on 32-bit Windows. I hope this makes sense.