I am learning x86 assembly from Paul Carter's e-book.
I tried creating the first example program.
I used following switch to complie the first.asm as told in the book.
nasm -f coff first.asm
And created the exe file by linking the object files by gcc.exe of CodeBlocks (MinGW).
But it displays some symbols like 'G!!@' in the console.
Please help me.
First I created the file first.asm from notepad.exe and created its object file using nasm as told in the book. But I think that maybe I need to use object file formats other than coff. There aren't any linker errors. I'll try linking the object files by ld.exe.
I did the same; download example files for cygwin coz the book says it might work for MinGW as well. Can I use TC++ 3.0 compiler to link and complie the files since it's Borland software ?
I don't think that's a good idea, for the simple reason that TC++ 3.0 is too old.
If you absolutely want to try a free legacy Borland compiler, download the free version 5.5.
You will need to fill out a download form, then receive the download link in an e-mail.
Try changing coff to win32. Using Nuwen's MinGW with the Cygwin examples, it worked for me. Here's what I get:
--using coff
nasm -f coff first.asm
gcc -o first first.o driver.c asm_io.o
first
▀‼@
--using win32
nasm -f win32 first.asm
gcc -o first first.obj driver.c asm_io.o
first
Enter a number: 3
Enter another number: 2
You entered 3 and 2, the sum of these is 5
; my own x86 program
%include "E:\NASMexamples\asm_io.inc"
segment .data
mymsg1 db "Let's see if this works !", 0
segment .text
global _asm_main
_asm_main:
mov eax, mymsg1
call print_string
call print_nl
call print_string
popa
mov eax,0
leave
ret
The error is 'The program myown.exe has stopped working correctly'.
But I got where the code was wrong. It should have been like this at line 9