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.

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.

29 questions
26
votes
9 answers

Resources on learning to program in machine code?

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 people said it's not as fast as C and there is no use.…
AceofSpades
  • 605
  • 1
  • 7
  • 12
24
votes
3 answers

Why do executables depend on the OS but not on the CPU?

If I write a C program and compile it to an .exe file, the .exe file contains raw machine instructions to the CPU. (I think). If so, how is it possible for me to run the compiled file on any computer that runs a modern version of Windows? Each…
Aviv Cohn
  • 21,190
  • 31
  • 118
  • 178
22
votes
6 answers

Is machine language always binary?

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 exactly what to do - always binary? I.e. always composed…
Aviv Cohn
  • 21,190
  • 31
  • 118
  • 178
18
votes
4 answers

Why can't native machine code be easily decompiled?

With bytecode-based virtual machine languages like Java, VB.NET, C#, ActionScript 3.0, etc., you hear sometimes about how easy it is to just go download some decompiler off the Internet, run the bytecode through it one good time, and oftentimes,…
Panzercrisis
  • 3,145
  • 4
  • 19
  • 34
15
votes
5 answers

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)?
Julian A.
  • 253
  • 1
  • 2
  • 7
14
votes
7 answers

"Write an Assembler in C." Why writing a machine code translator for a low level language in a higher level language?

My Microprocessor class instructor gave us an assignment and said: "Write an Assembler in C." - My beloved Professor So it seemed a little bit illogical to me. If I'm not wrong Assembly Language is the first step from Machine Code to the journey…
mertyildiran
  • 265
  • 1
  • 3
  • 8
14
votes
4 answers

How is software for machines such as ATMs or TVs built?

As a beginner programmer I've only worked with programming computer based applications, but a question has been coming to my head very often since I started programming and I can't get it answered properly. Machines don't act on their own, that's…
Bugster
  • 4,013
  • 8
  • 37
  • 44
10
votes
1 answer

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 Systems include support for an NX bit, (including…
Siler
  • 421
  • 3
  • 11
10
votes
5 answers

Do compiler-writers actually need to 'understand' machine code?

Might be kind of an odd question. A guy writing a C++ compiler (or whatever non-VM language): Does he need to be able to read/write raw machine language? How does that work? EDIT: I am specifically referring to compilers that compile to machine…
Aviv Cohn
  • 21,190
  • 31
  • 118
  • 178
8
votes
2 answers

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 this? E.g. Ignoring machine instructions that are…
br3w5
  • 719
  • 2
  • 6
  • 12
3
votes
4 answers

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 %INCLUDE 'mikedev.inc' start: mov si, mystring …
user12979
  • 345
  • 1
  • 3
  • 4
3
votes
3 answers

Is it possible to use GNU GPL for application that has no source?

I mean, it is possible to create application without source code - for example using HEX editor or some debugger that can assembly instructions (actually every decent debugger can). Creating programs this way is of course hard, but possible for…
johnfound
  • 318
  • 1
  • 11
2
votes
4 answers

Meaning of Machine in Compiler Theory

Can anyone tell me what does "machine" means in Compiler Theory? Does it mean computer in general or operating system? Actually, the problem is I understand the definition of machine language as "the language understand by the computer". But does…
Delsilon
  • 143
  • 6
1
vote
3 answers

How do binary numbers interact with the CPU and cause some action to take place?

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 electric states, then I actually don't have a question…
steez
  • 31
  • 5
1
vote
1 answer

is the relocatable machine code essentially the text segment of the virtual address?

Sorry if this is a basic question, I'm studying for my operating systems class and compiler theory class at the same time and this is confusing me. From what I do understand, virtual memory is larger than RAM and the virtual memory of a process…
qwerty_99
  • 163
  • 3
1
2