[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emulator Project Question



Bryan Parkoff wrote:

Emulator Project Question

    I am curious why C++ is written to read 6502 opcode before C++ function
has to be built in order to translate 6502 opcode into 80x86 opcode.  I
believe that function is not needed however we must match each opcode code.
    For example: 0x4C is the JMP for 6502 and we need to find 80x86 opcode
that has similiar JMP opcode.  If hex code is found, then we can be able to
translate from 4C to ?? without using C++ function.


No we can't. Otherwise the 80x86 jumps to an adress that contains 6502 codes. That wouldn't work.

    If 6502 and 80x86 opcodes are very similar, but they are never
compatible then function is necessary to be written. I am curious.

They are not compatible. The main reason is that the emulator is an emulator, and not a piece of hardware. The 6502 code needs to do things with the *emulated* processor, memory, screen, disk drives etc., not with the *real* processor etc. For example we do not want an LDA to load the real AX register of the 80x86 because the emulator software needs that register for itself - for example to do the hex lookup you mentioned you will probably need the 80x86 registers.

--

Linards Ticmanis

 The Master said, "The business of laying on the colors follows the
preparation of the plain ground."