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.
In words, AND the byte at memory location 45 with immediate value 03.
as reports "Ambiguous operand size for and". How could I code the instruction such that as understands my intention?
In words, AND the byte at memory location 45 with immediate value 03.
as reports "Ambiguous operand size for and". How could I code the instruction such that as understands my intention?
I am not familiar with as, but in gcc assembly, the op code must in many cases specify the size, as in
Code:
andb $3,$John
the 'b' in 'andb' designating 'byte'.
This thread has me wondering how i missed as. I went through alot of work converting many of my old Dos masm source files to gcc assembly. Wrote a C program to do most of the converting.
I am also in the task of converting a MASM source file to some linux assembler.
If you have lots of code to convert, it may be worth the effort to write a C program to convert the code line by line. I don't think a shell script would answer in this case, since there are too many factors in just a single line. e.g. transposing the operands, adding byte or word indicators, converting comments, etc.
Anyway, that's how i skinned this particular cat. Still had some tinkering to do afterwards by hand, but in the end saved me lots of time.
@dogpatch: the program would have to do much less work if you feed the output to nasm instead of as. Nasm is almost compatible with MASM. Also, in as, you can turn intel syntax on with the .intel_syntax directive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.