Skip to content

Commit

Permalink
[base] List opcode numbers in octal.
Browse files Browse the repository at this point in the history
  • Loading branch information
youngman-g committed Jun 27, 2023
1 parent a5d385e commit eb32020
Showing 1 changed file with 57 additions and 51 deletions.
108 changes: 57 additions & 51 deletions base/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,60 +331,66 @@ impl TryFrom<u8> for Opcode {
0o5 => Ok(Jmp),
0o6 => Ok(Jpx),
0o7 => Ok(Jnx),

0o10 => Ok(Aux),
0o11 => Ok(Rsx),
0o12 => Ok(Skx),
11 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
12 => Ok(Exx),
13 => Ok(Adx),
14 => Ok(Dpx),
15 => Ok(Skm),
16 => Ok(Lde),
17 => Ok(Spf),
18 => Ok(Spg),
19 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
20 => Ok(Lda),
21 => Ok(Ldb),
22 => Ok(Ldc),
23 => Ok(Ldd),
24 => Ok(Ste),
25 => Ok(Flf),
26 => Ok(Flg),
27 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
28 => Ok(Sta),
29 => Ok(Stb),
30 => Ok(Stc),
31 => Ok(Std),
32 => Ok(Ite),
33 => Ok(Ita),
34 => Ok(Una),
35 => Ok(Sed),
// 36 is unused
36 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
37 => Ok(Jov),
38 => Ok(Jpa),
39 => Ok(Jna),
40..=43 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
44 => Ok(Exa),
45 => Ok(Ins),
46 => Ok(Com),
47 => Ok(Tsd),
48 => Ok(Cya),
49 => Ok(Cyb),
50 => Ok(Cab),
51 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
52 => Ok(Noa),
53 => Ok(Dsa),
54 => Ok(Nab),
55 => Ok(Add),
56 => Ok(Sca),
57 => Ok(Scb),
58 => Ok(Sab),
59 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
60 => Ok(Tly),
61 => Ok(Div),
62 => Ok(Mul),
63 => Ok(Sub),
0o13 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
0o14 => Ok(Exx),
0o15 => Ok(Adx),
0o16 => Ok(Dpx),
0o17 => Ok(Skm),

0o20 => Ok(Lde),
0o21 => Ok(Spf),
0o22 => Ok(Spg),
0o23 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
0o24 => Ok(Lda),
0o25 => Ok(Ldb),
0o26 => Ok(Ldc),
0o27 => Ok(Ldd),

0o30 => Ok(Ste),
0o31 => Ok(Flf),
0o32 => Ok(Flg),
0o33 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
0o34 => Ok(Sta),
0o35 => Ok(Stb),
0o36 => Ok(Stc),
0o37 => Ok(Std),

0o40 => Ok(Ite),
0o41 => Ok(Ita),
0o42 => Ok(Una),
0o43 => Ok(Sed),
0o44 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
0o45 => Ok(Jov),
0o46 => Ok(Jpa),
0o47 => Ok(Jna),

0o50..=0o53 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
0o54 => Ok(Exa),
0o55 => Ok(Ins),
0o56 => Ok(Com),
0o57 => Ok(Tsd),

0o60 => Ok(Cya),
0o61 => Ok(Cyb),
0o62 => Ok(Cab),
0o63 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
0o64 => Ok(Noa),
0o65 => Ok(Dsa),
0o66 => Ok(Nab),
0o67 => Ok(Add),

0o70 => Ok(Sca),
0o71 => Ok(Scb),
0o72 => Ok(Sab),
0o73 => Err(DisassemblyFailure::InvalidOpcode(opcode)),
0o74 => Ok(Tly),
0o75 => Ok(Div),
0o76 => Ok(Mul),
0o77 => Ok(Sub),
_ => Err(DisassemblyFailure::InvalidOpcode(opcode)),
}
}
Expand Down

0 comments on commit eb32020

Please sign in to comment.