Electronic – what does byte 2 and byte 3 mean

8085microprocessor

An instruction from the instruction set of intel 8085 that is SBI data (Subtract immediate with borrow) . This instruction says "The contents of the second byte of the instruction and the contents of the CY flag are both subtracted from the accumulator. The result is placed in the accumulator."

Or

(A) <– (A) -(byte 2) – (CY)

In this what does second byte or byte mean ?

Also in the instruction STA addr (Store immediate address) which says "The content of the accumulator is moved to the memory location whose address is specified in byte 2 and byte 3 of the instruction." What does byte 2 and byte 3 mean ?

Best Answer

Instructions are made up of a variable number of "words" and those words are made up of bits. In the case of the 8085 architecture, you can have instructions that are one, two, or three words long, and each word is 8-bits. Those bits are divided up into fields based on your instruction set. What fields there are and what those fields mean is usually contextually sensitive based on the value of one field that always has the same meaning. Typically this field is referred to as the "op code." You should read in detail at least chapter 8 of the linked pdf to get a thorough understanding.

In the case of instructions that operate on registers and store their results in a register, the source and target registers need to be identified in some fields in the instruction. In the case of an instruction that adds a constant to a register and stores the result in a register, the registers still need to be identified, but the constant also needs to be encoded in the instruction in its own field. In instruction set architectures, the term "immediate" is often used to mean a "constant value." In case of instructions that read from or write to memory, the location in memory may have to be encoded within the instruction.

That's the basic idea, hope this helps. For future reference, a good search term for questions like this is "Instruction Set Architecture" for your processor.


Edit Re: STA 4200

The STA instruction is described on page 3-61 (pg 117) of this Assembly Language Programming guide for 8080/8085 processors.The three bytes are:

  • Byte 1 = OpCode (00110010)
  • Byte 2 = Low Address Byte
  • Byte 3 = High Address Byte

STA is the "Store Accumulator Direct" instruction, and what it does is copies the value of the Accumulator into memory at the 16-bit address composed from Bytes 2 and 3.