- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
setRegState :: RegisterStates -> M_Register -> Word8 -> RegisterStates
setRegState rs r n =
let (a, b, c, d, e, f, h, l, pc, sp) = rs in
case r of
M_A -> (n, b, c, d, e, f, h, l, pc, sp)
M_B -> (a, n, c, d, e, f, h, l, pc, sp)
M_C -> (a, b, n, d, e, f, h, l, pc, sp)
M_D -> (a, b, c, n, e, f, h, l, pc, sp)
M_E -> (a, b, c, d, n, f, h, l, pc, sp)
M_F -> (a, b, c, d, e, n.&.0xF0, h, l, pc, sp)
M_H -> (a, b, c, d, e, f, n, l, pc, sp)
M_L -> (a, b, c, d, e, f, h, n, pc, sp)
Haskell has no boilerplate.
Из исходников заброшенного эмулятора GameBoy (https://github.com/bitc/omegagb/)