Hi
I have 4 questions
1-Is it right that when you learn assembly you learn machine language,too?How?
2-What makes a programming language feature OS dependent?
3-Does Assembly have OS dependent feature?what about HLA?
4-How can i write an OS independent program(bootable programs)?
thanks alot

Recommended Answers

All 8 Replies

I can answer 1 and 3 for you right now.

1. As far as I know, Assembly IS machine language. It's the actual instructions that get passed to the CPU. Hence having to manually keep track of a lot of things that high-level languages do for you automatically.

3. Assembly isn't OS dependent. However, compiling it to runnable files can be dependent on the OS (like a .exe file for Windows). The source is unchanged by the OS it's run on, but what it IS dependent on is the architecture of the CPU. The most common is the 80x86 architecture (found in most desktops), but there are others like MIPS. This means that different architectures have different instruction sets, etc.
The other thing the source does actually depend on is the compiler too. Like, NASM and MASM use slightly different syntaxes in the ASM source code.
And I don't know anything about HLA

But again ASM instructions must be introduced to the CPU.no?
if yes,What does that?
and HLA stands for High Level Assembler and is a kind of assembly that supports some commands of high level languages like condition statements

Hi
I have 4 questions
1-Is it right that when you learn assembly you learn machine language,too?How?
2-What makes a programming language feature OS dependent?
3-Does Assembly have OS dependent feature?what about HLA?
4-How can i write an OS independent program(bootable programs)?
thanks alot

In response to the poster above me, no, Assembly is not machine language. Assembly is a language that is translated into machine code by the assembler. Programming languages are not OS dependent, they are dependent on the hardware. The Operating System is a piece of software, not hardware. And no, Assembly does not have an OS independent feature, since 1. the OS is software, not hardware; 2. Assembly breaks down into machine code, and machine code is dependent on the specific architecture you are running on.


-A specific hardware has a specific set of instructions that it can execute. http://en.wikipedia.org/wiki/Instruction_set_architecture
-If your programming language wants to run on that architecture, it must somehow break all of its high level statements down into instructions that that architecture can understand. So if I want C code to run on a specific architecture, there needs to be a compiler that breaks the C code statements into machine code that the machine understands.

Note: I think this process happens by first breaking the C code down into assembly language statements that the machine understands, then breaking the assembly into machine code. But I'm not positive about that.

So there must be different versions of a compiler for different architectures.Is it right?
And does the word architecture returns just to CPU?

Well in computer architectures , the newer versions have new technology appended to the older ones .
so if ur programming 8086 on an intel core 2 duo processor , it would still work (but the vice - verse will not ) , its just the size of the registers and their no changes but the primary architecture still remains the same .
well the above i said assuming that intel pc s are used .
well as far as i know it may/maynot work for motorola or IBM pc `s .

So there must be different versions of a compiler for different architectures.Is it right?
And does the word architecture returns just to CPU?

Yes, since different architectures have different sets of instructions (instructions break down into machine code), different architectures would need a different compiler.

And is it right for all compiled languages?(I meant High level languages)

...???

I'm not sure what you mean by that. Put it like this: since every architecture has it's own set of instructions, a compiler needs to be capable of breaking a high level language's statements down into those instructions. Those instructions are then broken down into the machine code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.