Cosmos/source/Cosmos.HAL/DebugTextScreen.cs
fanoI 847a1a772b Used right expception, new TextScreenHelpers class (for debug)
- In the DebugTextScreen class used the already existing
NotImplementedException instead of create a new exception type
- Created new class TextScreenHelpers  for the debug of the TextScreen
Class
- In the TextScreen class replaced any call to Debugger.XXX() in
TextScreenHelpers.DebugXXX()
2015-12-13 16:39:04 +01:00

106 lines
2.3 KiB
C#

using System;
using System.Linq;
using Cosmos.Debug.Kernel;
namespace Cosmos.HAL
{
public class DebugTextScreen: TextScreenBase
{
private readonly Debugger mDebugger;
public DebugTextScreen()
{
mDebugger = new Debugger("HAL", "DebugTextScreen");
}
public override void Clear()
{
}
public override void SetColors(ConsoleColor aForeground, ConsoleColor aBackground)
{
}
public override byte GetColor()
{
return 0x0F;
}
public override ushort Cols
{
get
{
return 80;
}
}
public override ushort Rows
{
get
{
return 25;
}
}
private void SendChar(char[] aData)
{
var xBytes = new byte[aData.Length];
for (int i = 0; i < aData.Length; i++)
{
xBytes[i] = (byte)aData[i];
}
mDebugger.SendChannelCommand(129, 0, xBytes);
}
public override void SetCursorPos(int x, int y)
{
}
public override void ScrollUp()
{
}
private int mCurrentY = 1;
public override char this[int x, int y]
{
get
{
throw new NotImplementedException();
}
set
{
if (y != mCurrentY)
{
SendChar(new[]
{
'\r',
'\n'
});
mCurrentY = y;
}
SendChar(new []{value});
}
}
public override int GetCursorSize()
{
throw new NotImplementedException();
}
public override void SetCursorSize(int value)
{
throw new NotImplementedException();
}
public override bool GetCursorVisible()
{
throw new NotImplementedException();
}
public override void SetCursorVisible(bool value)
{
throw new NotImplementedException();
}
}
}