8086 opcode conversion

Len

Len

@len-w2v8jb Oct 27, 2024
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.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • simplycoder

    simplycoder

    @simplycoder-NsBEdD Oct 27, 2012

    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

    @len-w2v8jb Oct 27, 2012

    #-Link-Snipped-#
    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]

    @prototype-G9Gn5k Oct 27, 2012

    Len
    #-Link-Snipped-#
    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.

    [​IMG]

    Its like ROW and COLUMN. So,

    0x00 = ADD
    0x10 = ADC

    Is it what you're asking?
  • Len

    Len

    @len-w2v8jb Oct 27, 2012

    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

    @simplycoder-NsBEdD Oct 28, 2012

    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

    @manishks-AZybhs Oct 28, 2012

    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.