summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-10-14 13:53:46 -0700
committerJulian Blake Kongslie2022-10-14 13:53:46 -0700
commit9212909e24252ed723884c29a9c7e68018897bd7 (patch)
tree10574a0129fe4028558caae396dfc14d710c43d8
parentUse automatic literal support in palbart; fix loader to ignore checksum (diff)
downloadbiggolf-9212909e24252ed723884c29a9c7e68018897bd7.tar.xz
Add Fibonacci program (which doesn't work yet)
Diffstat (limited to '')
-rw-r--r--main.cpp4
-rw-r--r--programs/fib.pal19
2 files changed, 22 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index b6c136c..63dcb50 100644
--- a/main.cpp
+++ b/main.cpp
@@ -9,9 +9,11 @@
9#include "isa/checker.h" 9#include "isa/checker.h"
10 10
11extern std::uint8_t _binary_count_bin_start[]; 11extern std::uint8_t _binary_count_bin_start[];
12extern std::uint8_t _binary_fib_bin_start[];
12 13
13static const std::map<std::string, std::uint8_t *> programs = { 14static const std::map<std::string, std::uint8_t *> programs = {
14 { "count", _binary_count_bin_start } 15 { "count", _binary_count_bin_start },
16 { "fib", _binary_fib_bin_start },
15}; 17};
16 18
17int load_program(checker &checker, const std::uint8_t *program) { 19int load_program(checker &checker, const std::uint8_t *program) {
diff --git a/programs/fib.pal b/programs/fib.pal
new file mode 100644
index 0000000..4d3fb1b
--- /dev/null
+++ b/programs/fib.pal
@@ -0,0 +1,19 @@
1/ vim: set sw=8 noexpandtab :
2
3*200
4
5LOOP, CLA
6 TAD N
7 TAD NPLUS1
8 DCA NPLUS2
9 TAD NPLUS1
10 DCA N
11 TAD NPLUS2
12 DCA NPLUS1
13 JMP LOOP
14
15*300
16
17N, 0
18NPLUS1, 1
19NPLUS2, 0