Skip to content

Commit

Permalink
Update to ares v111r02 release.
Browse files Browse the repository at this point in the history
  - all: Makefile improvements (obj and out paths are no longer hard-
    coded)
  - all: renamed Screen::Region<String> to Screen::Overscan<Boolean>
  - lucia: implemented bsnes' multiple-mappings per input system
  - lucia: implemented memory editor and export tool
  - Super Famicom: added memory editing support
  - PC Engine: added overscan setting to the dot-based renderer (256 ->
    272 width)
  • Loading branch information
byuu committed Mar 27, 2020
1 parent ea6c7e4 commit 2eb629a
Show file tree
Hide file tree
Showing 82 changed files with 851 additions and 524 deletions.
2 changes: 1 addition & 1 deletion ares/ares/information.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ares {
static const string Name = "ares";
static const string Version = "111.1";
static const string Version = "111.2";
static const string License = "GPLv3+";
static const string Website = "https://ares.dev";

Expand Down
27 changes: 27 additions & 0 deletions ares/ares/node/memory.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
struct Memory : Object {
DeclareClass(Memory, "Memory")

Memory(string name = {}) : Object(name) {
}

inline auto size() const -> uint { return _size; }
inline auto read(uint32 address) const -> uint8 { if(_read) return _read(address); return 0; }
inline auto write(uint32 address, uint8 data) const -> void { if(_write) return _write(address, data); }

auto setSize(uint size) -> void { _size = size; }
auto setRead(function<uint8 (uint32)> read) -> void { _read = read; }
auto setWrite(function<void (uint32, uint8)> write) -> void { _write = write; }

auto serialize(string& output, string depth) -> void override {
Object::serialize(output, depth);
}

auto unserialize(Markup::Node node) -> void override {
Object::unserialize(node);
}

protected:
uint _size = 0;
function<uint8 (uint32)> _read;
function<void (uint32, uint8)> _write;
};
3 changes: 3 additions & 0 deletions ares/ares/node/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace ares::Core {
struct RealTimeClock;
struct Peripheral;
struct Port;
struct Memory;
struct Input;
struct Button;
struct Axis;
Expand Down Expand Up @@ -34,6 +35,7 @@ namespace ares::Node {
using RealTimeClock = shared_pointer<Core::RealTimeClock>;
using Peripheral = shared_pointer<Core::Peripheral>;
using Port = shared_pointer<Core::Port>;
using Memory = shared_pointer<Core::Memory>;
using Input = shared_pointer<Core::Input>;
using Button = shared_pointer<Core::Button>;
using Axis = shared_pointer<Core::Axis>;
Expand Down Expand Up @@ -70,6 +72,7 @@ namespace ares::Core {
#include <ares/node/real-time-clock.hpp>
#include <ares/node/peripheral.hpp>
#include <ares/node/port.hpp>
#include <ares/node/memory.hpp>
#include <ares/node/input.hpp>
#include <ares/node/setting.hpp>
#include <ares/node/event/event.hpp>
Expand Down
18 changes: 9 additions & 9 deletions ares/cv/cpu/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ auto CPU::load(Node::Object parent, Node::Object from) -> void {
node = Node::append<Node::Component>(parent, from, "CPU");
from = Node::scan(parent = node, from);

eventInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "CPU");
eventInstruction->setAddressBits(16);
debugInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "CPU");
debugInstruction->setAddressBits(16);

eventInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", "CPU");
debugInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", "CPU");
}

auto CPU::unload() -> void {
eventInstruction = {};
eventInterrupt = {};
debugInstruction = {};
debugInterrupt = {};
node = {};
}

auto CPU::main() -> void {
if(state.nmiLine) {
state.nmiLine = 0; //edge-sensitive
if(eventInterrupt->enabled()) eventInterrupt->notify("NMI");
if(debugInterrupt->enabled()) debugInterrupt->notify("NMI");
irq(0, 0x0066, 0xff);
}

if(state.irqLine) {
//level-sensitive
if(eventInterrupt->enabled()) eventInterrupt->notify("IRQ");
if(debugInterrupt->enabled()) debugInterrupt->notify("IRQ");
irq(1, 0x0038, 0xff);
}

if(eventInstruction->enabled() && eventInstruction->address(r.pc)) {
eventInstruction->notify(disassembleInstruction(), disassembleContext());
if(debugInstruction->enabled() && debugInstruction->address(r.pc)) {
debugInstruction->notify(disassembleInstruction(), disassembleContext());
}
instruction();
}
Expand Down
4 changes: 2 additions & 2 deletions ares/cv/cpu/cpu.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
struct CPU : Z80, Z80::Bus, Thread {
Node::Component node;
Node::Instruction eventInstruction;
Node::Notification eventInterrupt;
Node::Instruction debugInstruction;
Node::Notification debugInterrupt;

inline auto synchronizing() const -> bool override { return scheduler.synchronizing(); }

Expand Down
18 changes: 8 additions & 10 deletions ares/fc/cpu/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@ auto CPU::load(Node::Object parent, Node::Object from) -> void {
node = Node::append<Node::Component>(parent, from, "CPU");
from = Node::scan(parent = node, from);

eventInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "CPU");
eventInstruction->setAddressBits(16);
//eventInstruction->setEnabled(true);
debugInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "CPU");
debugInstruction->setAddressBits(16);

eventInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", "CPU");
//eventInterrupt->setEnabled(true);
debugInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", "CPU");
}

auto CPU::unload() -> void {
eventInstruction = {};
eventInterrupt = {};
debugInstruction = {};
debugInterrupt = {};
node = {};
}

auto CPU::main() -> void {
if(io.interruptPending) {
if(eventInterrupt->enabled()) eventInterrupt->notify("IRQ");
if(debugInterrupt->enabled()) debugInterrupt->notify("IRQ");
return interrupt();
}

if(eventInstruction->enabled() && eventInstruction->address(r.pc)) {
eventInstruction->notify(disassembleInstruction(), disassembleContext());
if(debugInstruction->enabled() && debugInstruction->address(r.pc)) {
debugInstruction->notify(disassembleInstruction(), disassembleContext());
}
instruction();
}
Expand Down
4 changes: 2 additions & 2 deletions ares/fc/cpu/cpu.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
struct CPU : MOS6502, Thread {
Node::Component node;
Node::Instruction eventInstruction;
Node::Notification eventInterrupt;
Node::Instruction debugInstruction;
Node::Notification debugInterrupt;

inline auto rate() const -> uint { return Region::PAL() ? 16 : 12; }

Expand Down
15 changes: 7 additions & 8 deletions ares/fc/ppu/ppu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ auto PPU::load(Node::Object parent, Node::Object from) -> void {
screen->setAspect(8.0, 7.0);
from = Node::scan(parent = screen, from);

region = Node::append<Node::String>(parent, from, "Region", "PAL", [&](auto region) {
if(region == "NTSC") screen->setSize(256, 224);
if(region == "PAL" ) screen->setSize(256, 240);
overscan = Node::append<Node::Boolean>(parent, from, "Overscan", true, [&](auto value) {
if(value == 0) screen->setSize(256, 224);
if(value == 1) screen->setSize(256, 240);
});
region->setAllowedValues({"NTSC", "PAL"});
region->setDynamic(true);
overscan->setDynamic(true);

colorEmulation = Node::append<Node::Boolean>(parent, from, "Color Emulation", true, [&](auto value) {
screen->resetPalette();
Expand All @@ -35,7 +34,7 @@ auto PPU::load(Node::Object parent, Node::Object from) -> void {
auto PPU::unload() -> void {
node = {};
screen = {};
region = {};
overscan = {};
colorEmulation = {};
}

Expand Down Expand Up @@ -79,11 +78,11 @@ auto PPU::frame() -> void {
}

auto PPU::refresh() -> void {
if(region->value() == "NTSC") {
if(overscan->value() == 0) {
screen->refresh(buffer + 8 * 256, 256 * sizeof(uint32), 256, 224);
}

if(region->value() == "PAL") {
if(overscan->value() == 1) {
screen->refresh(buffer, 256 * sizeof(uint32), 256, 240);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ares/fc/ppu/ppu.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
struct PPU : Thread {
Node::Component node;
Node::Screen screen;
Node::String region;
Node::Boolean overscan;
Node::Boolean colorEmulation;

inline auto rate() const -> uint { return Region::PAL() ? 5 : 4; }
Expand Down
16 changes: 8 additions & 8 deletions ares/gb/cpu/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ auto CPU::load(Node::Object parent, Node::Object from) -> void {

string origin = Model::SuperGameBoy() ? "SGB" : "CPU";

eventInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", origin);
eventInstruction->setAddressBits(16);
debugInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", origin);
debugInstruction->setAddressBits(16);

eventInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", origin);
debugInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", origin);
}

auto CPU::unload() -> void {
node = {};
version = {};
eventInstruction = {};
eventInterrupt = {};
debugInstruction = {};
debugInterrupt = {};
}

auto CPU::main() -> void {
Expand All @@ -71,7 +71,7 @@ auto CPU::main() -> void {
if(r.ime) {
//are any interrupts pending?
if(status.interruptLatch) {
if(eventInterrupt->enabled()) eventInterrupt->notify("IRQ");
if(debugInterrupt->enabled()) debugInterrupt->notify("IRQ");

idle();
idle();
Expand All @@ -91,8 +91,8 @@ auto CPU::main() -> void {
}
}

if(eventInstruction->enabled() && eventInstruction->address(PC)) {
eventInstruction->notify(disassembleInstruction(), disassembleContext());
if(debugInstruction->enabled() && debugInstruction->address(PC)) {
debugInstruction->notify(disassembleInstruction(), disassembleContext());
}
instruction();

Expand Down
4 changes: 2 additions & 2 deletions ares/gb/cpu/cpu.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
struct CPU : SM83, Thread {
Node::Component node;
Node::String version;
Node::Instruction eventInstruction;
Node::Notification eventInterrupt;
Node::Instruction debugInstruction;
Node::Notification debugInterrupt;

struct Interrupt { enum : uint {
/* 0 */ VerticalBlank,
Expand Down
10 changes: 5 additions & 5 deletions ares/gba/cpu/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ auto CPU::load(Node::Object parent, Node::Object from) -> void {
node = Node::append<Node::Component>(parent, from, "CPU");
from = Node::scan(parent = node, from);

eventInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "CPU");
eventInstruction->setAddressBits(32);
debugInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "CPU");
debugInstruction->setAddressBits(32);
}

auto CPU::unload() -> void {
node = {};
eventInstruction = {};
debugInstruction = {};
}

auto CPU::main() -> void {
Expand All @@ -43,8 +43,8 @@ auto CPU::main() -> void {
context.halted = false;
}

if(eventInstruction->enabled() && eventInstruction->address(pipeline.execute.address)) {
eventInstruction->notify(disassembleInstruction(), disassembleContext());
if(debugInstruction->enabled() && debugInstruction->address(pipeline.execute.address)) {
debugInstruction->notify(disassembleInstruction(), disassembleContext());
}
instruction();
}
Expand Down
2 changes: 1 addition & 1 deletion ares/gba/cpu/cpu.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
struct CPU : ARM7TDMI, Thread, IO {
Node::Component node;
Node::Instruction eventInstruction;
Node::Instruction debugInstruction;

struct Interrupt { enum : uint {
VBlank = 0x0001,
Expand Down
18 changes: 9 additions & 9 deletions ares/md/apu/apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ auto APU::load(Node::Object parent, Node::Object from) -> void {
node = Node::append<Node::Component>(parent, from, "APU");
from = Node::scan(parent = node, from);

eventInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "APU");
eventInstruction->setAddressBits(16);
debugInstruction = Node::append<Node::Instruction>(parent, from, "Instruction", "APU");
debugInstruction->setAddressBits(16);

eventInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", "APU");
debugInterrupt = Node::append<Node::Notification>(parent, from, "Interrupt", "APU");
}

auto APU::unload() -> void {
eventInstruction = {};
eventInterrupt = {};
debugInstruction = {};
debugInterrupt = {};
node = {};
}

Expand All @@ -29,18 +29,18 @@ auto APU::main() -> void {

if(state.nmiLine) {
state.nmiLine = 0; //edge-sensitive
if(eventInterrupt->enabled()) eventInterrupt->notify("NMI");
if(debugInterrupt->enabled()) debugInterrupt->notify("NMI");
irq(0, 0x0066, 0xff);
}

if(state.intLine) {
//level-sensitive
if(eventInterrupt->enabled()) eventInterrupt->notify("IRQ");
if(debugInterrupt->enabled()) debugInterrupt->notify("IRQ");
irq(1, 0x0038, 0xff);
}

if(eventInstruction->enabled() && eventInstruction->address(r.pc)) {
eventInstruction->notify(disassembleInstruction(), disassembleContext());
if(debugInstruction->enabled() && debugInstruction->address(r.pc)) {
debugInstruction->notify(disassembleInstruction(), disassembleContext());
}
instruction();
}
Expand Down
4 changes: 2 additions & 2 deletions ares/md/apu/apu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

struct APU : Z80, Z80::Bus, Thread {
Node::Component node;
Node::Instruction eventInstruction;
Node::Notification eventInterrupt;
Node::Instruction debugInstruction;
Node::Notification debugInterrupt;

inline auto synchronizing() const -> bool override { return scheduler.synchronizing(); }

Expand Down
Loading

0 comments on commit 2eb629a

Please sign in to comment.