mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-14 01:59:19 +03:00
Implement various SH_ instructions
Implement various shorthand instructions introduced in Alice 2010. This is enough to get through the first scene in Haru Urare.
This commit is contained in:
@@ -63,6 +63,8 @@ bool string_index_valid(int index);
|
||||
struct page *heap_get_page(int index);
|
||||
struct string *heap_get_string(int index);
|
||||
void heap_set_page(int slot, struct page *page);
|
||||
void heap_string_assign(int slot, struct string *string);
|
||||
void heap_struct_assign(int lval, int rval);
|
||||
int32_t heap_alloc_page(struct page *page);
|
||||
int32_t heap_alloc_string(struct string *s);
|
||||
|
||||
|
||||
@@ -61,6 +61,26 @@ struct page {
|
||||
union vm_value values[];
|
||||
};
|
||||
|
||||
static inline union vm_value page_get_var(struct page *page, int i)
|
||||
{
|
||||
#ifdef DEBUG_HEAP
|
||||
if (i < 0 || i >= page->nr_vars)
|
||||
VM_ERROR("Invalid page index: %d", i);
|
||||
#endif
|
||||
return page->values[i];
|
||||
}
|
||||
|
||||
static inline void _page_set_var(struct page *page, int i, union vm_value v)
|
||||
{
|
||||
#ifdef DEBUG_HEAP
|
||||
if (i < 0 || i >= page->nr_vars)
|
||||
VM_ERROR("Invalid page index: %d", i);
|
||||
#endif
|
||||
page->values[i] = v;
|
||||
}
|
||||
|
||||
#define page_set_var(page, i, v) _page_set_var(page, i, vm_value_cast(v))
|
||||
|
||||
// variables
|
||||
union vm_value variable_initval(enum ain_data_type type);
|
||||
void variable_fini(union vm_value v, enum ain_data_type type);
|
||||
|
||||
Reference in New Issue
Block a user