From dead9024c73e16a141b1381ba6e8432d44d2d567 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 6 Jan 2012 21:50:30 +0000 Subject: Added some shifted ED opcodes and added GPL headers to all files. --- src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs | 16 ++- .../Z80CpuBaseOpcodes.cs | 16 ++- .../Z80CpuDecodeByte.cs | 16 ++- .../Z80CpuDecodeCB.cs | 16 ++- .../Z80CpuDecodeED.cs | 129 ++++++++++++++++++++- .../Z80CpuDecodeShiftedCB.cs | 16 ++- 6 files changed, 202 insertions(+), 7 deletions(-) (limited to 'src/Noddybox.Emulation.EightBit.Z80') diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs index 13e8582..78f0bfa 100644 --- a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs +++ b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs @@ -1,4 +1,18 @@ -// +// This file is part of the Noddybox.Emulation C# suite. +// +// Noddybox.Emulation is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Noddybox.Emulation is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Foobar. If not, see . +// // Copyright (c) 2012 Ian Cowburn // using System; diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs index 3c37561..47f4d28 100644 --- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs +++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs @@ -1,4 +1,18 @@ -// +// This file is part of the Noddybox.Emulation C# suite. +// +// Noddybox.Emulation is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Noddybox.Emulation is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Foobar. If not, see . +// // Copyright (c) 2012 Ian Cowburn // using System; diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeByte.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeByte.cs index 65de984..e03a3f3 100644 --- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeByte.cs +++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeByte.cs @@ -1,4 +1,18 @@ -// +// This file is part of the Noddybox.Emulation C# suite. +// +// Noddybox.Emulation is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Noddybox.Emulation is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Foobar. If not, see . +// // Copyright (c) 2012 Ian Cowburn // using System; diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs index 73cb611..fc17936 100644 --- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs +++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs @@ -1,4 +1,18 @@ -// +// This file is part of the Noddybox.Emulation C# suite. +// +// Noddybox.Emulation is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Noddybox.Emulation is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Foobar. If not, see . +// // Copyright (c) 2012 Ian Cowburn // using System; diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeED.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeED.cs index 5d8ec1e..d06ee3d 100644 --- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeED.cs +++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeED.cs @@ -1,4 +1,18 @@ -// +// This file is part of the Noddybox.Emulation C# suite. +// +// Noddybox.Emulation is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Noddybox.Emulation is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Foobar. If not, see . +// // Copyright (c) 2012 Ian Cowburn // using System; @@ -8,11 +22,122 @@ namespace Noddybox.Emulation.EightBit.Z80 public partial class Z80Cpu { /// - /// Decode and execute a ED-shifted opcode. + /// Decode and execute an ED-shifted opcode. /// /// The opcode. private void DecodeED(byte opcode) { + ushort addr; + byte b; + + switch(opcode) + { + case 0x40: // IN B,(C) + clock.Add(12); + BC.high = device.Read(BC.reg); + F = Z80Flags.Carry | PSZtable[BC.high] | H35table[BC.high]; + break; + + case 0x41: // OUT (C),B + clock.Add(12); + device.Write(BC.reg, BC.high); + break; + + case 0x42: // SBC HL,BC + clock.Add(15); + SBC(ref HL.reg, BC.reg); + break; + + case 0x43: // LD (nnnn),BC + clock.Add(20); + addr = FetchWord(); + memory.Write(addr++, BC.low); + memory.Write(addr, BC.high); + break; + + case 0x44: // NEG + clock.Add(8); + b = A; + A = 0; + SUB8(b); + break; + + case 0x45: // RETN + clock.Add(14); + IFF1 = IFF2; + PC = POP(); + break; + + case 0x46: // IM 0 + clock.Add(8); + IM = 0; + break; + + case 0x47: // LD I,A + clock.Add(9); + I = A; + break; + + case 0x48: // IN C,(C) + clock.Add(12); + BC.low = device.Read(BC.reg); + F = Z80Flags.Carry | PSZtable[BC.low] | H35table[BC.low]; + break; + + case 0x49: // OUT (C),C + clock.Add(12); + device.Write(BC.reg, BC.low); + break; + + case 0x4a: // ADC HL, BC + clock.Add(15); + ADC16(ref HL.reg, BC.reg); + break; + + case 0x4b: // LD BC,(nnnn) + clock.Add(20); + addr = FetchWord(); + BC.low = memory.Read(addr++); + BC.high = memory.Read(addr); + break; + + case 0x4c: // NEG + clock.Add(8); + b = A; + A = 0; + SUB8(b); + break; + + case 0x4d: // RETI + clock.Add(14); + IFF1 = IFF2; + PC = POP(); + break; + + case 0x4e: // IM 0/1 + clock.Add(8); + IM = 0; + break; + + case 0x4f: // LD R,A + clock.Add(9); + R = A; + break; + + case 0x50: // IN D,(C) + clock.Add(12); + DE.high = device.Read(BC.reg); + F = Z80Flags.Carry | PSZtable[DE.high] | H35table[DE.high]; + break; + + case 0x51: // OUT (C),D + clock.Add(12); + device.Write(BC.reg, DE.high); + break; + + default: + break; + } } } } diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs index ad663f3..80ce41d 100644 --- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs +++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs @@ -1,4 +1,18 @@ -// +// This file is part of the Noddybox.Emulation C# suite. +// +// Noddybox.Emulation is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Noddybox.Emulation is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Foobar. If not, see . +// // Copyright (c) 2012 Ian Cowburn // using System; -- cgit v1.3