[virtmach] Your VM
Tue, 29 May 2001 03:40:54 -0600
Thomas Fjellstrom wrote:
> MickaŽl Pointier wrote:
> > > and VM code can be called by native code.
> > Interesting. How do you "declare" to the code that a particular
> > piece (function) of VM code exists, how do you handle parameters
> > exchange between VM code and native code ?
> Very carefully. You have to know how to call the VM func
> before even trying. (or the stack could get seriously
I should read more carefully.. To 'declare' a VM
function you do this:
do some neat stuff....
and the assembler saves the assembly program/script
into a .cxe file (Chip eXEcutible) where the lables
prefixed by FUNC have thier addreses saved into a table
that lists the VM function name along side its address.
So you can just call 'chip_exec_sym(vm, "vm_func");'
and it calls the func. (I havent got around to
making argument passing to vm functions easier by
letting them be passed through by the 'chip_exec_sym'
function so at the moment it has to be done manualy)
the .cxe file also lists the 'linked' native
libraries/functions. (linking to native lib is done
"Computer programmers don't byte, they nybble a bit."