diff --git a/c-test-arith/Makefile b/c-test-arith/Makefile new file mode 100644 index 0000000..49d1aab --- /dev/null +++ b/c-test-arith/Makefile @@ -0,0 +1 @@ +include ../common/common.mk diff --git a/c-test-arith/main.c b/c-test-arith/main.c new file mode 100644 index 0000000..e7bf177 --- /dev/null +++ b/c-test-arith/main.c @@ -0,0 +1,33 @@ +static void putc(int); + +int x; +int y; +int z; + +void _start(void) +{ + /* TODO: handle sp/fp init better -- separate crt0.S? */ + asm ("law 03000"); + asm ("dac 209"); + asm ("law 04000"); + asm ("dac 208"); + + x = 21; + y = 37; + + z = x << 3; + if (z == 168) + putc(027); + + z = y >> 3; + if (z == 4) + putc(027); + + asm ("hlt"); + __builtin_unreachable(); +} + +static void putc(int c) { + asm ("lio %0" : : "r"(c)); + asm ("tyo"); +} diff --git a/pdp1-gcc b/pdp1-gcc index 0be8d83..c52c05d 160000 --- a/pdp1-gcc +++ b/pdp1-gcc @@ -1 +1 @@ -Subproject commit 0be8d834a47ef2b399cdb453a68e6134b4fa2637 +Subproject commit c52c05d4f15a362e517379fba5d172e07660f3fe