gen: fix some vram corruption issues

general: fix some build warnings
This commit is contained in:
beirich 2012-09-09 21:15:20 +00:00
parent 52df58c84d
commit 90d1d12086
10 changed files with 115 additions and 111 deletions

View File

@ -239,19 +239,19 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x026:
case 0x027:
throw new NotImplementedException();
dest = (byte)(opcode & 0x7);
dest_value = Register[dest];
ones = (dest_value ^ 0xFFFF);
result = ones + 1;
Calc_FlagC(result);
Calc_FlagO_Add(ones, 1, result);
result &= 0xFFFF;
Calc_FlagS(result);
Calc_FlagZ(result);
Register[dest] = (ushort)result;
cycles = 6;
Interruptible = true;
break;
//dest = (byte)(opcode & 0x7);
//dest_value = Register[dest];
//ones = (dest_value ^ 0xFFFF);
//result = ones + 1;
//Calc_FlagC(result);
//Calc_FlagO_Add(ones, 1, result);
//result &= 0xFFFF;
//Calc_FlagS(result);
//Calc_FlagZ(result);
//Register[dest] = (ushort)result;
//cycles = 6;
//Interruptible = true;
//break;
// ADCR
case 0x028:
case 0x029:
@ -262,19 +262,19 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x02E:
case 0x02F:
throw new NotImplementedException();
dest = (byte)(opcode & 0x7);
dest_value = Register[dest];
carry = FlagC ? 1 : 0;
result = dest_value + carry;
Calc_FlagC(result);
Calc_FlagO_Add(dest_value, carry, result);
result &= 0xFFFF;
Calc_FlagS(result);
Calc_FlagZ(result);
Register[dest] = (ushort)result;
cycles = 6;
Interruptible = true;
break;
//dest = (byte)(opcode & 0x7);
//dest_value = Register[dest];
//carry = FlagC ? 1 : 0;
//result = dest_value + carry;
//Calc_FlagC(result);
//Calc_FlagO_Add(dest_value, carry, result);
//result &= 0xFFFF;
//Calc_FlagS(result);
//Calc_FlagZ(result);
//Register[dest] = (ushort)result;
//cycles = 6;
//Interruptible = true;
//break;
// GSWD
case 0x030:
case 0x031:
@ -922,15 +922,15 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x1BE:
case 0x1BF:
throw new NotImplementedException();
src = (byte)((opcode >> 3) & 0x7);
dest = (byte)(opcode & 0x7);
result = Register[dest] & Register[src];
Calc_FlagS(result);
Calc_FlagZ(result);
Register[dest] = (ushort)result;
cycles = 6;
Interruptible = true;
break;
//src = (byte)((opcode >> 3) & 0x7);
//dest = (byte)(opcode & 0x7);
//result = Register[dest] & Register[src];
//Calc_FlagS(result);
//Calc_FlagZ(result);
//Register[dest] = (ushort)result;
//cycles = 6;
//Interruptible = true;
//break;
// XORR
case 0x1C0:
case 0x1C1:
@ -1421,21 +1421,21 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x306:
case 0x307:
throw new NotImplementedException();
dest = (byte)(opcode & 0x7);
addr = ReadMemory(RegisterPC++);
dest_value = Register[dest];
addr_read = ReadMemory(addr);
twos = (0xFFFF ^ addr_read) + 1;
result = dest_value + twos;
Calc_FlagC(result);
Calc_FlagO_Add(dest_value, addr_read, result);
result &= 0xFFFF;
Calc_FlagS(result);
Calc_FlagZ(result);
Register[dest] = (ushort)result;
cycles = 10;
Interruptible = true;
break;
//dest = (byte)(opcode & 0x7);
//addr = ReadMemory(RegisterPC++);
//dest_value = Register[dest];
//addr_read = ReadMemory(addr);
//twos = (0xFFFF ^ addr_read) + 1;
//result = dest_value + twos;
//Calc_FlagC(result);
//Calc_FlagO_Add(dest_value, addr_read, result);
//result &= 0xFFFF;
//Calc_FlagS(result);
//Calc_FlagZ(result);
//Register[dest] = (ushort)result;
//cycles = 10;
//Interruptible = true;
//break;
// SUB@
case 0x308:
case 0x309:
@ -1612,17 +1612,17 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x386:
case 0x387:
throw new NotImplementedException();
dest = (byte)(opcode & 0x7);
addr = ReadMemory(RegisterPC++);
dest_value = Register[dest];
addr_read = ReadMemory(addr);
result = dest_value & addr_read;
Calc_FlagS(result);
Calc_FlagZ(result);
Register[dest] = (ushort)result;
cycles = 10;
Interruptible = true;
break;
//dest = (byte)(opcode & 0x7);
//addr = ReadMemory(RegisterPC++);
//dest_value = Register[dest];
//addr_read = ReadMemory(addr);
//result = dest_value & addr_read;
//Calc_FlagS(result);
//Calc_FlagZ(result);
//Register[dest] = (ushort)result;
//cycles = 10;
//Interruptible = true;
//break;
// AND@
case 0x388:
case 0x389:
@ -1700,17 +1700,17 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x3C6:
case 0x3C7:
throw new NotImplementedException();
dest = (byte)(opcode & 0x7);
addr = ReadMemory(RegisterPC++);
dest_value = Register[dest];
addr_read = ReadMemory(addr);
result = dest_value ^ addr_read;
Calc_FlagS(result);
Calc_FlagZ(result);
Register[dest] = (ushort)result;
cycles = 10;
Interruptible = true;
break;
//dest = (byte)(opcode & 0x7);
//addr = ReadMemory(RegisterPC++);
//dest_value = Register[dest];
//addr_read = ReadMemory(addr);
//result = dest_value ^ addr_read;
//Calc_FlagS(result);
//Calc_FlagZ(result);
//Register[dest] = (ushort)result;
//cycles = 10;
//Interruptible = true;
//break;
// XOR@
case 0x3C8:
case 0x3C9:

View File

@ -16,8 +16,6 @@ namespace BizHawk
public byte[] ram = new byte[128];
public MapperBase mapper;
bool resetSignal;
// The Atari 2600 memory mapper looks something like this...usually
// N/A Page #

View File

@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int prg_reg_16k, chr_reg_8k;
int prg_bank_mask_16k;
int chr_bank_mask_8k;
bool low;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)

View File

@ -24,29 +24,24 @@ Blood Shot - FPS game - some texture corruption
Bonkers - substantial gfx corruption
Buck Rogers crashes in a fun way
Burning Force - some gfx issues. works way better than it has in the past though!
Castle of Illusion - doesn't boot
Cheese Cat-astrophe - crashes renderer!!
Chester Cheetah - freezes when starting new game
Chuck Rock - Music messed up
Contra Hard Corps: Scrolling is messed up in level 1... used to work.
Crusader of Centy- Text boxes messed up
Dashin' Desperados .. bottom screen messed up
Death Duel crashes my renderer... (!)
Decap Attack - Item select screen messed up
Double Dragon doesn't boot
Devilish/Bad Omen - intro messed up.... interesting debug target
Dune... freezes in intro
Eternal Champions... GFX issues, immediately
Exile - Immediate gfx issues... Debug target.
Exo Squad - Doesn't boot at all
F1 World Championship... Gfx issue at bottom of screen... quite cool working game though!
Fatal Rewind - appears to do a read.w on FFFFFF... that would be an address error. read.l messes up too. Ergo: basically doesnt work.
Final Blow - Music messed up
Fire Shark - Messed up sound
Flavio's Raster FX Test.. doesnt work
Foreman for Real doent boot
Galaxy Force II - minor gfx corruption now...
Garfield... immediate gfx corruption. debug target.
Galaxy Force II - gfx issue in level select screen, and in level-end "shoot the core" part
Gargoyles... gameplay is nonfunctional
Gauntlet 4 .. title screen messed. gfx corruption. immediately - debug target.
Golden Axe - controls are jacked up
@ -60,7 +55,6 @@ Jurassic Park 2 - crashes in intro
Landstalker - Sprite masking on bottom is too high on the screen...
Lemmings: Sound is royally effed... gfx glitches.
Marvel Land .. holy shit thats psychadelic
Mega Bomberman....gfx glitches title screen
Mega Turrican some gfx glitches
Mortal Kombat...
MUSHA: Intro music starts too soon. Suffers from lack of 2-cell-vertical-scroll mode.
@ -70,31 +64,24 @@ Outrun, minor gfx issue. maybe related to h-int timing?
Outrunners, some gfx issues... but not as bad as you might think!!! apparently doesnt use interlace mode?
Panorama Cotton still not working right
Power Monger messed up
Quackshot doesn't boot.
RamboIII - intro gfx corrupted - MAYBE GOOD DEBUGGING TARGET
Road Blasters: was working, now has gfx glitches.
Shining in the Darkness: Gfx glitches, pretty severe
Skitchin doesnt boot
Shining in the Darkness: Check out sprites in the tavern... very odd
Sonic 2: Aside from lack of interlace mode, the shadows in the special stage are white....?
Sonic 3 serious gfx glitches
Star Control - Shit gets crazy
Steel Empire - controls messed up. probably gfx issues also.
Sub-Terrania some gfx issues in intro
Super Hang-On - Sprite priority/masking isnt happening the way its supposed to on the tracks.
Super Fantasy Zone: Sound totally boned, missing graphics
TaleSpin - gfx glitches
The Humans
The Immortal
Truxton - Sound is jaaaacked.
Verytex - gfx issues
World of Illusion doesnt boot
Zero Tolerance - gfx bugs that didnt used to happen :(
Zombies At My Neighbors: doesnt boot really
Zoop doesnt boot
Things that read from VRAM work like 50%-90%, but not 100%. It's frustrating. Kid Chameleon and Eternal Champions are examples.
Some games flicker in the rightmost columns. Is this caused by mid-frame mode shifting(32/40 col modes?) Alisia Dragoon is one example.
--- Havent seen an example of this in a long time. Maybe it's a non-issue.
======================================================
Fixed Issues: (listed for regression testing purposes)
@ -112,6 +99,21 @@ Fun-n-Games fails its fadeouts. -- Fixed CRAM reads. I failed math.
Sonic Spinball executes a VSRAM read -- Implemented VSRAM reads.
Bugs related to longword read/write VRAM. Multiple bugs were present including sign-extension and endians and crap.
- Crusader of Centy- Text boxes messed up
- Eternal Champions - immediate gfx corruption
- Garfield... immediate gfx corruption. debug target.
- Kid Chameleon - gfx corruption on bounce bricks and level-end effect
Games to test window calculation on:
- Road Blasters (doesnt use window, but Window & Nametable A are at same location)
- Out of this World - Same as Road Blasters
- Musha,Gaiares - Window at top
- Eliminate Down - Window at bottom
- Monster World 4, Wonder Boy in Monster World - Window at top - needs window scroll plane size adjustment
- D&D Warriors of the Eternal Sun - Window at bottom and at sides
- Truxton, Fire Shark - Window on Right
======================================================
TODO: non-instant DMA emulation
@ -119,10 +121,6 @@ TODO: Add 68000/VDP interrupt enable delay (one instruction, similar to After Bu
TODO: H-Ints timing possibly not correct... Some game raster effects work, others don't work as expected. (could be HVC tho)
TODO: Test DMA/ VDP command words.... I'm not at all convinced that VRAM is always correct
TODO: Seems like the Window should be high-priority... or Sprites aren't getting masked or something. Sprites routinely draw over window.
==============
Notable games:
@ -142,4 +140,10 @@ Games that use VRAM->VRAM Copy: D&D Warriors of the Eternal Sun, MUSHA, Devilish
Games that require accurate VRAM fill emulation include Thunder Force IV,
Contra Hard Corps, Revenge of Shinobi, Taiga Drama, and Sword of Vermillion.
Sonic Spinball reads from VSRAM
Sonic Spinball reads from VSRAM
Games known to use 2-cell vertical scroll mode:
- Air Diver
- Exo Squad
- Contra Hard Corps (giant robot boss on stage 1)
- MUSHA (stage 3)

View File

@ -59,6 +59,8 @@ namespace BizHawk.Emulation.Consoles.Sega
public bool VdpDebug = false;
public Func<int> GetPC;
public GenVDP()
{
WriteVdpRegister(00, 0x04);
@ -105,7 +107,7 @@ namespace BizHawk.Emulation.Consoles.Sega
public void WriteVdpControl(ushort data)
{
Log.Note("VDP", "Control Write {0:X4}", data);
Log.Note("VDP", "Control Write {0:X4} (PC={1:X6})", data, GetPC());
if (ControlWordPending == false)
{
@ -171,14 +173,14 @@ namespace BizHawk.Emulation.Consoles.Sega
public void WriteVdpData(ushort data)
{
Log.Note("VDP", "Data port write: {0:X4}", data);
Log.Note("VDP", "Data port write: {0:X4} (PC={1:X6})", data, GetPC());
ControlWordPending = false;
// byte-swap incoming data when A0 is set
if ((VdpDataAddr & 1) != 0)
{
data = (ushort)((data >> 8) | (data << 8));
Log.Error("VDP", "VRAM byte-swap is happening because A0 is not 0");
Log.Error("VDP", "VRAM byte-swap is happening because A0 is not 0. [{0:X4}] = {1:X4}", VdpDataAddr, data);
}
switch (VdpDataCode & 0xF)

View File

@ -125,8 +125,10 @@ namespace BizHawk.Emulation.Consoles.Sega
#if MUSASHI
Musashi.Init();
Musashi.Reset();
VDP.GetPC = () => Musashi.PC;
#else
MainCPU.Reset();
VDP.GetPC = () => MainCPU.PC;
#endif
}

View File

@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Consoles.Sega
if (address >= 0xE00000) // Work RAM
{
maskedAddr = address & 0xFFFF;
maskedAddr = address & 0xFFFE;
return (short)((Ram[maskedAddr] << 8) | Ram[maskedAddr + 1]);
}
@ -80,6 +80,14 @@ namespace BizHawk.Emulation.Consoles.Sega
return (Ram[maskedAddr] << 24) | (Ram[maskedAddr + 1] << 16) | (Ram[maskedAddr + 2] << 8) | Ram[maskedAddr + 3];
}
if (address >= 0xC00000)
{
//Console.WriteLine("long-read from VDP");
short msw = ReadWord(address);
short msl = ReadWord(address + 2);
return (msw << 16) | (ushort) msl;
}
// try to handle certain things separate if they need to be separate? otherwise handle as 2x readwords?
{
return ((ushort)ReadWord(address) | (ushort)(ReadWord(address + 2) << 16));
@ -197,7 +205,7 @@ namespace BizHawk.Emulation.Consoles.Sega
if (address >= 0xC00000)
{
WriteWord(address, (short)(value >> 16));
WriteWord(address, (short)value);
WriteWord(address+2, (short)value);
return;
}

View File

@ -530,7 +530,6 @@ namespace BizHawk.MultiClient
class UIDisplay
{
public string Message;
public DateTime ExpireAt;
public int X;
public int Y;
public bool Alert;

View File

@ -350,7 +350,6 @@ namespace BizHawk.MultiClient
private byte[] GetRomBytes()
{
byte[] bytes;
string path = Global.MainForm.CurrentlyOpenRom;
if (path == null)
{
@ -376,8 +375,6 @@ namespace BizHawk.MultiClient
return File.ReadAllBytes(path);
}
}
return new byte[0];
}
private void SetMemoryDomain(int pos)

View File

@ -26,12 +26,6 @@ namespace BizHawk
InitializeComponent();
}
private class DiscRecord
{
public Disc Disc;
public string BaseName;
}
private void MainDiscoForm_Load(object sender, EventArgs e)
{