Hello,
I have finished a cycle-accurate implementation of the 6502 CPU and tested it with the `nestest.nes` ROM.
I am trying to implement the PPU now. I have loaded and displayed the pattern memory and print it out and checked it is ok. I have displayed the nametables and also verified they are correctly displayed.
However, they certainly are not correctly filled with the `nestest.nes` ROM (and all the other ROMs). Currently, I am not using the color palettes and instead, I use shades of blue, but I have this:
[img][https://drive.google.com/file/d/1OlIDpe ... sp=sharing]
Notice that the line rendered "SELECT: Invalid ops" is the last line of the nestest ROM screen.
So I went on about seeing if the fine_y and coarse_y were incremented. Turns out they were, but after the screen was all already rendered.
By "already rendered" I mean that I can see, byte by byte, the lines being writen onto the nametable, but the following line overwrites the first because coarse_y and fine_y still did not increment. It is only after the last line (the SELECT line) is written, that the coarse and fine ys start incrementing.
I have no clue whatsoever, I leave here my relevant PPU code:
https://gist.github.com/joao-conde/60f6 ... 37b3e49cd2
Any help or debug suggestions appreciated, thanks!
PPU Emulation - nestest ROM
Moderator: Moderators
Re: PPU Emulation - nestest ROM
I'm not particularly familiar with Rust, but this code doesn't look right:
Based on the code below it, it seems like it ought to be more like this:
Of course, I'm not sure if that's the only problem, but it certainly seems to be one of them.
Code: Select all
impl From<u16> for VRAMAddress {
fn from(word: u16) -> VRAMAddress {
VRAMAddress {
coarse_x: (word & 0x001F) as u8,
coarse_y: (word & 0x03E0) as u8,
nametable_x: (word & 0x0400) as u8,
nametable_y: (word & 0x0800) as u8,
fine_y: (word & 0x7000) as u8,
}
}
}
Code: Select all
impl From<u16> for VRAMAddress {
fn from(word: u16) -> VRAMAddress {
VRAMAddress {
coarse_x: (word & 0x001F) as u8,
coarse_y: ((word & 0x03E0) >> 5) as u8,
nametable_x: ((word & 0x0400) >> 10) as u8,
nametable_y: ((word & 0x0800) >> 11) as u8,
fine_y: ((word & 0x7000) >> 12) as u8,
}
}
}
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
Re: PPU Emulation - nestest ROM
You are absolutely right @Quietust ! Thanks