-
Notifications
You must be signed in to change notification settings - Fork 4
/
op_bitop.go
67 lines (58 loc) · 1.26 KB
/
op_bitop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package z80
func (cpu *CPU) bitchk8b(b, v uint8) {
var nand uint8 = maskS53 | maskZ | maskH | maskPV | maskN
var or uint8
if v&(0x01<<b) == 0 {
or |= maskZ | maskPV
} else if b == 7 {
or |= maskS
}
or |= maskH
cpu.AF.Lo = cpu.AF.Lo&^nand | or
}
func xopBITbIXdP(cpu *CPU, b, d uint8) {
p := addrOff(cpu.IX, d)
v := cpu.Memory.Get(p)
cpu.bitchk8b(b, v)
}
func xopBITbIYdP(cpu *CPU, b, d uint8) {
p := addrOff(cpu.IY, d)
v := cpu.Memory.Get(p)
cpu.bitchk8b(b, v)
}
func xopSETbIXdP(cpu *CPU, b, d uint8) {
p := addrOff(cpu.IX, d)
v := cpu.Memory.Get(p)
v = cpu.bitset8(b, v)
cpu.Memory.Set(p, v)
}
func xopSETbIYdP(cpu *CPU, b, d uint8) {
p := addrOff(cpu.IY, d)
v := cpu.Memory.Get(p)
v = cpu.bitset8(b, v)
cpu.Memory.Set(p, v)
}
func xopRESbIXdP(cpu *CPU, b, d uint8) {
p := addrOff(cpu.IX, d)
v := cpu.Memory.Get(p)
v = cpu.bitres8(b, v)
cpu.Memory.Set(p, v)
}
func xopRESbIYdP(cpu *CPU, b, d uint8) {
p := addrOff(cpu.IY, d)
v := cpu.Memory.Get(p)
v = cpu.bitres8(b, v)
cpu.Memory.Set(p, v)
}
func xopBITbHLP(cpu *CPU, b uint8) {
p := cpu.HL.U16()
x := cpu.Memory.Get(p)
x = cpu.bitres8(b, x)
cpu.Memory.Set(p, x)
}
func xopSETbHLP(cpu *CPU, b uint8) {
p := cpu.HL.U16()
x := cpu.Memory.Get(p)
x = cpu.bitset8(b, x)
cpu.Memory.Set(p, x)
}