News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Console Input/ Output nasm

Started by consoleUser, March 21, 2006, 05:12:46 PM

Previous topic - Next topic

consoleUser

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

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

#2
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

MSDN: Windows API Reference, Functions by Category

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]
eschew obfuscation