a7800 - misc simplifications, remove mapperBase peek/poke methods since they weren't being used and did not differ from read/write on any mapper

This commit is contained in:
adelikat 2020-02-22 11:42:50 -06:00
parent 33ad336b6a
commit 8a60043697
14 changed files with 54 additions and 145 deletions

View File

@ -3,7 +3,7 @@
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Emulates the M6532 RIOT Chip
public class M6532
public sealed class M6532
{
public A7800Hawk Core { get; set; }
@ -224,7 +224,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
PrescalerCount--;
if ((PrescalerCount == 0) || Overflowed)
if (PrescalerCount == 0 || Overflowed)
{
Value--;

View File

@ -7,30 +7,14 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public A7800Hawk Core { get; set; }
public int mask;
public virtual byte ReadMemory(ushort addr)
{
return 0;
}
public virtual byte PeekMemory(ushort addr)
{
return 0;
}
public virtual byte ReadMemory(ushort addr) => 0;
public virtual void WriteMemory(ushort addr, byte value)
{
}
public virtual void PokeMemory(ushort addr, byte value)
{
}
public virtual void SyncState(Serializer ser)
{
}
public virtual void Dispose()
{
}
}
}

View File

@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Default mapper with no bank switching
// Just need to keep track of high score bios stuff
public class MapperDefault : MapperBase
public sealed class MapperDefault : MapperBase
{
public override byte ReadMemory(ushort addr)
{
@ -50,8 +50,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return 0x00;
}
public override byte PeekMemory(ushort addr) => ReadMemory(addr);
public override void WriteMemory(ushort addr, byte value)
{
if (addr >= 0x1000 && addr < 0x1800)
@ -82,10 +80,5 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
// cartridge and other OPSYS
}
}
public override void PokeMemory(ushort addr, byte value)
{
WriteMemory(addr, value);
}
}
}

View File

@ -4,7 +4,7 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Mapper only used by F-18 Hornet
public class MapperF18 : MapperBase
public sealed class MapperF18 : MapperBase
{
private byte _bank;
@ -50,8 +50,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return Core._rom[tempAddr + _bank * 0x4000];
}
public override byte PeekMemory(ushort addr) => ReadMemory(addr);
public override void WriteMemory(ushort addr, byte value)
{
if (addr >= 0x1000 && addr < 0x1800)
@ -84,11 +82,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
}
}
public override void PokeMemory(ushort addr, byte value)
{
WriteMemory(addr, value);
}
public override void SyncState(Serializer ser)
{
ser.Sync("Bank", ref _bank);

View File

@ -4,7 +4,7 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Rescue on Fractalus has unique RAM mapping
public class MapperFractalus : MapperBase
public sealed class MapperFractalus : MapperBase
{
private byte[] RAM = new byte[0x800];
@ -55,11 +55,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return 0x00;
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);
}
public override void WriteMemory(ushort addr, byte value)
{
if (addr >= 0x1000 && addr < 0x1800)
@ -93,11 +88,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
}
}
public override void PokeMemory(ushort addr, byte value)
{
WriteMemory(addr, value);
}
public override void SyncState(Serializer ser)
{
ser.Sync(nameof(RAM), ref RAM, false);

View File

@ -4,7 +4,7 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Mapper only used by Rampage and Double Dragon
public class MapperRampage : MapperBase
public sealed class MapperRampage : MapperBase
{
private byte _bank;
@ -75,11 +75,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return Core._rom[7 * 0x4000 + tempAddr];
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);
}
public override void WriteMemory(ushort addr, byte value)
{
if (addr >= 0x1000 && addr < 0x1800)
@ -111,11 +106,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
}
}
public override void PokeMemory(ushort addr, byte value)
{
WriteMemory(addr, value);
}
public override void SyncState(Serializer ser)
{
ser.Sync("Bank", ref _bank);

View File

@ -4,7 +4,7 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Default Bank Switching Mapper used by most games
public class MapperSG : MapperBase
public sealed class MapperSG : MapperBase
{
private byte _bank;
private byte[] RAM = new byte[0x4000];
@ -96,8 +96,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return 0xFF;
}
public override byte PeekMemory(ushort addr) => ReadMemory(addr);
public override void WriteMemory(ushort addr, byte value)
{
if (addr >= 0x1000 && addr < 0x1800)
@ -144,11 +142,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
}
}
public override void PokeMemory(ushort addr, byte value)
{
WriteMemory(addr, value);
}
public override void SyncState(Serializer ser)
{
ser.Sync("Bank", ref _bank);

View File

@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Super Game mapper but with extra ROM at the start of the file
// Have to add 1 to bank number to get correct bank value
public class MapperSGE : MapperBase
public sealed class MapperSGE : MapperBase
{
private byte _bank;
@ -70,8 +70,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return Core._rom[tempAddr];
}
public override byte PeekMemory(ushort addr) => ReadMemory(addr);
public override void WriteMemory(ushort addr, byte value)
{
if (addr >= 0x1000 && addr < 0x1800)
@ -111,11 +109,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
}
}
public override void PokeMemory(ushort addr, byte value)
{
WriteMemory(addr, value);
}
public override void SyncState(Serializer ser)
{
ser.Sync("Bank", ref _bank);

View File

@ -5,7 +5,7 @@ using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Emulates the Atari 7800 Maria graphics chip
public class Maria
public sealed class Maria
{
public A7800Hawk Core { get; set; }
@ -192,16 +192,11 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
if (cycle == 453 && !sl_DMA_complete && do_dma && (DMA_phase == DMA_GRAPHICS || DMA_phase == DMA_HEADER))
{
if (current_DLL_offset == 0)
{
DMA_phase = DMA_SHUTDOWN_LAST;
}
else
{
DMA_phase = DMA_SHUTDOWN_OTHER;
}
DMA_phase = current_DLL_offset == 0
? DMA_SHUTDOWN_LAST
: DMA_SHUTDOWN_OTHER;
DMA_phase_counter = 0;
DMA_phase_counter = 0;
}
Core.RunCPUCycle();
@ -296,15 +291,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
Core.tia._hsyncCnt = 0;
Core.cpu.RDY = true;
// swap sacnline buffers
if (GFX_index == 1)
{
GFX_index = 0;
}
else
{
GFX_index = 1;
}
// swap scanline buffers
GFX_index = GFX_index == 1 ? 0 : 1;
}
}
}
@ -377,7 +365,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
GFX_Objects[header_counter].addr |= (ushort)(temp << 8);
header_pointer++;
temp = ReadMemory((ushort)(current_DLL_addr + header_pointer));
int temp_w = (temp & 0x1F); // this is the 2's complement of width (for reasons that escape me)
int temp_w = temp & 0x1F; // this is the 2's complement of width (for reasons that escape me)
if (temp_w == 0)
{
@ -591,7 +579,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
Core.cpu_resume_pending = true;
sl_DMA_complete = true;
// on the last line of a zone, we load up the disply list list for the next zone.
// on the last line of a zone, we load up the display list list for the next zone.
display_zone_counter++;
ushort temp_addr = (ushort)(display_zone_pointer + 3 * display_zone_counter);
byte temp = ReadMemory(temp_addr);

View File

@ -3,7 +3,7 @@ using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// emualtes pokey sound chip
// emulates pokey sound chip
// note: A7800 implementation is used only for sound
// potentiometers, keyboard, and IRQs are not used in this context
/*
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
* The registers are write only, except for the RNG none of the things that would return reads are connected
* for now return FF
*/
public class Pokey
public sealed class Pokey
{
public A7800Hawk Core { get; set; }
@ -37,11 +37,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public bool[] clock_ch = new bool[4];
public int bit_xor;
public Pokey()
{
}
public int sample()
{
LocalAudioCycles = 0;
@ -138,7 +133,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
inc_ch[2]++;
if (Regs[8].Bit(0))
{
if (inc_ch[2] >= 114) { inc_ch[2] = 0; clock_ch[2] = true; }
if (inc_ch[2] >= 114) { inc_ch[2] = 0; clock_ch[2] = true; }
}
else
{
@ -150,7 +145,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
if (clock_ch[0])
{
clock_ch[1] = true;
clock_ch[1] = true;
}
}
else
@ -159,7 +154,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
if (Regs[8].Bit(0))
{
if (inc_ch[1] >= 114) { inc_ch[1] = 0; clock_ch[1] = true; }
}
else
{
@ -179,7 +173,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
inc_ch[3]++;
if (Regs[8].Bit(0))
{
if (inc_ch[3] >= 114) { inc_ch[3] = 0; clock_ch[3] = true; }
if (inc_ch[3] >= 114) { inc_ch[3] = 0; clock_ch[3] = true; }
}
else
{
@ -273,7 +267,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
//if (ch_src[i])
//{
ch_out[i] = poly4.Bit(3);
//}
//}
}
else if ((Regs[i * 2 + 1] & 0xF0) == 0xE0)
{

View File

@ -1,7 +1,7 @@
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
// Emulates the TIA
public partial class TIA
public sealed partial class TIA
{
public A7800Hawk Core { get; set; }
@ -94,10 +94,8 @@
Core._isLag = false;
return (byte)(Core.p1_fire_2x & 0x80);
}
else
{
return 0;
}
return 0;
}
if (maskedAddr == 0x09) // INPT1
@ -107,10 +105,8 @@
Core._isLag = false;
return (byte)((Core.p1_fire_2x & 0x40)<<1);
}
else
{
return 0;
}
return 0;
}
if (maskedAddr == 0x0A) // INPT2
@ -120,10 +116,8 @@
Core._isLag = false;
return (byte)(Core.p2_fire_2x & 0x80);
}
else
{
return 0;
}
return 0;
}
if (maskedAddr == 0x0B) // INPT3
@ -133,10 +127,8 @@
Core._isLag = false;
return (byte)((Core.p2_fire_2x & 0x40)<<1);
}
else
{
return 0;
}
return 0;
}
if (maskedAddr == 0x0C) // INPT4
@ -149,19 +141,16 @@
{
return Core.p1_fire;
}
else
{
return Core.lg_1_trigger_hit;
}
return Core.lg_1_trigger_hit;
}
else if ((Core.m6532._outputB & 0x04) != 0 || (Core.m6532._ddRb & 0x04) != 0x04)
if ((Core.m6532._outputB & 0x04) != 0 || (Core.m6532._ddRb & 0x04) != 0x04)
{
return Core.p1_fire;
}
else
{
return 0x80;
}
return 0x80;
}
if (maskedAddr == 0x0D) // INPT5
@ -173,19 +162,16 @@
{
return Core.p2_fire;
}
else
{
return Core.lg_2_trigger_hit;
}
return Core.lg_2_trigger_hit;
}
else if ((Core.m6532._outputB & 0x10) != 0 || (Core.m6532._ddRb & 0x10) != 0x10)
if ((Core.m6532._outputB & 0x10) != 0 || (Core.m6532._ddRb & 0x10) != 0x10)
{
return Core.p2_fire;
}
else
{
return 0x80;
}
return 0x80;
}
return 0;

View File

@ -2,7 +2,7 @@
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
public partial class TIA
public sealed partial class TIA
{
public class Audio
{
@ -137,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
One5();
Run4();
on = Run1();
break;
break;
case 0x06:
case 0x0a:
Run5();
@ -153,7 +153,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
case 0x07:
case 0x09:
on = Run5();
break;
break;
case 0x08:
on = Run9();
break;

View File

@ -2,7 +2,7 @@
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
public partial class TIA
public sealed partial class TIA
{
public void SyncState(Serializer ser)
{

View File

@ -235,8 +235,10 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Coroutine/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cpus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=curr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=databus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Datacorder/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Datarows/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Datasheet/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Deadzone/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=dearchive/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=defctrl/@EntryIndexedValue">True</s:Boolean>
@ -364,6 +366,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=preload/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Prereqs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=prescale/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Prescaler/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Presize/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Quantizer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=quantizes/@EntryIndexedValue">True</s:Boolean>
@ -384,6 +387,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Saturnus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=saveram/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=savestate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=savestated/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=savestates/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Scanline/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=scanlines/@EntryIndexedValue">True</s:Boolean>
@ -423,6 +427,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=UDLR/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=underrun/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Underruns/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=undriven/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unflatten/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Uninitialize/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unmerge/@EntryIndexedValue">True</s:Boolean>