Hacker News new | ask | show | jobs
by lmitchell 3014 days ago
I dunno, I find it pretty easy to understand... seems like the main instruction loop is in tvm.c, in the function tvm_vm_run(), which is exactly the first place I looked and seems totally sensible to me.

  for (; vm->prog->instr[*instr_idx] != -0x1; ++(*instr_idx))
    tvm_step(vm, instr_idx);
1 comments

Compare that to my 6809 emulator [1]. I have a mc6809_run() function that is pretty much the same, but mc6809_step() is in the same file and not hidden in a header file. There also seems to be a lack of memory operations (like reading or writing) other than PUSH/POP.

[1] https://github.com/spc476/mc6809 [2]

[2] Yes, it lacks a README. I know.