void cmp_set_flag(int size, uint32_t l, uint32_t r, uint32_t tmp) { set_zf(tmp); set_pf(tmp); set_sf(tmp, size); //use carry bit as borrow bit set_cf_b(l, r); set_af_b(l, r); set_of_minus(size, tmp, l, r); }
inline void cpu_sal16(bit16u *dest, bit8u src) { bit16u tmp = *dest; *dest <<= (src & 0x1F); set_cf_sal16(src, *dest); set_zf(*dest); set_sf16(*dest); set_af(tmp, src, *dest); set_of_sal16(tmp, src, *dest); set_pf(*dest); }
inline void cpu_sal8(bit8u *dest, bit8u src) { bit8u tmp = *dest; *dest <<= (src & 0x1F); set_of_sal8(tmp, src, *dest); set_cf_sal8(src, *dest); set_af(tmp, src, *dest); set_sf8(*dest); set_zf(*dest); set_pf(*dest); }
inline void cpu_shr16(bit16u *dest, bit8u src) { bit16u tmp = *dest; src &= 0x1F; *dest >>= src; set_zf(*dest); set_cf_shr16(tmp,src); set_pf(*dest); set_sf8(*dest); set_of_shr16(tmp, src); }
inline void cpu_daa() { if (((reg_al & 0x0F) > 9) || (flags.AF)) { reg_al += 0x06; flags.AF = 1; } else flags.AF = 0; if ((reg_al > 0x9f) || (flags.CF)) { reg_al += 0x60; flags.CF = 1; } else flags.CF = 0; set_zf(reg_al); set_sf8(reg_al); set_pf(reg_al); }