2018-07-25 12:24:03 +00:00
|
|
|
auto MasterSystemInterface::information() -> Information {
|
|
|
|
Information information;
|
2017-01-13 01:15:45 +00:00
|
|
|
information.manufacturer = "Sega";
|
|
|
|
information.name = "Master System";
|
2018-07-25 12:24:03 +00:00
|
|
|
information.extension = "ms";
|
|
|
|
return information;
|
2017-01-13 01:15:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 12:24:03 +00:00
|
|
|
auto MasterSystemInterface::displays() -> vector<Display> {
|
|
|
|
Display display;
|
|
|
|
display.type = Display::Type::CRT;
|
|
|
|
display.colors = 1 << 6;
|
|
|
|
display.width = 256;
|
|
|
|
display.height = 240;
|
|
|
|
display.internalWidth = 256;
|
|
|
|
display.internalHeight = 240;
|
|
|
|
display.aspectCorrection = 8.0 / 7.0;
|
|
|
|
if(Region::NTSC()) display.refreshRate = (system.colorburst() * 15.0 / 5.0) / (262.0 * 684.0);
|
|
|
|
if(Region::PAL()) display.refreshRate = (system.colorburst() * 15.0 / 5.0) / (312.0 * 684.0);
|
|
|
|
return {display};
|
2017-01-13 01:15:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 12:24:03 +00:00
|
|
|
auto MasterSystemInterface::color(uint32 color) -> uint64 {
|
2017-01-13 01:15:45 +00:00
|
|
|
uint2 B = color >> 4;
|
|
|
|
uint2 G = color >> 2;
|
|
|
|
uint2 R = color >> 0;
|
|
|
|
|
|
|
|
uint64 r = image::normalize(R, 2, 16);
|
|
|
|
uint64 g = image::normalize(G, 2, 16);
|
|
|
|
uint64 b = image::normalize(B, 2, 16);
|
|
|
|
|
|
|
|
return r << 32 | g << 16 | b << 0;
|
|
|
|
}
|
|
|
|
|
2018-07-25 12:24:03 +00:00
|
|
|
auto MasterSystemInterface::ports() -> vector<Port> { return {
|
|
|
|
{ID::Port::Controller1, "Controller Port 1"},
|
|
|
|
{ID::Port::Controller2, "Controller Port 2"},
|
|
|
|
{ID::Port::Hardware, "Hardware" }};
|
|
|
|
}
|
|
|
|
|
|
|
|
auto MasterSystemInterface::devices(uint port) -> vector<Device> {
|
|
|
|
if(port == ID::Port::Controller1) return {
|
|
|
|
{ID::Device::None, "None" },
|
|
|
|
{ID::Device::Gamepad, "Gamepad"}
|
|
|
|
};
|
|
|
|
|
|
|
|
if(port == ID::Port::Controller2) return {
|
|
|
|
{ID::Device::None, "None" },
|
|
|
|
{ID::Device::Gamepad, "Gamepad"}
|
|
|
|
};
|
|
|
|
|
|
|
|
if(port == ID::Port::Hardware) return {
|
|
|
|
{ID::Device::MasterSystemControls, "Controls"}
|
|
|
|
};
|
|
|
|
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
auto MasterSystemInterface::inputs(uint device) -> vector<Input> {
|
|
|
|
using Type = Input::Type;
|
|
|
|
|
|
|
|
if(device == ID::Device::None) return {
|
|
|
|
};
|
|
|
|
|
|
|
|
if(device == ID::Device::Gamepad) return {
|
|
|
|
{Type::Hat, "Up" },
|
|
|
|
{Type::Hat, "Down" },
|
|
|
|
{Type::Hat, "Left" },
|
|
|
|
{Type::Hat, "Right"},
|
|
|
|
{Type::Button, "1" },
|
|
|
|
{Type::Button, "2" }
|
|
|
|
};
|
|
|
|
|
|
|
|
if(device == ID::Device::MasterSystemControls) return {
|
|
|
|
{Type::Control, "Reset"},
|
|
|
|
{Type::Control, "Power"}
|
|
|
|
};
|
|
|
|
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
auto MasterSystemInterface::load() -> bool {
|
|
|
|
return system.load(this, System::Model::MasterSystem);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto MasterSystemInterface::connected(uint port) -> uint {
|
|
|
|
if(port == ID::Port::Controller1) return settings.controllerPort1;
|
|
|
|
if(port == ID::Port::Controller2) return settings.controllerPort2;
|
|
|
|
if(port == ID::Port::Hardware) return ID::Device::MasterSystemControls;
|
|
|
|
return 0;
|
2017-01-13 01:15:45 +00:00
|
|
|
}
|
Update to v103r05 release.
byuu says:
Changelog:
- fc/controller: added ControllerPort class; removed Peripherals class
- md/controller/gamepad: removed X,Y,Z buttons since this isn't a
6-button controller
- ms/controller: added ControllerPort class (not used in Game Gear
mode); removed Peripherals class
- pce/controller: added ControllerPort class; removed Peripherals
class
- processor/spc700: idle(address) is part of SMP class again, contains
flag to detect mov (x)+ edge case
- sfc/controller/super-scope,justifier: use CPU frequency instead of
hard-coding NTSC frequency
- sfc/cpu: move 4x8-bit SMP ports to SMP class
- sfc/smp: move APU RAM to DSP class
- sfc/smp: improved emulation of TEST registers bits 4-7 [information
from nocash]
- d4,d5 is RAM wait states (1,2,5,10)
- d6,d7 is ROM/IO wait states (1,2,5,10)
- sfc/smp: code cleanup to new style (order from lowest to highest
bits; use .bit(s) functions)
- sfc/smp: $00f8,$00f9 are P4/P5 auxiliary ports; named the registers
better
2017-07-01 06:15:27 +00:00
|
|
|
|
|
|
|
auto MasterSystemInterface::connect(uint port, uint device) -> void {
|
|
|
|
if(port == ID::Port::Controller1) controllerPort1.connect(settings.controllerPort1 = device);
|
|
|
|
if(port == ID::Port::Controller2) controllerPort2.connect(settings.controllerPort2 = device);
|
|
|
|
}
|