//BIG TODO: This will probably need to be /totally/ overhauled
//in order for ROMS with different mappers to work; so for now
//we are just going to hardcode mapper 000
BIG TODO: This will probably need to be /totally/ overhauled
in order for ROMS with different mappers to work; so for now
we are just going to hardcode mapper 000
BIG TODO : This will probably need to be / totally / overhauled in order for ROMS with different mappers to work ; so for now we are just going to hardcode mapper 000
pub fn write_mem(&mut self, addr: usize, val: u8) {
        match addr {
            0x0000...0x1FFF => {
                self.internal_ram[addr % 0x0800] = val;
            }
            0x2000...0x3FFF => {
                //TODO: write to ppu registers
                //println!("Unimplemented Write to PPU registers!");
                self.ppu().write_ppu((addr - 0x2000) % 8, val);
            }
            0x4000...0x4017 => {
                //TODO: write to apu and i/o registers
                println!("Unimplemented Write to I/O registers!");
            }
            0x4018...0x401F => {
                //do we need this?
            }
            0x4020...0x5FFF => {
            }
            0x6000...0x7FFF => {
                self.cart.write_ram(addr - 0x6000, val)
            }
            0x8000...0xFFFF => {
                println!("tried to write to cart rom!");
            }
            _ => {
                println!("shouldn't get here, as the above code is exhaustive");
            }
        };
    }
pub fn write_mem ( & mut self , addr : usize , val : u8 ) { match addr { 0x0000 ... 0x1FFF => { self . internal_ram [ addr % 0x0800 ] = val ; } 0x2000 ... 0x3FFF => { //TODO: write to ppu registers //println!("Unimplemented Write to PPU registers!"); self . ppu ( ) . write_ppu ( ( addr - 0x2000 ) % 8 , val ) ; } 0x4000 ... 0x4017 => { //TODO: write to apu and i/o registers println ! ( " " ) ; } 0x4018 ... 0x401F => { //do we need this? } 0x4020 ... 0x5FFF => { } 0x6000 ... 0x7FFF => { self . cart . write_ram ( addr - 0x6000 , val ) } 0x8000 ... 0xFFFF => { println ! ( " " ) ; } _ => { println ! ( " " ) ; } } ; }
BIG TODO: This will probably need to be /totally/ overhauled
in order for ROMS with different mappers to work; so for now
we are just going to hardcode mapper 000
BIG TODO : This will probably need to be / totally / overhauled in order for ROMS with different mappers to work ; so for now we are just going to hardcode mapper 000
&mut self
addr
usize
val
u8