add test images for each instruction excluding i/o

the tests now include a small muri assembly file for each
instruction. if your vm runs these successfully and supports
basic i/o, it should be sufficient to run a full retro system.

FossilOrigin-Name: b80eaeb75ee2b4476f5b5a4aa62adf76da3ed11ac3b2f493f77d9bd4366f8ea9
This commit is contained in:
crc 2021-06-01 19:00:48 +00:00
parent 91aa668160
commit 0307e57fdc
31 changed files with 382 additions and 25 deletions

View file

@ -34,6 +34,10 @@
## I/O
- floating point
- increased precision of `f:E` and `f:PI` (Kiyoshi)
## Toolchain
## VM
@ -51,6 +55,7 @@
- retro-repl.c now uses an external image
- removed barebones.c (overlaps w/new retro-repl.c)
- retro-runtime.c now based on standard retro.c
- changed behavior of -t command line argument (Rick)
- nga-nim
@ -69,3 +74,7 @@
- removed references to old command line arguments
- removed reference to the no longer existing "ok" prompt
- add a note that mentions that Retro does not display a prompt
## Testing
- add small test images for each instruction

40
tests/Instructions.md Normal file
View file

@ -0,0 +1,40 @@
# Testing Instructions
Build & install Retro.
Run:
sh instructions.sh
Compare resulting stacks to the table below.
| Opcode | Expected |
| ------ | ------------------------ |
| 0 | |
| 1 | 1 -1 99 -99 |
| 2 | 100 100 200 200 |
| 3 | 100 200 |
| 4 | 200 300 100 |
| 5 | 100 300 200 |
| 6 | 100 300 200 |
| 7 | 10 |
| 8 | 10 |
| 9 | 100 |
| 10 | 10 |
| 11 | 0 -1 |
| 12 | -1 0 |
| 13 | -1 0 0 |
| 14 | 0 0 -1 |
| 15 | 97 98 99 |
| 16 | 97 98 48 |
| 17 | 300 1 |
| 18 | -100 199 |
| 19 | 20000 -9900 |
| 20 | 100 0 1 -1 89 2 |
| 21 | -1 0 0 |
| 22 | -1 -1 0 |
| 23 | 0 -1 0 |
| 24 | 3640 455 |
| 25 | 2 |
| 26 | |

10
tests/ad.muri Normal file
View file

@ -0,0 +1,10 @@
~~~
: main
i liliadli
d 100
d 200
d 100
i liadha..
d -99
~~~

14
tests/an.muri Normal file
View file

@ -0,0 +1,14 @@
~~~
: main
i lilian..
d -1
d -1
i lilian..
d 0
d -1
i lilian..
d 0
d 0
i ha......
~~~

12
tests/ca.muri Normal file
View file

@ -0,0 +1,12 @@
~~~
i liju....
r main
: subr
i lire....
d 10
: main
i lica....
r subr
i ha......
~~~

23
tests/cc.muri Normal file
View file

@ -0,0 +1,23 @@
~~~
: c1
i lire....
d 100
: c2
i lire....
d 200
: main
i lilieqli
d 100
d 100
r c1
i cc......
i lilieqli
d 100
d 200
r c2
i cc......
i ha......
~~~

14
tests/di.muri Normal file
View file

@ -0,0 +1,14 @@
~~~
: main
i lilidi..
d 100
d 200
i lilidi..
d 100
d -99
i lilidi..
d 355
d 133
i ha......
~~~

7
tests/dr.muri Normal file
View file

@ -0,0 +1,7 @@
~~~
i lililidr
d 100
d 200
d 300
i ha......
~~~

6
tests/du.muri Normal file
View file

@ -0,0 +1,6 @@
~~~
i lidulidu
d 100
d 200
i ha......
~~~

10
tests/eq.muri Normal file
View file

@ -0,0 +1,10 @@
~~~
i lilieq..
d 100
d 200
i lilieq..
d 100
d 100
i ha......
~~~

19
tests/fe.muri Normal file
View file

@ -0,0 +1,19 @@
~~~
i liju....
r main
: abc
s abc
: main
i lifelili
r abc
r abc
d 1
i adfelili
r abc
d 2
i adfe....
i ha......
~~~

12
tests/gt.muri Normal file
View file

@ -0,0 +1,12 @@
~~~
i liligt..
d 100
d 200
i liligt..
d 100
d 100
i liligt..
d 200
d 100
i ha......
~~~

3
tests/ha.muri Normal file
View file

@ -0,0 +1,3 @@
~~~
i ha......
~~~

29
tests/instructions.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
echo "no"; retro-muri no.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "li"; retro-muri li.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "du"; retro-muri du.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "dr"; retro-muri dr.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "sw"; retro-muri sw.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "pu"; retro-muri pu.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "po"; retro-muri po.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "ju"; retro-muri ju.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "ca"; retro-muri ca.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "cc"; retro-muri cc.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "re"; retro-muri re.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "eq"; retro-muri eq.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "ne"; retro-muri ne.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "lt"; retro-muri lt.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "gt"; retro-muri gt.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "fe"; retro-muri fe.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "st"; retro-muri st.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "ad"; retro-muri ad.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "su"; retro-muri su.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "mu"; retro-muri mu.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "di"; retro-muri di.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "an"; retro-muri an.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "or"; retro-muri or.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "xo"; retro-muri xo.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "sh"; retro-muri sh.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "zr"; retro-muri zr.muri >/dev/null; retro -r ngaImage; rm -f ngaImage
echo "ha"; retro-muri ha.muri >/dev/null; retro -r ngaImage; rm -f ngaImage

10
tests/ju.muri Normal file
View file

@ -0,0 +1,10 @@
~~~
i liju....
r subr
i liha....
d 89
: subr
i liha....
d 10
~~~

8
tests/li.muri Normal file
View file

@ -0,0 +1,8 @@
~~~
i lililili
d 1
d -1
d 99
d -99
i ha......
~~~

12
tests/lt.muri Normal file
View file

@ -0,0 +1,12 @@
~~~
i lililt..
d 100
d 200
i lililt..
d 100
d 100
i lililt..
d 200
d 100
i ha......
~~~

9
tests/mu.muri Normal file
View file

@ -0,0 +1,9 @@
~~~
i lilimu..
d 100
d 200
i lilimu..
d 100
d -99
i ha......
~~~

9
tests/ne.muri Normal file
View file

@ -0,0 +1,9 @@
~~~
i liline..
d 100
d 200
i liline..
d 100
d 100
i ha......
~~~

4
tests/no.muri Normal file
View file

@ -0,0 +1,4 @@
~~~
i ........
i ha......
~~~

12
tests/or.muri Normal file
View file

@ -0,0 +1,12 @@
~~~
i lilior..
d -1
d -1
i lilior..
d 0
d -1
i lilior..
d 0
d 0
i ha......
~~~

8
tests/po.muri Normal file
View file

@ -0,0 +1,8 @@
~~~
i lilipuli
d 100
d 200
d 300
i po......
i ha......
~~~

8
tests/pu.muri Normal file
View file

@ -0,0 +1,8 @@
~~~
i lilipuli
d 100
d 200
d 300
i po......
i ha......
~~~

9
tests/re.muri Normal file
View file

@ -0,0 +1,9 @@
~~~
i lica....
r subr
i ha......
: subr
i lire....
d 10
~~~

9
tests/sh.muri Normal file
View file

@ -0,0 +1,9 @@
~~~
i lilish..
d 455
d -3
i lilish..
d 3640
d 3
i ha......
~~~

20
tests/st.muri Normal file
View file

@ -0,0 +1,20 @@
~~~
i liju....
r main
: abc
s abc
: main
i lifelili
r abc
r abc
d 1
i adfelili
d 48
r abc
i stlife..
r abc
i ha......
~~~

10
tests/su.muri Normal file
View file

@ -0,0 +1,10 @@
~~~
: main
i lilisuli
d 100
d 200
d 100
i lisuha..
d -99
~~~

9
tests/sw.muri Normal file
View file

@ -0,0 +1,9 @@
~~~
: main
i liliswli
d 100
d 200
d 300
i swha....
~~~

14
tests/xo.muri Normal file
View file

@ -0,0 +1,14 @@
~~~
: main
i lilixo..
d -1
d -1
i lilixo..
d 0
d -1
i lilixo..
d 0
d 0
i ha......
~~~

18
tests/zr.muri Normal file
View file

@ -0,0 +1,18 @@
~~~
i liju....
r main
: c1
i zr......
i drlire..
d 2
: main
i lilica..
d 100
r c1
i lilica..
d 0
r c1
i ha......
~~~

View file

@ -10,8 +10,8 @@
#define CELL_MAX LLONG_MAX - 1
#endif
#endif
CELL ngaImageCells = 15347;
CELL ngaImage[] = { 1793,14730,15322,15346,202107,372,344,1023,1535,0,10,1,10,2,10,3,10,4,10,
CELL ngaImageCells = 14949;
CELL ngaImage[] = { 1793,14730,14924,14948,202107,372,344,1023,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,140,157,268505089,63,62,285281281,0,63,2063,10,101384453,0,9,10,2049,56,25,
@ -170,7 +170,7 @@ CELL ngaImage[] = { 1793,14730,15322,15346,202107,372,344,1023,1535,0,10,1,10,2,
3113,2049,2095,4100,10,3096,3136,145,118,58,117,112,100,97,116,101,0,4,1793,3143,
15,4,8,10,1,3139,2049,2105,16,10,3124,3157,145,99,111,112,121,0,1793,3166,
285278725,1,33951492,268767489,1,6,10,1,3159,2049,2270,771,10,3149,3185,145,83,99,111,112,
101,76,105,115,116,0,15172,15224,10,3172,3194,145,123,123,0,2049,1570,2,1,3185,
101,76,105,115,116,0,14774,14826,10,3172,3194,145,123,123,0,2049,1570,2,1,3185,
2049,59,16,10,3188,3219,145,45,45,45,114,101,118,101,97,108,45,45,45,0,
2049,1570,1,3185,2049,2921,16,10,3203,3233,145,125,125,0,1,3185,2049,56,4,15,
11,1793,3247,3841,3185,4097,2,10,1,3242,1793,3273,3841,3185,1793,3268,1,2,983567,1,
@ -189,7 +189,7 @@ CELL ngaImage[] = { 1793,14730,15322,15346,202107,372,344,1023,1535,0,10,1,10,2,
2095,4097,3296,10,3464,3518,133,84,101,109,112,83,116,114,105,110,103,115,0,32,
3503,3536,133,84,101,109,112,83,116,114,105,110,103,77,97,120,0,512,3519,3548,
145,83,84,82,73,78,71,83,0,2049,1543,3841,3518,3841,3536,19,18,10,3537,3568,
133,67,117,114,114,101,110,116,0,20,10,3557,3583,145,115,58,112,111,105,110,
133,67,117,114,114,101,110,116,0,0,10,3557,3583,145,115,58,112,111,105,110,
116,101,114,0,3841,3568,3841,3536,19,2049,3548,17,10,3570,3602,145,115,58,110,101,
120,116,0,1,3568,2049,3019,3841,3568,3841,3518,11,1793,3618,1,0,4097,3568,10,1,
3613,9,10,3537,3632,145,115,58,116,101,109,112,0,2,2049,81,2049,2921,2049,3583,
@ -758,24 +758,4 @@ CELL ngaImage[] = { 1793,14730,15322,15346,202107,372,344,1023,1535,0,10,1,10,2,
98,101,103,105,110,110,105,110,103,45,119,105,116,104,0,2049,1871,2049,4678,1793,
14905,2049,163,2049,14845,10,1,14900,2049,7528,10,14868,14921,145,115,58,115,112,108,105,
116,0,2049,6143,10,14910,14945,145,115,58,115,112,108,105,116,45,111,110,45,115,
116,114,105,110,103,0,2049,6175,10,14924,14959,145,100,58,119,111,114,100,115,0,
1793,14968,2049,163,2049,9379,2049,9353,10,1,14961,2049,7528,10,14948,14989,145,100,58,119,
111,114,100,115,45,119,105,116,104,0,2049,1871,2049,4678,1793,15020,2049,163,2,2049,
1871,2049,4192,1793,15009,2049,9379,2049,9353,10,1,15004,1793,15015,3,10,1,15013,2049,64,
10,1,14995,2049,7528,10,14973,15044,145,100,105,115,112,108,97,121,45,105,102,45,
108,101,102,116,0,2,2049,1871,2049,4628,1793,15056,2049,9379,2049,9353,10,1,15051,1793,
15062,3,10,1,15060,2049,64,10,14973,15093,145,100,58,119,111,114,100,115,45,98,
101,103,105,110,110,105,110,103,45,119,105,116,104,0,2049,1871,2049,4678,1793,15104,
2049,163,2049,15044,10,1,15099,2049,7528,10,15067,15120,145,115,58,115,112,108,105,116,
0,2049,6143,10,15109,15144,145,115,58,115,112,108,105,116,45,111,110,45,115,116,
114,105,110,103,0,2049,6175,10,15123,15158,145,100,58,119,111,114,100,115,0,1793,
15167,2049,163,2049,9379,2049,9353,10,1,15160,2049,7528,10,15147,15188,145,100,58,119,111,
114,100,115,45,119,105,116,104,0,2049,1871,2049,4678,1793,15219,2049,163,2,2049,1871,
2049,4192,1793,15208,2049,9379,2049,9353,10,1,15203,1793,15214,3,10,1,15212,2049,64,10,
1,15194,2049,7528,10,15172,15243,145,100,105,115,112,108,97,121,45,105,102,45,108,
101,102,116,0,2,2049,1871,2049,4628,1793,15255,2049,9379,2049,9353,10,1,15250,1793,15261,
3,10,1,15259,2049,64,10,15172,15292,145,100,58,119,111,114,100,115,45,98,101,
103,105,110,110,105,110,103,45,119,105,116,104,0,2049,1871,2049,4678,1793,15303,2049,
163,2049,15243,10,1,15298,2049,7528,10,15266,15319,145,115,58,115,112,108,105,116,0,
2049,6143,10,15308,15343,145,115,58,115,112,108,105,116,45,111,110,45,115,116,114,
105,110,103,0,2049,6175,10,0 };
116,114,105,110,103,0,2049,6175,10,0 };