From Infogalactic: the planetary knowledge core
Jump to: navigation, search

In computing, an opcode (abbreviated from operation code) is the portion of a machine language instruction that specifies the operation to be performed. Beside the opcode itself, instructions usually specify the data they will process, in form of operands. In addition to opcodes used in instruction set architectures of various CPUs, which are hardware devices, they can also be used in abstract computing machines as part of their byte code specifications.


Specifications and format of the opcodes are laid out in the instruction set architecture (ISA) of the processor in question, which may be a general CPU or a more specialized processing unit.[citation needed] Apart from the opcode itself, an instruction normally also has one or more specifiers for operands (i.e. data) on which the operation should act, although some operations may have implicit operands, or none at all.[citation needed] There are instruction sets with nearly uniform fields for opcode and operand specifiers, as well as others (the x86 architecture for instance) with a more complicated, variable-length structure.[1][better source needed]

Depending on architecture, the operands may be register values, values in the stack, other memory values, I/O ports, etc., specified and accessed using more or less complex addressing modes.[citation needed] The types of operations include arithmetics, data copying, logical operations, and program control, as well as special instructions (such as CPUID and others).[citation needed]

Assembly language, or just assembly, is a low-level programming language, which uses mnemonics, instructions and operands to represent machine code.[citation needed] This enhances the readability while still giving precise control over the machine instructions. Most programming is currently done using high-level programming languages,[2] which are typically easier to read and write.[citation needed] These languages need to be compiled (translated into assembly language), or run through other compiled programs.[3]

Software instruction sets

Opcodes can also be found in so-called byte codes and other representations intended for a software interpreter rather than a hardware device. These software-based instruction sets often employ slightly higher-level data types and operations than most hardware counterparts, but are nevertheless constructed along similar lines. Examples include the byte code found in Java class files which are then interpreted by the Java Virtual Machine (JVM), the byte code used in GNU Emacs for compiled LISP code, .NET Common Intermediate Language (CIL), and many others.[4]

See also


  1. "Machine Language For Beginners - Introduction". atariarchives.org. Archived from the original on 13 February 2008.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  2. "Programming Language Popularity". langpop.com. 2013-10-25. Archived from the original on 2015-04-11. Retrieved 2015-10-10.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  3. "Introduction to Assembly Language". Swansontec.com. Retrieved 2015-10-10.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  4. "bytecode Definition from PC Magazine Encyclopedia". Pcmag.com. Retrieved 2015-10-10.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>

Further reading

  • Hyde, Randall (2004). Write Great Code: Thinking Low-level, Writing High-level, Vol. 1, Understanding the Machine, pages passim, San Francisco, CA, USA: No Starch Press, ISBN 1593270038, see [1], accessed 10 October 2015.