mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-06 16:22:40 +00:00
commit
d5a122d6b4
2 changed files with 33 additions and 13 deletions
|
|
@ -67,11 +67,31 @@ namespace Cosmos.Core
|
||||||
xDest++;
|
xDest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Fill(byte aData)
|
public void Fill(byte aData)
|
||||||
{
|
{
|
||||||
Fill(0, Size, aData);
|
Fill(0, Size, aData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Fill(UInt16 aData)
|
||||||
|
{
|
||||||
|
Fill(0, Size / 2, aData);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DebugStub(Off = true)]
|
||||||
|
public unsafe void Fill(UInt32 aStart, UInt32 aCount, UInt16 aData)
|
||||||
|
{
|
||||||
|
//TODO: before next step can at least check bounds here and do the addition just once to
|
||||||
|
//start the loop.
|
||||||
|
//TODO - When asm can check count against size just one time and use a native fill asm op
|
||||||
|
UInt16* xDest = (UInt16*)(this.Base + aStart);
|
||||||
|
for (UInt32 i = 0; i < aCount; i++)
|
||||||
|
{
|
||||||
|
*xDest = aData;
|
||||||
|
xDest++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[DebugStub(Off = true)]
|
[DebugStub(Off = true)]
|
||||||
public unsafe void Fill(UInt32 aStart, UInt32 aCount, byte aData)
|
public unsafe void Fill(UInt32 aStart, UInt32 aCount, byte aData)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,9 @@ namespace Cosmos.HAL {
|
||||||
// by memory moves
|
// by memory moves
|
||||||
public class TextScreen : TextScreenBase {
|
public class TextScreen : TextScreenBase {
|
||||||
protected byte Color = 0x0F; // White
|
protected byte Color = 0x0F; // White
|
||||||
// Empty + White
|
protected UInt16 mClearCellValue;
|
||||||
protected UInt16 mClearCellValue = 0x000F;
|
|
||||||
protected UInt32 mClearCellValue32;
|
|
||||||
protected UInt32 mRow2Addr;
|
protected UInt32 mRow2Addr;
|
||||||
protected UInt32 mScrollSize;
|
protected UInt32 mScrollSize;
|
||||||
protected UInt32 mRowSize32;
|
|
||||||
|
|
||||||
protected Core.IOGroup.TextScreen IO = new Cosmos.Core.IOGroup.TextScreen();
|
protected Core.IOGroup.TextScreen IO = new Cosmos.Core.IOGroup.TextScreen();
|
||||||
protected readonly MemoryBlock08 mRAM;
|
protected readonly MemoryBlock08 mRAM;
|
||||||
|
|
@ -31,10 +28,10 @@ namespace Cosmos.HAL {
|
||||||
Debugger.DoSend("ERROR: This is not of type TextScreen!");
|
Debugger.DoSend("ERROR: This is not of type TextScreen!");
|
||||||
}
|
}
|
||||||
mRAM = IO.Memory.Bytes;
|
mRAM = IO.Memory.Bytes;
|
||||||
mClearCellValue32 = (UInt32)(mClearCellValue << 16 | mClearCellValue);
|
// Set the Console default colors: White foreground on Black background, the default value of mClearCellValue is set there too as it is linked with the Color
|
||||||
|
SetColors(ConsoleColor.White, ConsoleColor.Black);
|
||||||
mRow2Addr = (UInt32)(Cols * 2);
|
mRow2Addr = (UInt32)(Cols * 2);
|
||||||
mScrollSize = (UInt32)(Cols * (Rows - 1) * 2);
|
mScrollSize = (UInt32)(Cols * (Rows - 1) * 2);
|
||||||
mRowSize32 = (UInt32)Cols * 2 / 4;
|
|
||||||
Debugger.DoSend("End of TextScreen..ctor");
|
Debugger.DoSend("End of TextScreen..ctor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,13 +39,16 @@ namespace Cosmos.HAL {
|
||||||
public override UInt16 Cols { get { return 80; } }
|
public override UInt16 Cols { get { return 80; } }
|
||||||
|
|
||||||
public override void Clear() {
|
public override void Clear() {
|
||||||
IO.Memory.Fill(mClearCellValue32);
|
Debugger.DoSend("Clearing screen with value ");
|
||||||
|
Debugger.DoSendNumber(mClearCellValue);
|
||||||
|
IO.Memory.Fill(mClearCellValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ScrollUp()
|
public override void ScrollUp()
|
||||||
{
|
{
|
||||||
IO.Memory.MoveDown(0, mRow2Addr, mScrollSize);
|
IO.Memory.MoveDown(0, mRow2Addr, mScrollSize);
|
||||||
IO.Memory.Fill(mScrollSize, mRowSize32, mClearCellValue32);
|
//IO.Memory.Fill(mScrollSize, mRowSize32, mClearCellValue32);
|
||||||
|
IO.Memory.Fill(mScrollSize, Cols, mClearCellValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override char this[int aX, int aY]
|
public override char this[int aX, int aY]
|
||||||
|
|
@ -64,11 +64,11 @@ namespace Cosmos.HAL {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetColors(ConsoleColor aForeground, ConsoleColor aBackground) {
|
||||||
|
Color = (byte)((byte)(aForeground) | ((byte)(aBackground) << 4));
|
||||||
public override void SetColors(ConsoleColor aForeground, ConsoleColor aBackground) {
|
// The Color | the NUL character this is used to Clear the Screen
|
||||||
Color = (byte)((byte)(aForeground) | ((byte)(aBackground) << 4));
|
mClearCellValue = (UInt16)(Color << 8 | 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetCursorPos(int aX, int aY)
|
public override void SetCursorPos(int aX, int aY)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue