2010-08-09 13:28:56 +00:00
|
|
|
#include "list.cpp"
|
|
|
|
|
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::Sprite::Sprite(PPU& self) : self(self) {
|
|
|
|
}
|
|
|
|
|
|
|
|
auto PPU::Sprite::address_reset() -> void {
|
2010-09-24 13:15:21 +00:00
|
|
|
self.regs.oam_addr = self.regs.oam_baseaddr;
|
|
|
|
set_first_sprite();
|
|
|
|
}
|
|
|
|
|
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::Sprite::set_first_sprite() -> void {
|
2016-02-18 10:32:22 +00:00
|
|
|
regs.first_sprite = !self.regs.oam_priority ? 0 : self.regs.oam_addr >> 2;
|
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::Sprite::frame() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
regs.time_over = false;
|
|
|
|
regs.range_over = false;
|
|
|
|
}
|
|
|
|
|
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::Sprite::scanline() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
t.x = 0;
|
|
|
|
t.y = self.vcounter();
|
|
|
|
|
|
|
|
t.item_count = 0;
|
|
|
|
t.tile_count = 0;
|
|
|
|
|
|
|
|
t.active = !t.active;
|
|
|
|
auto oam_item = t.item[t.active];
|
|
|
|
auto oam_tile = t.tile[t.active];
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
if(t.y == (!self.regs.overscan ? 225 : 240) && !self.regs.display_disable) address_reset();
|
2010-08-09 13:28:56 +00:00
|
|
|
if(t.y >= (!self.regs.overscan ? 224 : 239)) return;
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
for(auto n : range(32)) oam_item[n].valid = false; //default to invalid
|
|
|
|
for(auto n : range(34)) oam_tile[n].valid = false; //default to invalid
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
for(auto n : range(128)) {
|
|
|
|
uint7 sprite = regs.first_sprite + n;
|
|
|
|
if(!on_scanline(list[sprite])) continue;
|
2010-08-09 13:28:56 +00:00
|
|
|
if(t.item_count++ >= 32) break;
|
2016-02-18 10:32:22 +00:00
|
|
|
oam_item[t.item_count - 1] = {true, sprite};
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
if(t.item_count > 0 && oam_item[t.item_count - 1].valid) {
|
|
|
|
ppu.regs.oam_iaddr = 0x0200 + (oam_item[t.item_count - 1].index >> 2);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
auto PPU::Sprite::on_scanline(Object& sprite) -> bool {
|
2010-08-09 13:28:56 +00:00
|
|
|
if(sprite.x > 256 && (sprite.x + sprite.width() - 1) < 512) return false;
|
2016-02-18 10:32:22 +00:00
|
|
|
int height = sprite.height() >> regs.interlace;
|
2010-08-09 13:28:56 +00:00
|
|
|
if(t.y >= sprite.y && t.y < (sprite.y + height)) return true;
|
|
|
|
if((sprite.y + height) >= 256 && t.y < ((sprite.y + height) & 255)) return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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::Sprite::run() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
output.main.priority = 0;
|
|
|
|
output.sub.priority = 0;
|
|
|
|
|
|
|
|
auto oam_tile = t.tile[!t.active];
|
2016-02-18 10:32:22 +00:00
|
|
|
uint priority_table[] = {regs.priority0, regs.priority1, regs.priority2, regs.priority3};
|
|
|
|
uint x = t.x++;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
for(auto n : range(34)) {
|
2010-08-09 13:28:56 +00:00
|
|
|
auto tile = oam_tile[n];
|
2016-02-18 10:32:22 +00:00
|
|
|
if(!tile.valid) break;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
int px = x - sclip<9>(tile.x);
|
|
|
|
if(px & ~7) continue;
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
uint mask = 0x80 >> (!tile.hflip ? px : 7 - px);
|
|
|
|
uint color;
|
2010-08-09 13:28:56 +00:00
|
|
|
color = ((bool)(tile.d0 & mask)) << 0;
|
|
|
|
color |= ((bool)(tile.d1 & mask)) << 1;
|
|
|
|
color |= ((bool)(tile.d2 & mask)) << 2;
|
|
|
|
color |= ((bool)(tile.d3 & mask)) << 3;
|
|
|
|
|
|
|
|
if(color) {
|
Update to v068r12 release.
(there was no r11 release posted to the WIP thread)
byuu says:
This took ten hours of mind boggling insanity to pull off.
It upgrades the S-PPU dot-based renderer to fetch one tile, and then
output all of its pixels before fetching again. It sounds easy enough,
but it's insanely difficult. I ended up taking one small shortcut, in
that rather than fetch at -7, I fetch at the first instance where a tile
is needed to plot to x=0. So if you have {-3 to +4 } as a tile, it
fetches at -3. That won't work so well on hardware, if two BGs fetch at
the same X offset, they won't have time.
I have had no luck staggering the reads at BG1=-7, BG3=-5, etc. While
I can shift and fetch just fine, what happens is that when a new tile is
fetched in, that gives a new palette, priority, etc; and this ends up
happening between two tiles which results in the right-most edges of the
screen ending up with the wrong colors and such.
Offset-per-tile is cheap as always. Although looking at it, I'm not sure
how BG3 could pre-fetch, especially with the way one or two OPT modes
can fetch two tiles.
There's no magic in Hoffset caching yet, so the SMW1 pixel issue is
still there.
Mode 7 got a bugfix, it was off-by-one horizontally from the mosaic
code. After re-designing the BG mosaic, I ended up needing a separate
mosaic for Mode7, and in the process I fixed that bug. The obvious
change is that the Chrono Trigger Mode7->Mode2 transition doesn't cause
the pendulum to jump anymore.
Windows were simplified just a tad. The range testing is shared for all
modes now. Ironically, it's a bit slower, but I'll take less code over
more speed for the accuracy core.
Speaking of speed, because there's so much less calculations per pixel
for BGs, performance for the entire emulator has gone up by 30% in the
accuracy core. Pretty neat overall, I can maintain 60fps in all but,
yeah you can guess can't you?
2010-09-04 03:36:03 +00:00
|
|
|
if(regs.main_enable) {
|
2010-08-09 13:28:56 +00:00
|
|
|
output.main.palette = tile.palette + color;
|
|
|
|
output.main.priority = priority_table[tile.priority];
|
|
|
|
}
|
|
|
|
|
Update to v068r12 release.
(there was no r11 release posted to the WIP thread)
byuu says:
This took ten hours of mind boggling insanity to pull off.
It upgrades the S-PPU dot-based renderer to fetch one tile, and then
output all of its pixels before fetching again. It sounds easy enough,
but it's insanely difficult. I ended up taking one small shortcut, in
that rather than fetch at -7, I fetch at the first instance where a tile
is needed to plot to x=0. So if you have {-3 to +4 } as a tile, it
fetches at -3. That won't work so well on hardware, if two BGs fetch at
the same X offset, they won't have time.
I have had no luck staggering the reads at BG1=-7, BG3=-5, etc. While
I can shift and fetch just fine, what happens is that when a new tile is
fetched in, that gives a new palette, priority, etc; and this ends up
happening between two tiles which results in the right-most edges of the
screen ending up with the wrong colors and such.
Offset-per-tile is cheap as always. Although looking at it, I'm not sure
how BG3 could pre-fetch, especially with the way one or two OPT modes
can fetch two tiles.
There's no magic in Hoffset caching yet, so the SMW1 pixel issue is
still there.
Mode 7 got a bugfix, it was off-by-one horizontally from the mosaic
code. After re-designing the BG mosaic, I ended up needing a separate
mosaic for Mode7, and in the process I fixed that bug. The obvious
change is that the Chrono Trigger Mode7->Mode2 transition doesn't cause
the pendulum to jump anymore.
Windows were simplified just a tad. The range testing is shared for all
modes now. Ironically, it's a bit slower, but I'll take less code over
more speed for the accuracy core.
Speaking of speed, because there's so much less calculations per pixel
for BGs, performance for the entire emulator has gone up by 30% in the
accuracy core. Pretty neat overall, I can maintain 60fps in all but,
yeah you can guess can't you?
2010-09-04 03:36:03 +00:00
|
|
|
if(regs.sub_enable) {
|
2010-08-09 13:28:56 +00:00
|
|
|
output.sub.palette = tile.palette + color;
|
|
|
|
output.sub.priority = priority_table[tile.priority];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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::Sprite::tilefetch() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
auto oam_item = t.item[t.active];
|
|
|
|
auto oam_tile = t.tile[t.active];
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
for(int i = 31; i >= 0; i--) {
|
|
|
|
if(!oam_item[i].valid) continue;
|
|
|
|
auto sprite = list[oam_item[i].index];
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
uint tile_width = sprite.width() >> 3;
|
|
|
|
int x = sprite.x;
|
|
|
|
int y = (t.y - sprite.y) & 0xff;
|
2010-08-09 13:28:56 +00:00
|
|
|
if(regs.interlace) y <<= 1;
|
|
|
|
|
|
|
|
if(sprite.vflip) {
|
|
|
|
if(sprite.width() == sprite.height()) {
|
|
|
|
y = (sprite.height() - 1) - y;
|
|
|
|
} else if(y < sprite.width()) {
|
|
|
|
y = (sprite.width() - 1) - y;
|
|
|
|
} else {
|
|
|
|
y = sprite.width() + ((sprite.width() - 1) - (y - sprite.width()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(regs.interlace) {
|
2016-02-18 10:32:22 +00:00
|
|
|
y = !sprite.vflip ? y + self.field() : y - self.field();
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
x &= 511;
|
|
|
|
y &= 255;
|
|
|
|
|
|
|
|
uint16 tiledata_addr = regs.tiledata_addr;
|
|
|
|
uint16 chrx = (sprite.character >> 0) & 15;
|
|
|
|
uint16 chry = (sprite.character >> 4) & 15;
|
|
|
|
if(sprite.nameselect) {
|
|
|
|
tiledata_addr += (256 * 32) + (regs.nameselect << 13);
|
|
|
|
}
|
|
|
|
chry += (y >> 3);
|
|
|
|
chry &= 15;
|
|
|
|
chry <<= 4;
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
for(uint tx = 0; tx < tile_width; tx++) {
|
|
|
|
uint sx = (x + (tx << 3)) & 511;
|
2010-08-09 13:28:56 +00:00
|
|
|
if(x != 256 && sx >= 256 && (sx + 7) < 512) continue;
|
|
|
|
if(t.tile_count++ >= 34) break;
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
uint n = t.tile_count - 1;
|
|
|
|
oam_tile[n].valid = true;
|
2010-08-09 13:28:56 +00:00
|
|
|
oam_tile[n].x = sx;
|
|
|
|
oam_tile[n].priority = sprite.priority;
|
|
|
|
oam_tile[n].palette = 128 + (sprite.palette << 4);
|
|
|
|
oam_tile[n].hflip = sprite.hflip;
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
uint mx = !sprite.hflip ? tx : (tile_width - 1) - tx;
|
|
|
|
uint pos = tiledata_addr + ((chry + ((chrx + mx) & 15)) << 5);
|
2010-08-09 13:28:56 +00:00
|
|
|
uint16 addr = (pos & 0xffe0) + ((y & 7) * 2);
|
|
|
|
|
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
|
|
|
oam_tile[n].d0 = ppu.vram[addr + 0];
|
|
|
|
oam_tile[n].d1 = ppu.vram[addr + 1];
|
2010-08-09 13:28:56 +00:00
|
|
|
self.add_clocks(2);
|
|
|
|
|
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
|
|
|
oam_tile[n].d2 = ppu.vram[addr + 16];
|
|
|
|
oam_tile[n].d3 = ppu.vram[addr + 17];
|
2010-08-09 13:28:56 +00:00
|
|
|
self.add_clocks(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(t.tile_count < 34) self.add_clocks((34 - t.tile_count) * 4);
|
|
|
|
regs.time_over |= (t.tile_count > 34);
|
|
|
|
regs.range_over |= (t.item_count > 32);
|
|
|
|
}
|
|
|
|
|
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::Sprite::reset() -> void {
|
2016-02-18 10:32:22 +00:00
|
|
|
for(auto n : range(128)) {
|
|
|
|
list[n].x = 0;
|
|
|
|
list[n].y = 0;
|
|
|
|
list[n].character = 0;
|
|
|
|
list[n].nameselect = 0;
|
|
|
|
list[n].vflip = 0;
|
|
|
|
list[n].hflip = 0;
|
|
|
|
list[n].priority = 0;
|
|
|
|
list[n].palette = 0;
|
|
|
|
list[n].size = 0;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2011-04-27 08:57:31 +00:00
|
|
|
synchronize();
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
t.x = 0;
|
|
|
|
t.y = 0;
|
|
|
|
|
|
|
|
t.item_count = 0;
|
|
|
|
t.tile_count = 0;
|
|
|
|
|
|
|
|
t.active = 0;
|
2016-02-18 10:32:22 +00:00
|
|
|
for(auto p : range(2)) {
|
|
|
|
for(auto n : range(32)) {
|
|
|
|
t.item[p][n].valid = false;
|
|
|
|
t.item[p][n].index = 0;
|
|
|
|
}
|
|
|
|
for(auto n : range(34)) {
|
|
|
|
t.tile[p][n].valid = false;
|
|
|
|
t.tile[p][n].x = 0;
|
|
|
|
t.tile[p][n].priority = 0;
|
|
|
|
t.tile[p][n].palette = 0;
|
|
|
|
t.tile[p][n].hflip = 0;
|
|
|
|
t.tile[p][n].d0 = 0;
|
|
|
|
t.tile[p][n].d1 = 0;
|
|
|
|
t.tile[p][n].d2 = 0;
|
|
|
|
t.tile[p][n].d3 = 0;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-27 08:57:31 +00:00
|
|
|
regs.main_enable = random(false);
|
|
|
|
regs.sub_enable = random(false);
|
|
|
|
regs.interlace = random(false);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2011-04-27 08:57:31 +00:00
|
|
|
regs.base_size = random(0);
|
|
|
|
regs.nameselect = random(0);
|
2012-02-13 11:44:02 +00:00
|
|
|
regs.tiledata_addr = (random(0x0000) & 3) << 14;
|
2010-08-09 13:28:56 +00:00
|
|
|
regs.first_sprite = 0;
|
|
|
|
|
|
|
|
regs.priority0 = 0;
|
|
|
|
regs.priority1 = 0;
|
|
|
|
regs.priority2 = 0;
|
|
|
|
regs.priority3 = 0;
|
|
|
|
|
2011-04-27 08:57:31 +00:00
|
|
|
regs.time_over = false;
|
|
|
|
regs.range_over = false;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
output.main.palette = 0;
|
|
|
|
output.main.priority = 0;
|
|
|
|
output.sub.palette = 0;
|
|
|
|
output.sub.priority = 0;
|
|
|
|
}
|