diff options
| author | cheapie <no-email-for-you@example.com> | 2026-05-23 20:14:34 -0500 |
|---|---|---|
| committer | cheapie <no-email-for-you@example.com> | 2026-05-23 20:14:34 -0500 |
| commit | 85b5fde272be6ab543aa866baebabddc24566bdb (patch) | |
| tree | b4f2e3bb634effe51c2bdc5585ca4ea8b98d6dfa /c/squares/squares.c | |
| download | rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.gz rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.bz2 rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.xz rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.zip | |
Add initial content
Diffstat (limited to 'c/squares/squares.c')
| -rw-r--r-- | c/squares/squares.c | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/c/squares/squares.c b/c/squares/squares.c new file mode 100644 index 0000000..435ddff --- /dev/null +++ b/c/squares/squares.c @@ -0,0 +1,169 @@ +/* This is a translation of squares.b, generated by bftoc.py (by Paul Kaefer) + * It was generated on Friday, May 15, 2026 at 07:20PM + */ + +#include "rvcontroller-ecalls.h" + +void main(void) +{ + int size = 1000; + int tape[size]; + int i = 0; + + /* Clearing the tape (array) */ + for (i=0; i<size; i++) + tape[i] = 0; + + int ptr = 0; + + tape[ptr] += 4; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] += 5; + ptr -= 1; + tape[ptr] -= 1; + } + ptr += 1; + while (tape[ptr] != 0) + { + ptr -= 1; + tape[ptr] += 5; + ptr += 1; + tape[ptr] -= 1; + } + tape[ptr] += 1; + ptr -= 1; + tape[ptr] += 1; + while (tape[ptr] != 0) + { + ptr += 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] += 1; + ptr += 1; + tape[ptr] += 1; + ptr -= 2; + tape[ptr] -= 1; + } + tape[ptr] += 2; + ptr += 2; + while (tape[ptr] != 0) + { + ptr -= 2; + tape[ptr] += 1; + ptr += 2; + tape[ptr] -= 1; + } + ptr += 3; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 2; + ptr += 1; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 1; + ptr += 3; + tape[ptr] += 1; + while (tape[ptr] != 0) + { + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 6; + ptr += 3; + } + ptr -= 3; + while (tape[ptr] != 0) + { + while (tape[ptr] != 0) + { + ptr -= 1; + tape[ptr] += 8; + ptr -= 1; + tape[ptr] += 2; + ptr += 2; + tape[ptr] -= 1; + } + tape[ptr] += 1; + ptr -= 1; + printchar(tape[ptr]); + ptr -= 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] -= 4; + ptr -= 1; + tape[ptr] -= 1; + } + ptr -= 1; + } + ptr -= 2; + while (tape[ptr] != 0) + { + ptr += 5; + while (tape[ptr] != 0) + { + ptr += 3; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 9; + ptr -= 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] -= 1; + ptr -= 1; + tape[ptr] -= 1; + } + tape[ptr] += 9; + ptr += 1; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + while (tape[ptr] != 0) + { + ptr -= 1; + tape[ptr] -= 1; + ptr += 1; + tape[ptr] -= 1; + } + tape[ptr] += 1; + while (tape[ptr] != 0) + { + ptr -= 3; + } + } + ptr -= 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] += 1; + ptr -= 1; + tape[ptr] -= 1; + } + ptr += 1; + } + ptr -= 2; + tape[ptr] -= 1; + } + ptr -= 2; + tape[ptr] -= 1; + } + while (tape[ptr] != 0) + { + printchar(tape[ptr]); + printchar(tape[ptr]); + printchar(tape[ptr]); + } + +} + |
