1. Home >
  2. Apps >
  3. Groups >

How to rebuild an 8086 microprocessor instruction from its opcode?

Question asked by Len in #Electronics on Oct 27, 2012
Len
Len 路 Oct 27, 2012
Rank E1 - BEGINNER

Is there any method to rebuild an 8086 microprocessor instruction from its opcode? Also how can we convert the instruction to the opcode? I am trying to build an emulator, and cannot continue without knowing these. Thanks in advance.

Posted in: #Electronics
simplycoder
simplycoder 路 Oct 27, 2012
Rank B3 - LEADER
I think firstly you have to maintain a mapping between you opcodes and instructions.
so that there is some kind of relation between them.
I believe there is a CEan who programmed emulator for the same.

Just post some opcode along with the instruction,
then we shall see how to tackle this.

If you are making an emulator and you are serious about it, I advise you to keep separate array which will handle all the memory locations as you would need it.
Len
Len 路 Oct 28, 2012
Rank E1 - BEGINNER
https://www.mlsite.net/8086/
I found an opcode map in this link, but cant quite make out how the actual opcode is generated. I wish they had some examples 馃様


If you are making an emulator and you are serious about it, I advise you to keep separate array which will handle all the memory locations as you would need it.
I am planning to store the memory locations in a database.
[Prototype]
[Prototype] 路 Oct 28, 2012
Rank B1 - LEADER
Len
https://www.mlsite.net/8086/
I found an opcode map in this link, but cant quite make out how the actual opcode is generated. I wish they had some examples 馃様




I am planning to store the memory locations in a database.

[鈥婭MG]

Its like ROW and COLUMN. So,

0x00 = ADD
0x10 = ADC

Is it what you're asking?
Len
Len 路 Oct 28, 2012
Rank E1 - BEGINNER
Its like ROW and COLUMN. So,

0x00 = ADD
0x10 = ADC

Is it what you're asking?
No i got that part. What about the rest of the opcode? For example, what will be the opcode for the instruction MOV AX,BX ? And one i get the opcode,how can i convert it back to the original instruction?
simplycoder
simplycoder 路 Oct 28, 2012
Rank B3 - LEADER
I think you get a sheet which maps the opcodes to instructions, based on that sheet, you can create something like dictionary.

If you have some opcode, search in your dictionary, find the corresponding instruction
manishks
manishks 路 Oct 28, 2012
Rank C2 - EXPERT
yes there's a sheets which is needed to be referred while writing an opcode.
1st 6 bits of code will be machine code of MOV instruction.
Next bit descides the direction of data flow i.e it is from register to memory location or vice versa.
Next bit(on right of direction bit) tells us if the data being transferred is word or data word or byte.
Similarly rest of the bits are obtained by referring the table.

Refer any microprocessor book on 8086.
Kavya Burramolla
Kavya Burramolla 路 Feb 1, 2020
Rank C1 - EXPERT

Generally, the structure of the instructions in microprocessor has 4 parts.聽Label, Opcode, Operand, Comments.聽

Here the label is the starting part of the code that can be a number or a symbol. Label is assigned the current value of the active location counter and serves as an instruction operand. Opcodes are also known as operational code or the opstring. They define the function that needs to be carried on the input variables. For example opcode MOV - is for the move operation, ADD, SUB, DIV are some of the examples of the opcode.

Operands are trhe input variables. And comments are the remarks given at the end of the instruction for ease of understanding. For example : - 1: ADD A, B ; # adds the value of two variables A and B. Here 1 is the label, ADD is the opcode, A,B are operands and text after # is the comment.

Opcode conversion is nothing but the translation to binary digits.Every opcode has its binary equivalent.聽聽

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up