nga-c: remove a variable in invalid_opcode()

FossilOrigin-Name: 5566b4671f5af90202b8493e14142acd7e902732410a3d071040310721e7d8d6
This commit is contained in:
crc 2021-01-24 05:16:18 +00:00
parent e19e2e95eb
commit 3d276b7be4
4 changed files with 77 additions and 67 deletions

View file

@ -128,7 +128,7 @@ update-extensions: bin/retro
vm/nga-c/retro-image.c: ngaImage bin/retro-embedimage bin/retro-extend interface/filesystem.retro interface/floatingpoint.retro interface/unix.retro interface/rng.retro interface/sockets.retro interface/scripting.retro interface/retro-unix.retro interface/clock.retro
cp ngaImage rre.image
./bin/retro-extend rre.image interface/filesystem.retro interface/floatingpoint.retro interface/unix.retro interface/rng.retro interface/sockets.retro interface/scripting.retro interface/retro-unix.retro interface/clock.retro
./bin/retro-extend rre.image interface/filesystem.retro interface/floatingpoint.retro interface/unix.retro interface/rng.retro interface/sockets.retro interface/scripting.retro interface/clock.retro interface/retro-unix.retro
./bin/retro-embedimage rre.image >vm/nga-c/retro-image.c
bin/retro: vm/nga-c/retro-image.c vm/nga-c/retro-unix.c vm/nga-c/bsd-strl.c vm/nga-c/config.h vm/nga-c/dev-clock.c vm/nga-c/dev-files.c vm/nga-c/dev-floatingpoint.c vm/nga-c/dev-image.c vm/nga-c/dev-rng.c vm/nga-c/dev-sockets.c vm/nga-c/dev-unix.c vm/nga-c/prototypes.h package/list.forth package/load-extensions.retro

View file

@ -4,6 +4,8 @@
## I/O
- simplify definition of `c:get`
## Toolchain
## VM

View file

@ -2,8 +2,8 @@
#ifndef CELL
#define CELL int32_t
#endif
CELL ngaImageCells = 14899;
CELL ngaImage[] = { 1793,14319,14856,14898,202104,0,10,1,10,2,10,3,10,4,10,5,10,6,10,
CELL ngaImageCells = 15060;
CELL ngaImage[] = { 1793,14718,15017,15059,202104,0,10,1,10,2,10,3,10,4,10,5,10,6,10,
7,10,8,10,9,10,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,10,68223234,1,2575,
85000450,1,656912,141,140,268505089,63,62,285281281,0,63,2063,10,101384453,0,9,10,2049,56,25,
@ -12,7 +12,7 @@ CELL ngaImage[] = { 1793,14319,14856,14898,202104,0,10,1,10,2,10,3,10,4,10,5,10,
1793,114,2049,114,117506307,0,107,0,524545,25,112,168820993,0,126,1642241,126,134283523,7,112,1793,
107,7,524545,2049,107,1793,107,16846593,126,141,140,1793,64,16846593,126,112,140,1793,64,7,
10,659713,1,659713,2,659713,3,1793,168,17108737,3,2,524559,107,2049,107,2049,107,2049,121,
168820998,2,13585,1025,167841793,181,5,17826049,0,181,2,15,25,524546,164,134287105,182,95,2305,183,
168820998,2,13984,1025,167841793,181,5,17826049,0,181,2,15,25,524546,164,134287105,182,95,2305,183,
459023,191,134287361,182,186,659201,181,2049,56,25,84152833,48,286458116,10,459014,206,184618754,45,25,16974851,
-1,168886532,1,134284289,1,215,134284289,0,206,660227,32,0,0,112,114,101,102,105,120,58,
105,0,285278479,232,7,2576,524546,81,1641217,1,167838467,229,2049,245,2049,241,524545,232,201,17826050,
@ -55,7 +55,7 @@ CELL ngaImage[] = { 1793,14319,14856,14898,202104,0,10,1,10,2,10,3,10,4,10,5,10,
101,114,115,105,111,110,0,975,416,146,105,0,986,107,146,100,0,991,410,146,
114,0,996,339,146,101,114,114,58,110,111,116,102,111,117,110,100,0,0,0,
0,0,0,0,0,0,105,109,97,103,101,58,115,97,118,101,0,103,101,0,
65,68,77,69,46,114,101,116,114,111,0,0,79,85,78,68,0,125,126,0,
65,68,77,69,46,114,101,116,114,111,0,0,110,0,78,68,0,125,126,0,
72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -160,7 +160,7 @@ CELL ngaImage[] = { 1793,14319,14856,14898,202104,0,10,1,10,2,10,3,10,4,10,5,10,
983556,1793,3087,1,21,2049,2100,10,1,3082,2049,2100,4100,10,3065,3105,146,118,58,117,
112,100,97,116,101,0,4,1793,3112,15,4,8,10,1,3108,2049,2110,16,10,3093,
3126,146,99,111,112,121,0,1793,3135,285278725,1,33951492,268767489,1,6,10,1,3128,2049,2275,
771,10,3118,3154,146,83,99,111,112,101,76,105,115,116,0,14762,14814,10,3141,3163,
771,10,3118,3154,146,83,99,111,112,101,76,105,115,116,0,14923,14975,10,3141,3163,
146,123,123,0,2049,1570,2,1,3154,2049,59,16,10,3157,3188,146,45,45,45,114,
101,118,101,97,108,45,45,45,0,2049,1570,1,3154,2049,2890,16,10,3172,3202,146,
125,125,0,1,3154,2049,56,4,15,11,1793,3216,3841,3154,4097,2,10,1,3211,1793,
@ -179,7 +179,7 @@ CELL ngaImage[] = { 1793,14319,14856,14898,202104,0,10,1,10,2,10,3,10,4,10,5,10,
21,2049,2100,4097,3256,10,1,3458,2049,2100,4097,3265,10,3433,3487,133,84,101,109,112,
83,116,114,105,110,103,115,0,32,3472,3505,133,84,101,109,112,83,116,114,105,
110,103,77,97,120,0,512,3488,3517,146,83,84,82,73,78,71,83,0,2049,1543,
3841,3487,3841,3505,19,18,10,3506,3537,133,67,117,114,114,101,110,116,0,12,10,
3841,3487,3841,3505,19,18,10,3506,3537,133,67,117,114,114,101,110,116,0,20,10,
3526,3552,146,115,58,112,111,105,110,116,101,114,0,3841,3537,3841,3505,19,2049,3517,
17,10,3539,3571,146,115,58,110,101,120,116,0,1,3537,2049,2988,3841,3537,3841,3487,
11,1793,3587,1,0,4097,3537,10,1,3582,9,10,3506,3601,146,115,58,116,101,109,
@ -682,64 +682,64 @@ CELL ngaImage[] = { 1793,14319,14856,14898,202104,0,10,1,10,2,10,3,10,4,10,5,10,
13234,2049,9135,10,13490,13547,146,115,99,114,105,112,116,58,97,98,111,114,116,45,
105,110,99,108,117,100,101,0,2049,13247,1,7,3841,13234,2049,9135,10,13523,13565,146,
97,98,111,114,116,0,1,126,2049,3047,2049,13247,1,8,3841,13234,2049,9135,10,13556,
1024,133,84,73,66,0,13578,13599,146,105,109,97,103,101,58,115,97,118,101,0,
1,1000,2049,9152,2049,9135,10,13585,13615,146,99,58,103,101,116,0,1,1,2049,9152,
2049,9135,10,13606,13631,146,101,100,105,116,63,0,2,1793,13638,1,8,11,10,1,
13634,1793,13646,1,127,11,10,1,13642,2049,2122,22,10,13622,13662,146,103,97,116,104,
101,114,0,2049,13631,1,11,1,3336,2049,64,10,13652,13680,146,99,121,99,108,101,
0,2049,13615,2049,2090,4,8,2049,2459,25,3,2049,13662,1,13680,7,10,13606,13711,146,
112,97,114,115,101,45,117,110,116,105,108,0,1793,13723,2049,3627,2049,3428,2049,13680,
771,2049,3302,10,1,13713,2049,3452,10,13696,13737,146,115,58,103,101,116,0,1793,13759,
1793,13745,1,10,11,10,1,13741,1793,13753,1,13,11,10,1,13749,2049,2122,22,10,
1,13739,2049,13711,10,13728,13778,146,115,58,103,101,116,45,119,111,114,100,0,1,
5592,2049,13711,10,13764,13792,146,99,108,101,97,114,0,2049,3646,92,94,91,50,74,
92,94,91,48,59,48,72,0,1,13794,2049,7225,2049,9248,10,13783,13824,133,78,111,
69,99,104,111,0,0,13814,13832,146,98,121,101,0,1,0,2049,12311,10,13825,13844,
133,69,79,84,0,0,13837,13857,133,73,103,110,111,114,105,110,103,0,0,13845,
13871,146,105,103,110,111,114,105,110,103,63,0,3841,13857,10,13858,13885,146,118,101,
114,115,105,111,110,0,3841,4,1,100,20,10,13874,13900,146,100,111,110,101,63,
0,2,4097,13844,1793,13909,1,13,11,10,1,13905,1793,13917,1,10,11,10,1,13913,
1793,13925,1,32,11,10,1,13921,2049,2159,22,22,10,13891,13940,146,101,111,108,63,
0,3841,13844,1793,13948,1,13,11,10,1,13944,1793,13956,1,10,11,10,1,13952,2049,
2122,22,10,13932,13972,146,118,97,108,105,100,63,0,2,2049,81,2049,2609,10,13962,
13991,146,99,104,101,99,107,45,101,111,102,0,2,1793,13998,1,-1,11,10,1,
13994,1793,14006,1,4,11,10,1,14002,2049,2122,22,1,13832,9,10,13978,14021,146,98,
115,0,2049,3360,2049,3360,771,10,14015,14039,146,99,104,101,99,107,45,98,115,0,
2,1793,14046,1,8,11,10,1,14042,1793,14054,1,127,11,10,1,14050,2049,2122,22,
1,14021,9,10,14027,14072,146,99,104,101,99,107,0,2049,13991,2049,14039,10,14063,14090,
146,99,104,97,114,97,99,116,101,114,0,2049,13615,2,2049,3336,10,14077,14106,146,
98,117,102,102,101,114,0,1793,14116,1,1024,2049,3428,8,2049,3302,10,1,14108,2049,
3452,10,14096,14135,146,114,101,97,100,45,116,111,107,101,110,0,1793,14151,1793,14146,
2049,14090,2049,14072,2049,13900,10,1,14139,2049,2250,10,1,14137,2049,14106,2049,3724,10,14121,
14167,146,105,110,112,117,116,0,2049,14135,2049,13972,10,14158,14183,146,112,114,111,99,
101,115,115,0,2049,13871,1793,14201,771,2049,13940,1793,14197,1,13857,2049,3047,10,1,14192,
9,10,1,14187,2049,2653,1,369,1,11,2049,64,10,13825,14218,158,47,47,0,2049,
13514,1,13857,2049,3034,10,14212,14235,146,98,97,110,110,101,114,0,2049,13885,2049,3646,
82,69,84,82,79,32,49,50,32,40,37,110,46,37,110,41,92,110,0,1,
14239,2049,7225,2049,9248,2049,1543,2049,1874,18,2049,1874,2049,1543,2049,3646,37,110,32,77,
97,120,44,32,37,110,32,85,115,101,100,44,32,37,110,32,70,114,101,101,
92,110,0,1,14275,2049,7225,2049,9248,10,14225,14319,146,108,105,115,116,101,110,0,
3841,13824,1793,14326,2049,14235,10,1,14323,2049,72,2049,14167,2049,14183,1,14330,7,10,14309,
14347,133,67,108,111,99,107,0,0,14338,14360,146,105,100,101,110,116,105,102,121,
0,3841,14347,2049,2527,25,3,1,5,2049,9152,2,2049,2562,1793,14415,3,2049,3646,73,
13587,133,67,108,111,99,107,0,0,13578,13600,146,105,100,101,110,116,105,102,121,
0,3841,13587,2049,2527,25,3,1,5,2049,9152,2,2049,2562,1793,13655,3,2049,3646,73,
79,32,68,69,86,73,67,69,32,84,89,80,69,32,48,48,48,53,32,78,
79,84,32,70,79,85,78,68,0,1,14378,2049,9248,2049,9211,10,1,14375,1793,14422,
4097,14347,10,1,14419,2049,64,10,14309,14446,146,99,108,111,99,107,58,111,112,101,
114,97,116,105,111,110,0,2049,14360,3841,14347,2049,9135,10,14427,14472,146,99,108,111,
99,107,58,116,105,109,101,115,116,97,109,112,0,1,0,2049,14446,10,14453,14490,
146,99,108,111,99,107,58,100,97,121,0,1,1,2049,14446,10,14477,14510,146,99,
108,111,99,107,58,109,111,110,116,104,0,1,2,2049,14446,10,14495,14529,146,99,
108,111,99,107,58,121,101,97,114,0,1,3,2049,14446,10,14515,14548,146,99,108,
111,99,107,58,104,111,117,114,0,1,4,2049,14446,10,14534,14569,146,99,108,111,
99,107,58,109,105,110,117,116,101,0,1,5,2049,14446,10,14553,14590,146,99,108,
111,99,107,58,115,101,99,111,110,100,0,1,6,2049,14446,10,14574,14612,146,99,
108,111,99,107,58,117,116,99,58,100,97,121,0,1,7,2049,14446,10,14595,14636,
79,84,32,70,79,85,78,68,0,1,13618,2049,9248,2049,9211,10,1,13615,1793,13662,
4097,13587,10,1,13659,2049,64,10,13556,13686,146,99,108,111,99,107,58,111,112,101,
114,97,116,105,111,110,0,2049,13600,3841,13587,2049,9135,10,13667,13712,146,99,108,111,
99,107,58,116,105,109,101,115,116,97,109,112,0,1,0,2049,13686,10,13693,13730,
146,99,108,111,99,107,58,100,97,121,0,1,1,2049,13686,10,13717,13750,146,99,
108,111,99,107,58,109,111,110,116,104,0,1,2,2049,13686,10,13735,13769,146,99,
108,111,99,107,58,121,101,97,114,0,1,3,2049,13686,10,13755,13788,146,99,108,
111,99,107,58,104,111,117,114,0,1,4,2049,13686,10,13774,13809,146,99,108,111,
99,107,58,109,105,110,117,116,101,0,1,5,2049,13686,10,13793,13830,146,99,108,
111,99,107,58,115,101,99,111,110,100,0,1,6,2049,13686,10,13814,13852,146,99,
108,111,99,107,58,117,116,99,58,100,97,121,0,1,7,2049,13686,10,13835,13876,
146,99,108,111,99,107,58,117,116,99,58,109,111,110,116,104,0,1,8,2049,
14446,10,14617,14659,146,99,108,111,99,107,58,117,116,99,58,121,101,97,114,0,
1,9,2049,14446,10,14641,14682,146,99,108,111,99,107,58,117,116,99,58,104,111,
117,114,0,1,10,2049,14446,10,14664,14707,146,99,108,111,99,107,58,117,116,99,
58,109,105,110,117,116,101,0,1,11,2049,14446,10,14687,14732,146,99,108,111,99,
107,58,117,116,99,58,115,101,99,111,110,100,0,1,12,2049,14446,10,14712,14748,
13686,10,13857,13899,146,99,108,111,99,107,58,117,116,99,58,121,101,97,114,0,
1,9,2049,13686,10,13881,13922,146,99,108,111,99,107,58,117,116,99,58,104,111,
117,114,0,1,10,2049,13686,10,13904,13947,146,99,108,111,99,107,58,117,116,99,
58,109,105,110,117,116,101,0,1,11,2049,13686,10,13927,13972,146,99,108,111,99,
107,58,117,116,99,58,115,101,99,111,110,100,0,1,12,2049,13686,10,13952,1024,
133,84,73,66,0,13977,13998,146,105,109,97,103,101,58,115,97,118,101,0,1,
1000,2049,9152,2049,9135,10,13984,14014,146,99,58,103,101,116,0,1,1,2049,9152,2049,
9135,10,14005,14030,146,101,100,105,116,63,0,2,1793,14037,1,8,11,10,1,14033,
1793,14045,1,127,11,10,1,14041,2049,2122,22,10,14021,14061,146,103,97,116,104,101,
114,0,2049,14030,1,11,1,3336,2049,64,10,14051,14079,146,99,121,99,108,101,0,
2049,14014,2049,2090,4,8,2049,2459,25,3,2049,14061,1,14079,7,10,14005,14110,146,112,
97,114,115,101,45,117,110,116,105,108,0,1793,14122,2049,3627,2049,3428,2049,14079,771,
2049,3302,10,1,14112,2049,3452,10,14095,14136,146,115,58,103,101,116,0,1793,14158,1793,
14144,1,10,11,10,1,14140,1793,14152,1,13,11,10,1,14148,2049,2122,22,10,1,
14138,2049,14110,10,14127,14177,146,115,58,103,101,116,45,119,111,114,100,0,1,5592,
2049,14110,10,14163,14191,146,99,108,101,97,114,0,2049,3646,92,94,91,50,74,92,
94,91,48,59,48,72,0,1,14193,2049,7225,2049,9248,10,14182,14223,133,78,111,69,
99,104,111,0,0,14213,14231,146,98,121,101,0,1,0,2049,12311,10,14224,14243,133,
69,79,84,0,0,14236,14256,133,73,103,110,111,114,105,110,103,0,0,14244,14270,
146,105,103,110,111,114,105,110,103,63,0,3841,14256,10,14257,14284,146,118,101,114,
115,105,111,110,0,3841,4,1,100,20,10,14273,14299,146,100,111,110,101,63,0,
2,4097,14243,1793,14308,1,13,11,10,1,14304,1793,14316,1,10,11,10,1,14312,1793,
14324,1,32,11,10,1,14320,2049,2159,22,22,10,14290,14339,146,101,111,108,63,0,
3841,14243,1793,14347,1,13,11,10,1,14343,1793,14355,1,10,11,10,1,14351,2049,2122,
22,10,14331,14371,146,118,97,108,105,100,63,0,2,2049,81,2049,2609,10,14361,14390,
146,99,104,101,99,107,45,101,111,102,0,2,1793,14397,1,-1,11,10,1,14393,
1793,14405,1,4,11,10,1,14401,2049,2122,22,1,14231,9,10,14377,14420,146,98,115,
0,2049,3360,2049,3360,771,10,14414,14438,146,99,104,101,99,107,45,98,115,0,2,
1793,14445,1,8,11,10,1,14441,1793,14453,1,127,11,10,1,14449,2049,2122,22,1,
14420,9,10,14426,14471,146,99,104,101,99,107,0,2049,14390,2049,14438,10,14462,14489,146,
99,104,97,114,97,99,116,101,114,0,2049,14014,2,2049,3336,10,14476,14505,146,98,
117,102,102,101,114,0,1793,14515,1,1024,2049,3428,8,2049,3302,10,1,14507,2049,3452,
10,14495,14534,146,114,101,97,100,45,116,111,107,101,110,0,1793,14550,1793,14545,2049,
14489,2049,14471,2049,14299,10,1,14538,2049,2250,10,1,14536,2049,14505,2049,3724,10,14520,14566,
146,105,110,112,117,116,0,2049,14534,2049,14371,10,14557,14582,146,112,114,111,99,101,
115,115,0,2049,14270,1793,14600,771,2049,14339,1793,14596,1,14256,2049,3047,10,1,14591,9,
10,1,14586,2049,2653,1,369,1,11,2049,64,10,14224,14617,158,47,47,0,2049,13514,
1,14256,2049,3034,10,14611,14634,146,98,97,110,110,101,114,0,2049,14284,2049,3646,82,
69,84,82,79,32,49,50,32,40,37,110,46,37,110,41,92,110,0,1,14638,
2049,7225,2049,9248,2049,1543,2049,1874,18,2049,1874,2049,1543,2049,3646,37,110,32,77,97,
120,44,32,37,110,32,85,115,101,100,44,32,37,110,32,70,114,101,101,92,
110,0,1,14674,2049,7225,2049,9248,10,14624,14718,146,108,105,115,116,101,110,0,3841,
14223,1793,14725,2049,14634,10,1,14722,2049,72,2049,14566,2049,14582,1,14729,7,10,14708,14748,
146,100,58,119,111,114,100,115,0,1793,14757,2049,164,2049,9248,2049,9222,10,1,14750,
2049,7454,10,14737,14778,146,100,58,119,111,114,100,115,45,119,105,116,104,0,2049,
1874,2049,4648,1793,14809,2049,164,2,2049,1874,2049,4162,1793,14798,2049,9248,2049,9222,10,1,
@ -747,4 +747,13 @@ CELL ngaImage[] = { 1793,14319,14856,14898,202104,0,10,1,10,2,10,3,10,4,10,5,10,
115,112,108,97,121,45,105,102,45,108,101,102,116,0,2,2049,1874,2049,4598,1793,
14845,2049,9248,2049,9222,10,1,14840,1793,14851,3,10,1,14849,2049,64,10,14762,14882,146,
100,58,119,111,114,100,115,45,98,101,103,105,110,110,105,110,103,45,119,105,
116,104,0,2049,1874,2049,4648,1793,14893,2049,164,2049,14833,10,1,14888,2049,7454,10,0 };
116,104,0,2049,1874,2049,4648,1793,14893,2049,164,2049,14833,10,1,14888,2049,7454,10,14856,
14909,146,100,58,119,111,114,100,115,0,1793,14918,2049,164,2049,9248,2049,9222,10,1,
14911,2049,7454,10,14898,14939,146,100,58,119,111,114,100,115,45,119,105,116,104,0,
2049,1874,2049,4648,1793,14970,2049,164,2,2049,1874,2049,4162,1793,14959,2049,9248,2049,9222,10,
1,14954,1793,14965,3,10,1,14963,2049,64,10,1,14945,2049,7454,10,14923,14994,146,100,
105,115,112,108,97,121,45,105,102,45,108,101,102,116,0,2,2049,1874,2049,4598,
1793,15006,2049,9248,2049,9222,10,1,15001,1793,15012,3,10,1,15010,2049,64,10,14923,15043,
146,100,58,119,111,114,100,115,45,98,101,103,105,110,110,105,110,103,45,119,
105,116,104,0,2049,1874,2049,4648,1793,15054,2049,164,2049,14994,10,1,15049,2049,7454,10,
0 };

View file

@ -269,14 +269,13 @@ void io_scripting_handler() {
---------------------------------------------------------------------*/
void invalid_opcode(CELL opcode) {
CELL a, b, i;
CELL a, i;
printf("\nERROR (nga/execute): Invalid instruction!\n");
printf("At %lld, opcode %lld\n", (long long)ip, (long long)opcode);
printf("Instructions: ");
a = opcode;
for (i = 0; i < 4; i++) {
b = a & 0xFF;
printf("%lldd ", (long long)b);
printf("%lldd ", (long long)a & 0xFF);
a = a >> 8;
}
printf("\n");