Skip to content

Commit

Permalink
replace by mask53
Browse files Browse the repository at this point in the history
  • Loading branch information
koron committed Jul 23, 2022
1 parent 53f368c commit 09530a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions accum.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (cpu *CPU) cpU8(a, b uint8) uint8 {
var nand uint8 = maskS53 | maskZ | maskH | maskPV | maskN | maskC
var or uint8
or |= uint8(r) & maskS
or |= b & (mask5 | mask3)
or |= b & mask53
if uint8(r) == 0 {
or |= maskZ
}
Expand Down Expand Up @@ -171,9 +171,9 @@ func (cpu *CPU) addU16(a, b uint16) uint16 {
a32, b32 := uint32(a), uint32(b)
r := a32 + b32
c := r ^ a32 ^ b32
var nand uint8 = maskH | maskN | maskC | mask5 | mask3
var nand uint8 = mask53 | maskH | maskN | maskC
var or uint8
or |= uint8(r>>8) & (mask5 | mask3)
or |= uint8(r>>8) & mask53
or |= uint8(c>>8) & maskH
or |= uint8(r>>16) & maskC
cpu.AF.Lo = cpu.AF.Lo&^nand | or
Expand Down Expand Up @@ -282,7 +282,7 @@ func (cpu *CPU) bitchk8(b, v uint8) {
or |= maskS
}
or |= maskH
or |= v & (mask5 | mask3)
or |= v & mask53
cpu.AF.Lo = cpu.AF.Lo&^nand | or
}

Expand Down
2 changes: 1 addition & 1 deletion op_exbtsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func oopEXSPPIY(cpu *CPU) {
}

func (cpu *CPU) updateFlagLDID(a uint8) {
var nand uint8 = maskH | maskPV | maskN | mask5 | mask3
var nand uint8 = mask53 | maskH | maskPV | maskN
var or uint8
if cpu.BC.Lo != 0 || cpu.BC.Hi != 0 {
or |= maskPV
Expand Down
8 changes: 4 additions & 4 deletions op_rotateshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package z80
import "math/bits"

func (cpu *CPU) updateFlagRL(r uint8) {
var nand uint8 = maskH | maskN | maskC | mask5 | mask3
var nand uint8 = mask53 | maskH | maskN | maskC
var or = (r >> 7) & maskC
or |= r << 1 & (mask5 | mask3)
or |= r << 1 & mask53
cpu.AF.Lo = cpu.AF.Lo&^nand | or
}

Expand All @@ -24,9 +24,9 @@ func oopRLA(cpu *CPU) {
}

func (cpu *CPU) updateFlagRR(r uint8) {
var nand uint8 = maskH | maskN | maskC | mask5 | mask3
var nand uint8 = mask53 | maskH | maskN | maskC
var or = r & maskC
or |= r >> 1 & (mask5 | mask3)
or |= r >> 1 & mask53
cpu.AF.Lo = cpu.AF.Lo&^nand | or
}

Expand Down

0 comments on commit 09530a6

Please sign in to comment.