def cmp(self, a, b):
r = ctypes.c_short(ctypes.c_byte(a).value - ctypes.c_byte(b).value).value
rs = ctypes.c_byte(a - b).value
self.pc_state.P.set_N((0,1)[0x80 == (rs & 0x80)]) # Negative
self.pc_state.P.set_Z((0,1)[rs == 0]) # Zero
r = (a & 0xFF) - (b & 0xFF)
self.pc_state.P.set_C((1,0)[0x100 == (r & 0x100)]) # Carry (not borrow)
评论列表
文章目录