Render: Impl sprite rendering

This commit is contained in:
Andrew Glaze
2024-08-21 16:42:05 -04:00
parent ddd8fd6ee6
commit 6974110b22
4 changed files with 90 additions and 13 deletions

View File

@@ -28,7 +28,6 @@ class NesPPU {
func tick(_ cycles: UInt8) -> Bool {
self.cycles += Int(cycles)
if self.cycles >= 341 {
//print(self.cycles)
self.cycles = self.cycles - 341
self.scanline += 1
@@ -37,7 +36,6 @@ class NesPPU {
status.setSpriteZeroHit(false)
if ctrl.generateVblankNMI() {
nmiInterrupt = 1
print("interrupt")
}
}
@@ -116,7 +114,6 @@ class NesPPU {
func writeToData(_ data: UInt8) {
let addr = addr.get()
print("\(addr): \(data)")
switch addr {
case 0...0x1fff:
print("Attempt to write to chr rom space \(addr)!")

View File

@@ -46,4 +46,28 @@ struct ControlRegister: OptionSet {
0x1000
}
}
func spritePatternAddr() -> Int {
if !self.contains(.SPRITE_PATTERN_ADDR) {
0
} else {
0x1000
}
}
func spriteSize() -> Int {
if !self.contains(.SPRITE_SIZE) {
8
} else {
16
}
}
func masterSlaveSelect() -> Int {
if !self.contains(.SPRITE_SIZE) {
0
} else {
1
}
}
}