-1

I know about assembly language and machine code. A computer can usually execute programs written in its native machine language. Each instruction in this language is simple enough to be executed using a relatively small number of electronic circuits. For simplicity, we will call this language L0. Programmers would have a difficult time writing programs in L0 because it is enormously detailed and consists purely of numbers. If a new language, L1, could be constructed that was easier to use, programs could be written in L1.

But I just want to know that is there a single example what the machine code is? I mean is there any thing that I can write and just save it and run it (without compiling it with any compiler).

  • 1
    You could open an executable in a hex editor to see some machine code... But to a human it just looks like random garbage (apart from some text constants). But this is not really a good question for StackOverflow. – alain May 30 '16 at 21:00
  • i tried searching on google not didn't got any info that i can understand easily that why i posted here and your answer is very helpful for me to understand. – Ahmed Naseer May 30 '16 at 22:36
  • what instruction set are you interested in? – old_timer May 31 '16 at 02:37
  • First you have to research the operating system and what your binary choices are (exe, coff, elf, etc). What the entry point is and rules, and what the exit/return is or can be. A very simple program would perhaps be to exit with some return value. so you need to know the machine code for those instructions, you cant do this without an assembler, but that assembler could be you, the human, write out the assembly, and then hand compute the machine code. then you need a hex editor to put it all together, machine code and binary. – old_timer May 31 '16 at 02:40
  • this question has been asked and answered dozens of times here at SO. Look at those answers. If you cant do this in assembly language then you are not ready for machine code. Even then you need to be able to generate the binary format without a linker if you think that is cheating too. Learning to run before you crawl and walk makes no sense, takes longer, and involves excess pain. – old_timer May 31 '16 at 02:42
  • You do it like this: https://www.youtube.com/watch?v=iefuJ_jZAiQ – Jerry Jeremiah Jul 03 '17 at 02:18
  • "Code" when referring to "source code" is a mass noun; you don't "write a machine code," you write "machine code." Please don't say "a code." – Kaiser Keister May 22 '18 at 23:20

1 Answers1

1

Аssembly instructions have a one-to-one relationship with the underlying machine instructions. This means that essentially you can convert assembly instructions into machine instructions with a look-up table.

look here: x86 instructions

Stranger in the Q
  • 3,668
  • 2
  • 21
  • 26