### Author Topic: x86 machine code  (Read 1824 times)

0 Members and 1 Guest are viewing this topic.

#### Ephraim B

• LV2 Member (Next: 40)
• Posts: 28
• Rating: +1/-1
##### x86 machine code
« on: February 19, 2015, 09:42:29 am »
I feel like those high level languages are not actual programming, for example, there's a whole compiler to compile ASM down to machine code and a whole #include file to compile C down to machine code. I feel like this is cheating and anyone can make mistakes on a compiler. I feel like machine code is actual programming. Is there any tutorials for x86 machine code?

#### Eeems

• Mr. Dictator
• LV13 Extreme Addict (Next: 9001)
• Posts: 6169
• Rating: +318/-36
• C'est la vie
##### Re: x86 machine code
« Reply #1 on: February 19, 2015, 01:15:08 pm »
/e

#### harold

• Posts: 226
• Rating: +41/-3
##### Re: x86 machine code
« Reply #2 on: February 19, 2015, 01:27:16 pm »
Well not really, but there is plenty of information to get started, in the form of assembly tutorials, the Intel manuals (or the AMD manuals if you want), and this handy ModRM table.

Encoding x86 instructions isn't too bad once you know how they work, for example take "add r8, [r10 + 8 * r9 + 8]". This is of the form add r64, rm64, so that'll be REX.W 03 /r. The rm operand needs a SIB byte, so the ModRM and SIB are 44 CA, also REX.B, REX.X and REX.R should be set, and the ofs8 is 8. So in total: 4F 03 44 CA 08
Check the haroldbot thread for the supported commands and syntax.
You can use haroldbot from this website.

#### Ivoah

• LV6 Super Member (Next: 500)
• Posts: 336
• Rating: +3/-0
##### Re: x86 machine code
« Reply #3 on: February 19, 2015, 08:22:29 pm »
I feel like those high level languages are not actual programming, for example, there's a whole compiler to compile ASM down to machine code and a whole #include file to compile C down to machine code. I feel like this is cheating and anyone can make mistakes on a compiler. I feel like machine code is actual programming. Is there any tutorials for x86 machine code?

1st, there is no "compiler" for assembly code, it's an assembler. Also, there's much more to C than an #include file.
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2 TI SR-56 -$0
TI-Nspire CX CAS - $152 TI-84+ Silver Edition -$56
TI-84+ Silver Edition - $0 TI-85 -$0
TI-73 Explorer VS - $10 ViewScreen -$3

#### MateoConLechuga

• LV0 Newcomer (Next: 5)
• Posts: 4
• Rating: +1/-0
##### Re: x86 machine code
« Reply #4 on: February 19, 2015, 09:24:36 pm »
I feel like those high level languages are not actual programming, for example, there's a whole compiler to compile ASM down to machine code and a whole #include file to compile C down to machine code. I feel like this is cheating and anyone can make mistakes on a compiler. I feel like machine code is actual programming. Is there any tutorials for x86 machine code?
One question: Why would you ever want to do this? It is making it extremely difficult on yourself for no real gain. There is a reason compilers exist. If you have a valid reason for wanting to learn, besides feeling that it is better, then go for it. As for making mistakes, there are orders of magnitudes more you can make with this route. Most C IDEs have debuggers and compiler warnings.

#### AngelFish

• Is this my custom title?