F8: Some commenting

This commit is contained in:
Asnivor 2019-04-24 14:39:03 +01:00
parent 033fe57763
commit 7d961d85bd
5 changed files with 277 additions and 176 deletions

View File

@ -35,11 +35,11 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
case 0x09: LR_P_K(); break; // LR P, (K)
case 0x0A: LR_A_IS(); break; // LR A, (ISAR)
case 0x0B: LR_IS_A(); break; // LR ISAR, (A)
case 0x0C: LR_PK(); break; // LR PC1, (PC0); LR PC0l <- (r13); LR PC0h, (r12)
case 0x0C: PK(); break; // LR PC1, (PC0); LR PC0l <- (r13); LR PC0h, (r12)
case 0x0D: LR_P0_Q(); break; // LR PC0l, (r15); LR PC0h <- (r14)
case 0x0E: LR_Q_DC(); break; // LR r14, (DC0h); r15 <- (DC0l)
case 0x0F: LR_DC_Q(); break; // LR DC0h, (r14); DC0l <- (r15)
case 0x10: LR_DC_Q(); break; // LR DC0h, (r10); DC0l <- (r11)
case 0x10: LR_DC_H(); break; // LR DC0h, (r10); DC0l <- (r11)
case 0x11: LR_H_DC(); break; // LR r10, (DC0h); r11 <- (DC0l)
case 0x12: SHIFT_R(1); break; // Shift (A) right one bit position (zero fill)
case 0x13: SHIFT_L(1); break; // Shift (A) left one bit position (zero fill)

View File

@ -11,32 +11,6 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
public sealed partial class F3850
{
/*
private void IncrementBySignedByte(ushort dest, byte src)
{
if (src >= 0x80)
{
dest -= (ushort)(src & 0x80);
}
else
{
dest += (ushort)(src & 0x80);
}
}
private void IncrementBySignedByte(byte dest, byte src)
{
if (src >= 0x80)
{
dest -= (byte)(src & 0x80);
}
else
{
dest += (byte)(src & 0x80);
}
}
*/
public void LR8_Func(ushort dest, ushort src)
{
if (dest == DB)
@ -49,6 +23,11 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// mask for status register
Regs[dest] = (ushort)(Regs[src] & 0x1F);
}
else if (dest == ISAR)
{
// mask for ISAR register
Regs[dest] = (ushort)(Regs[src] & 0x3F);
}
else
{
Regs[dest] = Regs[src];
@ -67,6 +46,11 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// mask for status register
Regs[dest] = (ushort)(Regs[src] & 0x1F);
}
else if (dest == ISAR)
{
// mask for ISAR register
Regs[dest] = (ushort)(Regs[src] & 0x3F);
}
else
{
Regs[dest] = Regs[src];
@ -79,6 +63,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
FlagS = Regs[dest] > 127;
}
public void SZ_FLAG_TEST(ushort value)
{
// SZ only
FlagO = false;
FlagC = false;
FlagZ = (value & 0xFF) == 0;
FlagS = value > 127;
}
public void SR_Func(ushort src, ushort index)
{
int shft = (Regs[src] >> index) & 0xFF;
@ -211,6 +204,8 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
FlagO = (Regs[dest].Bit(7) != Regs[src].Bit(7)) && (Regs[dest].Bit(7) != ans.Bit(7));
FlagS = ans > 127;
Regs[dest] = ans;
}
public void INC8_Func(ushort src)

View File

@ -85,7 +85,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
/// <summary>
/// 0xff value for arithmetic ops
/// </summary>
public ushort BYTE = 78;
public ushort ONE = 78;
/// <summary>
@ -179,7 +179,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
Regs[i] = 0;
}
Regs[BYTE] = 0xff;
Regs[ONE] = 1;
}
}
}

View File

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components;
namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
@ -16,8 +17,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_A_KU()
{
PopulateCURINSTR(
OP_LR8, A, Kh, // S
ROMC_00_S,
// S
OP_LR8, A, Kh, // A <- (r12)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -25,8 +27,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_A_KL()
{
PopulateCURINSTR(
OP_LR8, A, Kl, // S
ROMC_00_S,
// S
OP_LR8, A, Kl, // A <- (r13)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -34,8 +37,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_A_QU()
{
PopulateCURINSTR(
OP_LR8, A, Qh, // S
ROMC_00_S,
// S
OP_LR8, A, Qh, // A <- (r14)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -43,8 +47,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_A_QL()
{
PopulateCURINSTR(
OP_LR8, A, Ql, // S
ROMC_00_S,
// S
OP_LR8, A, Ql, // A <- (r15)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -52,8 +57,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_KU_A()
{
PopulateCURINSTR(
OP_LR8, Kh, A, // S
ROMC_00_S,
// S
OP_LR8, Kh, A, // r12 <- (A)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -61,8 +67,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_KL_A()
{
PopulateCURINSTR(
OP_LR8, Kl, A, // S
ROMC_00_S,
// S
OP_LR8, Kl, A, // r13 <- (A)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -70,8 +77,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_QU_A()
{
PopulateCURINSTR(
OP_LR8, Qh, A, // S
ROMC_00_S,
// S
OP_LR8, Qh, A, // r14 <- (A)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -79,8 +87,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_QL_A()
{
PopulateCURINSTR(
OP_LR8, Ql, A, // S
ROMC_00_S,
// S
OP_LR8, Ql, A, // r15 <- (A)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -88,19 +97,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_K_P()
{
PopulateCURINSTR(
ROMC_07, // L
// L
ROMC_07, // DB <- (PC1h)
IDLE,
IDLE,
OP_LR8, Kh, DB,
OP_LR8, Kh, DB, // r12 <- (DB)
IDLE,
IDLE,
ROMC_0B, // L
// L
ROMC_0B, // DB <- (PC1l)
IDLE,
IDLE,
OP_LR8, Kl, DB,
OP_LR8, Kl, DB, // r13 <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -109,19 +121,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_P_K()
{
PopulateCURINSTR(
OP_LR8, DB, Kh, // L
// L
OP_LR8, DB, Kh, // DB <- (r12)
IDLE,
IDLE,
ROMC_15,
ROMC_15, // PC1h <- (DB)
IDLE,
IDLE,
OP_LR8, DB, Kl, // L
// L
OP_LR8, DB, Kl, // DB <- (r13)
IDLE,
IDLE,
ROMC_18,
ROMC_18, // PC1l <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -130,8 +145,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_A_IS()
{
PopulateCURINSTR(
OP_LR8, A, ISAR, // S
ROMC_00_S,
// S
OP_LR8, A, ISAR, // A <- (ISAR)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -139,28 +155,32 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_IS_A()
{
PopulateCURINSTR(
OP_LR8, ISAR, A, // S
ROMC_00_S,
// S
OP_LR8, ISAR, A, // ISAR <- (A)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
private void LR_PK()
private void PK()
{
PopulateCURINSTR(
OP_LR8, DB, Kh, // L
// L
OP_LR8, DB, Kl, // DB <- (r13)
IDLE,
IDLE,
ROMC_12,
ROMC_12, // PC1 <- (PC0); PC0l <- (DB)
IDLE,
IDLE,
OP_LR8, DB, Kl, // L
// L
OP_LR8, DB, Kh, // DB <- (r12)
IDLE,
IDLE,
ROMC_14,
ROMC_14, // PC0h <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -169,19 +189,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_P0_Q()
{
PopulateCURINSTR(
OP_LR8, DB, Ql, // L
// L
OP_LR8, DB, Ql, // DB <- (r15)
IDLE,
IDLE,
ROMC_17,
ROMC_17, // PC0l <- (DB)
IDLE,
IDLE,
OP_LR8, DB, Qh, // L
// L
OP_LR8, DB, Qh, // DB <- (r14)
IDLE,
IDLE,
ROMC_14,
ROMC_14, // PC0h <- DB
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -190,19 +213,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_Q_DC()
{
PopulateCURINSTR(
ROMC_06, // L
// L
ROMC_06, // DB <- (DC0h)
IDLE,
IDLE,
OP_LR8, Qh, DB,
OP_LR8, Qh, DB, // r14 <- (DB)
IDLE,
IDLE,
ROMC_09, // L
// L
ROMC_09, // DB <- (DC0l)
IDLE,
IDLE,
OP_LR8, Ql, DB,
OP_LR8, Ql, DB, // r15 <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -211,19 +237,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_DC_Q()
{
PopulateCURINSTR(
OP_LR8, DB, Qh, // L
// L
OP_LR8, DB, Qh, // DB <- (r14)
IDLE,
IDLE,
ROMC_16,
ROMC_16, // DC0h <- (DB)
IDLE,
IDLE,
OP_LR8, DB, Ql, // L
// L
OP_LR8, DB, Ql, // DB <- (r15)
IDLE,
IDLE,
ROMC_19,
ROMC_19, // DC0l <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -232,19 +261,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_DC_H()
{
PopulateCURINSTR(
OP_LR8, DB, Hh, // L
// L
OP_LR8, DB, Hh, // DB <- (r10)
IDLE,
IDLE,
ROMC_16,
ROMC_16, // DC0h <- (DB)
IDLE,
IDLE,
OP_LR8, DB, Hl, // L
// L
OP_LR8, DB, Hl, // DB <- (r11)
IDLE,
IDLE,
ROMC_19,
ROMC_19, // DC0l <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -253,19 +285,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_H_DC()
{
PopulateCURINSTR(
ROMC_06, // L
// L
ROMC_06, // DB <- (DC0h)
IDLE,
IDLE,
OP_LR8, Hh, DB,
OP_LR8, Hh, DB, // r10 <- (DB)
IDLE,
IDLE,
ROMC_09, // L
// L
ROMC_09, // DB <- (DC0l)
IDLE,
IDLE,
OP_LR8, Hl, DB,
OP_LR8, Hl, DB, // r11 <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -274,8 +309,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void SHIFT_R(ushort index)
{
PopulateCURINSTR(
OP_SHFT_R, A, index, // S
ROMC_00_S,
// S
OP_SHFT_R, A, index, // A >> (index)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -283,8 +319,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void SHIFT_L(ushort index)
{
PopulateCURINSTR(
OP_SHFT_L, A, index, // S
ROMC_00_S,
// S
OP_SHFT_L, A, index, // A << (index)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -292,13 +329,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LM()
{
PopulateCURINSTR(
ROMC_02, // L
// L
ROMC_02, // DB <- ((DC0)); DC0++
IDLE,
IDLE,
OP_LR8, DB, A,
OP_LR8, A, DB, // A <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -307,13 +346,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void ST()
{
PopulateCURINSTR(
OP_LR8, DB, A, // L
// L
OP_LR8, DB, A, // DB <- (A)
IDLE,
IDLE,
ROMC_05,
ROMC_05, // ((DC0)) <- (DB); DC0++
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -322,8 +363,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void COM()
{
PopulateCURINSTR(
OP_XOR8C, A, DB, // S
ROMC_00_S,
// S
OP_XOR8C, A, ONE, // A <- A XOR 0xFF
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -331,8 +373,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LNK()
{
PopulateCURINSTR(
OP_LNK, // S
ROMC_00_S,
// S
OP_LNK, // A <- A + FlagC
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -340,11 +383,13 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void DI()
{
PopulateCURINSTR(
ROMC_1C_S, // S
OP_DI,
// S
ROMC_1C_S, // Idle
OP_DI, // Clear ICB
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -353,11 +398,13 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void EI()
{
PopulateCURINSTR(
ROMC_1C_S, // S
OP_EI,
// S
ROMC_1C_S, // Idle
OP_EI, // Set ICB
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -366,11 +413,13 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void POP()
{
PopulateCURINSTR(
ROMC_04, // S
// S
ROMC_04, // PC0 <- (PC1)
IDLE,
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -379,11 +428,13 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_W_J()
{
PopulateCURINSTR(
ROMC_1C_S, // S
// S
ROMC_1C_S, // Idle
IDLE,
OP_LR8, W, J,
OP_LR8, W, J, // W <- (r9)
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -392,8 +443,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LR_J_W()
{
PopulateCURINSTR(
OP_LR8, J, W, // S
ROMC_00_S,
// S
OP_LR8, J, W, // r9 <- (W)
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -401,8 +453,9 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void INC()
{
PopulateCURINSTR(
OP_INC8, A, // S
ROMC_00_S,
// S
OP_INC8, A, // A <- A + 1
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
END);
}
@ -410,13 +463,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void LI()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
OP_LR8, A, DB,
OP_LR8, A, DB, // A <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -425,13 +480,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void NI()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
OP_AND8, A, DB,
OP_AND8, A, DB, // A <- (A) AND (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -440,13 +497,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void OI()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
OP_OR8, A, DB,
OP_OR8, A, DB, // A <- (A) OR (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -455,13 +514,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void XI()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
OP_XOR8, A, DB,
OP_XOR8, A, DB, // A <- (A) XOR (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -470,13 +531,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void AI()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
OP_ADD8, A, DB,
OP_ADD8, A, DB, // A <- (A) + (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -485,13 +548,15 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void CI()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
OP_CI, A,
OP_CI, A, // Set flags for A <- (A) + (DB) + 1 (do not store result in A)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -501,7 +566,8 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void ILLEGAL()
{
PopulateCURINSTR(
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -510,19 +576,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void IN()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB/IO <- ((PC0)); PC0++
IDLE,
IDLE,
IDLE,
IDLE,
IDLE,
ROMC_1B, // L
// L
ROMC_1B, // DB <- ((IO));
IDLE,
IDLE,
OP_LR8_IO, A, DB,
OP_LR8_IO, A, DB, // A <- (DB)
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -531,19 +600,22 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void OUT()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB/IO <- ((PC0)); PC0++
IDLE,
IDLE,
OP_LR8, DB, A,
OP_LR8, DB, A, // DB <- (A)
IDLE,
IDLE,
ROMC_1A, // L
// L
ROMC_1A, // ((IO)) <- DB
IDLE,
IDLE,
IDLE,
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -552,29 +624,34 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void PI()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB/IO <- ((PC0)); PC0++
IDLE,
IDLE,
OP_LR8, A, DB,
OP_LR8, A, DB, // A <- (DB)
IDLE,
IDLE,
ROMC_0D, // S
// S
ROMC_0D, // PC1 <- PC0 + 1
IDLE,
IDLE,
IDLE,
ROMC_0C, // L
// L
ROMC_0C, // DB <- ((PC0)); PC0l <- (DB)
IDLE,
IDLE,
OP_LR8, DB, A,
OP_LR8, DB, A, // DB <- (A)
IDLE,
IDLE,
ROMC_14, // L
// L
ROMC_14, // PC0h <- (DB)
IDLE,
IDLE,
IDLE,
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -583,25 +660,29 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void JMP()
{
PopulateCURINSTR(
ROMC_03_L, // L
// L
ROMC_03_L, // DB/IO <- ((PC0)); PC0++
IDLE,
IDLE,
OP_LR8, A, DB,
OP_LR8, A, DB, // A <- (DB)
IDLE,
IDLE,
ROMC_0C, // L
// L
ROMC_0C, // DB <- ((PC0)); PC0l <- DB
IDLE,
IDLE,
OP_LR8, DB, A,
OP_LR8, DB, A, // DB <- (A)
IDLE,
IDLE,
ROMC_14, // L
// L
ROMC_14, // PC0h <- (DB)
IDLE,
IDLE,
IDLE,
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -610,27 +691,32 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void DCI()
{
PopulateCURINSTR(
ROMC_11, // L
// L
ROMC_11, // DB <- ((PC0)); DC0h <- DB
IDLE,
IDLE,
IDLE,
IDLE,
IDLE,
ROMC_03_S, // S
// S
ROMC_03_S, // DB/IO <- ((PC0)); PC0++
IDLE,
IDLE,
IDLE,
ROMC_0E, // L
// L
ROMC_0E, // DB <- ((PC0)); DC0l <- (DB)
IDLE,
IDLE,
IDLE,
IDLE,
IDLE,
ROMC_03_S, // S
// S
ROMC_03_S, // DB/IO <- ((PC0)); PC0++
IDLE,
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -639,7 +725,8 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void NOP()
{
PopulateCURINSTR(
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -648,11 +735,13 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void XDC()
{
PopulateCURINSTR(
ROMC_1D, // S
// S
ROMC_1D, // DC0 <-> DC1
IDLE,
IDLE,
IDLE,
ROMC_00_S, // S
// S
ROMC_00_S, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -661,9 +750,10 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void DS(ushort rIndex)
{
PopulateCURINSTR(
OP_LR8, rIndex, BYTE, // L
// L
OP_SUB8, rIndex, ONE,
IDLE,
ROMC_00_L,
ROMC_00_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);
@ -671,9 +761,10 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
private void DS_ISAR()
{
PopulateCURINSTR(
OP_DS_IS, // L
// L
OP_DS_IS,
IDLE,
ROMC_00_L,
ROMC_00_L, // DB <- ((PC0)); PC0++
IDLE,
IDLE,
END);

View File

@ -116,6 +116,8 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
public const ushort OP_ASD_IS = 129;
public const ushort OP_XS_IS = 130;
public const ushort OP_NS_IS = 131;
public const ushort OP_AFTEST = 132;
public const ushort OP_SUB8 = 133;
public F3850()
@ -281,7 +283,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// DS op performed indirectly on the ScratchPad register pointed to by the ISAR
case OP_DS_IS:
LR8_Func(Regs[ISAR], Regs[BYTE]);
SUB8_Func(Regs[ISAR], ONE);
break;
// ISAR is incremented
@ -418,12 +420,14 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// A <- (I/O Port 0 or 1)
case OP_IN:
IN_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
Regs[cur_instr[instr_pntr++]] = ReadHardware(cur_instr[instr_pntr++]);
//IN_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
break;
// I/O Port 0 or 1 <- (A)
case OP_OUT:
OUT_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
WriteHardware(cur_instr[instr_pntr++], (byte)cur_instr[instr_pntr++]);
//OUT_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
break;
// Add the content of the SR register addressed by ISAR to A (Binary)
@ -446,6 +450,16 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
AND8_Func(A, Regs[ISAR]);
break;
// Set flags based on accumulator
case OP_AFTEST:
break;
// subtraction
case OP_SUB8:
SUB8_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
break;
// instruction fetch
@ -553,7 +567,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
Regs[PC0l] = Regs[DB];
break;
// All devices store in PC1 the current contents of PC0, incremented by 1; PC1 is unaltered
// All devices store in PC1 the current contents of PC0, incremented by 1; PC0 is unaltered
// CYCLE LENGTH: S
case ROMC_0D:
RegPC1 = (ushort)(RegPC0 + 1);
@ -648,6 +662,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
// registers cannot be read back onto the data bus)
// CYCLE LENGTH: L
case ROMC_1B:
//Regs[DB] = ReadHardware(Regs[IO]);
Regs[DB] = ReadHardware(Regs[IO]);
break;