diff options
| author | Julian Blake Kongslie | 2022-10-14 13:53:46 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-14 13:53:46 -0700 |
| commit | 9212909e24252ed723884c29a9c7e68018897bd7 (patch) | |
| tree | 10574a0129fe4028558caae396dfc14d710c43d8 | |
| parent | Use automatic literal support in palbart; fix loader to ignore checksum (diff) | |
| download | biggolf-9212909e24252ed723884c29a9c7e68018897bd7.tar.xz | |
Add Fibonacci program (which doesn't work yet)
Diffstat (limited to '')
| -rw-r--r-- | main.cpp | 4 | ||||
| -rw-r--r-- | programs/fib.pal | 19 |
2 files changed, 22 insertions, 1 deletions
| @@ -9,9 +9,11 @@ | |||
| 9 | #include "isa/checker.h" | 9 | #include "isa/checker.h" |
| 10 | 10 | ||
| 11 | extern std::uint8_t _binary_count_bin_start[]; | 11 | extern std::uint8_t _binary_count_bin_start[]; |
| 12 | extern std::uint8_t _binary_fib_bin_start[]; | ||
| 12 | 13 | ||
| 13 | static const std::map<std::string, std::uint8_t *> programs = { | 14 | static 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 | ||
| 17 | int load_program(checker &checker, const std::uint8_t *program) { | 19 | int 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 | |||
| 5 | LOOP, 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 | |||
| 17 | N, 0 | ||
| 18 | NPLUS1, 1 | ||
| 19 | NPLUS2, 0 | ||
