Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
PPU::Screen::Screen(PPU& self) : self(self) {
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::scanline() -> void {
|
Update to v096r07 release.
byuu says:
Changelog:
- configuration files are now stored in localpath() instead of configpath()
- Video gamma/saturation/luminance sliders are gone now, sorry
- added Video Filter->Blur Emulation [1]
- added Video Filter->Scanline Emulation [2]
- improvements to GBA audio emulation (fixes Minish Cap) [Jonas Quinn]
[1] For the Famicom, this does nothing. For the Super Famicom, this
performs horizontal blending for proper pseudo-hires translucency. For
the Game Boy, Game Boy Color, and Game Boy Advance, this performs
interframe blending (each frame is the average of the current and
previous frame), which is important for things like the GBVideoPlayer.
[2] Right now, this only applies to the Super Famicom, but it'll come to
the Famicom in the future. For the Super Famicom, this option doesn't
just add scanlines, it simulates the phosphor decay that's visible in
interlace mode. If you observe an interlaced game like RPM Racing on
a real SNES, you'll notice that even on perfectly still screens, the
image appears to shake. This option emulates that effect.
Note 1: the buffering right now is a little sub-optimal, so there will
be a slight speed hit with this new support. Since the core is now
generating native ARGB8888 colors, it might as well call out to the
interface to lock/unlock/refresh the video, that way it can render
directly to the screen. Although ... that might not be such a hot idea,
since the GBx interframe blending reads from the target buffer, and that
tends to be a catastrophic option for performance.
Note 2: the balanced and performance profiles for the SNES are
completely busted again. This WIP took 6 1/2 hours, and I'm exhausted.
Very much not looking forward to working on those, since those two have
all kinds of fucked up speedup tricks for non-interlaced and/or
non-hires video modes.
Note 3: if you're on Windows and you saved your system folders somewhere
else, now'd be a good time to move them to %localappdata%/higan
2016-01-15 10:06:51 +00:00
|
|
|
line = self.output + self.vcounter() * 1024;
|
|
|
|
if(self.display.interlace && self.field()) line += 512;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
//the first hires pixel of each scanline is transparent
|
|
|
|
//note: exact value initializations are not confirmed on hardware
|
|
|
|
math.main.color = get_color(0);
|
|
|
|
math.sub.color = math.main.color;
|
2011-04-27 08:57:31 +00:00
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
math.main.color_enable = !(self.window.regs.col_main_mask & 1);
|
|
|
|
math.sub.color_enable = !(self.window.regs.col_sub_mask & 1) && regs.back_color_enable;
|
|
|
|
|
|
|
|
math.transparent = true;
|
|
|
|
math.addsub_mode = false;
|
|
|
|
math.color_halve = regs.color_halve && !regs.addsub_mode && math.main.color_enable;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::run() -> void {
|
Update to v096r07 release.
byuu says:
Changelog:
- configuration files are now stored in localpath() instead of configpath()
- Video gamma/saturation/luminance sliders are gone now, sorry
- added Video Filter->Blur Emulation [1]
- added Video Filter->Scanline Emulation [2]
- improvements to GBA audio emulation (fixes Minish Cap) [Jonas Quinn]
[1] For the Famicom, this does nothing. For the Super Famicom, this
performs horizontal blending for proper pseudo-hires translucency. For
the Game Boy, Game Boy Color, and Game Boy Advance, this performs
interframe blending (each frame is the average of the current and
previous frame), which is important for things like the GBVideoPlayer.
[2] Right now, this only applies to the Super Famicom, but it'll come to
the Famicom in the future. For the Super Famicom, this option doesn't
just add scanlines, it simulates the phosphor decay that's visible in
interlace mode. If you observe an interlaced game like RPM Racing on
a real SNES, you'll notice that even on perfectly still screens, the
image appears to shake. This option emulates that effect.
Note 1: the buffering right now is a little sub-optimal, so there will
be a slight speed hit with this new support. Since the core is now
generating native ARGB8888 colors, it might as well call out to the
interface to lock/unlock/refresh the video, that way it can render
directly to the screen. Although ... that might not be such a hot idea,
since the GBx interframe blending reads from the target buffer, and that
tends to be a catastrophic option for performance.
Note 2: the balanced and performance profiles for the SNES are
completely busted again. This WIP took 6 1/2 hours, and I'm exhausted.
Very much not looking forward to working on those, since those two have
all kinds of fucked up speedup tricks for non-interlaced and/or
non-hires video modes.
Note 3: if you're on Windows and you saved your system folders somewhere
else, now'd be a good time to move them to %localappdata%/higan
2016-01-15 10:06:51 +00:00
|
|
|
if(self.vcounter() == 0) return;
|
2011-04-30 13:12:15 +00:00
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
bool hires = self.regs.pseudo_hires || self.regs.bgmode == 5 || self.regs.bgmode == 6;
|
|
|
|
auto sscolor = get_pixel_sub(hires);
|
|
|
|
auto mscolor = get_pixel_main();
|
2010-08-09 13:28:56 +00:00
|
|
|
|
Update to v096r07 release.
byuu says:
Changelog:
- configuration files are now stored in localpath() instead of configpath()
- Video gamma/saturation/luminance sliders are gone now, sorry
- added Video Filter->Blur Emulation [1]
- added Video Filter->Scanline Emulation [2]
- improvements to GBA audio emulation (fixes Minish Cap) [Jonas Quinn]
[1] For the Famicom, this does nothing. For the Super Famicom, this
performs horizontal blending for proper pseudo-hires translucency. For
the Game Boy, Game Boy Color, and Game Boy Advance, this performs
interframe blending (each frame is the average of the current and
previous frame), which is important for things like the GBVideoPlayer.
[2] Right now, this only applies to the Super Famicom, but it'll come to
the Famicom in the future. For the Super Famicom, this option doesn't
just add scanlines, it simulates the phosphor decay that's visible in
interlace mode. If you observe an interlaced game like RPM Racing on
a real SNES, you'll notice that even on perfectly still screens, the
image appears to shake. This option emulates that effect.
Note 1: the buffering right now is a little sub-optimal, so there will
be a slight speed hit with this new support. Since the core is now
generating native ARGB8888 colors, it might as well call out to the
interface to lock/unlock/refresh the video, that way it can render
directly to the screen. Although ... that might not be such a hot idea,
since the GBx interframe blending reads from the target buffer, and that
tends to be a catastrophic option for performance.
Note 2: the balanced and performance profiles for the SNES are
completely busted again. This WIP took 6 1/2 hours, and I'm exhausted.
Very much not looking forward to working on those, since those two have
all kinds of fucked up speedup tricks for non-interlaced and/or
non-hires video modes.
Note 3: if you're on Windows and you saved your system folders somewhere
else, now'd be a good time to move them to %localappdata%/higan
2016-01-15 10:06:51 +00:00
|
|
|
*line++ = (self.regs.display_brightness << 15) | (hires ? sscolor : mscolor);
|
|
|
|
*line++ = (self.regs.display_brightness << 15) | (mscolor);
|
2013-01-23 08:28:35 +00:00
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::get_pixel_sub(bool hires) -> uint16 {
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.regs.display_disable || (!self.regs.overscan && self.vcounter() >= 225)) return 0;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
uint priority = 0;
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg1.output.sub.priority) {
|
|
|
|
priority = self.bg1.output.sub.priority;
|
2010-08-09 13:28:56 +00:00
|
|
|
if(regs.direct_color && (self.regs.bgmode == 3 || self.regs.bgmode == 4 || self.regs.bgmode == 7)) {
|
2013-01-23 08:28:35 +00:00
|
|
|
math.sub.color = get_direct_color(self.bg1.output.sub.palette, self.bg1.output.sub.tile);
|
2010-08-09 13:28:56 +00:00
|
|
|
} else {
|
2013-01-23 08:28:35 +00:00
|
|
|
math.sub.color = get_color(self.bg1.output.sub.palette);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg2.output.sub.priority > priority) {
|
|
|
|
priority = self.bg2.output.sub.priority;
|
|
|
|
math.sub.color = get_color(self.bg2.output.sub.palette);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg3.output.sub.priority > priority) {
|
|
|
|
priority = self.bg3.output.sub.priority;
|
|
|
|
math.sub.color = get_color(self.bg3.output.sub.palette);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg4.output.sub.priority > priority) {
|
|
|
|
priority = self.bg4.output.sub.priority;
|
|
|
|
math.sub.color = get_color(self.bg4.output.sub.palette);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.sprite.output.sub.priority > priority) {
|
|
|
|
priority = self.sprite.output.sub.priority;
|
|
|
|
math.sub.color = get_color(self.sprite.output.sub.palette);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(math.transparent = (priority == 0)) math.sub.color = get_color(0);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
if(!hires) return 0;
|
2016-02-16 09:27:55 +00:00
|
|
|
if(!math.sub.color_enable) return math.main.color_enable ? math.sub.color : (uint16)0;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
return addsub(
|
2016-02-16 09:27:55 +00:00
|
|
|
math.main.color_enable ? math.sub.color : (uint16)0,
|
2013-01-23 08:28:35 +00:00
|
|
|
math.addsub_mode ? math.main.color : fixed_color()
|
|
|
|
);
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::get_pixel_main() -> uint16 {
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.regs.display_disable || (!self.regs.overscan && self.vcounter() >= 225)) return 0;
|
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
uint priority = 0;
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg1.output.main.priority) {
|
|
|
|
priority = self.bg1.output.main.priority;
|
2010-08-09 13:28:56 +00:00
|
|
|
if(regs.direct_color && (self.regs.bgmode == 3 || self.regs.bgmode == 4 || self.regs.bgmode == 7)) {
|
2013-01-23 08:28:35 +00:00
|
|
|
math.main.color = get_direct_color(self.bg1.output.main.palette, self.bg1.output.main.tile);
|
2010-08-09 13:28:56 +00:00
|
|
|
} else {
|
2013-01-23 08:28:35 +00:00
|
|
|
math.main.color = get_color(self.bg1.output.main.palette);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
math.sub.color_enable = regs.bg1_color_enable;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg2.output.main.priority > priority) {
|
|
|
|
priority = self.bg2.output.main.priority;
|
|
|
|
math.main.color = get_color(self.bg2.output.main.palette);
|
|
|
|
math.sub.color_enable = regs.bg2_color_enable;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg3.output.main.priority > priority) {
|
|
|
|
priority = self.bg3.output.main.priority;
|
|
|
|
math.main.color = get_color(self.bg3.output.main.palette);
|
|
|
|
math.sub.color_enable = regs.bg3_color_enable;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.bg4.output.main.priority > priority) {
|
|
|
|
priority = self.bg4.output.main.priority;
|
|
|
|
math.main.color = get_color(self.bg4.output.main.palette);
|
|
|
|
math.sub.color_enable = regs.bg4_color_enable;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(self.sprite.output.main.priority > priority) {
|
|
|
|
priority = self.sprite.output.main.priority;
|
|
|
|
math.main.color = get_color(self.sprite.output.main.palette);
|
|
|
|
math.sub.color_enable = regs.oam_color_enable && self.sprite.output.main.palette >= 192;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-01-23 08:28:35 +00:00
|
|
|
if(priority == 0) {
|
|
|
|
math.main.color = get_color(0);
|
|
|
|
math.sub.color_enable = regs.back_color_enable;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
if(!self.window.output.sub.color_enable) math.sub.color_enable = false;
|
|
|
|
math.main.color_enable = self.window.output.main.color_enable;
|
2016-02-16 09:27:55 +00:00
|
|
|
if(!math.sub.color_enable) return math.main.color_enable ? math.main.color : (uint16)0;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
if(regs.addsub_mode && math.transparent) {
|
|
|
|
math.addsub_mode = false;
|
|
|
|
math.color_halve = false;
|
2010-08-09 13:28:56 +00:00
|
|
|
} else {
|
2013-01-23 08:28:35 +00:00
|
|
|
math.addsub_mode = regs.addsub_mode;
|
|
|
|
math.color_halve = regs.color_halve && math.main.color_enable;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2013-01-23 08:28:35 +00:00
|
|
|
return addsub(
|
2016-02-16 09:27:55 +00:00
|
|
|
math.main.color_enable ? math.main.color : (uint16)0,
|
2013-01-23 08:28:35 +00:00
|
|
|
math.addsub_mode ? math.sub.color : fixed_color()
|
|
|
|
);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::addsub(uint x, uint y) -> uint16 {
|
2010-08-09 13:28:56 +00:00
|
|
|
if(!regs.color_mode) {
|
2013-01-23 08:28:35 +00:00
|
|
|
if(!math.color_halve) {
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
uint sum = x + y;
|
|
|
|
uint carry = (sum - ((x ^ y) & 0x0421)) & 0x8420;
|
2010-08-09 13:28:56 +00:00
|
|
|
return (sum - carry) | (carry - (carry >> 5));
|
|
|
|
} else {
|
|
|
|
return (x + y - ((x ^ y) & 0x0421)) >> 1;
|
|
|
|
}
|
|
|
|
} else {
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
uint diff = x - y + 0x8420;
|
|
|
|
uint borrow = (diff - ((x ^ y) & 0x8420)) & 0x8420;
|
2013-01-23 08:28:35 +00:00
|
|
|
if(!math.color_halve) {
|
2010-08-09 13:28:56 +00:00
|
|
|
return (diff - borrow) & (borrow - (borrow >> 5));
|
|
|
|
} else {
|
|
|
|
return (((diff - borrow) & (borrow - (borrow >> 5))) & 0x7bde) >> 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::get_color(uint palette) -> uint16 {
|
2010-08-09 13:28:56 +00:00
|
|
|
palette <<= 1;
|
2010-09-24 13:15:21 +00:00
|
|
|
self.regs.cgram_iaddr = palette;
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
return ppu.cgram[palette + 0] + (ppu.cgram[palette + 1] << 8);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::get_direct_color(uint palette, uint tile) -> uint16 {
|
2010-08-09 13:28:56 +00:00
|
|
|
//palette = -------- BBGGGRRR
|
|
|
|
//tile = ---bgr-- --------
|
|
|
|
//output = 0BBb00GG Gg0RRRr0
|
|
|
|
return ((palette << 7) & 0x6000) + ((tile >> 0) & 0x1000)
|
|
|
|
+ ((palette << 4) & 0x0380) + ((tile >> 5) & 0x0040)
|
|
|
|
+ ((palette << 2) & 0x001c) + ((tile >> 9) & 0x0002);
|
|
|
|
}
|
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::fixed_color() const -> uint16 {
|
2013-01-23 08:28:35 +00:00
|
|
|
return (regs.color_b << 10) | (regs.color_g << 5) | (regs.color_r << 0);
|
|
|
|
}
|
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto PPU::Screen::reset() -> void {
|
2011-04-27 08:57:31 +00:00
|
|
|
regs.addsub_mode = random(false);
|
|
|
|
regs.direct_color = random(false);
|
|
|
|
regs.color_mode = random(false);
|
|
|
|
regs.color_halve = random(false);
|
|
|
|
regs.bg1_color_enable = random(false);
|
|
|
|
regs.bg2_color_enable = random(false);
|
|
|
|
regs.bg3_color_enable = random(false);
|
|
|
|
regs.bg4_color_enable = random(false);
|
|
|
|
regs.oam_color_enable = random(false);
|
|
|
|
regs.back_color_enable = random(false);
|
|
|
|
regs.color_r = random(0);
|
|
|
|
regs.color_g = random(0);
|
|
|
|
regs.color_b = random(0);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|