Backspace now supported.

This commit is contained in:
moitoius_cp 2008-01-02 18:48:00 +00:00
parent a7ddae1db8
commit 5eddc078e9
3 changed files with 52 additions and 2 deletions

View file

@ -32,6 +32,16 @@ namespace Cosmos.Kernel.Plugs {
TextScreen.SetColors(_foreground, _background);
}
public static int get_CursorLeft()
{
return TextScreen.CurrentChar;
}
public static void set_CursorLeft(int x)
{
TextScreen.CurrentChar = x;
}
//TODO: Console uses TextWriter - intercept and plug it instead
public static void Clear() {
TextScreen.Clear();
@ -67,7 +77,7 @@ namespace Cosmos.Kernel.Plugs {
}
public static string ReadLine() {
List<char> chars = new List<char>(32);
List<char> chars = new List<char>();
char current;
// HACK: convert this to "while ((current = Keyboard.ReadChar()) != '\n') {"
// MTW: SOmehow an invalid opcode exception is occurring.
@ -76,6 +86,17 @@ namespace Cosmos.Kernel.Plugs {
if (current == '\n') {
break;
}
if (current == '\u0968') // Backspace
{
if (chars.Count != 0)
{
chars.RemoveAt(chars.Count);
TextScreen.CurrentChar--;
TextScreen.WriteChar(' ');
TextScreen.CurrentChar--;
}
continue;
}
chars.Add(current);
Write(current);
}

View file

@ -39,6 +39,14 @@ namespace Cosmos.Kernel.FileSystem
// TODO: FAT32
#endregion
#region Util
public uint _rootDirSectors;
public uint _realFatSize;
public uint _firstDataSector;
public uint _realTotalSectors;
public uint _dataSectors;
#endregion
/// <summary>
/// Reads the header from a byte source.
/// </summary>
@ -75,6 +83,22 @@ namespace Cosmos.Kernel.FileSystem
#region FAT 32
#endregion
#region Util
/*_rootDirSectors = ((_rootEntryCount * 32) + (_bytesPerSector - 1)) / _bytesPerSector;
_fatSize = _fatSize;
_firstDataSector = _reservedSectorCount + (_allocationTables * _realFatSize) + _rootDirSectors;
if (_totalSectors == 0)
_realTotalSectors = _totalSectors32;
else
_realTotalSectors = _totalSectors;
_dataSectors = _realTotalSectors - (_reservedSectorCount + (_allocationTables * _realFatSize) + _rootDirSectors);*/
#endregion
}
public uint FirstSectorOfCluster(uint cluster)
{
return ((cluster - 2) * _sectorPerCluster) + _firstDataSector;
}
private ushort ReadShort(byte[] source, int pos, ushort mask)
@ -120,6 +144,7 @@ namespace Cosmos.Kernel.FileSystem
}
private ATA _ata;
private Header _header;
public Fat16(ATA ata)
{
@ -131,7 +156,9 @@ namespace Cosmos.Kernel.FileSystem
public override void Open()
{
_header = new Header();
// TODO: Read the header.
}
public override void Dispose()

View file

@ -126,6 +126,8 @@ namespace Cosmos.Kernel {
AddKey(0x1C0000, '\n');
AddKey(0x39, ' ');
AddKey(0x390000, ' ');
AddKey(0x0E, '\u0968');
AddKey(0x0E0000, '\u0968');
#endregion
#region Punctuation