NSC now returns floating bus data on D1-D7.

This commit is contained in:
Nick Westgate 2010-09-12 10:19:03 +12:00
parent 01a1c1b1f5
commit 19feb3b349
2 changed files with 20 additions and 19 deletions

View File

@ -24,7 +24,7 @@ public Machine()
Cassette = new Cassette(this); Cassette = new Cassette(this);
Speaker = new Speaker(this); Speaker = new Speaker(this);
Video = new Video(this); Video = new Video(this);
NoSlotClock = new NoSlotClock(); NoSlotClock = new NoSlotClock(this);
var emptySlot = new PeripheralCard(this); var emptySlot = new PeripheralCard(this);
Slot1 = emptySlot; Slot1 = emptySlot;

View File

@ -3,19 +3,12 @@
namespace Jellyfish.Virtu namespace Jellyfish.Virtu
{ {
public sealed class NoSlotClock public sealed class NoSlotClock : MachineComponent
{ {
public NoSlotClock() public NoSlotClock(Machine machine) :
base(machine)
{ {
Reset(); ResetClock();
}
public void Reset()
{
// SmartWatch reset - whether tied to system reset is component specific
_comparisonRegister.Reset();
_clockRegisterEnabled = false;
_writeEnabled = true;
} }
public int Read(int address, int data) public int Read(int address, int data)
@ -23,10 +16,10 @@ public int Read(int address, int data)
// this may read or write the clock // this may read or write the clock
if ((address & 0x4) != 0) if ((address & 0x4) != 0)
{ {
return ClockRead(data); return ReadClock(data);
} }
ClockWrite(address); WriteClock(address);
return data; return data;
} }
@ -35,15 +28,23 @@ public void Write(int address)
// this may read or write the clock // this may read or write the clock
if ((address & 0x4) != 0) if ((address & 0x4) != 0)
{ {
ClockRead(0); ReadClock(0);
} }
else else
{ {
ClockWrite(address); WriteClock(address);
} }
} }
public int ClockRead(int data) private void ResetClock()
{
// SmartWatch reset - whether tied to system reset is component specific
_comparisonRegister.Reset();
_clockRegisterEnabled = false;
_writeEnabled = true;
}
private int ReadClock(int data)
{ {
// for a ROM, A2 high = read, and data out (if any) is on D0 // for a ROM, A2 high = read, and data out (if any) is on D0
if (!_clockRegisterEnabled) if (!_clockRegisterEnabled)
@ -53,7 +54,7 @@ public int ClockRead(int data)
return data; return data;
} }
data = _clockRegister.ReadBit(data); data = _clockRegister.ReadBit(Machine.Video.ReadFloatingBus());
if (_clockRegister.NextBit()) if (_clockRegister.NextBit())
{ {
_clockRegisterEnabled = false; _clockRegisterEnabled = false;
@ -61,7 +62,7 @@ public int ClockRead(int data)
return data; return data;
} }
public void ClockWrite(int address) private void WriteClock(int address)
{ {
// for a ROM, A2 low = write, and data in is on A0 // for a ROM, A2 low = write, and data in is on A0
if (!_writeEnabled) if (!_writeEnabled)