Some minor changes and playing about
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Core.Interfaces;
|
||||
using Core.Io;
|
||||
|
||||
namespace Core.Cpu
|
||||
{
|
||||
@@ -38,12 +39,12 @@ namespace Core.Cpu
|
||||
|
||||
// The Memory Bus
|
||||
private readonly IMemory _memory;
|
||||
private readonly IIoBus _ioBus;
|
||||
private readonly IO_Bus _simpleIoBus;
|
||||
|
||||
public Z80(IMemory memory, IIoBus ioBus)
|
||||
public Z80(IMemory memory, IO_Bus ioBus)
|
||||
{
|
||||
_memory = memory;
|
||||
_ioBus = ioBus;
|
||||
_simpleIoBus = ioBus;
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -122,15 +123,7 @@ namespace Core.Cpu
|
||||
// Placeholder for your hardware I/O
|
||||
private byte ReadPort(ushort portAddress)
|
||||
{
|
||||
// If the port is 0xFE, the ROM is asking for keyboard/tape/ULA data!
|
||||
// For now, we will return 0xFF (meaning "No keys are currently pressed")
|
||||
if ((portAddress & 0xFF) == 0xFE)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
// Default floating bus return
|
||||
return 0xFF;
|
||||
return _simpleIoBus.ReadPort(portAddress);
|
||||
}
|
||||
|
||||
public int Step()
|
||||
@@ -1086,7 +1079,7 @@ namespace Core.Cpu
|
||||
// The Z80 puts 'A' on the top 8 bits, and 'n' on the bottom 8 bits of the port address
|
||||
ushort portAddress = (ushort)((AF.High << 8) | portOffset);
|
||||
|
||||
_ioBus.Write(portAddress, AF.High);
|
||||
_simpleIoBus.WritePort(portAddress, AF.High);
|
||||
|
||||
return 11;
|
||||
case 0xd5: //push bc
|
||||
|
||||
Reference in New Issue
Block a user