Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Kokosiński <filip.kokosinski@gmail.com>
  • Loading branch information
fkokosinski committed Jun 14, 2024
1 parent e1ed6df commit 523a0ee
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions c-test-arith/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../common/common.mk
33 changes: 33 additions & 0 deletions c-test-arith/main.c
Original file line number Diff line number Diff line change
@@ -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");
}
1 change: 1 addition & 0 deletions tests/test.exp
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ run_test "c-print-struct" "xyz"
run_test "c-print-array" "xyzxyzxyzxyz"
run_test "c-print-for-loop" "xxxxyxxx"
run_test "c-test-comparison" "aceg"
run_test "c-test-arithmetic" "xx"

0 comments on commit 523a0ee

Please sign in to comment.