mirror of
https://gitlab.cs.washington.edu/fidelp/frustration.git
synced 2024-11-16 07:48:10 +01:00
fix collision betweeen opcode and large literals
This commit is contained in:
parent
bd55267c35
commit
60da6e54a9
1 changed files with 6 additions and 6 deletions
|
@ -59,8 +59,8 @@ impl Core {
|
|||
fn step(&mut self) {
|
||||
let opcode = self.load(self.ip);
|
||||
self.ip = self.ip.wrapping_add(2);
|
||||
if opcode >= 0xfff0 {
|
||||
PRIMITIVES[(opcode - 0xfff0) as usize](self);
|
||||
if (opcode >= 0xffe0) && (opcode & 1 == 0) {
|
||||
PRIMITIVES[((opcode - 0xffe0) >> 1) as usize](self);
|
||||
}
|
||||
else if (opcode & 1) == 1 {
|
||||
// Literal
|
||||
|
@ -77,10 +77,10 @@ impl Core {
|
|||
type Primitive = fn(&mut Core);
|
||||
|
||||
enum Op {
|
||||
RET = 0xfff0, TOR = 0xfff1, RTO = 0xfff2, LD = 0xfff3,
|
||||
ST = 0xfff4, DUP = 0xfff5, SWP = 0xfff6, DRP = 0xfff7,
|
||||
Q = 0xfff8, ADD = 0xfff9, SFT = 0xfffa, OR = 0xfffb,
|
||||
INV = 0xfffc, OUT = 0xfffd, IN = 0xfffe, NOP = 0xffff,
|
||||
RET = 0xffe0, TOR = 0xffe2, RTO = 0xffe4, LD = 0xffe6,
|
||||
ST = 0xffe8, DUP = 0xffea, SWP = 0xffec, DRP = 0xffee,
|
||||
Q = 0xfff0, ADD = 0xfff2, SFT = 0xfff4, OR = 0xfff6,
|
||||
INV = 0xfff8, OUT = 0xfffa, IN = 0xfffc, NOP = 0xfffe,
|
||||
}
|
||||
|
||||
const PRIMITIVES: [Primitive; 16] = [
|
||||
|
|
Loading…
Reference in a new issue