From e8d09ec1ec3c8f11ce62bf20f2637440e8d15305 Mon Sep 17 00:00:00 2001 From: crc Date: Fri, 11 Jun 2021 19:51:42 +0000 Subject: [PATCH] nga-c-wip: start work on setting up a single struct to hold the system state (#67) FossilOrigin-Name: ca0e3ee3d97c7188edbb9ef4a86ede7ae2cc141d5d8ed20c33c9ca7a0f400c02 --- vm/nga-c/retro-wip.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/vm/nga-c/retro-wip.c b/vm/nga-c/retro-wip.c index c797902..5709414 100644 --- a/vm/nga-c/retro-wip.c +++ b/vm/nga-c/retro-wip.c @@ -83,6 +83,28 @@ #include "image.c" + +typedef void (*Handler)(void); + +/* Issue 66 ----------- */ +struct Nga { + CELL sp, rp, ip; /* Stack & instruction pointers */ + CELL data[STACK_DEPTH]; /* The data stack */ + CELL address[ADDRESSES]; /* The address stack */ + CELL memory[IMAGE_SIZE]; /* RAM */ + char code_start[33], code_end[33], test_start[33], test_end[33]; + Handler DeviceHandlers[MAX_DEVICES]; + Handler QueryHandlers[MAX_DEVICES]; + Handler Bindings[1000]; + char string_data[8192]; + char **sys_argv; + int sys_argc; + char scripting_sources[64][8192]; + int current_source; + int perform_abort; +}; + + /* Function Prototypes ----------------------------------------------- */ CELL stack_pop(); void stack_push(CELL value); @@ -159,7 +181,6 @@ int devices; /* The number of I/O devices */ char code_start[33], code_end[33], test_start[33], test_end[33]; /* Populate The I/O Device Tables ------------------------------------ */ -typedef void (*Handler)(void); Handler IO_deviceHandlers[MAX_DEVICES]; Handler IO_queryHandlers[MAX_DEVICES];