nga-c: retro.c now has optional support code for controlling cores. not exposed via the i/o at this point.

FossilOrigin-Name: f695ef452e906e9047b0cac2c6ae62147d6c3381538e7ce2fd05b446f022152f
This commit is contained in:
crc 2021-07-29 09:57:26 +00:00
parent d89a184a1c
commit 5e0b2e177e
3 changed files with 41 additions and 92 deletions

View file

@ -14,6 +14,7 @@ ENABLED += -DENABLE_RNG
ENABLED += -DENABLE_CLOCK
ENABLED += -DENABLE_SCRIPTING
ENABLED += -DENABLE_SIGNALS
#ENABLED += -DENABLE_MULTICORE
all: build

View file

@ -10,8 +10,8 @@
#define CELL_MAX LLONG_MAX - 1
#endif
#endif
CELL ngaImageCells = 17239;
CELL ngaImage[] = { 1793,15137,17221,17238,202110,400,372,1069,1535,0,10,1,10,2,10,3,10,4,10,
CELL ngaImageCells = 15504;
CELL ngaImage[] = { 1793,15137,15486,15503,202110,400,372,1069,1535,0,10,1,10,2,10,3,10,4,10,
5,10,6,10,7,10,8,10,11,10,12,10,13,10,14,10,15,10,16,10,
17,10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,68223234,1,2575,
85000450,1,656912,161,178,268505089,63,62,285281281,0,63,2063,10,101384453,0,9,10,68485378,255,18350338,
@ -162,7 +162,7 @@ CELL ngaImage[] = { 1793,15137,17221,17238,202110,400,372,1069,1535,0,10,1,10,2,
2967,166,110,58,105,110,99,0,659713,1,10,2958,2979,166,110,58,100,101,99,0,
659969,1,10,2970,2996,166,110,58,98,101,116,119,101,101,110,63,0,67503109,1793,3004,
67503109,67503109,2049,2950,10,1,2999,2049,2165,11,10,2982,3023,166,83,99,111,112,101,76,
105,115,116,0,16916,16968,10,3010,3032,166,123,123,0,2049,1570,2,1,3023,2049,59,
105,115,116,0,15181,15233,10,3010,3032,166,123,123,0,2049,1570,2,1,3023,2049,59,
16,10,3026,3057,166,45,45,45,114,101,118,101,97,108,45,45,45,0,2049,1570,
1,3023,2049,2967,16,10,3041,3071,166,125,125,0,1,3023,2049,56,4,15,11,1793,
3085,3841,3023,4097,2,10,1,3080,1793,3111,3841,3023,1793,3106,1,2,983567,1,3023,2049,
@ -208,7 +208,7 @@ CELL ngaImage[] = { 1793,15137,17221,17238,202110,400,372,1069,1535,0,10,1,10,2,
10,1,3873,2049,2155,4097,3680,10,3848,3902,154,84,101,109,112,83,116,114,105,110,
103,115,0,32,3887,3920,154,84,101,109,112,83,116,114,105,110,103,77,97,120,
0,512,3903,3932,166,83,84,82,73,78,71,83,0,2049,1543,3841,3902,3841,3920,19,
18,10,3921,3952,154,67,117,114,114,101,110,116,0,17,10,3941,3967,166,115,58,
18,10,3921,3952,154,67,117,114,114,101,110,116,0,31,10,3941,3967,166,115,58,
112,111,105,110,116,101,114,0,3841,3952,3841,3920,19,2049,3932,17,10,3954,3986,166,
115,58,110,101,120,116,0,1,3952,2049,3509,3841,3952,3841,3902,11,1793,4002,1,0,
4097,3952,10,1,3997,9,10,3921,4016,166,115,58,116,101,109,112,0,2,2049,102,
@ -786,90 +786,4 @@ CELL ngaImage[] = { 1793,15137,17221,17238,202110,400,372,1069,1535,0,10,1,10,2,
111,102,0,2049,8676,10,15428,15466,166,97,58,105,110,100,101,120,45,111,102,45,
115,116,114,105,110,103,0,2049,8712,10,15445,15483,166,115,58,105,110,100,101,120,
45,111,102,0,2049,4320,10,15469,15500,166,115,58,105,110,100,101,120,45,111,102,
0,2049,4789,10,15486,15514,166,100,58,119,111,114,100,115,0,1793,15523,2049,184,2049,
9746,2049,9720,10,1,15516,2049,7965,10,15503,15544,166,100,58,119,111,114,100,115,45,
119,105,116,104,0,2049,1929,2049,5061,1793,15575,2049,184,2,2049,1929,2049,4578,1793,15564,
2049,9746,2049,9720,10,1,15559,1793,15570,3,10,1,15568,2049,64,10,1,15550,2049,7965,
10,15528,15599,166,100,105,115,112,108,97,121,45,105,102,45,108,101,102,116,0,
2,2049,1929,2049,5011,1793,15611,2049,9746,2049,9720,10,1,15606,1793,15617,3,10,1,15615,
2049,64,10,15528,15648,166,100,58,119,111,114,100,115,45,98,101,103,105,110,110,
105,110,103,45,119,105,116,104,0,2049,1929,2049,5061,1793,15659,2049,184,2049,15599,10,
1,15654,2049,7965,10,15622,15675,166,115,58,115,112,108,105,116,0,2049,6526,10,15664,
15699,166,115,58,115,112,108,105,116,45,111,110,45,115,116,114,105,110,103,0,
2049,6558,10,15678,15722,166,115,58,99,111,110,116,97,105,110,115,45,99,104,97,
114,63,0,2049,4386,10,15702,15747,166,115,58,99,111,110,116,97,105,110,115,45,
115,116,114,105,110,103,63,0,2049,4578,10,15725,15772,166,97,58,99,111,110,116,
97,105,110,115,45,115,116,114,105,110,103,63,0,2049,4578,10,15750,15789,166,97,
58,105,110,100,101,120,45,111,102,0,2049,8676,10,15775,15813,166,97,58,105,110,
100,101,120,45,111,102,45,115,116,114,105,110,103,0,2049,8712,10,15792,15830,166,
115,58,105,110,100,101,120,45,111,102,0,2049,4320,10,15816,15847,166,115,58,105,
110,100,101,120,45,111,102,0,2049,4789,10,15833,15861,166,100,58,119,111,114,100,
115,0,1793,15870,2049,184,2049,9746,2049,9720,10,1,15863,2049,7965,10,15850,15891,166,100,
58,119,111,114,100,115,45,119,105,116,104,0,2049,1929,2049,5061,1793,15922,2049,184,
2,2049,1929,2049,4578,1793,15911,2049,9746,2049,9720,10,1,15906,1793,15917,3,10,1,15915,
2049,64,10,1,15897,2049,7965,10,15875,15946,166,100,105,115,112,108,97,121,45,105,
102,45,108,101,102,116,0,2,2049,1929,2049,5011,1793,15958,2049,9746,2049,9720,10,1,
15953,1793,15964,3,10,1,15962,2049,64,10,15875,15995,166,100,58,119,111,114,100,115,
45,98,101,103,105,110,110,105,110,103,45,119,105,116,104,0,2049,1929,2049,5061,
1793,16006,2049,184,2049,15946,10,1,16001,2049,7965,10,15969,16022,166,115,58,115,112,108,
105,116,0,2049,6526,10,16011,16046,166,115,58,115,112,108,105,116,45,111,110,45,
115,116,114,105,110,103,0,2049,6558,10,16025,16069,166,115,58,99,111,110,116,97,
105,110,115,45,99,104,97,114,63,0,2049,4386,10,16049,16094,166,115,58,99,111,
110,116,97,105,110,115,45,115,116,114,105,110,103,63,0,2049,4578,10,16072,16119,
166,97,58,99,111,110,116,97,105,110,115,45,115,116,114,105,110,103,63,0,
2049,4578,10,16097,16136,166,97,58,105,110,100,101,120,45,111,102,0,2049,8676,10,
16122,16160,166,97,58,105,110,100,101,120,45,111,102,45,115,116,114,105,110,103,
0,2049,8712,10,16139,16177,166,115,58,105,110,100,101,120,45,111,102,0,2049,4320,
10,16163,16194,166,115,58,105,110,100,101,120,45,111,102,0,2049,4789,10,16180,16208,
166,100,58,119,111,114,100,115,0,1793,16217,2049,184,2049,9746,2049,9720,10,1,16210,
2049,7965,10,16197,16238,166,100,58,119,111,114,100,115,45,119,105,116,104,0,2049,
1929,2049,5061,1793,16269,2049,184,2,2049,1929,2049,4578,1793,16258,2049,9746,2049,9720,10,1,
16253,1793,16264,3,10,1,16262,2049,64,10,1,16244,2049,7965,10,16222,16293,166,100,105,
115,112,108,97,121,45,105,102,45,108,101,102,116,0,2,2049,1929,2049,5011,1793,
16305,2049,9746,2049,9720,10,1,16300,1793,16311,3,10,1,16309,2049,64,10,16222,16342,166,
100,58,119,111,114,100,115,45,98,101,103,105,110,110,105,110,103,45,119,105,
116,104,0,2049,1929,2049,5061,1793,16353,2049,184,2049,16293,10,1,16348,2049,7965,10,16316,
16369,166,115,58,115,112,108,105,116,0,2049,6526,10,16358,16393,166,115,58,115,112,
108,105,116,45,111,110,45,115,116,114,105,110,103,0,2049,6558,10,16372,16416,166,
115,58,99,111,110,116,97,105,110,115,45,99,104,97,114,63,0,2049,4386,10,
16396,16441,166,115,58,99,111,110,116,97,105,110,115,45,115,116,114,105,110,103,
63,0,2049,4578,10,16419,16466,166,97,58,99,111,110,116,97,105,110,115,45,115,
116,114,105,110,103,63,0,2049,4578,10,16444,16483,166,97,58,105,110,100,101,120,
45,111,102,0,2049,8676,10,16469,16507,166,97,58,105,110,100,101,120,45,111,102,
45,115,116,114,105,110,103,0,2049,8712,10,16486,16524,166,115,58,105,110,100,101,
120,45,111,102,0,2049,4320,10,16510,16541,166,115,58,105,110,100,101,120,45,111,
102,0,2049,4789,10,16527,16555,166,100,58,119,111,114,100,115,0,1793,16564,2049,184,
2049,9746,2049,9720,10,1,16557,2049,7965,10,16544,16585,166,100,58,119,111,114,100,115,
45,119,105,116,104,0,2049,1929,2049,5061,1793,16616,2049,184,2,2049,1929,2049,4578,1793,
16605,2049,9746,2049,9720,10,1,16600,1793,16611,3,10,1,16609,2049,64,10,1,16591,2049,
7965,10,16569,16640,166,100,105,115,112,108,97,121,45,105,102,45,108,101,102,116,
0,2,2049,1929,2049,5011,1793,16652,2049,9746,2049,9720,10,1,16647,1793,16658,3,10,1,
16656,2049,64,10,16569,16689,166,100,58,119,111,114,100,115,45,98,101,103,105,110,
110,105,110,103,45,119,105,116,104,0,2049,1929,2049,5061,1793,16700,2049,184,2049,16640,
10,1,16695,2049,7965,10,16663,16716,166,115,58,115,112,108,105,116,0,2049,6526,10,
16705,16740,166,115,58,115,112,108,105,116,45,111,110,45,115,116,114,105,110,103,
0,2049,6558,10,16719,16763,166,115,58,99,111,110,116,97,105,110,115,45,99,104,
97,114,63,0,2049,4386,10,16743,16788,166,115,58,99,111,110,116,97,105,110,115,
45,115,116,114,105,110,103,63,0,2049,4578,10,16766,16813,166,97,58,99,111,110,
116,97,105,110,115,45,115,116,114,105,110,103,63,0,2049,4578,10,16791,16830,166,
97,58,105,110,100,101,120,45,111,102,0,2049,8676,10,16816,16854,166,97,58,105,
110,100,101,120,45,111,102,45,115,116,114,105,110,103,0,2049,8712,10,16833,16871,
166,115,58,105,110,100,101,120,45,111,102,0,2049,4320,10,16857,16888,166,115,58,
105,110,100,101,120,45,111,102,0,2049,4789,10,16874,16902,166,100,58,119,111,114,
100,115,0,1793,16911,2049,184,2049,9746,2049,9720,10,1,16904,2049,7965,10,16891,16932,166,
100,58,119,111,114,100,115,45,119,105,116,104,0,2049,1929,2049,5061,1793,16963,2049,
184,2,2049,1929,2049,4578,1793,16952,2049,9746,2049,9720,10,1,16947,1793,16958,3,10,1,
16956,2049,64,10,1,16938,2049,7965,10,16916,16987,166,100,105,115,112,108,97,121,45,
105,102,45,108,101,102,116,0,2,2049,1929,2049,5011,1793,16999,2049,9746,2049,9720,10,
1,16994,1793,17005,3,10,1,17003,2049,64,10,16916,17036,166,100,58,119,111,114,100,
115,45,98,101,103,105,110,110,105,110,103,45,119,105,116,104,0,2049,1929,2049,
5061,1793,17047,2049,184,2049,16987,10,1,17042,2049,7965,10,17010,17063,166,115,58,115,112,
108,105,116,0,2049,6526,10,17052,17087,166,115,58,115,112,108,105,116,45,111,110,
45,115,116,114,105,110,103,0,2049,6558,10,17066,17110,166,115,58,99,111,110,116,
97,105,110,115,45,99,104,97,114,63,0,2049,4386,10,17090,17135,166,115,58,99,
111,110,116,97,105,110,115,45,115,116,114,105,110,103,63,0,2049,4578,10,17113,
17160,166,97,58,99,111,110,116,97,105,110,115,45,115,116,114,105,110,103,63,
0,2049,4578,10,17138,17177,166,97,58,105,110,100,101,120,45,111,102,0,2049,8676,
10,17163,17201,166,97,58,105,110,100,101,120,45,111,102,45,115,116,114,105,110,
103,0,2049,8712,10,17180,17218,166,115,58,105,110,100,101,120,45,111,102,0,2049,
4320,10,17204,17235,166,115,58,105,110,100,101,120,45,111,102,0,2049,4789,10,0 };
0,2049,4789,10,0 };

View file

@ -161,7 +161,7 @@ CELL memory[IMAGE_SIZE + 1]; /* The memory for the image */
#define TORS cpu[active].address[cpu[active].rp] /* Top item on address stack */
struct NgaCore {
CELL sp, rp, ip; /* Stack & instruction pointers */
CELL sp, rp, ip, active; /* Stack & instruction pointers */
CELL data[STACK_DEPTH]; /* The data stack */
CELL address[ADDRESSES]; /* The address stack */
} cpu[CORES];
@ -189,6 +189,37 @@ char scripting_sources[64][8192];
int current_source;
int perform_abort;
/* Multi Core Support ------------------------------------------------ */
#ifdef MULTICORE
void init_core(CELL x) {
int y;
core[x].sp = 0;
core[x].rp = 0;
core[x].ip = 0;
core[x].active = 0;
for (y = 0; y < STACK_DEPTH; y++) { core[x].data[y] = 0; };
for (y = 0; y < ADDRESSES; y++) { core[x].address[y] = 0; };
}
void start_core(CELL x, CELL ip) {
core[x].ip = ip;
core[x].active = -1;
}
void pause_core(CELL x) {
core[x].active = 0;
}
void resume_core(CELL x) {
core[x].active = -1;
}
void switch_core() {
active += 1;
if (active >= CORES) { active = 0; }
if (!core[active].active) { switch_core(); }
}
#endif
/* Floating Point ---------------------------------------------------- */
#ifdef ENABLE_FLOATS
@ -1321,6 +1352,9 @@ void execute(CELL cell) {
} else {
carry_out_abort();
}
#ifdef MULTICORE
switch_core();
#endif
}
}