Hi,
I'm forced to use the nasm assembler, and I have to do some console input/output (in cmd) in my app.
Because im quiet new to assembly programming/ winapi programming and I found no tutorials for nasm on the net on this topic, I hope I can get a sample codesnippet here.
greetz consoleUser
You are welcome to ask in here if any of the members remember using NASM buit you may get a better answer from a guy called Bryant Keller in the forum at this link http://www.asmcommunity.net/board/ . He is one of the moderators and his nick is Synfire but he is up to date with NASM and does some support for it.
You can get the NASM binaries, documentation, and example sources here:
http://sourceforge.net/project/showfiles.php?group_id=6208
The attachment contains a simple console app that demonstrates console I/O using a few of the functions available in MSVCRT.DLL. The batch file to build the app is coded to use GoLink, available here:
http://www.jorgon.freeserve.co.uk/
---
MSDN: Run-Time Library Reference, Run-Time Routines by Category (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_run.2d.time_routines_by_category.asp)
MSDN: Windows API Reference, Functions by Category (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/functions_by_category.asp)
Example of a Windows API function call:
segment .data
...
mbtext db "the message",0
mbcaption db "the caption",0
...
segment .text
...
extern MessageBoxA
...
push 0
push mbcaption
push mbtext
push 0
call MessageBoxA
...
And you would need to add the name of the DLL that contains the called function to the GoLink command line, in this case user32.dll:
GoLink /console console.obj user32.dll msvcrt.dll
Most API functions that take string parameters or return a string (pointer) are implemented as ANSI and Unicode versions. In this case MessageBoxA specifies the ANSI version, and MessageBoxW would specify the Unicode version. When you search for a function on MSDN you should specify the function name without the suffix, for example 'MessageBox'.
[attachment deleted by admin]