Re: newbie: I/O with nasm
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Tue, 07 Mar 2006 19:14:26 -0500
James Daughtry wrote:
Actually, I'm kinda hoping Thomas wants it in "pure asm"! :)
*I* want it in "pure asm". Gimme gimme. ;-)
You can't have it until you say "what OS"! :)
Then, the question arises, "How pure do you want it?" If you want *really* pure, I suppose "no OS". No bios ints, either! And I suppose you want it to be 32-bit code... Oh, and "redirectable" like stdio, which means a filesystem of some kind... All possible, but more like "OS development" than a "newbie project"!
For more practical purposes, if we're allowed to call availabe OS services, dos and Linux are easy. For Windows, I think we're going to have to call GetStdHandle with -10 for stdin, and -11 for stdout (that seems too insane to be true!). Then, ReadFile and WriteFile might take a parameter to say whether it's unicode or not, and I think ReadFile wants a parameter telling it where to put "status" - number of characters read or errno - rather than returning it in eax... Otherwise not too much different than the read()/write() example.
I'd post a Linux example, in case that's what you want, but I suppose the odds are against it :( TK originally asked for "from the command line", so we may be on the wrong track entirely with these "stdin" examples. If he wants to read "command line parameters", well "they're on the stack", except for dos, where they're at offset 80h into the PSP... and I guess Windows has a "GetCommandLine" API...
So, if you want I/O examples that don't use libc, you gotta "say what OS". :)
Best,
Frank
.
- Follow-Ups:
- Re: newbie: I/O with nasm
- From: ArarghMail603NOSPAM
- Re: newbie: I/O with nasm
- References:
- newbie: I/O with nasm
- From: TK
- Re: newbie: I/O with nasm
- From: James Daughtry
- Re: newbie: I/O with nasm
- From: santosh
- Re: newbie: I/O with nasm
- From: Frank Kotler
- Re: newbie: I/O with nasm
- From: James Daughtry
- newbie: I/O with nasm
- Prev by Date: Re: newbie: I/O with nasm
- Next by Date: Re: application that retrieve the number of cpu cycles, junk 'cycle' after expression
- Previous by thread: Re: newbie: I/O with nasm
- Next by thread: Re: newbie: I/O with nasm
- Index(es):
Relevant Pages
|