1
0
mirror of https://github.com/livingcomputermuseum/ContrAlto.git synced 2026-01-22 02:24:54 +00:00
Josh Dersch 523a4bb27f Initial implementation of Trident controller and drives (supporting T-80 and T-300 packs). TFU works and can certify, erase, exercise and manipulate files on Trident packs. TriEx doesn't quite work properly yet. Still some issues to iron out.
Added file-backed disk image implementation for use with Trident disk images, did some basic refactoring of disk load/unload logic, added support for creating new (empty) disk images for both Trident and Diablo disks.

Added UI for loading/unloading/creating up to 8 trident packs; added blank Diablo pack creation UI.  (Both Windows and *nix interfaces.)

Added configuration support for same (both Windows and *nix.)

Small correction to Print output path browsing logic.

Fixed Windows installer, now places the right ROMs for Alto I configurations in the right place.

Fixed issue when starting up with corrupted configuration.  Corrupted configuration is ignored and ContrAlto will run with default config.
2017-08-22 13:18:31 -07:00

135 lines
3.8 KiB
C#

/*
This file is part of ContrAlto.
ContrAlto is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ContrAlto 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with ContrAlto. If not, see <http://www.gnu.org/licenses/>.
*/
#define LOGGING_ENABLED
using System;
using System.IO;
namespace Contralto.Logging
{
/// <summary>
/// Specifies a component to specify logging for
/// </summary>
[Flags]
public enum LogComponent
{
None = 0,
EmulatorTask = 0x1,
DiskSectorTask = 0x2,
DiskWordTask = 0x4,
DiskController = 0x8,
Alu = 0x10,
Memory = 0x20,
Keyboard = 0x40,
Display = 0x80,
Microcode = 0x100,
CPU = 0x200,
EthernetController = 0x400,
EthernetTask = 0x800,
TaskSwitch = 0x1000,
HostNetworkInterface = 0x2000,
EthernetPacket = 0x4000,
Configuration = 0x8000,
DAC = 0x10000,
Organ = 0x20000,
Orbit = 0x40000,
DoverROS = 0x80000,
TridentTask = 0x100000,
TridentController = 0x200000,
TridentDisk = 0x400000,
Debug = 0x40000000,
All = 0x7fffffff
}
/// <summary>
/// Specifies the type (or severity) of a given log message
/// </summary>
[Flags]
public enum LogType
{
None = 0,
Normal = 0x1,
Warning = 0x2,
Error = 0x4,
Verbose = 0x8,
All = 0x7fffffff
}
/// <summary>
/// Provides basic functionality for logging messages of all types.
/// </summary>
public static class Log
{
static Log()
{
_components = Configuration.LogComponents;
_type = Configuration.LogTypes;
_logIndex = 0;
}
public static LogComponent LogComponents
{
get { return _components; }
set { _components = value; }
}
#if LOGGING_ENABLED
/// <summary>
/// Logs a message without specifying type/severity for terseness;
/// will not log if Type has been set to None.
/// </summary>
/// <param name="level"></param>
/// <param name="message"></param>
/// <param name="args"></param>
public static void Write(LogComponent component, string message, params object[] args)
{
Write(LogType.Normal, component, message, args);
}
public static void Write(LogType type, LogComponent component, string message, params object[] args)
{
if ((_type & type) != 0 &&
(_components & component) != 0)
{
//
// My log has something to tell you...
// TODO: color based on type, etc.
Console.WriteLine(_logIndex.ToString() + ": " + component.ToString() + ": " + message, args);
_logIndex++;
}
}
#else
public static void Write(LogComponent component, string message, params object[] args)
{
}
public static void Write(LogType type, LogComponent component, string message, params object[] args)
{
}
#endif
private static LogComponent _components;
private static LogType _type;
private static long _logIndex;
}
}