ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By the way, how primitive this assembler is! And yet so popular! Look how it does not list the values of freq, len, len_low when declared. And it does not produce a listing file unless there has been no errors in the assembly.
By the way, how primitive this assembler is! And yet so popular! Look how it does not list the values of freq, len, len_low when declared. And it does not produce a listing file unless there has been no errors in the assembly.
If you supply the -l option to NASM, followed (with the usual optional space) by a file name, NASM will generate a source-listing file for you, in which addresses and generated code are listed on the left, and the actual source code, with expansions of multi-line macros (except those which specifically request no expansion in source listings: see section 4.3.11) on the right. For example:
nasm -f elf myfile.asm -l myfile.lst
If a list file is selected, you may turn off listing for a section of your source with[list -], and turn it back on with[list +], (the default, obviously). There is no "user form" (without the brackets). This can be used to list only sections of interest, avoiding excessively long listings.
I'll try RTFMing, although I picked nasm up because it is the most nearly compatible with MASM I found, and I have a long program written in the MASM assembler that I want to adapt for linux.
About nasm, it sounds incredible, I know, but line 26 of the listing, is not correctly assembled. It says 8025 and it should say 8026. And this translates into the binary file. So either I discard nasm or get a newer version.
But of course I used the -l option. But no listing outpu if there are errors. I wanted to use a shift but I did not know the syntax. Thanks for the post.
I'll try RTFMing, although I picked nasm up because it is the most nearly compatible with MASM I found, and I have a long program written in the MASM assembler that I want to adapt for linux.
About nasm, it sounds incredible, I know, but line 26 of the listing, is not correctly assembled. It says 8025 and it should say 8026. And this translates into the binary file. So either I discard nasm or get a newer version.
But of course I used the -l option. But no listing outpu if there are errors. I wanted to use a shift but I did not know the syntax. Thanks for the post.
<< gives a bit-shift to the left, just as it does in C. So 5<<3 evaluates to 5 times 8, or 40. >> gives a bit-shift to the right; in NASM, such a shift is always unsigned, so that the bits shifted in from the left-hand end are filled with zero rather than a sign-extension of the previous highest bit.
IMO, fasm is a more advanced assembler with nearly identical nasm syntax that is written in assembler, as opposed to nasm being written in c. Also it uses multiple passes to generate a more efficient compilation
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.