aboutsummaryrefslogtreecommitdiff
path: root/xcpu/test
diff options
context:
space:
mode:
authorJon duSaint2022-05-05 15:46:41 -0700
committerJon duSaint2022-05-05 15:46:41 -0700
commit6a290f10cf9aaa142db637834b54602286204394 (patch)
treefed7333895a747244fc1518c3613281f6bf34c9a /xcpu/test
parent7c75c02f784be12343e2e4f82726f3a5f0ddb6a7 (diff)

xcpu: add old program

Diffstat (limited to 'xcpu/test')
-rw-r--r--xcpu/test/compare.s12
-rw-r--r--xcpu/test/ltest.c51
2 files changed, 63 insertions, 0 deletions
diff --git a/xcpu/test/compare.s b/xcpu/test/compare.s
new file mode 100644
index 0000000..291c421
--- /dev/null
+++ b/xcpu/test/compare.s
@@ -0,0 +1,12 @@
+ _include xcpu_asm.h
+
+ cpuop CPU_DEBUG, 1
+
+ assign A, 5
+ assign B, 1
+ assign C, 5
+ assign D, 9
+ compare B
+ compare C
+ compare D
+ jump JUMP_UNCOND
diff --git a/xcpu/test/ltest.c b/xcpu/test/ltest.c
new file mode 100644
index 0000000..2896dfa
--- /dev/null
+++ b/xcpu/test/ltest.c
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "xas.h"
+
+int line_pos = 0;
+int line_no = 1;
+
+int
+main (void)
+{
+ int lval;
+
+ yyin = fopen ("bootstrap.s", "rt");
+ if (yyin == NULL)
+ {
+ fprintf (stderr, "Unable to open bootstrap.s\n");
+ exit (1);
+ }
+
+ while ((lval = yylex ()) != 0)
+ {
+ switch ((xtoken_t)lval)
+ {
+ case FILENAME:
+ printf ("%4d:%2d:FILENAME:'%s'\n", line_no, line_pos, yytext);
+ break;
+ case DIRECTIVE:
+ printf ("%4d:%2d:DIRECTIVE:'%s'\n", line_no, line_pos, yytext);
+ break;
+ case INSTRUCTION:
+ printf ("%4d:%2d:INSTRUCTION:'%s'\n", line_no, line_pos, yytext);
+ break;
+ case ID:
+ printf ("%4d:%2d:ID:'%s'\n", line_no, line_pos, yytext);
+ break;
+ case NUMBER:
+ printf ("%4d:%2d:NUMBER:'%s'\n", line_no, line_pos, yytext);
+ break;
+ case HEXNUMBER:
+ printf ("%4d:%2d:HEXNUMBER:'%s'\n", line_no, line_pos, yytext);
+ break;
+ default:
+ printf ("%4d:%2d:??%d??:'%s'\n", line_no, line_pos, lval, yytext);
+ }
+ }
+
+ fclose (yyin);
+
+ return 0;
+}