Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukexor committed Sep 9, 2019
2 parents 76d75c4 + eb32fa3 commit 82fc557
Show file tree
Hide file tree
Showing 10 changed files with 490 additions and 118 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ ARGS:
| --------------------- | ----------- | ---------------- |
| A | Z | A |
| B | X | B |
| A (Turbo) | A | X/Left Trigger |
| B (Turbo) | S | Y/Right Trigger |
| A (Turbo) | A | X |
| B (Turbo) | S | Y |
| Start | Enter | Start |
| Select | Right Shift | Select |
| Up, Down, Left, Right | Arrow Keys | Left Stick/D-Pad |
Expand All @@ -104,13 +104,13 @@ There are also some emulator actions:
| Action | Keyboard | Controller |
| --------------------- | ---------------- | ------------------ |
| Open/Run ROM | Ctrl-O | |
| Pause / Open Menu | Escape | Left Stick Button |
| Pause / Open Menu | Escape | Right Stick Button |
| Quit | Ctrl-Q | |
| Reset | Ctrl-R | |
| Power Cycle | Ctrl-P | |
| Increase Speed 25% | Ctrl-= | |
| Decrease Speed 25% | Ctrl-- | |
| Toggle Fast-Forward | Space | Right Stick Button |
| Increase Speed 25% | Ctrl-= | Right Trigger |
| Decrease Speed 25% | Ctrl-- | Left Trigger |
| Toggle Fast-Forward | Space | |
| Set State Slot | Ctrl-(1-4) | |
| Save State | Ctrl-S | Left Shoulder |
| Load State | Ctrl-L | Right Shoulder |
Expand Down Expand Up @@ -181,7 +181,7 @@ The following is a checklist of features and their progress:
- [x] TxROM/MMC3 (Mapper 4)
- [ ] ExROM/MMC5 (Mapper 5)
- [x] AxROM (Mapper 7)
- [ ] PxROM/MMC2 (Mapper 9)
- [x] PxROM/MMC2 (Mapper 9)
- [x] User Interface (UI)
- [x] SDL2
- [ ] WebAssembly
Expand Down
2 changes: 1 addition & 1 deletion src/console/apu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ impl DMC {
let cpu: &mut Cpu = unsafe { &mut *self.cpu }; // TODO ugly work-around to access CPU
self.sample_buffer = cpu.read(self.addr);
self.sample_buffer_empty = false;
self.addr = (self.addr + 1) | 0x8000;
self.addr = self.addr.wrapping_add(1) | 0x8000;
self.length -= 1;

if self.length == 0 {
Expand Down
10 changes: 5 additions & 5 deletions src/console/ppu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct Ppu {
pub nmi_delay_enabled: bool, // Fixes some games by delaying nmi
pub nmi_pending: bool, // Whether the CPU should trigger an NMI next cycle
pub vram: Vram, // $2007 PPUDATA
regs: PpuRegs, // Registers
pub regs: PpuRegs, // Registers
oamdata: Oam, // $2004 OAMDATA read/write - Object Attribute Memory for Sprites
frame: Frame, // Frame data keeps track of data and shift registers between frames
}
Expand Down Expand Up @@ -903,8 +903,8 @@ impl Savable for Palette {
pub struct PpuRegs {
open_bus: u8, // This open bus gets set during any write to PPU registers
open_bus_updated: Instant, // Last updated value used to emualte open_bus decay
ctrl: PpuCtrl, // $2000 PPUCTRL write-only
mask: PpuMask, // $2001 PPUMASK write-only
pub ctrl: PpuCtrl, // $2000 PPUCTRL write-only
pub mask: PpuMask, // $2001 PPUMASK write-only
status: PpuStatus, // $2002 PPUSTATUS read-only
oamaddr: u8, // $2003 OAMADDR write-only
nmi_delay: u8, // Some games need a delay after vblank before nmi is triggered
Expand Down Expand Up @@ -1462,7 +1462,7 @@ impl Savable for Sprite {
// |+-------- PPU Master/Slave: 0 = read from EXT, 1 = write to EXT
// +--------- NMI Enable: NMI at next vblank: 0 = off, 1: on
#[derive(Default, Debug)]
struct PpuCtrl(u8);
pub struct PpuCtrl(pub u8);

impl PpuCtrl {
fn write(&mut self, val: u8) {
Expand Down Expand Up @@ -1523,7 +1523,7 @@ impl Savable for PpuCtrl {
// |+-------- Emphasize green
// +--------- Emphasize blue
#[derive(Default, Debug)]
struct PpuMask(u8);
pub struct PpuMask(pub u8);

impl PpuMask {
fn write(&mut self, val: u8) {
Expand Down
9 changes: 6 additions & 3 deletions src/mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ use std::io::{Read, Write};
use std::path::Path;
use std::rc::Rc;

use axrom::Axrom;
use axrom::Axrom; // Mapper 7
use cnrom::Cnrom; // Mapper 3
// use exrom::Exrom;
// use exrom::Exrom; // Mapper 5
use nrom::Nrom; // Mapper 0
use pxrom::Pxrom; // Mapper 9
use sxrom::Sxrom; // Mapper 1
use txrom::Txrom; // Mapper 4
use uxrom::Uxrom; // Mapper 2 // Mapper 5 // Mapper 7
use uxrom::Uxrom; // Mapper 2

pub mod axrom;
pub mod cnrom;
// pub mod exrom;
pub mod nrom;
pub mod pxrom;
pub mod sxrom;
pub mod txrom;
pub mod uxrom;
Expand Down Expand Up @@ -63,6 +65,7 @@ pub fn load_rom<P: AsRef<Path>>(rom: P) -> Result<MapperRef> {
4 => Ok(Txrom::load(cart)),
// 5 => Ok(Exrom::load(cart)),
7 => Ok(Axrom::load(cart)),
9 => Ok(Pxrom::load(cart)),
_ => Err(format_err!(
"unsupported mapper number: {}",
cart.header.mapper_num
Expand Down
Loading

0 comments on commit 82fc557

Please sign in to comment.