@@ -111,6 +111,14 @@ macro additionFlags(operand1, operand2) {
111
111
$(C_flag) = carry(operand1, operand2);
112
112
}
113
113
114
+ macro additionFlagsNoC(operand1, operand2) {
115
+ local AFmask = -1 >> 4;
116
+ $(H_flag) = (((operand1 & AFmask) + (operand2 & AFmask)) & (AFmask + 1)) != 0;
117
+ $(PV_flag) = scarry(operand1, operand2);
118
+ $(N_flag) = 0;
119
+ # $(C_flag) is not affected
120
+ }
121
+
114
122
macro additionFlagsNoPV(operand1, operand2) {
115
123
local AFmask = -1 >> 4;
116
124
$(H_flag) = (((operand1 & AFmask) + (operand2 & AFmask)) & (AFmask + 1)) != 0;
@@ -1021,7 +1029,7 @@ cc2: "C" is bits3_3=0x7 { c:1 = $(C_flag); export c; }
1021
1029
1022
1030
reg3_3 = reg3_3 + 1;
1023
1031
setResultFlags(reg3_3);
1024
- additionFlags (r_temp, 1);
1032
+ additionFlagsNoC (r_temp, 1);
1025
1033
}
1026
1034
1027
1035
:INC (HL) is op0_8=0x34 & HL {
@@ -1032,7 +1040,7 @@ cc2: "C" is bits3_3=0x7 { c:1 = $(C_flag); export c; }
1032
1040
val = val + 1;
1033
1041
MemStore(HL,val);
1034
1042
setResultFlags(val);
1035
- additionFlags (val_temp, 1);
1043
+ additionFlagsNoC (val_temp, 1);
1036
1044
}
1037
1045
1038
1046
:INC ixMem8 is op0_8=0xdd; op0_8=0x34; ixMem8 {
@@ -1042,7 +1050,7 @@ cc2: "C" is bits3_3=0x7 { c:1 = $(C_flag); export c; }
1042
1050
val = val + 1;
1043
1051
ixMem8 = val;
1044
1052
setResultFlags(val);
1045
- additionFlags (val_temp, 1);
1053
+ additionFlagsNoC (val_temp, 1);
1046
1054
}
1047
1055
1048
1056
:INC iyMem8 is op0_8=0xfd; op0_8=0x34; iyMem8 {
@@ -1052,7 +1060,7 @@ cc2: "C" is bits3_3=0x7 { c:1 = $(C_flag); export c; }
1052
1060
val = val + 1;
1053
1061
iyMem8 = val;
1054
1062
setResultFlags(val);
1055
- additionFlags (val_temp, 1);
1063
+ additionFlagsNoC (val_temp, 1);
1056
1064
}
1057
1065
1058
1066
:DEC reg3_3 is op6_2=0x0 & reg3_3 & bits0_3=0x5 {
0 commit comments