This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
win32 console print
#1
Hey people, were going to make a simple windows application that writes "Hello, World" to the console window.
keep in mind that assembly has no knowledge of the print function, due to this we need to link to a C library that has the functions built in.

we start buy opening your favourite notepad software and copying the code that is below this text
Code:
        global  _main
        extern  _printf

        section .text
_main:
        push    message
        call    _printf
        add     esp, 4
        ret
message:
        db      'Hello, World', 10, 0
we now save and name the file as 'helloworld.asm' (without the quotes)
next we open an nasm window and copy the code below in.

we link our code with the win32 library
Code:
nasm -fwin32 helloworld.asm
we then compile to an executable
Code:
gcc helloworld.obj
we then run the program
Code:
a
Disclaimer: Don't be misguided looking at my usergroup and assume whatever I say is official. When I speak in community I am just a member with personal opinions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)
www.000webhost.com