First, Hello everyone.  This is my first post here.  I am fairly new to NASM so bear with me if I say something stupid.

At current I am creating a compiler that changes a source file into ..asm, then outputs the .obj file via Nam. 

I am trying to learn how to print stuff to the console with out using in line C because those .lib won't be available when I link my .obj into a .exe.  The actual .asm execution happens outside of the C environment. 

So for simplistic sakes I am looking for a finger to point me in the write direction on how to print directly to the console screen.

Thanks

Chad
Posted on 2007-03-01 13:43:36 by chadsxe
now i am not sure, if you want to run without any OS or what.

You should tell us under which operating system, because usage of "console" is different on every one, and different if there is no OS and you must access hardware.
Posted on 2007-03-01 14:19:28 by vid
Windows XP OS...
Posted on 2007-03-01 14:42:36 by chadsxe
A few more notes I should add.....

1)I am working only with integers. No strings
2)I am pretty sure I can tag on a .INC be needed
Posted on 2007-03-01 15:05:13 by chadsxe
then, study GetStdHandle() and WriteConsole()
Posted on 2007-03-01 16:33:02 by vid
%include "windows.inc"
%define INVOKE_OFFSET_REGISTER edx
txt db "hello console",13,10,"press enter to quit >",0

main:
enter 8,0
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov    ,eax
invoke lstrlenA,txt
// write text
invoke WriteFile, , txt, eax, offset, 0

invoke GetStdHandle,STD_INPUT_HANDLE
// read text
invoke ReadFile, eax, offset, 1, offset, 0
leave
ret

let me know if you need includes for nasm.
Posted on 2007-03-01 16:38:14 by sapero

%include "windows.inc"
%define INVOKE_OFFSET_REGISTER edx
txt db "hello console",13,10,"press enter to quit >",0

main:
enter 8,0
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov    ,eax
invoke lstrlenA,txt
// write text
invoke WriteFile, , txt, eax, offset, 0

invoke GetStdHandle,STD_INPUT_HANDLE
// read text
invoke ReadFile, eax, offset, 1, offset, 0
leave
ret

let me know if you need includes for nasm.

Yes I do...
Were is windows.inc from....
Posted on 2007-03-01 16:58:08 by chadsxe

Were is windows.inc from....


Probably from The NASM32 Project ;)
Posted on 2007-03-01 19:45:53 by SpooK
http://www.mytempdir.com/1238854
The main include (asm.mac) is created by me, here you find the basic macros like offset, interface, coinvoke, "invoke", and cdecl version named "cdecl". A string parameter automatically puts the string into data section.
Push and pop are extended to accept more parameters than one. bstr_t(wchar*) used as parameter for COM method automatically converts the string to BSTR and frees it when finished.
Macros for functions: SUB(name, args),ENDSUB (very old), PROC(name,stack,args),ENDPROC, LOCAL - you need to manually %undef names before reusing
Macros for switch: select,case,break,default,endselect - the "break" is automatically added before next "case" (nagoa fix)
Invoke and cdecl are customizable: default defined "INVOKE_IMPORT" forces the api call to [__imp_name], and (not default)"INVOKE_EXTERN_C" decorates the imports like MASM, different for stdcall and cdecl.
class.inc makes OOP writing easier.
gp.asm - small structured exceptions handling (try,catch,leave and throw). Created for Aurora compiler :)
All other is downloaded except structs.inc and constants.inc (nagoa split)
Posted on 2007-03-02 14:12:08 by sapero