NASM Forum > Using NASM

Reading Assembly from standard input

(1/2) > >>

Fl0wless:
Hello! I'm generating assembly and want to pass it to nasm. (How) Can I pass the source via stdin? (I tried the standard - but it didn't work.) Couldn't find anything on the web or in the forums. Or do I have to create a temp file?
Many thanks!

Frank Kotler:
Hi Fl0wless

Welcome to the forum.

Nasm takes multiple passes over the file you present to it, so I don't think stdin  is going to work.

Best,
Frank

Fl0wless:
Hi! Thanks for the answer, that is a bit unfortunate. Although that makes me a bit curious. Why does Nasm need to read the file multiple times? Does the preprocessor not work on a token basis? Do you try to generate the result on the fly without having the file fully in-memory (like old c compilers did out of space constraints)? Or is it some other reason? Much appreciated!

Frank Kotler:

--- Code: ---jmp foo

--- End code ---
How far away is "foo"? Can it be a short jump or does it have to be a  near jump?

If you want a single pass assembler. try spasm/rosasm. (that's not a serious suggestion)
There may be other single pass assemblers... I don't know...
 Nasm started off as two pass and went to  multi pass after 0.98.

Best,
Frank


Fl0wless:
But why re-parse the asm file? Why not store the token stream in-memory? Do you then not have to re-apply the macros?

Navigation

[0] Message Index

[#] Next page

Go to full version