In computing, an opcode (abbreviated from operation code, also known as instruction syllable, instruction parcel or opstring) is the portion of a machine language instruction that specifies the operation to be performed. Beside the opcode itself, most instructions also specify the data they will process, in the form of operands. In addition to opcodes used in the 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. Opcodes for a given instruction set can be described through the use of an opcode table detailing all possible opcode bytes. 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. 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. Instruction sets can be extended through the use of opcode prefixes which add a subset of new instructions made up of existing opcodes following reserved byte sequences.
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. The types of operations include arithmetics, data copying, logical operations, and program control, as well as special instructions (such as CPUID and others).
Assembly language, or just assembly, is a low-level programming language, which uses mnemonics, instructions and operands to represent machine code. This enhances the readability while still giving precise control over the machine instructions. Most programming is currently done using high-level programming languages, which are typically easier to read and write. These languages need to be compiled (translated into assembly language), or run through other compiled programs.
Software instruction setsEdit
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.
- Jones, Douglas W. (2016) . "A Minimal CISC". Computer Architecture On-Line Collection. Iowa City, USA: The University of Iowa, Department of Computer Science. Retrieved 2016-05-28.
- Jones, Douglas W. (June 1988). "A Minimal CISC". ACM SIGARCH Computer Architecture News. New York, USA: ACM. 16 (3): 56–63. doi:10.1145/48675.48684. Retrieved 2016-05-28.
- Domagała, Łukasz (2012). Application of CLP to instruction modulo scheduling for VLIW processors. Gliwice, Poland: Jacek Skalmierski Computer Studio. p. 83. ISBN 83-62652-42-X. Retrieved 2016-05-28.
- Smotherman, Mark (2016) . "Multiple Instruction Issue". School of Computing, Clemson University. Archived from the original on 2016-05-28. Retrieved 2016-05-28.
- Schulman, Andrew (2005-07-01). "Finding Binary Clones with Opstrings & Function Digests". Dr. Dobb's Journal. 1.
- Schulman, Andrew (2005-08-01). "Finding Binary Clones with Opstrings & Function Digests". Dr. Dobb's Journal. 2. Retrieved 2016-05-28.
- Chiba, Shigeru (2007) . "Javassist, a Java-bytecode translator toolkit". Retrieved 2016-05-27.
- L.,, Hennessy, John. Computer architecture : a quantitative approach. Patterson, David A.,, Asanović, Krste,, Bakos, Jason D.,, Colwell, Robert P.,, Bhattacharjee, Abhishek, 1984-, Conte, Thomas M., 1964- (Sixth ed.). Cambridge, MA. ISBN 0128119055. OCLC 983459758.
- "Machine Language For Beginners - Introduction". atariarchives.org. Archived from the original on 2008-02-13. Retrieved 2016-05-28.
- "Programming Language Popularity". langpop.com. 2013-10-25. Archived from the original on 2015-04-11. Retrieved 2015-10-10.
- "Introduction to Assembly Language". Swansontec.com. Retrieved 2015-10-10.
- "bytecode Definition from PC Magazine Encyclopedia". Pcmag.com. Retrieved 2015-10-10.
- Hyde, Randall (2004). Write Great Code: Thinking Low-level, Writing High-level. Understanding the Machine. 1. San Francisco, CA, USA: No Starch Press. p. passim. ISBN 1-59327003-8. Retrieved 2015-10-10.