@tmustier/pi-nes 0.2.23 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/nes/native/nes-core/index.node +0 -0
- package/extensions/nes/native/nes-core/vendor/nes_rust/TODO_INVENTORY.md +8 -8
- package/extensions/nes/native/nes-core/vendor/nes_rust/VENDOR.md +2 -2
- package/extensions/nes/native/nes-core/vendor/nes_rust/src/apu.rs +4 -5
- package/extensions/nes/native/nes-core/vendor/nes_rust/src/cpu.rs +3 -6
- package/extensions/nes/native/nes-core/vendor/nes_rust/src/lib.rs +1 -1
- package/extensions/nes/native/nes-core/vendor/nes_rust/src/ppu.rs +2 -5
- package/package.json +1 -1
- package/TODO_INVENTORY.md +0 -116
|
Binary file
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
This inventory tracks TODOs in the vendored `nes_rust` snapshot.
|
|
4
4
|
|
|
5
5
|
## src/lib.rs
|
|
6
|
-
- L57: Audio buffer sample code T.B.D. (doc example).
|
|
6
|
+
- L57: Audio buffer sample code T.B.D. (doc example). Change: replace TODO with note that audio output is omitted.
|
|
7
7
|
|
|
8
8
|
## src/apu.rs
|
|
9
9
|
- L53: sample_period timing fix needed for audio accuracy.
|
|
10
10
|
- L67: APU reset behavior incomplete.
|
|
11
11
|
- L79: Sampling timing not precise.
|
|
12
|
-
- L93: Add note (DMC timer) —
|
|
12
|
+
- L93: Add note (DMC timer) — Delete: remove TODO unless a concrete note is added.
|
|
13
13
|
- L102: Frame sequencer timing not precise.
|
|
14
14
|
- L168: IRQ timing needs verification.
|
|
15
15
|
- L276: DMC CPU memory workaround is hacky; optional refactor.
|
|
16
|
-
- L400/612/775/949: Invalid register write handling —
|
|
16
|
+
- L400/612/775/949: Invalid register write handling — Change: document no-op and remove TODOs.
|
|
17
17
|
- L467: Sweep negation logic fix needed.
|
|
18
18
|
- L975: Remove DMC memory workaround; optional refactor.
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ This inventory tracks TODOs in the vendored `nes_rust` snapshot.
|
|
|
23
23
|
|
|
24
24
|
## src/ppu.rs
|
|
25
25
|
- L119: Data bus decay support (accuracy improvement).
|
|
26
|
-
- L322: Greyscale support comment
|
|
26
|
+
- L322: Greyscale support comment — Delete: masking handled in load_palette (unless register-read behavior needed).
|
|
27
27
|
- L495: Pixel alignment off-by-one investigation.
|
|
28
28
|
- L594-L618: Missing cycle/subcycle fetch behavior.
|
|
29
29
|
- L660: Attribute fetch correctness.
|
|
@@ -32,7 +32,7 @@ This inventory tracks TODOs in the vendored `nes_rust` snapshot.
|
|
|
32
32
|
- L804/L830: Scroll updates conditional on rendering.
|
|
33
33
|
- L863: Optional optimization.
|
|
34
34
|
- L1020: Color emphasis implementation.
|
|
35
|
-
- L1069: PPU master/slave select
|
|
35
|
+
- L1069: PPU master/slave select — Change: document as ignored on NES, remove TODO.
|
|
36
36
|
|
|
37
37
|
## src/register.rs
|
|
38
38
|
- L5: Combine Register<u8>/Register<u16> (optional refactor).
|
|
@@ -42,16 +42,16 @@ This inventory tracks TODOs in the vendored `nes_rust` snapshot.
|
|
|
42
42
|
- L149: MMC1 32KB banking fix needed.
|
|
43
43
|
|
|
44
44
|
## src/cpu.rs
|
|
45
|
-
- L44: Unknown button mapping
|
|
45
|
+
- L44: Unknown button mapping — Change: replace with unreachable! (exhaustive match).
|
|
46
46
|
- L242: Opcode table refactor (optional).
|
|
47
47
|
- L620: Page-cross cycle for ADC 0x71 needed.
|
|
48
48
|
- L1254/L1258: DMC sample handling simplification + stall timing fix.
|
|
49
49
|
- L1271: Frame update detection precision.
|
|
50
50
|
- L1285: Poweroff input handling.
|
|
51
51
|
- L1313: NMI vs IRQ ordering.
|
|
52
|
-
- L1368/1895: Cleanup notes
|
|
52
|
+
- L1368/1895: Cleanup notes — Delete: vague cleanup notes.
|
|
53
53
|
- L1417/1552/1557/1709/1716/1732/1738/1994: CPU logic correctness checks.
|
|
54
|
-
- L1531/L2116: Invalid instruction/addressing mode handling.
|
|
54
|
+
- L1531/L2116: Invalid instruction/addressing mode handling — Change: treat illegal opcodes as NOP placeholder and document unknown addressing mode fallback.
|
|
55
55
|
- L1909: DMA stall timing detail.
|
|
56
56
|
- L1952: Interrupt handling optimization (optional).
|
|
57
57
|
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
- Purpose: carry project-specific fixes and act as upstream-of-record for this vendor copy.
|
|
10
10
|
|
|
11
11
|
## Current Vendor Snapshot
|
|
12
|
-
- Source commit/tag: `
|
|
12
|
+
- Source commit/tag: `28b6e9b` (fork master)
|
|
13
13
|
- Vendored on: 2026-02-02
|
|
14
|
-
- Local patch set: SRAM helpers, CHR RAM support, mapper fixes, PPU timing tweaks, debug hooks.
|
|
14
|
+
- Local patch set: SRAM helpers, CHR RAM support, mapper fixes, PPU timing tweaks, debug hooks, palette index clamp.
|
|
15
15
|
|
|
16
16
|
## Update Process
|
|
17
17
|
1. Sync fork with upstream if needed.
|
|
@@ -90,7 +90,6 @@ impl Apu {
|
|
|
90
90
|
self.pulse1.drive_timer();
|
|
91
91
|
self.pulse2.drive_timer();
|
|
92
92
|
self.noise.drive_timer();
|
|
93
|
-
// @TODO: Add note
|
|
94
93
|
if self.dmc.drive_timer(dmc_sample_data) {
|
|
95
94
|
self.dmc_irq_active = true;
|
|
96
95
|
}
|
|
@@ -397,7 +396,7 @@ impl ApuPulse {
|
|
|
397
396
|
self.timer_sequence = 0;
|
|
398
397
|
self.envelope_start_flag = true;
|
|
399
398
|
},
|
|
400
|
-
_ => {} //
|
|
399
|
+
_ => {} // Invalid register: no-op.
|
|
401
400
|
};
|
|
402
401
|
}
|
|
403
402
|
|
|
@@ -609,7 +608,7 @@ impl ApuTriangle {
|
|
|
609
608
|
|
|
610
609
|
self.linear_reload_flag = true;
|
|
611
610
|
},
|
|
612
|
-
_ => {} //
|
|
611
|
+
_ => {} // Invalid register: no-op.
|
|
613
612
|
};
|
|
614
613
|
}
|
|
615
614
|
|
|
@@ -772,7 +771,7 @@ impl ApuNoise {
|
|
|
772
771
|
|
|
773
772
|
self.envelope_start_flag = true;
|
|
774
773
|
},
|
|
775
|
-
_ => {} //
|
|
774
|
+
_ => {} // Invalid register: no-op.
|
|
776
775
|
};
|
|
777
776
|
}
|
|
778
777
|
|
|
@@ -946,7 +945,7 @@ impl ApuDmc {
|
|
|
946
945
|
self.register3.store(value);
|
|
947
946
|
self.remaining_bytes_counter = ((self.sample_length() as u16) << 4) | 1;
|
|
948
947
|
},
|
|
949
|
-
_ => {} //
|
|
948
|
+
_ => {} // Invalid register: no-op.
|
|
950
949
|
}
|
|
951
950
|
}
|
|
952
951
|
|
|
@@ -41,7 +41,7 @@ fn to_joypad_button(button: button::Button) -> joypad::Button {
|
|
|
41
41
|
button::Button::Joypad2Right => joypad::Button::Right,
|
|
42
42
|
button::Button::Start => joypad::Button::Start,
|
|
43
43
|
button::Button::Select => joypad::Button::Select,
|
|
44
|
-
_ =>
|
|
44
|
+
_ => unreachable!("Unhandled button mapping")
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -1365,7 +1365,6 @@ impl Cpu {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
|
-
// @TODO: Clean up if needed
|
|
1369
1368
|
fn operate(&mut self, op: &Operation) {
|
|
1370
1369
|
match op.instruction_type {
|
|
1371
1370
|
InstructionTypes::ADC => {
|
|
@@ -1528,7 +1527,7 @@ impl Cpu {
|
|
|
1528
1527
|
self.update_z(result);
|
|
1529
1528
|
},
|
|
1530
1529
|
InstructionTypes::INV => {
|
|
1531
|
-
//
|
|
1530
|
+
// Illegal opcode placeholder (treated as NOP for now).
|
|
1532
1531
|
println!("INV operation");
|
|
1533
1532
|
},
|
|
1534
1533
|
InstructionTypes::INX | InstructionTypes::INY => {
|
|
@@ -1892,8 +1891,6 @@ impl Cpu {
|
|
|
1892
1891
|
self.apu.store_register(address, value);
|
|
1893
1892
|
}
|
|
1894
1893
|
|
|
1895
|
-
// @TODO: clean up
|
|
1896
|
-
|
|
1897
1894
|
if address == 0x4014 {
|
|
1898
1895
|
self.ppu.store_register(address, value, &mut self.rom);
|
|
1899
1896
|
|
|
@@ -2113,7 +2110,7 @@ impl Cpu {
|
|
|
2113
2110
|
effective_address
|
|
2114
2111
|
},
|
|
2115
2112
|
_ => {
|
|
2116
|
-
//
|
|
2113
|
+
// Unknown addressing mode; returning 0 as a fallback.
|
|
2117
2114
|
println!("Unknown addressing mode.");
|
|
2118
2115
|
0
|
|
2119
2116
|
}
|
|
@@ -54,7 +54,7 @@ use audio::Audio;
|
|
|
54
54
|
/// nes.step_frame();
|
|
55
55
|
/// nes.copy_pixels(rgba_pixels);
|
|
56
56
|
/// // Render rgba_pixels
|
|
57
|
-
/// //
|
|
57
|
+
/// // Audio output omitted in this example.
|
|
58
58
|
/// // Adjust sleep time for your platform
|
|
59
59
|
/// std::thread::sleep(Duration::from_millis(1));
|
|
60
60
|
/// }
|
|
@@ -319,8 +319,6 @@ impl Ppu {
|
|
|
319
319
|
};
|
|
320
320
|
self.vram_read_buffer = value;
|
|
321
321
|
|
|
322
|
-
// @TODO: Support greyscale if needed
|
|
323
|
-
|
|
324
322
|
// Accessing ppudata increments vram_address
|
|
325
323
|
self.increment_vram_address();
|
|
326
324
|
self.data_bus = return_value;
|
|
@@ -1011,7 +1009,7 @@ impl Ppu {
|
|
|
1011
1009
|
// read from the grey column 0x00, 0x10, 0x20, or 0x30
|
|
1012
1010
|
let mask = match self.ppumask.is_greyscale() {
|
|
1013
1011
|
true => 0x30,
|
|
1014
|
-
false =>
|
|
1012
|
+
false => 0x3F
|
|
1015
1013
|
};
|
|
1016
1014
|
PALETTES[(address & mask) as usize] & 0xFFFFFF
|
|
1017
1015
|
}
|
|
@@ -1066,8 +1064,7 @@ impl PpuControlRegister {
|
|
|
1066
1064
|
self.register.is_bit_set(7)
|
|
1067
1065
|
}
|
|
1068
1066
|
|
|
1069
|
-
// Bit 6. PPU master/slave select
|
|
1070
|
-
// @TODO: Implement
|
|
1067
|
+
// Bit 6. PPU master/slave select (unused on NES; ignored)
|
|
1071
1068
|
|
|
1072
1069
|
// Bit 5. Sprite height
|
|
1073
1070
|
// -- 0: 8 (8x8 pixels), 1: 16 (8x16 pixels)
|
package/package.json
CHANGED
package/TODO_INVENTORY.md
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# TODO Inventory Review
|
|
2
|
-
|
|
3
|
-
Scope: `extensions/nes/native/nes-core/vendor/nes_rust` (vendored emulator core). Each TODO reviewed for necessity.
|
|
4
|
-
|
|
5
|
-
## Action Plan (prioritized)
|
|
6
|
-
|
|
7
|
-
### P0 — Correctness (act)
|
|
8
|
-
- [ ] APU timing fixes (sample_period, sampling timing, frame sequencer timing, sweep negation, DMC stall timing)
|
|
9
|
-
- [ ] PPU fetch timing + scroll updates (cycles 257–340, subcycle fetch, attribute fetch, pixel alignment)
|
|
10
|
-
- [ ] Mapper IRQ/MMC1 correctness (MMC3 IRQ timing/placement, MMC1 32KB banking fix)
|
|
11
|
-
- [ ] CPU correctness/timing (ADC 0x71 page-cross, NMI vs IRQ priority, BIT/JMP/JSR/RTI/RTS/SBC logic, relative addressing sign extension, DMA stall timing)
|
|
12
|
-
|
|
13
|
-
### P1 — Architecture cleanup
|
|
14
|
-
- [ ] Move MMC3 IRQ handling out of ROM/PPU into mapper layer
|
|
15
|
-
- [ ] Replace invalid-register/addressing TODOs with explicit no-op or `unreachable!()`
|
|
16
|
-
- [ ] Remove/clarify doc-only TODOs (audio example note, greyscale comment, PPU master/slave select if intentionally ignored)
|
|
17
|
-
|
|
18
|
-
### P2 — Optional refactors/optimizations
|
|
19
|
-
- [ ] Opcode table refactor
|
|
20
|
-
- [ ] Register<u8>/Register<u16> merge
|
|
21
|
-
- [ ] Audio buffer cleanup + constant for 4096
|
|
22
|
-
- [ ] Header caching + sprite eval/pos calculation optimizations
|
|
23
|
-
|
|
24
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/lib.rs
|
|
25
|
-
| Line | TODO | Assessment |
|
|
26
|
-
| --- | --- | --- |
|
|
27
|
-
| 57 | Audio buffer sample code is T.B.D. (doc example) | Not needed for runtime; either remove the TODO or replace with a short note that audio output is omitted in the example. |
|
|
28
|
-
|
|
29
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/apu.rs
|
|
30
|
-
| Line | TODO | Assessment |
|
|
31
|
-
| --- | --- | --- |
|
|
32
|
-
| 53 | Fix sample_period (1764000 / 44100) | Needed for accurate audio timing; keep until audio timing is corrected. |
|
|
33
|
-
| 67 | Implement reset properly | Needed for accurate APU reset behavior; keep. |
|
|
34
|
-
| 79 | More precise sampling timing | Needed for correct audio output timing; keep. |
|
|
35
|
-
| 93 | Add note (DMC timer) | Not needed; either add a clarifying comment or remove the TODO. |
|
|
36
|
-
| 102 | More precise frame sequencer timing | Needed for correct APU frame sequencing; keep. |
|
|
37
|
-
| 168 | Check IRQ timing when sending | Needed for correct IRQ behavior; keep. |
|
|
38
|
-
| 276 | DMC CPU memory workaround is hacky; simplify | Optional refactor; keep if you want cleanup, otherwise can remove. |
|
|
39
|
-
| 400 | Throw an error on invalid pulse register | Not needed; invalid register writes are typically ignored. Consider removing TODO or clarifying no-op behavior. |
|
|
40
|
-
| 467 | Fix negated sweep behavior | Needed for accurate sweep; keep. |
|
|
41
|
-
| 612 | Throw an error on invalid triangle register | Not needed; invalid writes can be ignored. Consider removing TODO. |
|
|
42
|
-
| 775 | Throw an error on invalid noise register | Not needed; invalid writes can be ignored. Consider removing TODO. |
|
|
43
|
-
| 949 | DMC invalid register case | Not needed; either document as ignored or remove TODO. |
|
|
44
|
-
| 975 | Remove DMC CPU memory workaround | Optional refactor; keep if you want to eliminate the workaround. |
|
|
45
|
-
|
|
46
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/default_audio.rs
|
|
47
|
-
| Line | TODO | Assessment |
|
|
48
|
-
| --- | --- | --- |
|
|
49
|
-
| 29 | Remove side effect in copy_sample_buffer | Optional cleanup; keep if you plan to revisit buffer semantics. |
|
|
50
|
-
| 31 | Remove magic number (4096) | Needed for maintainability; replace with a named constant if audio is used. |
|
|
51
|
-
|
|
52
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/ppu.rs
|
|
53
|
-
| Line | TODO | Assessment |
|
|
54
|
-
| --- | --- | --- |
|
|
55
|
-
| 119 | Support data bus decay | Optional accuracy improvement; keep if fidelity matters. |
|
|
56
|
-
| 322 | Support greyscale if needed | Likely optional; greyscale masking is already applied in `load_palette`. Consider removing or clarifying if register-read greyscale behavior is desired. |
|
|
57
|
-
| 495 | Investigate `cycle - 1` vs `cycle - 2` pixel alignment | Needed for render correctness; keep. |
|
|
58
|
-
| 594 | Cycle 257-320 behavior | Needed for correct PPU fetch timing; keep. |
|
|
59
|
-
| 595 | Cycle 321-336 behavior | Needed for correct PPU fetch timing; keep. |
|
|
60
|
-
| 596 | Cycle 337-340 behavior | Needed for correct PPU fetch timing; keep. |
|
|
61
|
-
| 615 | 0-1 subcycle fetch details | Needed for correctness; keep. |
|
|
62
|
-
| 616 | 2-3 subcycle fetch details | Needed for correctness; keep. |
|
|
63
|
-
| 617 | 4-5 subcycle fetch details | Needed for correctness; keep. |
|
|
64
|
-
| 618 | 6-7 subcycle fetch details | Needed for correctness; keep. |
|
|
65
|
-
| 660 | Implement attribute fetch properly | Needed for PPU accuracy; keep. |
|
|
66
|
-
| 690 | Optimize pos calculation | Optional performance cleanup; not required. |
|
|
67
|
-
| 758 | Check MMC3 IRQ timing | Needed for mapper IRQ accuracy; keep. |
|
|
68
|
-
| 759 | MMC3-specific IRQ hook location | Optional refactor; keep if you plan to move this into mapper layer. |
|
|
69
|
-
| 804 | Only increment scroll if rendering enabled? | Needed for correctness; keep. |
|
|
70
|
-
| 830 | Only copy scroll if rendering enabled? | Needed for correctness; keep. |
|
|
71
|
-
| 863 | Optimize sprite evaluation | Optional performance cleanup; not required. |
|
|
72
|
-
| 1020 | Implement color emphasis properly | Needed if emphasis bits should affect output; keep. |
|
|
73
|
-
| 1069 | Implement PPU master/slave select | Likely not needed (unused on NES). Consider removing TODO or documenting it as intentionally ignored. |
|
|
74
|
-
|
|
75
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/register.rs
|
|
76
|
-
| Line | TODO | Assessment |
|
|
77
|
-
| --- | --- | --- |
|
|
78
|
-
| 5 | Combine Register<u8> with Register<u16> | Optional refactor; not required. Consider removing if you don’t plan to refactor. |
|
|
79
|
-
|
|
80
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/mapper.rs
|
|
81
|
-
| Line | TODO | Assessment |
|
|
82
|
-
| --- | --- | --- |
|
|
83
|
-
| 45 | MMC3-specific `drive_irq_counter` in trait | Optional architecture cleanup; keep if you want a mapper-specific IRQ interface. |
|
|
84
|
-
| 149 | MMC1 32KB banking fix | Needed for correct MMC1 behavior; keep. |
|
|
85
|
-
|
|
86
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/cpu.rs
|
|
87
|
-
| Line | TODO | Assessment |
|
|
88
|
-
| --- | --- | --- |
|
|
89
|
-
| 44 | Throw error for unknown button mapping | Not needed; enum should be exhaustive. Replace with `unreachable!()` or remove TODO. |
|
|
90
|
-
| 242 | Replace opcode match with static array | Optional refactor; not required. |
|
|
91
|
-
| 620 | Add +1 cycle if page crossed (ADC 0x71) | Needed for accurate timing; keep. |
|
|
92
|
-
| 1254 | Simplify DMC sample handling | Optional refactor; keep if you want cleanup. |
|
|
93
|
-
| 1258 | Fix DMC stall timing (+4 cycles) | Needed for accuracy; keep. |
|
|
94
|
-
| 1271 | More precise frame update detection | Optional; keep if timing fidelity matters. |
|
|
95
|
-
| 1285 | Implement Poweroff input | Optional feature; keep if you plan to support it. |
|
|
96
|
-
| 1313 | Handle NMI vs IRQ priority | Needed for correctness; keep. |
|
|
97
|
-
| 1368 | Clean up operate() if needed | Not needed; remove TODO unless you plan a refactor. |
|
|
98
|
-
| 1417 | Check BIT instruction logic | Needed for correctness; keep. |
|
|
99
|
-
| 1531 | Throw on INV instruction | Not needed for runtime; prefer `unreachable!()` or remove TODO. |
|
|
100
|
-
| 1552 | Check JMP logic | Needed for correctness; keep. |
|
|
101
|
-
| 1557 | Check JSR logic | Needed for correctness; keep. |
|
|
102
|
-
| 1709 | Check RTI logic | Needed for correctness; keep. |
|
|
103
|
-
| 1716 | Check RTS logic | Needed for correctness; keep. |
|
|
104
|
-
| 1732 | Confirm SBC carry/borrow logic | Needed for correctness; keep. |
|
|
105
|
-
| 1738 | Implement correct SBC overflow logic | Needed for correctness; keep. |
|
|
106
|
-
| 1895 | Clean up store() control flow | Not needed; remove TODO unless refactoring. |
|
|
107
|
-
| 1909 | DMA stall cycle timing | Needed for accuracy (513/514 cycle detail); keep. |
|
|
108
|
-
| 1952 | Optimize interrupt handling | Optional; not required. |
|
|
109
|
-
| 1994 | Confirm relative addressing sign extension | Needed for correctness; keep. |
|
|
110
|
-
| 2116 | Throw on unknown addressing mode | Not needed; prefer `unreachable!()` or remove TODO. |
|
|
111
|
-
|
|
112
|
-
## extensions/nes/native/nes-core/vendor/nes_rust/src/rom.rs
|
|
113
|
-
| Line | TODO | Assessment |
|
|
114
|
-
| --- | --- | --- |
|
|
115
|
-
| 139 | MMC3-specific `irq_interrupted` in ROM | Optional architecture cleanup; keep if you plan to move IRQ handling into mapper layer. |
|
|
116
|
-
| 145 | Cache RomHeader fields | Optional optimization; not required. |
|