Questions tagged [machine-code]
According to Wikipedia, Machine code or machine language is a set of instructions executed directly by a computer's central processing unit (CPU). Each instruction performs a very specific task, such as a load, a jump, or an ALU operation on a unit of data in a CPU register or memory. Every program directly executed by a CPU is made up of a series of such instructions.
30 questions
3
votes
1
answer
311
views
Are shorter variants of machine instructions worth it?
I'm writing a JIT runtime, and I've started thinking about shorter variants of some instructions.
In x64 we can do at least two kinds of jumps: rel8 and rel32. The first one takes say 2 bytes (opcode +...
1
vote
3
answers
3k
views
How do binary numbers interact with the CPU and cause some action to take place? [duplicate]
EDIT: Perhaps what I am misunderstanding is that when it is said that the code we type gets turned into machine code of 0s and 1s. If these 0s and 1s are the abstracted representation of their ...
-4
votes
3
answers
2k
views
How to Write Pure Machine Code for Linux?
I'm writing a compiler, and I want it to compile to a native executable (just Linux, for now). I don't want it to be Assembly, it needs to be PURE machine code. Can anyone point me in the right ...
1
vote
2
answers
457
views
Why do we use the symbols 0 and 1 for two-state logic?
We know a regular computer basically only knows two states and that we name these states 0 and 1 respectively. This seems arbitrary, we could name them "a" and "b", or even 3 and 4. Is there a reason ...
-2
votes
1
answer
3k
views
What is 16 bit word's equivalent in decimal?
Question:
For a 16 bit word with 6 bits for an opcode
How many different instructions could I fit into the instruction set?
What is the largest number that I could use as data?
Answer:
...
1
vote
3
answers
2k
views
Operation excution in terms of clock cycles
Typically for a single instrcution, 6 machine cycles are needed:
FETCH instruction
DECODE instruction
EVALUATE ADDRESS
fetch OPERANDS
EXECUTE oepration
STORE result
My concern is regarding the fifth ...
15
votes
5
answers
13k
views
Compilation to bytecode vs machine code
Does compilation that produces an interim bytecode (like with Java), rather than going "all the way" to machine code, generally involve less complexity (and thus likely take less time)?
10
votes
1
answer
335
views
Machine code JITs and the Execution Disable bit
How is runtime-generated machine-code (such as the output of a JIT), actually executed by the CPU if the CPU/OS has an Execution Disable bit?
As far as I know, many modern processors and Operating ...
1
vote
1
answer
989
views
How does an optimizing compiler react to a program with nested loops?
Say you have a bunch of nested loops.
public void testMethod() {
for(int i = 0; i<1203; i++){
//some computation
for(int k=2; k<123; k++){
//...
22
votes
6
answers
30k
views
Is machine language always binary? [duplicate]
I know absolutely nothing in low-level stuff, so this will be a very newbie question. Please excuse my ignorance.
Is machine language - the series of numbers to that tell the physical computer ...
1
vote
1
answer
1k
views
Creating a very basic compiler using Java
I want to try and create my own very basic language, with it's very basic compiler. All using Java.
For now, it will only need to enable to 'programmer' to print things to the screen.
I had an idea ...
3
votes
4
answers
3k
views
How does assembly relate to machine/binary code
How does assembly relate to machine/binary code.
For example here is how to print to the screen in mikeOS(a small pure assembly OS), mikeOS it uses NASM to assemble.
BITS 16
ORG 32768
%...
1
vote
1
answer
671
views
What did machine code for 4-bit architecture look like?
I don't know how a 4-bit instruction could be enough to do something so I read about the Intel 4004 and it says that it used 8-bit instructions and then I can understand how opcode and numbers has ...
10
votes
2
answers
12k
views
Do compilers have to be written for each model of CPU?
Do you need to take account of the different processors and their instructions when writing a compiler? Have instructions been standardised? Or what tools and techniques are available to assist with ...
26
votes
9
answers
65k
views
Resources on learning to program in machine code? [closed]
I'm a student, fresh into programming and loving it, from Java to C++ and down to C. I moved backwards to the barebones and thought to go further down to Assembly.
But, to my surprise, a lot of ...