Commit Graph
15 Commits
Author SHA1 Message Date
Nunuhara Cabbage e6f41f55b8 Implement S_LENGTH2 instruction 2019-11-19 21:23:12 -08:00
Nunuhara Cabbage 80ff1902e6 Implement MSG instruction 2019-11-19 20:34:31 -08:00
Nunuhara Cabbage 7ec7124d01 Implement CALLONJUMP and SJUMP instructions
Add support for scenario functions (functions which clear the call stack
upon entry and never return).
2019-11-19 19:56:18 -08:00
Nunuhara Cabbage edffc0ad76 Initial CALLHLL and Math.dll implementation
HLL libraries are compiled into the executable rather than dynamically
loaded as in early versions of System 4. These days AliceSoft does the
same thing.
2019-11-04 20:35:42 -08:00
Nunuhara Cabbage 9db69f8012 Implement DUP_U2, SP_INC, DELETE, R_ASSIGN
Reference assignment.
2019-10-31 21:37:47 -07:00
Nunuhara Cabbage 84e531b9ab Implement SWITCH, STRSWITCH 2019-10-31 17:27:03 -07:00
Nunuhara Cabbage 3ff406cb58 SR_POP, SR_ASSIGN, C_REF, C_ASSIGN 2019-10-29 19:58:26 -07:00
Nunuhara Cabbage 470c051124 Implement full suite of array instructions
All array instructions supported by the SDK compiler, anyway. There are
a few instructions that were added in later versions, like A_FIND and
A_REVERSE.
2019-10-28 20:31:50 -07:00
Nunuhara Cabbage 2bf800d77e Implement CALLSYS2 instruction (function types)
Also the SWAP instruction since the compiler generates it for indirect
function calls.
2019-10-22 19:02:20 -07:00
Nunuhara Cabbage e5ef9f4d2d Implement constructors and methods
Implement CALLMETHOD, SH_STRUCTREF and PUSHSTRUCTPAGE instructions.

Constructors are a bit tricky since SH_LOCALCREATE has to implicitly
call an arbitrary number of functions before it returns (just changing
the instruction pointer only allows for calling a single function).

To get around this, there is now a vm_call() function which is used to
call a function synchronously, before returning from the current
instruction.

Methods are implemented as functions, except that they get a struct page
as local variable -1.

Destructors are still not implemented.
2019-10-20 17:33:22 -07:00
Nunuhara Cabbage 2210696f93 Implement S_REF (struct pass-by-value) 2019-10-20 11:51:16 -07:00
Nunuhara Cabbage 7ba5626675 Support simple struct/class usage
No constructors, destructors or methods--just simple data structures.
2019-10-19 08:18:22 -07:00
Nunuhara Cabbage cc2a2c594a Floating point instructions 2019-10-13 21:32:17 -07:00
Nunuhara Cabbage 769e0ce0c3 Add argument types to instruction table
Not really useful for the VM, but could be used for an objdump-like
utility.
2019-10-10 07:16:48 -07:00
Nunuhara Cabbage 84df756faf Initial commit
An assortment of instructions have been implemented so far, mostly basic
stuff such as stack management. The following program can be executed:

int main(void)
{
    hello(2);
    for (;;) {
        system.Peek();
        system.Sleep(1);
    }
    return 0;
}

void hello(int n)
{
    int i;
    for (i = 0; i < n; i++) {
        system.Output("Hello, world! " + string(i));
    }
}
2019-10-06 19:35:36 -07:00