mirror of
https://github.com/Candygoblen123/SwiftNES.git
synced 2024-11-09 22:46:24 -06:00
19 lines
314 B
Swift
19 lines
314 B
Swift
|
class ScrollRegister {
|
||
|
public var x: UInt8 = 0
|
||
|
public var y: UInt8 = 0
|
||
|
public var latch = false
|
||
|
|
||
|
func write(_ data: UInt8) {
|
||
|
if !latch {
|
||
|
x = data
|
||
|
} else {
|
||
|
y = data
|
||
|
}
|
||
|
latch.toggle()
|
||
|
}
|
||
|
|
||
|
func resetLatch() {
|
||
|
latch = false
|
||
|
}
|
||
|
}
|