From ef8a8e320da972f9849b726ea49d843c3eda408c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Kokosi=C5=84ski?= Date: Thu, 13 Jun 2024 19:46:13 +0200 Subject: [PATCH] wip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip KokosiƄski --- c-test-arith/Makefile | 1 + c-test-arith/main.c | 33 +++++++++++++++++++++++++++++++++ pdp1-gcc | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 c-test-arith/Makefile create mode 100644 c-test-arith/main.c 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