-
Notifications
You must be signed in to change notification settings - Fork 4
/
op_load8.go
97 lines (84 loc) · 1.9 KB
/
op_load8.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package z80
func oopLDHLPn(cpu *CPU, n uint8) {
p := cpu.HL.U16()
cpu.Memory.Set(p, n)
}
func oopLDIXdPn(cpu *CPU, d, n uint8) {
p := addrOff(cpu.IX, d)
cpu.Memory.Set(p, n)
}
func oopLDIYdPn(cpu *CPU, d, n uint8) {
p := addrOff(cpu.IY, d)
cpu.Memory.Set(p, n)
}
func oopLDABCP(cpu *CPU) {
p := cpu.BC.U16()
cpu.AF.Hi = cpu.Memory.Get(p)
}
func oopLDADEP(cpu *CPU) {
p := cpu.DE.U16()
cpu.AF.Hi = cpu.Memory.Get(p)
}
func oopLDAnnP(cpu *CPU, l, h uint8) {
p := toU16(l, h)
cpu.AF.Hi = cpu.Memory.Get(p)
}
func oopLDBCPA(cpu *CPU) {
p := cpu.BC.U16()
cpu.Memory.Set(p, cpu.AF.Hi)
}
func oopLDDEPA(cpu *CPU) {
p := cpu.DE.U16()
cpu.Memory.Set(p, cpu.AF.Hi)
}
func oopLDnnPA(cpu *CPU, l, h uint8) {
p := toU16(l, h)
cpu.Memory.Set(p, cpu.AF.Hi)
}
func oopLDAI(cpu *CPU) {
d := cpu.IR.Hi
cpu.AF.Hi = d
// update F by d
// - S is set if the I Register is negative; otherwise, it is
// reset.
// - Z is set if the I Register is 0; otherwise, it is reset.
// - H is reset.
// - P/V contains contents of IFF2.
// - N is reset.
// - C is not affected.
// - If an interrupt occurs during execution of this instruction,
// the Parity flag contains a 0.
cpu.flagUpdate(FlagOp{}.
Put(S, d&0x80 != 0).
Put(Z, d == 0).
Reset(H).
Put(PV, cpu.IFF2).
Reset(N).
Keep(C))
}
func oopLDAR(cpu *CPU) {
d := cpu.IR.Lo
cpu.AF.Hi = d
// update F by d
// - S is set if, R-Register is negative; otherwise, it is reset.
// - Z is set if the R Register is 0; otherwise, it is reset.
// - H is reset.
// - P/V contains contents of IFF2.
// - N is reset.
// - C is not affected.
// - If an interrupt occurs during execution of this instruction,
// the parity flag contains a 0.
cpu.flagUpdate(FlagOp{}.
Put(S, d&0x80 != 0).
Put(Z, d == 0).
Reset(H).
Put(PV, cpu.IFF2).
Reset(N).
Keep(C))
}
func oopLDIA(cpu *CPU) {
cpu.IR.Hi = cpu.AF.Hi
}
func oopLDRA(cpu *CPU) {
cpu.IR.Lo = cpu.AF.Hi
}