@@ -43,39 +43,54 @@ enum AddrMode : uint8_t {
43
43
M_IDY = 12 , // Indexed Y
44
44
};
45
45
46
+ enum CodeFormat : uint8_t {
47
+ CF_00 = 0 , // 0x00
48
+ CF_10 = 1 , // 0x10
49
+ CF_30 = 2 , // 0x30
50
+ };
51
+
46
52
struct Entry final : entry::Base<Config::opcode_t > {
47
53
struct Flags final {
48
54
uint16_t _attr;
49
55
50
- static constexpr Flags create (AddrMode opr1, AddrMode opr2, AddrMode opr3) {
56
+ static constexpr Flags create (CodeFormat cf, AddrMode opr1, AddrMode opr2, AddrMode opr3) {
51
57
return Flags{static_cast <uint16_t >((static_cast <uint16_t >(opr1) << opr1_gp) |
52
58
(static_cast <uint16_t >(opr2) << opr2_gp) |
53
- (static_cast <uint16_t >(opr3) << opr3_gp))};
59
+ (static_cast <uint16_t >(opr3) << opr3_gp) |
60
+ (static_cast <uint16_t >(cf) << cf_gp))};
54
61
}
55
62
56
- static constexpr Flags undef (AddrMode opr1) {
57
- return Flags{
58
- static_cast <uint16_t >((static_cast <uint16_t >(opr1) << opr1_gp) |
59
- (static_cast <uint16_t >(M_NONE) << opr2_gp) |
60
- (static_cast <uint16_t >(M_NONE) << opr3_gp) | undef_bm)};
63
+ static constexpr Flags undef (CodeFormat cf, AddrMode opr1) {
64
+ return Flags{static_cast <uint16_t >((static_cast <uint16_t >(opr1) << opr1_gp) |
65
+ (static_cast <uint16_t >(cf) << cf_gp) | undef_bm)};
61
66
}
62
67
63
68
AddrMode mode1 () const { return AddrMode ((_attr >> opr1_gp) & mode_gm); }
64
69
AddrMode mode2 () const { return AddrMode ((_attr >> opr2_gp) & mode_gm); }
65
70
AddrMode mode3 () const { return AddrMode ((_attr >> opr3_gp) & mode_gm); }
66
71
bool undefined () const { return _attr & undef_bm; }
72
+ uint8_t mask () const {
73
+ static constexpr uint8_t MASK[] PROGMEM = {
74
+ 0x00 , // CF_00 = 0
75
+ 0x10 , // CF_10 = 1
76
+ 0x30 , // CF_30 = 2
77
+ };
78
+ return pgm_read_byte (&MASK[(_attr >> cf_gp) & cf_gm]);
79
+ }
67
80
68
81
private:
69
82
static constexpr int opr1_gp = 0 ;
70
83
static constexpr int opr2_gp = 4 ;
71
84
static constexpr int opr3_gp = 8 ;
85
+ static constexpr int cf_gp = 12 ;
72
86
static constexpr int undef_bp = 15 ;
73
- static constexpr uint8_t mode_gm = 0x0F ;
87
+ static constexpr uint_fast8_t mode_gm = 0x0F ;
88
+ static constexpr uint_fast8_t cf_gm = 0x03 ;
74
89
static constexpr uint16_t undef_bm = (1 << undef_bp);
75
90
};
76
91
77
- constexpr Entry (Config::opcode_t opCode , Flags flags, const /* PROGMEM */ char *name_P)
78
- : Base(name_P, opCode ), _flags_P(flags) {}
92
+ constexpr Entry (Config::opcode_t opc , Flags flags, const /* PROGMEM */ char *name_P)
93
+ : Base(name_P, opc ), _flags_P(flags) {}
79
94
80
95
Flags readFlags () const { return Flags{pgm_read_word (&_flags_P._attr )}; }
81
96
0 commit comments