SG-1000 almost done

This commit is contained in:
beirich 2011-01-20 23:58:58 +00:00
parent 8f59b1f582
commit 73cf2bc61b
7 changed files with 68 additions and 46 deletions

View File

@ -2,11 +2,31 @@
* CodeMasters games use a custom mapper and special video modes (both implemented) * CodeMasters games use a custom mapper and special video modes (both implemented)
+ Fantastic Dizzy crashes shortly after starting a new game. Investigating. + Fantastic Dizzy crashes shortly after starting a new game. Investigating.
+ Excellent Dizzy Collection doesn't boot.
* F16 Fighting Falcon uses old SG-1000 video mode.
======= Game Gear compatibility issues ======= ======= Game Gear compatibility issues =======
* Outrun has raster effect on the wrong line. I've been able to modify interrupt code to * Outrun has raster effect on the wrong line. I've been able to modify interrupt code to
fix it, but so far, not without breaking other games. fix it, but so far, not without breaking other games.
* GG Turrican homebrew not starting correctly * GG Turrican homebrew not starting correctly
======= SG-1000 compatibility checklist =======
Following games are untested (don't have the rom)
Bomb Jack
C_So!
Champion Kendou
Home Mahjong
Mahjong
Othello
Pachinko
Serizawa Hachidan no Tsumeshogi
Terebi Oekaki
Following games have issues:
The Castle dies
Guzzler (JP) crashes the core :O
Monaco GP graphics are whacked up - wonder if it uses an undoc mode?
Q-Bert crash core ? :o

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Consoles.Sega
if (DisplayOn == false) if (DisplayOn == false)
{ {
for (int x = 0; x < 256; x++) for (int x = 0; x < 256; x++)
FrameBuffer[(ScanLine * 256) + x] = BackdropColor; FrameBuffer[(ScanLine*256) + x] = Palette[BackdropColor];
return; return;
} }

View File

@ -28,18 +28,27 @@ namespace BizHawk.Emulation.Consoles.Sega
private void RenderBackgroundM0() private void RenderBackgroundM0()
{ {
if (DisplayOn == false)
{
Array.Clear(FrameBuffer, ScanLine * 256, 256);
return;
}
int yc = ScanLine/8; int yc = ScanLine/8;
int yofs = ScanLine%8; int yofs = ScanLine%8;
int FrameBufferOffset = ScanLine*256; int FrameBufferOffset = ScanLine*256;
int PatternNameOffset = TmsPatternNameTableBase + (yc*32); int PatternNameOffset = TmsPatternNameTableBase + (yc*32);
int ScreenBGColor = PaletteTMS9918[Registers[7] & 0x0F];
for (int xc=0; xc<32; xc++) for (int xc=0; xc<32; xc++)
{ {
int pn = VRAM[PatternNameOffset++]; int pn = VRAM[PatternNameOffset++];
int pv = VRAM[PatternGeneratorBase + (pn*8) + yofs]; int pv = VRAM[PatternGeneratorBase + (pn*8) + yofs];
int colorEntry = VRAM[ColorTableBase + (pn/8)]; int colorEntry = VRAM[ColorTableBase + (pn/8)];
int fgColor = PaletteTMS9918[(colorEntry >> 4 & 0x0F)]; int fgIndex = (colorEntry >> 4) & 0x0F;
int bgColor = PaletteTMS9918[(colorEntry & 0x0F)]; int bgIndex = colorEntry & 0x0F;
int fgColor = fgIndex == 0 ? ScreenBGColor : PaletteTMS9918[fgIndex];
int bgColor = bgIndex == 0 ? ScreenBGColor : PaletteTMS9918[bgIndex];
FrameBuffer[FrameBufferOffset++] = ((pv & 0x80) > 0) ? fgColor : bgColor; FrameBuffer[FrameBufferOffset++] = ((pv & 0x80) > 0) ? fgColor : bgColor;
FrameBuffer[FrameBufferOffset++] = ((pv & 0x40) > 0) ? fgColor : bgColor; FrameBuffer[FrameBufferOffset++] = ((pv & 0x40) > 0) ? fgColor : bgColor;
@ -54,20 +63,29 @@ namespace BizHawk.Emulation.Consoles.Sega
private void RenderBackgroundM2() private void RenderBackgroundM2()
{ {
if (DisplayOn == false)
{
Array.Clear(FrameBuffer, ScanLine * 256, 256);
return;
}
int yrow = ScanLine/8; int yrow = ScanLine/8;
int yofs = ScanLine%8; int yofs = ScanLine%8;
int FrameBufferOffset = ScanLine*256; int FrameBufferOffset = ScanLine*256;
int PatternNameOffset = TmsPatternNameTableBase + (yrow*32); int PatternNameOffset = TmsPatternNameTableBase + (yrow*32);
int PatternGeneratorOffset = (((Registers[4] & 4) << 11) & 0x2000);// +((yrow / 8) * 0x100); int PatternGeneratorOffset = (((Registers[4] & 4) << 11) & 0x2000);// +((yrow / 8) * 0x100);
int ColorOffset = (ColorTableBase & 0x2000);// +((yrow / 8) * 0x100); int ColorOffset = (ColorTableBase & 0x2000);// +((yrow / 8) * 0x100);
int ScreenBGColor = PaletteTMS9918[Registers[7] & 0x0F];
for (int xc=0; xc<32; xc++) for (int xc=0; xc<32; xc++)
{ {
int pn = VRAM[PatternNameOffset++]; int pn = VRAM[PatternNameOffset++] + ((yrow/8)*0x100);
int pv = VRAM[PatternGeneratorOffset + (pn * 8) + yofs]; int pv = VRAM[PatternGeneratorOffset + (pn * 8) + yofs];
int colorEntry = VRAM[ColorOffset + (pn * 8) + yofs]; int colorEntry = VRAM[ColorOffset + (pn * 8) + yofs];
int fgColor = PaletteTMS9918[(colorEntry >> 4 & 0x0F)]; int fgIndex = (colorEntry >> 4) & 0x0F;
int bgColor = PaletteTMS9918[(colorEntry & 0x0F)]; int bgIndex = colorEntry & 0x0F;
int fgColor = fgIndex == 0 ? ScreenBGColor : PaletteTMS9918[fgIndex];
int bgColor = bgIndex == 0 ? ScreenBGColor : PaletteTMS9918[bgIndex];
FrameBuffer[FrameBufferOffset++] = ((pv & 0x80) > 0) ? fgColor : bgColor; FrameBuffer[FrameBufferOffset++] = ((pv & 0x80) > 0) ? fgColor : bgColor;
FrameBuffer[FrameBufferOffset++] = ((pv & 0x40) > 0) ? fgColor : bgColor; FrameBuffer[FrameBufferOffset++] = ((pv & 0x40) > 0) ? fgColor : bgColor;
@ -82,6 +100,8 @@ namespace BizHawk.Emulation.Consoles.Sega
private void RenderTmsSprites() private void RenderTmsSprites()
{ {
if (DisplayOn == false) return;
Array.Clear(ScanlinePriorityBuffer, 0, 256); Array.Clear(ScanlinePriorityBuffer, 0, 256);
Array.Clear(SpriteCollisionBuffer, 0, 256); Array.Clear(SpriteCollisionBuffer, 0, 256);
@ -129,10 +149,13 @@ namespace BizHawk.Emulation.Consoles.Sega
if ((pv & (1 << (7 - (xp & 7)))) > 0) if ((pv & (1 << (7 - (xp & 7)))) > 0)
{ {
if (Color != 0) // todo sprite collision
FrameBuffer[(ScanLine * 256) + x + xp] = PaletteTMS9918[Color & 0x0F]; if (Color != 0 && ScanlinePriorityBuffer[x+xp] == 0)
{
ScanlinePriorityBuffer[x + xp] = 1;
FrameBuffer[(ScanLine*256) + x + xp] = PaletteTMS9918[Color & 0x0F];
}
} }
} }
} }
} }

View File

@ -204,26 +204,10 @@ namespace BizHawk.Emulation.Consoles.Sega
{ {
if (Mode4Bit == false) // check old TMS modes if (Mode4Bit == false) // check old TMS modes
{ {
if (Mode1Bit) if (Mode1Bit) TmsMode = 1;
{ else if (Mode2Bit) TmsMode = 2;
Console.WriteLine("set mode 1...."); else if (Mode3Bit) TmsMode = 3;
TmsMode = 1; else TmsMode = 0;
}
else if (Mode2Bit)
{
Console.WriteLine("set mode 2....");
TmsMode = 2;
}
else if (Mode3Bit)
{
Console.WriteLine("set mode 3....");
TmsMode = 3;
}
else
{
Console.WriteLine("set mode 0....");
TmsMode = 0;
}
} }
else if (Mode4Bit && Mode2Bit) // if Mode4 and Mode2 set, then check extension modes else if (Mode4Bit && Mode2Bit) // if Mode4 and Mode2 set, then check extension modes
@ -235,7 +219,6 @@ namespace BizHawk.Emulation.Consoles.Sega
case 0x18: // 192-line mode case 0x18: // 192-line mode
if (FrameHeight != 192) if (FrameHeight != 192)
{ {
Console.WriteLine("Change video mode to 192-line Mode4");
FrameHeight = 192; FrameHeight = 192;
FrameBuffer = new int[256*192]; FrameBuffer = new int[256*192];
NameTableBase = CalcNameTableBase(); NameTableBase = CalcNameTableBase();
@ -244,7 +227,6 @@ namespace BizHawk.Emulation.Consoles.Sega
case 0x10: // 224-line mode case 0x10: // 224-line mode
if (FrameHeight != 224) if (FrameHeight != 224)
{ {
Console.WriteLine("Change video mode to 224-line Mode4");
FrameHeight = 224; FrameHeight = 224;
FrameBuffer = new int[256*224]; FrameBuffer = new int[256*224];
NameTableBase = CalcNameTableBase(); NameTableBase = CalcNameTableBase();
@ -253,7 +235,6 @@ namespace BizHawk.Emulation.Consoles.Sega
case 0x08: // 240-line mode case 0x08: // 240-line mode
if (FrameHeight != 240) if (FrameHeight != 240)
{ {
Console.WriteLine("Change video mode to 240-line Mode4");
FrameHeight = 240; FrameHeight = 240;
FrameBuffer = new int[256 * 240]; FrameBuffer = new int[256 * 240];
NameTableBase = CalcNameTableBase(); NameTableBase = CalcNameTableBase();
@ -266,7 +247,6 @@ namespace BizHawk.Emulation.Consoles.Sega
TmsMode = 4; TmsMode = 4;
if (FrameHeight != 192) if (FrameHeight != 192)
{ {
Console.WriteLine("Change video mode to 192-line Mode4");
FrameHeight = 192; FrameHeight = 192;
FrameBuffer = new int[256*192]; FrameBuffer = new int[256*192];
NameTableBase = CalcNameTableBase(); NameTableBase = CalcNameTableBase();
@ -391,6 +371,7 @@ namespace BizHawk.Emulation.Consoles.Sega
RenderTmsSprites(); RenderTmsSprites();
} else if (TmsMode == 0) { } else if (TmsMode == 0) {
RenderBackgroundM0(); RenderBackgroundM0();
RenderTmsSprites();
} }
} }

View File

@ -3,10 +3,10 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion> <ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DD448B37-BA3F-4544-9754-5406E8094723}</ProjectGuid> <ProjectGuid>{DD448B37-BA3F-4544-9754-5406E8094723}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.MultiClient</RootNamespace> <RootNamespace>BizHawk.MultiClient</RootNamespace>
<AssemblyName>BizHawk.MultiClient</AssemblyName> <AssemblyName>BizHawk.MultiClient</AssemblyName>
@ -87,6 +87,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Gameboy\Debugger.resx"> <EmbeddedResource Include="Gameboy\Debugger.resx">
<DependentUpon>Debugger.cs</DependentUpon> <DependentUpon>Debugger.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="MainForm.resx"> <EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>

View File

@ -157,7 +157,6 @@ namespace BizHawk.MultiClient
genControls.BindMulti("P1 Start", Global.Config.GenP1Start); genControls.BindMulti("P1 Start", Global.Config.GenP1Start);
Global.GenControls = genControls; Global.GenControls = genControls;
var TI83Controls = new Controller(TI83.TI83Controller); var TI83Controls = new Controller(TI83.TI83Controller);
TI83Controls.BindMulti("0", "D0"); //numpad 4,8,6,2 (up/down/left/right) dont work in slimdx!! wtf!! TI83Controls.BindMulti("0", "D0"); //numpad 4,8,6,2 (up/down/left/right) dont work in slimdx!! wtf!!
TI83Controls.BindMulti("1", "D1"); TI83Controls.BindMulti("1", "D1");
@ -181,9 +180,7 @@ namespace BizHawk.MultiClient
TI83Controls.BindMulti("DIVIDE", "NumberPadSlash"); TI83Controls.BindMulti("DIVIDE", "NumberPadSlash");
TI83Controls.BindMulti("CLEAR", "Escape"); TI83Controls.BindMulti("CLEAR", "Escape");
TI83Controls.BindMulti("DOT", "NumberPadPeriod"); TI83Controls.BindMulti("DOT", "NumberPadPeriod");
Global.TI83Controls = TI83Controls; Global.TI83Controls = TI83Controls;
} }
private static void FormDragEnter(object sender, DragEventArgs e) private static void FormDragEnter(object sender, DragEventArgs e)

View File

@ -300,8 +300,8 @@ DFA2AE07 V Enduro Racer (corrupted) SMS Insert hex byte $0D at offset $B3A1 to f
5D5C50B3 Enduro Racer (JP) SMS 5D5C50B3 Enduro Racer (JP) SMS
C4BB1676 E-SWAT [A] SMS C4BB1676 E-SWAT [A] SMS
C10FCE39 E-SWAT [B] SMS C10FCE39 E-SWAT [B] SMS
8813514B "Excellent Dizzy Collection, The [Proto]" SMS 8813514B Excellent Dizzy Collection, The [Proto] SMS CMMapper,PAL
AA140C9C "Excellent Dizzy Collection, The [SMS-GG]" SMS AA140C9C Excellent Dizzy Collection, The [SMS-GG] SMS CMMapper,PAL
EC788661 F1 SMS EC788661 F1 SMS
8AB10CB4 V F1 (first 128KB only) SMS 8AB10CB4 V F1 (first 128KB only) SMS
EAEBF323 F-16 Fighter SMS EAEBF323 F-16 Fighter SMS
@ -1899,12 +1899,12 @@ F397F041 Zoop [A] GG Product code 88830 (Europe?)
3247FF8B Zoop [B] GG Product code 139048 (US?) 3247FF8B Zoop [B] GG Product code 139048 (US?)
590F9C54 D Zoop'em Up GG 590F9C54 D Zoop'em Up GG
26ECD094 "Black Onyx, The (JP)" SG 26ECD094 The Black Onyx SG
D8A87095 Bank Panic SG D8A87095 Bank Panic SG
EA0F2691 Bomb Jack SG EA0F2691 Bomb Jack SG
0B4BCA74 Borderline SG 0B4BCA74 Borderline SG
BE7ED0EB C_So! (JP) SG BE7ED0EB C_So! (JP) SG
092F29D6 "Castle, The (JP)" SG 092F29D6 The Castle SG
D37BDA49 Chack'n Pop SG D37BDA49 Chack'n Pop SG
5970A12B Champion Baseball SG 5970A12B Champion Baseball SG
62B21E31 Champion Billiards SG 62B21E31 Champion Billiards SG