From: Rod Pemberton on
"bartc" <bartc(a)freeuk.com> wrote in message
news:XqvNm.6933$Ym4.1565(a)text.news.virginmedia.com...
> "Rod Pemberton" <do_not_have(a)nohavenot.cmm> wrote in message
> news:he4pjc$9us$1(a)aioe.org...
> >
> > How would you recommend coding a bytecode interpreter that works for
> > 16-bit, 32-bit, and 64-bit x86?
>
> What, all together in the same program?

Either way.

> What, all together in the same program?

Sure, why not? It may be slow, but it could be useful for bootstrapping an
x86 OS independent of cpu mode. To fully implement useable subset of x86
instructions, one needs:

1) math operations on one of: register, stack, or memory
2) ability to move data between register and stack
3) (optionally) ability to move data between registers
4) (optionally) ability to move data between register and memory
5) ability to load constants

IIRC, the x86 has enough older single byte instructions, whose encodings are
identical in all three modes, to do that. The real problem is memory
addressing, and/or loading of constants. That was why I pointed to the
16-bit/32-bit partial solution in the middle of this thread:
http://groups.google.com/group/comp.lang.asm.x86/msg/ce546dada8708c27?hl=en


Rod Pemberton
PS. Added a.o.d. and a.l.a, since they said they were bored...