CrazyEngineers
  • 8086 opcode conversion

    Len

    Member

    Updated: Oct 27, 2024
    Views: 1.6K
    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.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • simplycoder

    MemberOct 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.
    Are you sure? This action cannot be undone.
    Cancel
  • Len

    MemberOct 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.
    Are you sure? This action cannot be undone.
    Cancel
  • [Prototype]

    MemberOct 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?
    Are you sure? This action cannot be undone.
    Cancel
  • Len

    MemberOct 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?
    Are you sure? This action cannot be undone.
    Cancel
  • simplycoder

    MemberOct 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
    Are you sure? This action cannot be undone.
    Cancel
  • manishks

    MemberOct 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.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register