views:

1481

answers:

16

Is there a programming language "below" Assembly?
Thanks.

+28  A: 

Machine code. Time it was programmers coded in the 1 and 0's of binary. Hex was considered an advance over this. That was before assembly, which uses the code's names and separates the parts of an instruction into its parts.

sblundy
Machine code is a direct translation of Assembly, so I wouldn't say it is below it.
Marius
@marius, My pc can run machine code, but not assembly. So it ain't equal ;).
Dykam
I don't know what state-of-the-art assembler programs can do these days, but in the Olden Days, a macro assembler could do a fair bit of automatic stuff for you (function entries, keeping track of argument counts, automatic allocation, conditional macro expansion and other Neat Stuff that is a chore to do manually). So I'd say that machine code is "lower" than assembly for taht reason.
Vatine
@Vatine, the commonly available assembler GNU as is a huge step backwards from the good ol' days. Anyone who's hand-assembled a bootstrap loader will appreciate that assembly is a substantially higher level of abstraction above machine code, even if there is largely a 1:1 mapping between instruction mnemonics and instructions.
RBerteig
+1  A: 

Well, you can always write code in binary (or hex, or some other representation). You'll then have to calculate jump offsets etc in your head. Not recommended. ;)

volley
+5  A: 

Machine Code

http://en.wikipedia.org/wiki/Low-level_programming_language

JTA
+1  A: 

Sort of. Machines don't read assembly, they read "machine language", which is what assembly is converted into. Machine language has "opcodes" instead of assembly's mnemonics, and these opcodes are usually just binary data. Machine code isn't usually considered human-readable.

On RISC systems, machine code is often a straightforward translation of assembly, but on x86 systems, in particular, the two are quite different.

Jacob B
Actually, on x86 it's also a straightforward translation. Do you have any examples that show otherwise?
Nathan Fellman
+29  A: 

Actually there's a level of code that sits above machine code, called Microcode.

Sijin
I consider microcode to be machine code. Just a different variant that lives on the processor, rather than being run from RAM.
Brian Knoblauch
microcode is a block of ROM where each bit is used to toggle some internal circuitry. a sequence of 'words' guide the CPU to perform a single machine language instruction, therefore, it's 'below' even machine language.
Javier
I agree with Javier. We built a microcoded processor as part of a university course once. Very fun!
kigurai
On the same page as Javier. It's not the same as machine code.. It's realy what machine code uses.
baash05
Sijin and Javier are correct. This should be the accepted answer.
Windows programmer
Yes, microcode is the right answer here. Assembly instructions (or their machine code equivalent) in turn execute microcode programs. On a CISC architecture like x86 the microcode can be quite complex. For example, the x86 FDIV bug is a bug in the microcode for the Pentium's floating point divide machine code instruction.
Nelson
Shouldn't this be "below machine code" not "above machine code"?
Marius
Not all processors have microcode though. In any case, it should be: `C -> assembly -> machine code -> microcode -> circuits -> atoms -> ?????`
Longpoke
+1  A: 

Sure: "machine code", about which, Wikipedia, in the article on Assembly Language (http://en.wikipedia.org/wiki/Assembly_language), says: "implements a symbolic representation of the numeric machine codes and other constants needed to program a particular CPU architecture."

George Jempty
+6  A: 
grieve
+2  A: 

Depends on why you're asking. There's nothing that you can't do in assembly that you can do via some other method. Machine code is just another representation of the exact same data.

Mark Ransom
Not 100% accurate.. You can't optimize your assembly via another method. I mean even a x*=2; in c++ might not be compiled down to the most efficient assembly. A for loop might not use the cx registry(8086). There are things you can only do in assebly... Tis why it's still used as a language(by sum)
baash05
Actually there are some things that can not even be done with assembly. Some kinds of self-modifying code, or using instructions as data and vice-versa. (on x86 with variable-length instructions... the possibilities...)
Artelius
+12  A: 

Assembly is a text representation of Machine code. It has a single statement which represents a single instruction within the CPU itself. "MOV X, Y" for example, is a single instruction which passes through the CPU and moves a value X into position Y. To get to machine code, the CPU will have a number that represents 'MOV', and a number that represents 'X' (if it's not already a number), and a number that represents Y. These raw HEX binary values are the Machine code. It's the numbers that cause the CPU to direct voltages / currents through the transistors to make it do what it does.

Machine code is a lower level, but it's very very close to assembly. It's so close, that no one bothers using it due to the advantages of being able to read the instruction "MOV" = move. Variable names also become readable rather than raw addresses in the stack or heap.

Kieveli
Well, many assemblers actually allow for labels in subsitution for an address. So assembly is not quite just a text representation of machine code.
Calyth
+2  A: 

Even below machine code, one could say, is VHDL - chip design. You don't even need to design the chip to execute code, but just instantly transform inputs into outputs.

(not that I'm an expert - I'm using C++)

xtofl
But after building the chip, you can't really program it. So I don't think it's really relevant.
kigurai
When using this on an FPGA, it _is_ reprogrammable. Still, I'm not an expert :)
xtofl
+8  A: 

And to go even lower, (not that the word "language" is appropriate for "machine" language or for even lower physical layers), but below machine language is the configuration of the many gates and switches used to actually implement each binary opcode for the particular hardware (CPU) involved... A great book to read that covers this even lower level is by Charles Petzold, called "CODE"

Charles Bretana
+2  A: 

The very first computers (ENIAC) used hard wiring so that output from one computation could be fed as input to another. To run another program, you had to unplug some cables and re-wire them differently.

Stephan Leclercq
+2  A: 

Assembler is translated into machine code by the assembler. You could write it with a binary editor. (Ouch!) CISC computers can have microcode, which sequences segments of the chip (ALU, memory fetch, etc). Typically, no one writes microcode, except at the chip manufacturer.

Dan Hewett
+1  A: 

Well, there's machine language, as others have mentioned. Machine language is typically a 1-to-1 translation of what you write in assembly, so it's at the same level of abstraction as assembly code -- just much harder to write by hand.

There are exceptions to this, like the pseudo-instructions provided by the MIPS assembly language.

There is, or maybe I should say was a level below even assembly/machine language: microcode. Modern logic-transistor budgets being what they are, I suspect that microcode is losing its relevance.

bendin
Microcode is definitely still around; it's too difficult and "bug"-prone to hardwire everything.
Artelius
A: 

Assembly language is the lower floor of the programming language building as machine code is not a language because it does not involve any grammatic rules to follow. Machine code may be the only data format to execute microprocessor operations: the CPU fetches data from memory and executes the instruction directly according to the machine code fetched.

However, in some recent designs, such as the Intel Pentium 4 and up, machine code is the expression of a lower level RISC execution unit operations, known as uops or microoperations. So the decoding logic of those designs is to translate CISC-type instructions into small uops which are generally targeted at a simpler load/store unit, RISC-like. In this aspect, we can say (altough this may not be technically exact) that machine code describes the "higher-level" complex instructions of the architecture, not the "real" operations that are carried atomically by the underlying execution logic of the CPU.

So we've an architectural instruction set, or architectural machine code, and an inner-level "micro-instruction" set which is hidden from the outer world. The trace cache of the Intel processors was conceived to store such ops to optimize the superscalar performance of the processor (as the CPU executes uops not the architectural instruction-set available for execution by programs).

Hernán
+1  A: 

I think the lowest you can get is something called Physics or TRW (The Real World). This is what chip designers and manufacturers use to create CPUs and other processors that can take the output of computer languages and turn them into something valuable.

John Fisher