mirror of
https://github.com/livingcomputermuseum/ContrAlto.git
synced 2026-01-24 19:31:26 +00:00
- Orbit controller: implemented and passes ROS-less diagnostics - ROS: In progress, not functional - DAC: For Ted Kaehler's Smalltalk Music system (FM and Sampling). Works, generates audio and can capture to WAV file. - Organ keybard: Stub, enough implemented to make the music system happy (so it will play back music and not crash.) Some minor cleanup. New dependency on NAudio package for DAC playback. Installer updated to include NAudio lib.
101 lines
3.1 KiB
C#
101 lines
3.1 KiB
C#
using Contralto.CPU;
|
|
using Contralto.Logging;
|
|
using Contralto.Memory;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Contralto.IO
|
|
{
|
|
/// <summary>
|
|
/// Implements the Organ Keyboard interface used by the ST-74
|
|
/// Music System. Very little is known about the hardware at this time,
|
|
/// so most of this is speculation or based on disassembly/reverse-engineering
|
|
/// of the music system code.
|
|
///
|
|
/// This is currently a stub that implements the bare minimum to make the
|
|
/// music system think there's a keyboard attached to the system.
|
|
/// </summary>
|
|
public class OrganKeyboard : IMemoryMappedDevice
|
|
{
|
|
public OrganKeyboard(AltoSystem system)
|
|
{
|
|
_system = system;
|
|
Reset();
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
//
|
|
// Initialize keyboard registers.
|
|
// Based on disassembly of the Nova code that drives the keyboard
|
|
// interface, the top 6 bits are active low.
|
|
//
|
|
for (int i = 0; i < 16; i++)
|
|
{
|
|
_keyData[i] = (ushort)(0xfc00);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reads a word from the specified address.
|
|
/// </summary>
|
|
/// <param name="address"></param>
|
|
/// <param name="extendedMemory"></param>
|
|
/// <returns></returns>
|
|
public ushort Read(int address, TaskType task, bool extendedMemory)
|
|
{
|
|
|
|
Log.Write(LogType.Verbose, LogComponent.Organ, "Organ read from {0} by task {1} (bank {2}), Nova PC {3}",
|
|
Conversion.ToOctal(address),
|
|
task,
|
|
UCodeMemory.GetBank(task),
|
|
Conversion.ToOctal(_system.CPU.R[6]));
|
|
|
|
return _keyData[address - 0xfe60];
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Writes a word to the specified address.
|
|
/// </summary>
|
|
/// <param name="address"></param>
|
|
/// <param name="data"></param>
|
|
public void Load(int address, ushort data, TaskType task, bool extendedMemory)
|
|
{
|
|
|
|
// The registers are write-only as far as I've been able to ascertain.
|
|
Log.Write(LogType.Verbose, LogComponent.Organ, "Unexpected organ write to {0} ({1}) by task {2} (bank {3})",
|
|
Conversion.ToOctal(address),
|
|
Conversion.ToOctal(data),
|
|
task,
|
|
UCodeMemory.GetBank(task));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Specifies the range (or ranges) of addresses decoded by this device.
|
|
/// </summary>
|
|
public MemoryRange[] Addresses
|
|
{
|
|
get { return _addresses; }
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// From: http://bitsavers.org/pdf/xerox/alto/memos_1975/Reserved_Alto_Memory_Locations_Jan75.pdf
|
|
///
|
|
/// #177140 - #177157: Organ Keyboard (Organ Hardware - Kaehler)
|
|
/// </summary>
|
|
private readonly MemoryRange[] _addresses =
|
|
{
|
|
new MemoryRange(0xfe60, 0xfe6f),
|
|
};
|
|
|
|
private ushort[] _keyData = new ushort[16];
|
|
|
|
private AltoSystem _system;
|
|
}
|
|
|
|
} |