diff options
| author | Julian Blake Kongslie | 2022-10-29 12:55:08 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-29 13:14:13 -0700 |
| commit | ff66523bb076a246c2fc159f0f76947bd6f84fc1 (patch) | |
| tree | 63dbffc8be3c41eb5ec2f74dd7919f5f34a25a53 /isa | |
| parent | Add untested interrupt-based echo program with input buffer (diff) | |
| download | biggolf-ff66523bb076a246c2fc159f0f76947bd6f84fc1.tar.xz | |
Control register values should not be "unsigned int"
Diffstat (limited to '')
| -rw-r--r-- | isa/checker.h | 3 | ||||
| -rw-r--r-- | isa/decode.cpp | 19 | ||||
| -rw-r--r-- | isa/isa.h | 3 |
3 files changed, 23 insertions, 2 deletions
diff --git a/isa/checker.h b/isa/checker.h index 332c483..571bbc8 100644 --- a/isa/checker.h +++ b/isa/checker.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | #include <array> | 3 | #include <array> |
| 4 | #include <cstdint> | ||
| 4 | #include <map> | 5 | #include <map> |
| 5 | 6 | ||
| 6 | #include "io/model.h" | 7 | #include "io/model.h" |
| @@ -41,7 +42,7 @@ struct checker { | |||
| 41 | unsigned int link = 0; | 42 | unsigned int link = 0; |
| 42 | unsigned int mq = 0; | 43 | unsigned int mq = 0; |
| 43 | unsigned int pc = 00200; | 44 | unsigned int pc = 00200; |
| 44 | std::array<unsigned int, NUM_CTLREGS> ctlregs; | 45 | std::array<std::uint_fast32_t, NUM_CTLREGS> ctlregs; |
| 45 | iomodel &system; | 46 | iomodel &system; |
| 46 | instruction_context inst; | 47 | instruction_context inst; |
| 47 | funcmem mem; | 48 | funcmem mem; |
diff --git a/isa/decode.cpp b/isa/decode.cpp index 4af9a0d..9563327 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp | |||
| @@ -140,6 +140,25 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit | |||
| 140 | break; | 140 | break; |
| 141 | } | 141 | } |
| 142 | break; | 142 | break; |
| 143 | case 003: | ||
| 144 | // KEYBOARD | ||
| 145 | switch (bits & 07) { | ||
| 146 | case 1: | ||
| 147 | // KSF skip if TTI flag is set | ||
| 148 | inst.read_ctlreg = TT_BITS; | ||
| 149 | inst.possibly_redirects = true; | ||
| 150 | inst.ef = [](auto &ctx) { | ||
| 151 | if (ctx.ctlval.value() & TTI_FLAG) | ||
| 152 | ctx.next_pc = (ctx.next_pc & ~07777) | ((ctx.next_pc + 1) & 07777); | ||
| 153 | }; | ||
| 154 | break; | ||
| 155 | default: | ||
| 156 | inst.ef = [bits](auto &ctx) { | ||
| 157 | std::cerr << "unimplemented IOT KB suboperation " << (bits & 07) << "\n"; | ||
| 158 | assert(false); | ||
| 159 | }; | ||
| 160 | } | ||
| 161 | break; | ||
| 143 | case 004: | 162 | case 004: |
| 144 | // TELETYPE TELEPRINTER/PUNCH | 163 | // TELETYPE TELEPRINTER/PUNCH |
| 145 | switch (bits & 07) { | 164 | switch (bits & 07) { |
| @@ -1,5 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | #include <cstdint> | ||
| 3 | #include <functional> | 4 | #include <functional> |
| 4 | #include <optional> | 5 | #include <optional> |
| 5 | 6 | ||
| @@ -49,7 +50,7 @@ struct instruction_context { | |||
| 49 | unsigned int next_pc; // includes IF | 50 | unsigned int next_pc; // includes IF |
| 50 | std::optional<unsigned int> init_address; // includes DF | 51 | std::optional<unsigned int> init_address; // includes DF |
| 51 | std::optional<unsigned int> final_address; // includes DF | 52 | std::optional<unsigned int> final_address; // includes DF |
| 52 | std::optional<unsigned int> ctlval; | 53 | std::optional<std::uint_fast32_t> ctlval; // control registers may be larger than 16 bits (e.g. TT_BITS) |
| 53 | std::optional<unsigned int> data; | 54 | std::optional<unsigned int> data; |
| 54 | std::optional<unsigned int> acc; | 55 | std::optional<unsigned int> acc; |
| 55 | std::optional<bool> link; | 56 | std::optional<bool> link; |
