Closed Smart-SangGe closed 3 months ago
Hi! Thanks for bringing this up. You're right, &mut self
is not necessary here.
However later in the book the same mem_read
would be used to access PPU and Joypads. And depending on the address, the read can modify state of a device.
I've added a short note clarifying why &mut self
was selected here. Hope it makes sense.
https://github.com/bugzmanov/nes_ebook/blob/5e1433984362b62f7d4cec4280691c0c8833cb61/src/chapter_3_2.md?plain=1#L88
Here should use immutable reference