Home / Definitions / Machine Code
Definitions 3 min read

Machine code is the language of digital computers consisting of instructions expressed in a string of binary digits or bits read by the central processing unit (CPU). Since a computer does not understand the language humans speak, it can only respond directly to its own elemental or native language that looks like a sequence of zeros and ones.

Machine code vs. machine language

Also known as machine language, both terms refer to the numerical language used to control computers at their most basic level. Both can be written in different ways using a hex editor; an assembler; or a high-level programming language such as Java, C++, or Python.

How are machine codes used?

Machine code example.
An example of machine code for a program that writes zeros to memory. Source: University of Washington CSE.

Computer programs and applications provide executable instructions or convert high-level source code into a low-level sequence of binary or hexadecimal digits that the machine understands and responds to. The processor reads and interprets the machine language, which serves as the interface between hardware and software, to execute tasks and processes.

To build a software application, one needs to employ a language code and a language compiler like C++—a high-level programming language that must be translated at the hardware level. The source code is then compiled and executed to produce the intended outcome. Machine codes are used to instruct the system to execute the program.

Machine code’s instructions vary as different computers communicate and respond to different machine languages. For instance, the size of instruction sets may vary based on whether the computer is running in 32-bit or 64-bit mode. Or, an operating system (OS) like Windows, which is a host environment to computer programs, has system requirements different from Linux or macOS.

What are different types of machine code?

Machine code is executed directly by a computer’s CPU, so the hardware can perform its fundamental operations. However, machine code is specific to a given family of processors, with its own set of instructions and processes. 

  • ARM Original 32-bit: A reduced instruction set computer (RISC) machine code for processors configured for different environments.
  • DEC VAX: A 32-bit instruction set for VAX computers developed by Digital Equipment Corporation (DEC).
  • Zilog Z80: The instruction set of the 8-bit microprocessor created by Federico Faggin in 1974–1976.
  • x86: The 16-bit x86 was first used in Intel 8086, and then in 8088 that runs the early IBM PC.
  • AMD64 (x86-64): A 64-bit version of x86 launched in 1999 by Advanced Micro Devices (AMD).
  • IBM z/Architecture: A 64-bit complex instruction set computer (CISC) architecture used in IBM’s mainframe computers.
  • Other types include Sun Microsystems SPARC, MCST Elbrus 2000, UNIVAC, and Motorola 6880.

What is the difference between machine code and assembly language?

An assembly language directly corresponds to machine code instructions understandable by humans. A programmer uses mnemonic codes instead of numbers and symbolic names in referring to storage locations or registers. The assemblers can then convert symbolic addresses into absolute addresses. Machine code, however, uses numerical values and is lower in the computer languages hierarchy.


Keep reading to find out why one of the oldest programming languages in existence is one of the most in-demand at TechRepublic.

 

Was this Article helpful? Yes No
Thank you for your feedback. 100% 0%