Vectrex: Implement 64K bank switching, add some homebrews to DB

This commit is contained in:
alyosha-tas 2022-01-10 17:15:01 -05:00
parent 28e57dd7f3
commit b0ab71ae35
5 changed files with 56 additions and 4 deletions

View File

@ -23,4 +23,9 @@
;;; Actually TRANSLATED
;;; Games NOT present in TOSEC
;;; Games NOT present in TOSEC
;;; Homebrew
SHA1:D2FB28CECC38202E17BEE2FAEBC93B3BC8B76AFD Where Have All The Pixels Gone? VEC
SHA1:CF5DF39705107732CAF81C7FE742A5AEE598E9BC EigenVectrex VEC

View File

@ -157,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (dir_ctrl.Bit(3)) { bc1 = value.Bit(3); }
if (dir_ctrl.Bit(4)) { bdir = value.Bit(4); }
if (dir_ctrl.Bit(5)) { /*compare = value.Bit(5);*/ }
if (dir_ctrl.Bit(6)) { /* cart bank switch */ }
if (dir_ctrl.Bit(6)) { /*writing here seems to change the bank for only a single cycle, and only in output mode, not implemented*/ }
if (dir_ctrl.Bit(7))
{
//Console.WriteLine(PB7_undriven + " " + !wrt_val.Bit(7));
@ -326,6 +326,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
break;
case 0x2:
dir_ctrl = value;
// the direction of bit 6 here controls the bank
mapper.bank = dir_ctrl.Bit(6) ? 1 : 0;
break;
case 0x3:
dir_dac = value;

View File

@ -7,6 +7,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{
public VectrexHawk Core { get; set; }
public int bank;
public virtual byte ReadMemory(ushort addr)
{
return 0;
@ -27,6 +29,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public virtual void SyncState(Serializer ser)
{
ser.Sync(nameof(bank), ref bank);
}
public virtual void Dispose()

View File

@ -0,0 +1,32 @@
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{
// Default mapper with no bank switching
// make sure peekmemory and poke memory don't effect the rest of the system!
public class Mapper_64K : MapperBase
{
public override void Initialize()
{
bank = 0;
}
public override byte ReadMemory(ushort addr)
{
return Core._rom[addr + bank * 0x8000];
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);
}
public override void WriteMemory(ushort addr, byte value)
{
}
public override void PokeMemory(ushort addr, byte value)
{
WriteMemory(addr, value);
}
}
}

View File

@ -62,7 +62,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
_rom = rom;
// If the game is minstorm, then no cartridge is inserted, retun 0xFF
// If the game is minestorm, then no cartridge is inserted, retun 0xFF
if (romHashSHA1 == RomChecksums.Minestorm)
{
_rom = new byte[0x8000];
@ -159,8 +159,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
private void Setup_Mapper()
{
mapper = new MapperDefault();
if (_rom.Length == 0x10000)
{
mapper = new Mapper_64K();
}
else
{
mapper = new MapperDefault();
}
mapper.Core = this;
mapper.Initialize();
}
}
}