Commit Graph
9 Commits
Author SHA1 Message Date
Nunuhara Cabbage 89cee10c51 Implement system.GetTime() 2019-11-15 21:20:27 -08:00
Nunuhara Cabbage d3de009e1d Import CG reading code from xsystem35
Plus a bit of SACT2 implementation, and fix a bug where global arrays
were not initialized properly.
2019-11-15 19:01:08 -08:00
Nunuhara Cabbage 1e3fbcd95f Change HLL calling convention
...and add OutputLog.dll stubs.

The calling convention no longer has HLL functions reaching into the
stack. The previous implementation didn't even work since the return
value could overwrite an argument that needed to be freed.
2019-11-07 19:26:58 -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
kichikuou e6a3bf4c06 Fix undefined behavior of stack_{push,set}
This makes sure that stack_ptr is evaluated / updated
after the evaluation of the macro argument.
2019-11-01 19:48:37 +09: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 33ec7a34e1 Basic arrays implementation
Just .Alloc() and .Free() for now.
2019-10-22 17:33:26 -07:00
Nunuhara Cabbage ac5859adfe Allocate all pages with malloc
Local pages need to be reference counted like any other page. It is
possible to create references to local variables which escape the extent
of their function call, so using a stack doesn't work.

Caching is implemented for small page sizes to avoid invoking
malloc/free on every function call.
2019-10-21 18:54:36 -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