mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
VGA Cursor code is now in vga.cpp.
This commit is contained in:
parent
7510708ea1
commit
cd78c42c78
3 changed files with 24 additions and 20 deletions
|
@ -35,6 +35,8 @@ namespace Sortix
|
||||||
namespace VGA
|
namespace VGA
|
||||||
{
|
{
|
||||||
uint16_t* const vga = (uint16_t* const) 0xB8000;
|
uint16_t* const vga = (uint16_t* const) 0xB8000;
|
||||||
|
const int width = 80;
|
||||||
|
const int height = 80;
|
||||||
|
|
||||||
DevVGAFrame* currentframe;
|
DevVGAFrame* currentframe;
|
||||||
|
|
||||||
|
@ -43,6 +45,21 @@ namespace Sortix
|
||||||
currentframe = NULL;
|
currentframe = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Changes the position of the hardware cursor.
|
||||||
|
void SetCursor(nat x, nat y)
|
||||||
|
{
|
||||||
|
nat value = x + y * width;
|
||||||
|
|
||||||
|
// This sends a command to indicies 14 and 15 in the
|
||||||
|
// CRT Control Register of the VGA controller. These
|
||||||
|
// are the high and low bytes of the index that show
|
||||||
|
// where the hardware cursor is to be 'blinking'.
|
||||||
|
CPU::OutPortB(0x3D4, 14);
|
||||||
|
CPU::OutPortB(0x3D5, (value >> 8) & 0xFF);
|
||||||
|
CPU::OutPortB(0x3D4, 15);
|
||||||
|
CPU::OutPortB(0x3D5, (value >> 0) & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
void SysCreateFrame(CPU::InterruptRegisters* R)
|
void SysCreateFrame(CPU::InterruptRegisters* R)
|
||||||
{
|
{
|
||||||
addr_t page = Page::Get();
|
addr_t page = Page::Get();
|
||||||
|
@ -82,7 +99,7 @@ namespace Sortix
|
||||||
frame->physical = page;
|
frame->physical = page;
|
||||||
frame->userframe = userframe;
|
frame->userframe = userframe;
|
||||||
|
|
||||||
process->_endcodesection = mapto + 0x1000;
|
process->_endcodesection = mapto + 0x1000UL;
|
||||||
|
|
||||||
R->eax = mapto;
|
R->eax = mapto;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +123,7 @@ namespace Sortix
|
||||||
|
|
||||||
// TODO: Check if userframe is actually user-space writable!
|
// TODO: Check if userframe is actually user-space writable!
|
||||||
|
|
||||||
//Log::PrintF("changeframe: fd = %u, frame = 0x%p, currentframe = 0x%p\n", fd, frame, currentframe);
|
//Log::PrintF("changeframe: fd = %u, frame = 0x%p, currentframe = 0x%p, userframe = 0x%p\n", fd, frame, currentframe, frame->userframe); while(true);
|
||||||
|
|
||||||
// Check if we need to do anything.
|
// Check if we need to do anything.
|
||||||
if ( frame == currentframe ) { R->eax = 0; return; }
|
if ( frame == currentframe ) { R->eax = 0; return; }
|
||||||
|
@ -150,6 +167,7 @@ namespace Sortix
|
||||||
|
|
||||||
frame->onscreen = true;
|
frame->onscreen = true;
|
||||||
currentframe = frame;
|
currentframe = frame;
|
||||||
|
SetCursor(width, height-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysDeleteFrame(CPU::InterruptRegisters* R)
|
void SysDeleteFrame(CPU::InterruptRegisters* R)
|
||||||
|
|
|
@ -66,6 +66,7 @@ namespace Sortix
|
||||||
};
|
};
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
void SetCursor(nat x, nat y);
|
||||||
|
|
||||||
// System Calls.
|
// System Calls.
|
||||||
void SysCreateFrame(CPU::InterruptRegisters* R);
|
void SysCreateFrame(CPU::InterruptRegisters* R);
|
||||||
|
|
|
@ -49,30 +49,15 @@ namespace Sortix
|
||||||
COMMAND,
|
COMMAND,
|
||||||
} ansimode;
|
} ansimode;
|
||||||
|
|
||||||
// Changes the position of the hardware cursor.
|
|
||||||
void SetCursor(nat x, nat y)
|
|
||||||
{
|
|
||||||
nat value = x + y * width;
|
|
||||||
|
|
||||||
// This sends a command to indicies 14 and 15 in the
|
|
||||||
// CRT Control Register of the VGA controller. These
|
|
||||||
// are the high and low bytes of the index that show
|
|
||||||
// where the hardware cursor is to be 'blinking'.
|
|
||||||
CPU::OutPortB(0x3D4, 14);
|
|
||||||
CPU::OutPortB(0x3D5, (value >> 8) & 0xFF);
|
|
||||||
CPU::OutPortB(0x3D4, 15);
|
|
||||||
CPU::OutPortB(0x3D5, (value >> 0) & 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateCursor()
|
void UpdateCursor()
|
||||||
{
|
{
|
||||||
if ( showcursor )
|
if ( showcursor )
|
||||||
{
|
{
|
||||||
SetCursor(column, line);
|
VGA::SetCursor(column, line);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCursor(width, height-1);
|
VGA::SetCursor(width, height-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue