#define BOOL_TYPE "int"
/* Define the minimal 680x0 where NV flags are not affected by xBCD instructions. */
-#define xBCD_KEEPS_NV_FLAGS 4
+#define xBCD_KEEPS_N_FLAG 4
+#define xBCD_KEEPS_V_FLAG 3
static FILE *headerfile;
static FILE *stblfile;
printf ("\tif ((((dst & 0xFF) - (src & 0xFF) - (GET_XFLG () ? 1 : 0)) & 0x100) > 0xFF) { newv -= 0x60; }\n");
printf ("\tSET_CFLG ((((dst & 0xFF) - (src & 0xFF) - bcd - (GET_XFLG () ? 1 : 0)) & 0x300) > 0xFF);\n");
duplicate_carry (0);
- /* Manual says bits NV are undefined though a real 68040/060 don't change them */
- if (cpu_level >= xBCD_KEEPS_NV_FLAGS) {
- if (next_cpu_level < xBCD_KEEPS_NV_FLAGS)
- next_cpu_level = xBCD_KEEPS_NV_FLAGS - 1;
+ /* Manual says bits NV are undefined though a real 68030 doesn't change V and 68040/060 don't change both */
+ if (cpu_level >= xBCD_KEEPS_N_FLAG) {
+ if (next_cpu_level < xBCD_KEEPS_N_FLAG)
+ next_cpu_level = xBCD_KEEPS_N_FLAG - 1;
genflags (flag_z, curi->size, "newv", "", "");
} else {
genflags (flag_zn, curi->size, "newv", "", "");
+ }
+ if (cpu_level >= xBCD_KEEPS_V_FLAG) {
+ if (next_cpu_level < xBCD_KEEPS_V_FLAG)
+ next_cpu_level = xBCD_KEEPS_V_FLAG - 1;
+ } else {
printf ("\tSET_VFLG ((tmp_newv & 0x80) != 0 && (newv & 0x80) == 0);\n");
}
if (isreg (curi->smode)) {
printf ("\tif (cflg) newv += 0x60;\n");
printf ("\tSET_CFLG (cflg);\n");
duplicate_carry (0);
- /* Manual says bits NV are undefined though a real 68040 don't change them */
- if (cpu_level >= xBCD_KEEPS_NV_FLAGS) {
- if (next_cpu_level < xBCD_KEEPS_NV_FLAGS)
- next_cpu_level = xBCD_KEEPS_NV_FLAGS - 1;
+ /* Manual says bits NV are undefined though a real 68030 doesn't change V and 68040/060 don't change both */
+ if (cpu_level >= xBCD_KEEPS_N_FLAG) {
+ if (next_cpu_level < xBCD_KEEPS_N_FLAG)
+ next_cpu_level = xBCD_KEEPS_N_FLAG - 1;
genflags (flag_z, curi->size, "newv", "", "");
- }
- else {
+ } else {
genflags (flag_zn, curi->size, "newv", "", "");
+ }
+ if (cpu_level >= xBCD_KEEPS_V_FLAG) {
+ if (next_cpu_level < xBCD_KEEPS_V_FLAG)
+ next_cpu_level = xBCD_KEEPS_V_FLAG - 1;
+ } else {
printf ("\tSET_VFLG ((tmp_newv & 0x80) == 0 && (newv & 0x80) != 0);\n");
}
if (isreg (curi->smode)) {
printf ("\tif (cflg) newv -= 0x60;\n");
printf ("\tSET_CFLG (cflg);\n");
duplicate_carry(0);
- /* Manual says bits NV are undefined though a real 68040 don't change them */
- if (cpu_level >= xBCD_KEEPS_NV_FLAGS) {
- if (next_cpu_level < xBCD_KEEPS_NV_FLAGS)
- next_cpu_level = xBCD_KEEPS_NV_FLAGS - 1;
+ /* Manual says bits NV are undefined though a real 68030 doesn't change V and 68040/060 don't change both */
+ if (cpu_level >= xBCD_KEEPS_N_FLAG) {
+ if (next_cpu_level < xBCD_KEEPS_N_FLAG)
+ next_cpu_level = xBCD_KEEPS_N_FLAG - 1;
genflags (flag_z, curi->size, "newv", "", "");
- }
- else {
+ } else {
genflags (flag_zn, curi->size, "newv", "", "");
+ }
+ if (cpu_level >= xBCD_KEEPS_V_FLAG) {
+ if (next_cpu_level < xBCD_KEEPS_V_FLAG)
+ next_cpu_level = xBCD_KEEPS_V_FLAG - 1;
+ } else {
printf ("\tSET_VFLG ((tmp_newv & 0x80) != 0 && (newv & 0x80) == 0);\n");
}
genastore ("newv", curi->smode, "srcreg", curi->size, "src");