Really interesting post Karlos, thanks.
If that does transpire, I shall no doubt be pestering you for further details.
Feel free
Just be careful how you implement the HCF operation
http://en.wikipedia.org/wiki/File:MC6800_Processor_Diagram.png
Just from the above diagram alone, you can start to get an idea of the minimal strucutural requirements of such an emulator. You'd will need some data structure to represent your virtual 6800 containing:
8-bit integer variable for Accumulator A
8-bit integer variable for Accumulator B
16-bit unsigned integer variable for the Index Register
16-bit unsigned integer variable for the Stack Pointer
16-bit unsigned integer variable for the Program Counter
8-bit integer variable (or 6 separate booleans) for the status register (H I N Z V C)
You will also need an array of 65536 bytes to represent the external memory. The index register, stack pointer and program counter will always be interpreted as offsets into this array.
If you are doing this in Java, I don't think it actually has "unsigned" as a qualifier for integers. So, you will probably have to use a regular "int" and make sure it never overflows 65535 for your emulation of the 16-bit registers.
The basic implementation of an interpretive emulator would be as follows:
Look up the value of the byte in the "memory" array at the position indicated by the program counter.
Perform the operation the byte represents, fetching any additional bytes that might represent immediate values.
Check for any special outcomes and handle accordingly.
Update all the register values accordingly (generally, the status register, accumulators and program counter) and external memory (if affected).
Rinse and repeat until some limit on the number of interpreted instructions, virtual clock ticks or whatever is reached.
Do whatever other housework is needed (if you are emulating a complete system), handle any pending virtual interrupts, etc.
Rinse and repeat until the emulation is stopped.