ChannelFHawk: Updates

* Maze/Hangman mappers working (SRAM2102)
* Fixed console buttons ones-compliment bug
* LagFrame detection
* NTSC/PAL SyncSetting
* Started adding mappers for all games
This commit is contained in:
Asnivor 2021-11-26 16:50:14 +00:00
parent fd02c872a9
commit 4f71df99ae
16 changed files with 358 additions and 322 deletions

View File

@ -8,12 +8,16 @@
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
C8D5CE90CB1C76C9589711B5029D3421 B Color Organ (19xx)(-)[b] ChannelF
3EF873268F8FC428DA225CADABB4703F B Democart (demo) (1977)(Fairchild)[b] ChannelF
0CFD9B9213CFF4A9DF9DD7FEA4663236 B Spitfire (USA) (proto)[b] ChannelF board=STD USA
7385E596BF2A58E2186439AC1E49C075 B Schach (Germany) [b] ChannelF board=SCHACH Germany
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Hacks
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
02B4A4F523B972C63FEF21BF2E51AE58 Channel F Multi-Cart - Menu (2004)(Riddle, Sean) ChannelF
4B3657594CD1000D08704F4F0FB53C75 Channel F Multi-Cart - Menu (2004)(Riddle, Sean)[a] ChannelF
ABC6FC7083B66A65C1E18EBF911F6689 Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) (Multicart Hack) ChannelF board=SCHACH USA
533BAC14DE68FBA49078EEF8E9502DD2 Hangman (USA) (Multicart Hack) ChannelF board=SCHACH USA
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Over Dumps
@ -33,46 +37,86 @@ D337BE6E8F348FB329FBAF44D3C2FA17 D International Karate Demo Test 2 (200x)(-)(PD
A6607B7C30CC4A7695D3112B3271D4E8 D International Karate Demo Test 3 (200x)(-)(PD) ChannelF
7DD3F1040C774FE147FC1D825B353524 D International Karate Demo Test 5 (200x)(-)(PD) ChannelF
F680225A38C3C4A66E30DBCA8D351407 D Test Controls (200x)(e5frog)(PD) ChannelF
D7050AF61479AA549206250441AA2B0F D Tetris (2004)(Trauner, Peter)[p] ChannelF board=SCHACH USA
2AEBEDA05478E8B7F5C1ECA037AC6C2F D Tetris (2004)(Trauner, Peter)[p][a] ChannelF board=SCHACH USA
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Believed Good
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
F7BF7D55A7660FFA80D08AD1BA903FF7 Alien Invasion (USA) ChannelF USA
D89B48AE8C906488CAAC2B2AE1D63D88 Backgammon, Acey-Deucey (USA) ChannelF USA
4FA83F734C139963AA02BDBB7A52E500 Baseball (USA) ChannelF USA
7E5C26A6D1F9A90C68669A9800BA522D Tic-Tac-Toe, Shooting Gallery, Doodle, Quadra-Doodle (USA) ChannelF board=STD USA
1FBD86DCCA0E4619963B902C48AE77F2 Muehle, Tontauben-Schiessen, Kreatives Malspiel, Videoscope (Germany) ChannelF board=STD Germany
4F11F13CBCA685CB20E888F87B3B1586 Desert Fox, Shooting Gallery (USA) ChannelF board=STD USA
B074C867F235FB69CED96C6916673B45 Video Blackjack (USA) ChannelF board=STD USA
1B409FE1154584F4D1AB76B344A73D99 Spitfire (USA) ChannelF board=STD USA
5B86FE22007E6D0A92247809AC8934E9 Spitfire (USA) (proto) ChannelF board=STD USA
32CCA8FF09041A39251D7AADE21EE22F Space War (USA) ChannelF board=STD USA
A8E6103FCAE4D0F9E14D9EDCFC3FC493 Math Quiz I - Addition + Subtraction (USA) ChannelF board=STD USA
86B77EAFDF7B806E19E01724987E384F Math Quiz II - Multiplication + Division (USA) ChannelF board=STD USA
4C10FA5C7316C59EFA241043FC67DFA8 Magic Numbers - Mind Reader + Nim (USA) ChannelF board=STD USA
F80AF74B09D058B90E719BB7DFBDD50E Drag Race (USA) ChannelF board=STD USA
6565DF74539476D66FD78DE1BAC0259C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) ChannelF board=MAZE USA
53E4CC2DA0F2C167E0692B794CB7692C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) (Alt 1) ChannelF board=MAZE USA
5DB71E3B0CD13F7C42790A2CD9072CA1 Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) (Alt 2) ChannelF board=MAZE USA
D89B48AE8C906488CAAC2B2AE1D63D88 Backgammon, Acey-Deucey (USA) ChannelF board=STD USA
4FA83F734C139963AA02BDBB7A52E500 Baseball (USA) ChannelF board=STD USA
3783B6AC359E21B99CFA17773AA811C6 Robot War, Torpedo Alley (USA) ChannelF board=STD USA
FACB452602F59FDDDE1CFBC4D598A282 Robot War (USA) (proto) ChannelF board=STD USA
FACB452602F59FDDDE1CFBC4D598A282 Robot War (USA) (proto) [b] ChannelF board=STD USA
4CB12EDAE37DF23851884B82CA410754 Sonar Search (USA) ChannelF board=STD USA
2B3CA549E27579E4519A765FD8F52D0F Memory Match 1 & 2 (USA) ChannelF board=STD USA
6FFEDAED3C5CD8BA74D98901849CC451 Dodge It (USA) ChannelF board=STD USA
E90339B7068C6227D54F3C0CA637E017 Pinball Challenge (USA) ChannelF board=STD USA
5CBCDA1C44F0DAD02B0DFE209B6325D5 Pinball Challenge (USA) (Alt 1) ChannelF board=STD USA
0124CD0B61DF5502AABD59029CCB6D5A Hangman (USA) ChannelF board=HANG USA
35D61D40EF7EC337CBA092AABAC74DBD Checkers (USA) ChannelF board=STD USA
90A9B3952568F91502A7088BFB0AE07E Video Whizball (USA) ChannelF board=STD USA
25E231E7A464A32B4715BFB47AF89240 Bowling (USA) ChannelF board=STD USA
BB7F7BBBE21F142591CDCAFA98D7F6E4 Casino Poker (USA) ChannelF USA
35D61D40EF7EC337CBA092AABAC74DBD Checkers (USA) ChannelF USA
DFB66EE145FAB65062FDEADAFC8DC34C Slot Machine (USA) ChannelF board=STD USA
9E0711B140E22729687DB1E1354980AB Galactic Space Wars, Lunar Lander (USA) ChannelF board=STD USA
5CCCEE534FD002AF6EB4FCAAA6B95D88 Glactic Space Wars (proto) (USA) ChannelF board=STD USA
9A894D745356A050F95410983C3BC54A Pro Football (USA) ChannelF board=STD USA
BB7F7BBBE21F142591CDCAFA98D7F6E4 Casino Poker (USA) ChannelF board=STD USA
F7BF7D55A7660FFA80D08AD1BA903FF7 Alien Invasion (USA) ChannelF board=STD USA
C2A44D22D3865B036479E9311C74D3AD Ordtaevling (Sweden) ChannelF board=hang Sweden
913ECBAA30816C6D78DE8651251761FC Rat' Mal (Germany) ChannelF board=hang Germany
5568205F926333914DEDC8EF8BF16AF2 Schach (Germany) ChannelF board=SCHACH Germany
7B227DE474806A8AB9474C4716A270B7 Schach [b] (Actually Tennis) ChannelF board=SCHACH Germany
94530113A22AE27AF6ED87B98D9AF62A Color Organ (19xx)(-) ChannelF
C44BE208013B82041D01D2BC1834060B Colortest Demo (200x)(Riddle, Sean) ChannelF
54CF17C48707467295749490D458EAFB Democart (demo) (1977)(Fairchild) ChannelF
F6916B665893AA8138CDE57C37E50ADA Democart 2 (demo) (197x)(Fairchild) ChannelF
54CF17C48707467295749490D458EAFB Demonstration Cartridge (USA) ChannelF USA
F6916B665893AA8138CDE57C37E50ADA Demonstration Cartridge 2 (USA) ChannelF USA
4F11F13CBCA685CB20E888F87B3B1586 Desert Fox, Shooting Gallery (USA) ChannelF USA
6FFEDAED3C5CD8BA74D98901849CC451 Dodge It (USA) ChannelF USA
F80AF74B09D058B90E719BB7DFBDD50E Drag Race (USA) ChannelF USA
9E0711B140E22729687DB1E1354980AB Galactic Space Wars, Lunar Lander (USA) ChannelF USA
0124CD0B61DF5502AABD59029CCB6D5A Hangman (USA) ChannelF board=HANG USA
4C10FA5C7316C59EFA241043FC67DFA8 Magic Numbers - Mind Reader + Nim (USA) ChannelF USA
A8E6103FCAE4D0F9E14D9EDCFC3FC493 Math Quiz I - Addition + Subtraction (USA) ChannelF USA
86B77EAFDF7B806E19E01724987E384F Math Quiz II - Multiplication + Division (USA) ChannelF USA
6565DF74539476D66FD78DE1BAC0259C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) ChannelF board=MAZE USA
53E4CC2DA0F2C167E0692B794CB7692C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) (Alt 1) ChannelF board=MAZE USA
2B3CA549E27579E4519A765FD8F52D0F Memory Match 1 & 2 (USA) ChannelF USA
1FBD86DCCA0E4619963B902C48AE77F2 Muehle, Tontauben-Schiessen, Kreatives Malspiel, Videoscope (Germany) ChannelF Germany
C2A44D22D3865B036479E9311C74D3AD Ordtaevling (Sweden) ChannelF Sweden
E90339B7068C6227D54F3C0CA637E017 Pinball Challenge (USA) ChannelF USA
5CBCDA1C44F0DAD02B0DFE209B6325D5 Pinball Challenge (USA) (Alt 1) ChannelF USA
9A894D745356A050F95410983C3BC54A Pro Football (USA) ChannelF USA
913ECBAA30816C6D78DE8651251761FC Rat' Mal (Germany) ChannelF Germany
3783B6AC359E21B99CFA17773AA811C6 Robot War, Torpedo Alley (USA) ChannelF USA
5568205F926333914DEDC8EF8BF16AF2 Schach (Germany) ChannelF board=SCHACH Germany
442E362A39018F2D117F43FE013D1D8B Scrolling Mountains (200x)(Curtdawg) ChannelF
DFB66EE145FAB65062FDEADAFC8DC34C Slot Machine (USA) ChannelF USA
4CB12EDAE37DF23851884B82CA410754 Sonar Search (USA) ChannelF USA
32CCA8FF09041A39251D7AADE21EE22F Space War (USA) ChannelF USA
1B409FE1154584F4D1AB76B344A73D99 Spitfire (USA) ChannelF USA
7E5C26A6D1F9A90C68669A9800BA522D Tic-Tac-Toe, Shooting Gallery, Doodle, Quadra-Doodle (USA) ChannelF USA
B074C867F235FB69CED96C6916673B45 Video Blackjack (USA) ChannelF USA
90A9B3952568F91502A7088BFB0AE07E Video Whizball (USA) ChannelF USA
C3C7B3246E50117BD5CDDB2B53E6FBAE Werbetextcassette (198x)(Electronic-Partner)(DE) ChannelF DE

View File

@ -45,7 +45,6 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
if (tone == 0)
{
// silence
amplitude = 0;
}
else
{

View File

@ -1,10 +0,0 @@
namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
/// <summary>
/// Cartridge and related functions
/// </summary>
public partial class ChannelF
{
//public byte[] Rom = new byte[4096];
}
}

View File

@ -50,7 +50,8 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
switch (boardStr)
{
// standard cart layout - default to this
case "STD":
case "STD":
default:
// any number of F3851 Program Storage Units (1KB ROM each) or F3856 Program Storage Unit (2KB ROM)
// no on-pcb RAM and no extra IO
return new mapper_STD(rom);
@ -59,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
return new mapper_MAZE(rom);
case "SCHACH":
default:
// F3853 Memory Interface Chip, 6KB of ROM and 2KB of RAM
return new mapper_SCHACH(rom);
@ -69,92 +70,86 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
}
}
/// <summary>
/// Write method for carts that have an IO-accessible 2102 SRAM chip
/// Taken from: https://github.com/mamedev/mame/blob/ee1e4f9683a4953cb9d88f9256017fcbc38e3144/src/devices/bus/chanf/rom.cpp
/// license:BSD-3-Clause
/// copyright-holders:Fabio Priuli
/// </summary>
public void SRAM2102_Write(int index, byte data)
{
switch (index)
{
case 0:
m_latch[0] = data;
m_read_write = data.Bit(0) ? 1 : 0;// BIT(data, 0);
//m_addr_latch = (m_addr_latch & 0x3f3) | (BIT(data, 2) << 2) | (BIT(data, 1) << 3); // bits 2,3 come from this write!
m_addr_latch = (ushort)((m_addr_latch & 0x3f3) | (data.Bit(2) ? 1 : 0 << 2) | (data.Bit(1) ? 1 : 0 << 3)); // bits 2,3 come from this write!
m_addr = m_addr_latch;
m_data0 = data.Bit(3) ? 1 : 0; // BIT(data, 3);
if (m_read_write == 1)
RAM[m_addr] = (byte)m_data0;
break;
case 1:
m_latch[1] = data;
// all bits but 2,3 come from this write, but they are shuffled
// notice that data is 8bits, so when swapping bit8 & bit9 are always 0!
//m_addr_latch = (m_addr_latch & 0x0c) | (bitswap < 16 > ((uint16_t)data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
if (m_addr_latch > 0)
{
BitArray b = new BitArray(m_addr_latch);
b[9] = m_addr_latch.Bit(7);
b[8] = m_addr_latch.Bit(6);
b[7] = m_addr_latch.Bit(5);
b[6] = m_addr_latch.Bit(3);
b[5] = m_addr_latch.Bit(2);
b[4] = m_addr_latch.Bit(1);
b[3] = m_addr_latch.Bit(3);
b[2] = m_addr_latch.Bit(2);
b[1] = m_addr_latch.Bit(4);
b[0] = m_addr_latch.Bit(0);
var resBytes = new byte[1];
b.CopyTo(resBytes, 0);
m_addr_latch = resBytes[0];
}
break;
default:
break;
}
}
/// <summary>
/// Read method for carts that have an IO-accessible 2102 SRAM chip
/// Taken from: https://github.com/mamedev/mame/blob/ee1e4f9683a4953cb9d88f9256017fcbc38e3144/src/devices/bus/chanf/rom.cpp
/// Based on: https://github.com/mamedev/mame/blob/ee1e4f9683a4953cb9d88f9256017fcbc38e3144/src/devices/bus/chanf/rom.cpp
/// license:BSD-3-Clause
/// copyright-holders:Fabio Priuli
/// </summary>
public byte SRAM2102_Read(int index)
{
switch (index)
if (index == 0)
{
case 0:
if (m_read_write == 0)
{
m_addr = m_addr_latch;
m_data0 = RAM[m_addr] & 1;
return (byte)((m_latch[0] & 0x7f) | (m_data0 << 7));
}
if (m_read_write == 0)
{
m_addr = m_addr_latch;
m_data0 = RAM[m_addr] & 1;
return (byte)((m_latch[0] & 0x7f) | (m_data0 << 7));
}
return m_latch[0];
case 1:
return m_latch[1];
default:
return 0xFF;
return m_latch[0];
}
else
{
return m_latch[1];
}
}
/// <summary>
/// Write method for carts that have an IO-accessible 2102 SRAM chip
/// Based on: https://github.com/mamedev/mame/blob/ee1e4f9683a4953cb9d88f9256017fcbc38e3144/src/devices/bus/chanf/rom.cpp
/// license:BSD-3-Clause
/// copyright-holders:Fabio Priuli
/// </summary>
public void SRAM2102_Write(int index, byte data)
{
if (index == 0)
{
m_latch[0] = data;
m_read_write = data.Bit(0) ? 1 : 0;// BIT(data, 0);
//m_addr_latch = (m_addr_latch & 0x3f3) | (BIT(data, 2) a<< 2) | (BIT(data, 1) << 3); // bits 2,3 come from this write!
m_addr_latch = (ushort)((m_addr_latch & 0x3f3) | ((data.Bit(2) ? 1 : 0) << 2) | ((data.Bit(1) ? 1 : 0) << 3)); // bits 2,3 come from this write!
m_addr = m_addr_latch;
m_data0 = data.Bit(3) ? 1 : 0; // BIT(data, 3);
if (m_read_write == 1)
{
RAM[m_addr] = (byte)m_data0;
}
}
else
{
m_latch[1] = data;
// all bits but 2,3 come from this write, but they are shuffled
// notice that data is 8bits, so when swapping bit8 & bit9 are always 0!
//m_addr_latch = (m_addr_latch & 0x0c) | (bitswap < 16 > ((uint16_t)data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
BitArray b = new BitArray(16);
b[3] = false;// data.Bit(3);
b[2] = false; // data.Bit(2);
b[9] = data.Bit(7);
b[8] = data.Bit(6);
b[7] = data.Bit(5);
b[6] = data.Bit(3);
b[5] = data.Bit(2);
b[4] = data.Bit(1);
b[1] = data.Bit(4);
b[0] = data.Bit(0);
var resBytes = new byte[4];
b.CopyTo(resBytes, 0);
m_addr_latch = (ushort)(resBytes[0] | resBytes[1] << 8);
}
}
public void Reset()
{
m_latch[0] = 0;

View File

@ -42,71 +42,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
public override byte ReadPort(ushort addr)
{
var result = 0xFF;
switch (addr)
{
case 0x24:
if (m_read_write == 0)
{
m_addr = m_addr_latch;
m_data0 = RAM[m_addr] & 1;
return (byte)((m_latch[0] & 0x7f) | (m_data0 << 7));
}
return m_latch[0];
case 0x25:
return m_latch[1];
}
return (byte)result;
var index = addr - 0x20;
return SRAM2102_Read(index);
}
public override void WritePort(ushort addr, byte data)
{
switch (addr)
{
case 20:
m_latch[0] = data;
m_read_write = data.Bit(0) ? 1 : 0;// BIT(data, 0);
//m_addr_latch = (m_addr_latch & 0x3f3) | (BIT(data, 2) a<< 2) | (BIT(data, 1) << 3); // bits 2,3 come from this write!
m_addr_latch = (ushort)((m_addr_latch & 0x3f3) | (data.Bit(2) ? 1 : 0 << 2) | (data.Bit(1) ? 1 : 0 << 3)); // bits 2,3 come from this write!
m_addr = m_addr_latch;
m_data0 = data.Bit(3) ? 1 : 0; // BIT(data, 3);
if (m_read_write == 1)
RAM[m_addr] = (byte)m_data0;
break;
case 21:
m_latch[1] = data;
// all bits but 2,3 come from this write, but they are shuffled
// notice that data is 8bits, so when swapping bit8 & bit9 are always 0!
//m_addr_latch = (m_addr_latch & 0x0c) | (bitswap < 16 > ((uint16_t)data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
BitArray b = new BitArray(m_addr_latch);
b[9] = m_addr_latch.Bit(7);
b[8] = m_addr_latch.Bit(6);
b[7] = m_addr_latch.Bit(5);
b[6] = m_addr_latch.Bit(3);
b[5] = m_addr_latch.Bit(2);
b[4] = m_addr_latch.Bit(1);
b[3] = m_addr_latch.Bit(3);
b[2] = m_addr_latch.Bit(2);
b[1] = m_addr_latch.Bit(4);
b[0] = m_addr_latch.Bit(0);
var resBytes = new byte[1];
b.CopyTo(resBytes, 0);
m_addr_latch = resBytes[0];
break;
}
}
var index = addr - 0x20;
SRAM2102_Write(index, data);
}
}
}

View File

@ -21,7 +21,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
ROM[i] = rom[i];
}
RAM = new byte[400];
RAM = new byte[0x400];
}
public override byte ReadBus(ushort addr)
@ -37,70 +37,14 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
public override byte ReadPort(ushort addr)
{
var result = 0xFF;
switch (addr)
{
case 0x24:
if (m_read_write == 0)
{
m_addr = m_addr_latch;
m_data0 = RAM[m_addr] & 1;
return (byte)((m_latch[0] & 0x7f) | (m_data0 << 7));
}
return m_latch[0];
case 0x25:
return m_latch[1];
}
return (byte)result;
var index = addr - 0x24;
return SRAM2102_Read(index);
}
public override void WritePort(ushort addr, byte data)
{
switch (addr)
{
case 24:
m_latch[0] = data;
m_read_write = data.Bit(0) ? 1 : 0;// BIT(data, 0);
//m_addr_latch = (m_addr_latch & 0x3f3) | (BIT(data, 2) << 2) | (BIT(data, 1) << 3); // bits 2,3 come from this write!
m_addr_latch = (ushort)((m_addr_latch & 0x3f3) | (data.Bit(2) ? 1 : 0 << 2) | (data.Bit(1) ? 1 : 0 << 3)); // bits 2,3 come from this write!
m_addr = m_addr_latch;
m_data0 = data.Bit(3) ? 1 : 0; // BIT(data, 3);
if (m_read_write == 1)
RAM[m_addr] = (byte)m_data0;
break;
case 25:
m_latch[1] = data;
// all bits but 2,3 come from this write, but they are shuffled
// notice that data is 8bits, so when swapping bit8 & bit9 are always 0!
//m_addr_latch = (m_addr_latch & 0x0c) | (bitswap < 16 > ((uint16_t)data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
BitArray b = new BitArray(m_addr_latch);
b[9] = m_addr_latch.Bit(7);
b[8] = m_addr_latch.Bit(6);
b[7] = m_addr_latch.Bit(5);
b[6] = m_addr_latch.Bit(3);
b[5] = m_addr_latch.Bit(2);
b[4] = m_addr_latch.Bit(1);
b[3] = m_addr_latch.Bit(3);
b[2] = m_addr_latch.Bit(2);
b[1] = m_addr_latch.Bit(4);
b[0] = m_addr_latch.Bit(0);
var resBytes = new byte[1];
b.CopyTo(resBytes, 0);
m_addr_latch = resBytes[0];
break;
}
var index = addr - 0x24;
SRAM2102_Write(index, data);
}
}
}

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
/// </summary>
public class mapper_SCHACH : VesCartBase
{
public override string BoardType => "MAZE";
public override string BoardType => "SCHACH";
public mapper_SCHACH(byte[] rom)
{

View File

@ -26,7 +26,10 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
public override byte ReadBus(ushort addr)
{
var off = addr - 0x800;
return ROM[off];
if (off < ROM.Length)
return ROM[off];
else
return 0xFF;
}
public override void WriteBus(ushort addr, byte value)

View File

@ -119,64 +119,5 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
return (byte)(w & 0xFF);
}
}
/// <summary>
/// Cycles through all the input callbacks
/// This should be done once per frame
/// </summary>
public bool PollInput()
{
bool noInput = true;
InputCallbacks.Call();
lock (this)
{
for (int i = 0; i < ButtonsConsole.Length; i++)
{
var key = ButtonsConsole[i];
bool prevState = StateConsole[i]; // CTRLConsole.Bit(i);
bool currState = _controller.IsPressed(key);
if (currState != prevState)
{
StateConsole[i] = currState;
noInput = false;
if (key == "RESET" && StateConsole[i] == true)
{
CPU.Reset();
return true;
}
}
}
for (int i = 0; i < ButtonsRight.Length; i++)
{
var key = "P1 " + ButtonsRight[i];
bool prevState = StateRight[i];
bool currState = _controller.IsPressed(key);
if (currState != prevState)
{
StateRight[i] = currState;
noInput = false;
}
}
for (int i = 0; i < ButtonsLeft.Length; i++)
{
var key = "P2 " + ButtonsLeft[i];
bool prevState = StateLeft[i];
bool currState = _controller.IsPressed(key);
if (currState != prevState)
{
StateLeft[i] = currState;
noInput = false;
}
}
}
return noInput;
}
}
}

View File

@ -12,8 +12,8 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
public bool DeterministicEmulation { get; set; }
private static readonly double cpuFreq = 1.7897725;
private static readonly double refreshRate = 60;
private double cpuFreq => region == RegionType.NTSC ? 1.7897725 : 2.000000;
private double refreshRate => region == RegionType.NTSC ? 60 : 50;
public int ClockPerFrame;
public int FrameClock = 0;
@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
public bool FrameAdvance(IController controller, bool render, bool renderSound)
{
_controller = controller;
_isLag = false;
_isLag = true;
if (_tracer.IsEnabled())
{
@ -40,29 +40,33 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
CPU.TraceCallback = null;
}
_isLag = PollInput();
while (FrameClock++ < ClockPerFrame)
{
CPU.ExecuteOne();
}
PollInput();
FrameClock = 0;
_frame++;
if (_isLag)
_lagCount++;
return true;
}
private int _frame;
#pragma warning disable CS0414
private int _lagcount;
private bool _islag;
//private int _lagcount;
//private bool _islag;
#pragma warning restore CS0414
public void ResetCounters()
{
_frame = 0;
_lagcount = 0;
_islag = false;
_lagCount = 0;
_isLag = false;
}
public int Frame => _frame;

View File

@ -56,6 +56,10 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
[Description("If true, the core agrees to behave in a completely deterministic manner")]
[DefaultValue(true)]
public bool DeterministicEmulation { get; set; }
[DisplayName("Region")]
[Description("NTSC or PAL - Affects the CPU clock speed and refresh rate")]
[DefaultValue(RegionType.NTSC)]
public RegionType Region { get; set; }
public ChannelFSyncSettings Clone()
{
@ -72,5 +76,11 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
return !DeepEquality.DeepEquals(x, y);
}
}
public enum RegionType
{
NTSC,
PAL
}
}
}

View File

@ -60,15 +60,14 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
}
public int _frameHz = 60;
//public int _frameHz => region == RegionType.NTSC ? 60 : 50;
public int[] CroppedBuffer = new int[102 * 58];
public int VirtualWidth => BufferWidth * 4;
public int VirtualHeight => (int)((double)BufferHeight * 1.15) * 4;
public int VirtualHeight => (int)((double)BufferHeight * 1.43) * 4;
public int BufferWidth => 102; //128
public int BufferHeight => 58; //64
public int BackgroundColor => Colors.ARGB(0xFF, 0xFF, 0xFF);
public int VsyncNumerator => _frameHz;
public int VsyncNumerator => (int)refreshRate;
public int VsyncDenominator => 1;
public int[] GetVideoBuffer()
@ -98,6 +97,6 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
return CroppedBuffer;
}
public DisplayType Region => DisplayType.NTSC;
public DisplayType Region => region == RegionType.NTSC ? DisplayType.NTSC : DisplayType.PAL;
}
}

View File

@ -20,5 +20,67 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private int _lagCount = 0;
private bool _isLag = false;
/// <summary>
/// Cycles through all the input callbacks
/// This should be done once per frame
/// </summary>
public bool PollInput()
{
bool noInput = true;
InputCallbacks.Call();
lock (this)
{
for (int i = 0; i < ButtonsConsole.Length; i++)
{
var key = ButtonsConsole[i];
bool prevState = StateConsole[i]; // CTRLConsole.Bit(i);
bool currState = _controller.IsPressed(key);
if (currState != prevState)
{
StateConsole[i] = currState;
noInput = false;
if (key == "RESET" && StateConsole[i] == true)
{
CPU.Reset();
for (int l = 0; l < OutputLatch.Length; l++)
{
OutputLatch[l] = 0;
}
return true;
}
}
}
for (int i = 0; i < ButtonsRight.Length; i++)
{
var key = "P1 " + ButtonsRight[i];
bool prevState = StateRight[i];
bool currState = _controller.IsPressed(key);
if (currState != prevState)
{
StateRight[i] = currState;
noInput = false;
}
}
for (int i = 0; i < ButtonsLeft.Length; i++)
{
var key = "P2 " + ButtonsLeft[i];
bool prevState = StateLeft[i];
bool currState = _controller.IsPressed(key);
if (currState != prevState)
{
StateLeft[i] = currState;
noInput = false;
}
}
}
return noInput;
}
}
}

View File

@ -23,6 +23,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
var settings = lp.Settings ?? new ChannelFSettings();
var syncSettings = lp.SyncSettings ?? new ChannelFSyncSettings();
region = syncSettings.Region;
MemoryCallbacks = new MemoryCallbackSystem(new[] { "System Bus" });
ControllerDefinition = ChannelFControllerDefinition;
@ -70,5 +73,6 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
public IController _controller;
public VesCartBase Cartridge;
public RegionType region;
}
}

View File

@ -37,8 +37,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// b1: MODE
// b2: HOLD
// b3: START
// RESET button is connected directly to the RST pin on the CPU (this is handled here in the PollInput() method)
result = ~(DataConsole & 0x0F) | OutputLatch[addr];
// RESET button is connected directly to the RST pin on the CPU (this is handled here in the PollInput() method)
result = (~DataConsole & 0x0F) | OutputLatch[addr];
_isLag = false;
break;
case 1:
@ -52,6 +53,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// b5: CW
var v1 = LS368Enable ? DataRight : DataRight | 0xC0;
result = (~v1) | OutputLatch[addr];
_isLag = false;
break;
case 4:
@ -68,6 +70,8 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// b7: PUSH
var v2 = LS368Enable ? DataLeft : 0xFF;
result = (~v2) | OutputLatch[addr];
if (LS368Enable)
_isLag = false;
break;
case 5:
@ -76,11 +80,10 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
default:
// possible cartridge hardware IO space
result = ~(Cartridge.ReadPort(addr)) | OutputLatch[addr];
result = (Cartridge.ReadPort(addr));
break;
}
return (byte)result;
}
@ -116,7 +119,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
case 5:
OutputLatch[addr] = value;
latch_y = (value | 0xC0) ^ 0xFF;
var audio = (value >> 6) & 0x03;
var audio = ((value ^ 0xFF) >> 6) & 0x03;
if (audio != tone)
{
tone = audio;
@ -128,7 +131,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
default:
// possible write to cartridge hardware
Cartridge.WritePort(addr, (byte)(value ^ 0xFF));
Cartridge.WritePort(addr, (byte)(value));
break;
}
}

View File

@ -0,0 +1,94 @@
# ChannelFHawk
## Fairchild Channel F Core
Work in progress.
### Testing
Lists taken from https://en.wikipedia.org/wiki/Fairchild_Channel_F_Videocarts and http://www.classic-consoles-center.at/fairchild/fairchild-channel-f-and-relatives-cart-list
Group 1: Fairchild Channel F (USA) and Grandstand Video Entertainment Computer (UK)
Group 2: Saba Videoplay (Germany)
Group 3: Luxor Video Entertainment System (Sweden)
Group 4: Nordmende Teleplay (Germany)
Group 5: ITT Tele-Match Processor (Germany)
#### Commercial Games (USA)
| Status | VideoCartID | Group | Game | Cart Info | MD5
| --- | --- | --- | --- | --- | --- |
| Working | 01 | 1 | Tic Tac Toe / Shooting Gallery / Doodle / Quadradoodle | STANDARD | 7E5C26A6D1F9A90C68669A9800BA522D |
| Working | 02 | 1 | Desert Fox / Shooting Gallery | STANDARD | 4F11F13CBCA685CB20E888F87B3B1586 |
| Untested | 03 | 1 | Video Blackjack | STANDARD | B074C867F235FB69CED96C6916673B45 |
| Working | 04 | 1 | Spitfire | STANDARD | 1B409FE1154584F4D1AB76B344A73D99 |
| Working | 04 | 1 | Spitfire (proto) | STANDARD | 5B86FE22007E6D0A92247809AC8934E9 |
| Untested | 05 | 1 | Space War | STANDARD | 32CCA8FF09041A39251D7AADE21EE22F |
| Working | 06 | 1 | Math Quiz I | STANDARD | A8E6103FCAE4D0F9E14D9EDCFC3FC493 |
| Working | 07 | 1 | Math Quiz II | STANDARD | 86B77EAFDF7B806E19E01724987E384F |
| Working | 08 | 1 | Magic Numbers | STANDARD | 4C10FA5C7316C59EFA241043FC67DFA8 |
| Working | 09 | 1 | Drag Race | STANDARD | F80AF74B09D058B90E719BB7DFBDD50E |
| Working | 10 | 1 | Maze | SRAM2102 | 6565DF74539476D66FD78DE1BAC0259C |
| Working | 10 | 1 | Maze (alt 1) | SRAM2102 | 6565DF74539476D66FD78DE1BAC0259C |
| Working | 10 | 1 | Maze (alt 2) | SRAM2102 | 5DB71E3B0CD13F7C42790A2CD9072CA1 |
| Working | 10 | 1 | Maze (Multicart Hack) | F3853 | 5DB71E3B0CD13F7C42790A2CD9072CA1 |
| Working | 11 | 1 | Backgammon / Acey Deucey | STANDARD | D89B48AE8C906488CAAC2B2AE1D63D88 |
| Working | 12 | 1 | Baseball | STANDARD | 4FA83F734C139963AA02BDBB7A52E500 |
| Working | 13 | 1 | Robot War / Torpedo Alley | STANDARD | 3783B6AC359E21B99CFA17773AA811C6 |
| Untested | 13 | 1 | Robot War (proto) | STANDARD | FACB452602F59FDDDE1CFBC4D598A282 |
| Untested | 13 | 1 | Robot War (proto) [b] | STANDARD | E1FB8D61FFE07B53869A93A8AD0C04A8 |
| Working | 14 | 1 | Sonar Search | STANDARD | 4CB12EDAE37DF23851884B82CA410754 |
| Working | 15 | 1 | Memory Match 1 & 2 | STANDARD | 2B3CA549E27579E4519A765FD8F52D0F |
| Untested | 16 | 1 | Dodge It | STANDARD | 6FFEDAED3C5CD8BA74D98901849CC451 |
| Working | 17 | 1 | Pinball Challenge | STANDARD | E90339B7068C6227D54F3C0CA637E017 |
| Working | 17 | 1 | Pinball Challenge (Alt 1) | STANDARD | 5CBCDA1C44F0DAD02B0DFE209B6325D5 |
| Working | 18 | 1 | Hangman | SRAM2102 | 0124CD0B61DF5502AABD59029CCB6D5A |
| Not Working | 18 | 1 | Hangman (Multicart Hack) | F3853 | 533BAC14DE68FBA49078EEF8E9502DD2 |
| Untested | 19 | 1 | Checkers | STANDARD | 35D61D40EF7EC337CBA092AABAC74DBD |
| Working | 20 | 1 | Video Whizball | STANDARD | 90A9B3952568F91502A7088BFB0AE07E |
| Working | 21 | 1 | Bowling | STANDARD | 25E231E7A464A32B4715BFB47AF89240 |
| Working | 22 | 1 | Slot Machine | STANDARD | DFB66EE145FAB65062FDEADAFC8DC34C |
| Working | 23 | 1 | Galactic Space Wars, Lunar Lander | STANDARD | 9E0711B140E22729687DB1E1354980AB |
| Working | 23 | 1 | Glactic Space Wars (proto) | STANDARD | 5CCCEE534FD002AF6EB4FCAAA6B95D88 |
| Working | 24 | 1 | Pro Football | STANDARD | 9A894D745356A050F95410983C3BC54A |
| Working | 25 | 1 | Casino Poker | STANDARD | BB7F7BBBE21F142591CDCAFA98D7F6E4 |
| Working | 26 | 1 | Alien Invasion | STANDARD | F7BF7D55A7660FFA80D08AD1BA903FF7 |
| Untested | xx | 1 | | | |
| Untested | xx | 1 | | | |
| Untested | xx | 1 | | | |
#### Commercial Games (Rest of World Regional Modifications)
| Status | VideoCartID | Group | Game | Cart Info | MD5
| --- | --- | --- | --- | --- | --- |
| Working | 01 | 2 | Mühle / Tontauben-Schießen / Kreatives Malspiel / Videoscope | STANDARD | 1FBD86DCCA0E4619963B902C48AE77F2 |
| Working | 18 | 3 | Ordtävling (Sweden) | SRAM2102 | C2A44D22D3865B036479E9311C74D3AD |
| Working | 16 | 2 | Rat' Mal (Germany) | SRAM2102 | 913ECBAA30816C6D78DE8651251761FC |
| Not Working | 20 | 2 | Schach (Germany) | F3853 | 5568205F926333914DEDC8EF8BF16AF2 |
| Working | 20 | 2 | Schach (Actually Tennis) | F3853 | 7B227DE474806A8AB9474C4716A270B7 |
#### Homebrew Games
| Status | VideoCartID | Group | Game | Cart Info | MD5
| --- | --- | --- | --- | --- | --- |
| Working | xx | 1 | Tetris (2004)(Trauner, Peter)[p] | SRAM2102 | D7050AF61479AA549206250441AA2B0F |
| Working | xx | 1 | Tetris (2004)(Trauner, Peter)[p][a] | SRAM2102 | 2AEBEDA05478E8B7F5C1ECA037AC6C2F |
#### Demos
| Status | VideoCartID | Group | Game | Cart Info | MD5
| --- | --- | --- | --- | --- | --- |
#### Applications
| Status | VideoCartID | Group | Game | Cart Info | MD5
| --- | --- | --- | --- | --- | --- |
#### Bad dumps?
| Status | VideoCartID | Group | Game | Cart Info | MD5
| --- | --- | --- | --- | --- | --- |
| Not Working | 04 | 1 | Spitfire (proto)[b] | Standard | 0CFD9B9213CFF4A9DF9DD7FEA4663236 |
| Not Working | 20 | 2 | Schach (Germany) [b] | F3853 | 7385E596BF2A58E2186439AC1E49C075 |
-Asnivor