Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Can you please help me how to compile assembly code in linux?
Is that assembly code written with gas syntax (gnu assembler) or with Intel/Masm syntax?
Is it 32 bit assembly or 64 bit assembly code?
Quote:
I am using AMD processor code instructions...is that amd registers inbuilt?
I don't understand what you mean. Maybe some examples would help.
Quote:
with what file extension i should give while writing assembly code program?
.asm is the traditional extension for Intel/Masm assembly files, though on Linux sometimes .s is used even for those. .s is the traditional extension for gas assembly files.
gas is the program normally used on Linux to "compile" assembly code. But for Intel/Masm syntax, you might need NASM (I think that is 32 bit only). I forget the name of the assembler that extends the feature set of NASM to include 64 bit and other enhancements. If you need 64 bit Intel/Masm syntax, I can look that up for you.
Edit: I just looked at your other thread started with the same subject (please don't do that). You want to "compile" 16 bit (not 32 or 64) assembly code in MASM syntax. NASM is probably the easiest tool for that. I'm not sure whether NASM is available as a package (.rpm) for Fedora.
With NASM, the correct command for compiling that code depends on how you plan to run that code. It looks like it is intended to run in DOS or maybe without an OS at all. Are you planning to reboot into to DOS (or no OS) to run it? Or do you plan to run it in some 16 bit DOS emulator? Or what?
MOV CX,533H
_SND_SPKR_TONE:
MOV AL,0B6H
OUT 43h,AL ; 43h = PIT mode control word (page 377)
MOV AX,CX
NEWIODELAY
OUT 42h,AL ; 42h = Counter 2 (page 376)
MOV AL,AH
NEWIODELAY
OUT 42h,AL ; 42h = Counter 2 (page 376)
IN AL,61h ; 61h = PIT conter 2 (Speaker) (page 378)
MOV AH,AL
OR AL,3
NEWIODELAY
OUT 61h,AL
This is DOS assembly (16 bit code). Use something like Tasm to assemble it in a DOSbox. Don't count on it that it runs in Linux since it requires I/O port access.
Is that assembly code written with gas syntax (gnu assembler) or with Intel/Masm syntax?
Is it 32 bit assembly or 64 bit assembly code?
No. The code in the other thread is 16 bit DOS Realmode code. It is rather plain code and when in a dosbox use A86 to compile or assemble it. A86 is a very good assembler. A386 is the 32 bit version with support for at least the Pentium III, perhaps even more.
Sir,
By seeing just the assembly code,How can we tell the code is 16-bit or 32 bit?
In my opinion it depends on the number of data lines of the processor!
am i rite?
What is the entry function i need to give if i want to compile the assembly code? (LIKE we will give main() in c-language)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.