fixed cursor synchroization bug

svn path=/trunk/; revision=381
This commit is contained in:
Eric Kohl 1999-04-14 23:43:13 +00:00
parent ed08466464
commit 5d97b74881
3 changed files with 40 additions and 50 deletions

View file

@ -122,9 +122,8 @@ NTSTATUS ScrCreate (PDEVICE_OBJECT DeviceObject, PIRP Irp)
outb_p (CRTC_DATA, 0x07);
__asm__("sti\n\t");
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
@ -144,11 +143,9 @@ NTSTATUS ScrWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
DeviceExtension = DeviceObject->DeviceExtension;
vidmem = DeviceExtension->VideoMemory;
// cursorx = DeviceExtension->CursorX;
// cursory = DeviceExtension->CursorY;
cursorx = __wherex();
cursory = __wherey();
cursorx = DeviceExtension->CursorX;
cursory = DeviceExtension->CursorY;
for (i = 0; i < stk->Parameters.Write.Length; i++, pch++)
{
switch (*pch)
@ -221,7 +218,6 @@ NTSTATUS ScrWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
/* Set the cursor position */
offset = (cursory * NR_COLUMNS) + cursorx;
outb_p (CRTC_COMMAND, CRTC_CURSORPOSLO);
@ -230,10 +226,8 @@ NTSTATUS ScrWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
offset >>= 8;
outb_p (CRTC_DATA, offset);
// DeviceExtension->CursorX = cursorx;
// DeviceExtension->CursorY = cursory;
__goxy(cursorx, cursory);
DeviceExtension->CursorX = cursorx;
DeviceExtension->CursorY = cursory;
Status = STATUS_SUCCESS;

View file

@ -7,11 +7,11 @@
#
#
#
__putchar
__goxy
__wherex
__wherey
__getscreensize
#__putchar
#__goxy
#__wherex
#__wherey
#__getscreensize
DbgPrint
ExAcquireFastMutex
ExAcquireFastMutexUnsafe

View file

@ -132,6 +132,11 @@ void HalSwitchToBlueScreen(void)
cursorx=0;
cursory=0;
outb_p(CRTC_COMMAND, CRTC_CURLO);
outb_p(CRTC_DATA, 0);
outb_p(CRTC_COMMAND, CRTC_CURHI);
outb_p(CRTC_DATA, 0);
/*
* This code section is taken from the sample routines by
* Jeff Morgan (kinfira@hotmail.com)
@ -185,6 +190,14 @@ void __putchar(char c)
outb_p(SER_THR, c);
#endif
outb_p(CRTC_COMMAND, CRTC_CURHI);
offset = inb_p(CRTC_DATA)<<8;
outb_p(CRTC_COMMAND, CRTC_CURLO);
offset += inb_p(CRTC_DATA);
cursory = offset / NR_COLUMNS;
cursorx = offset % NR_COLUMNS;
switch(c)
{
case '\n':
@ -241,15 +254,13 @@ void __putchar(char c)
* Set the cursor position
*/
offset = cursory * NR_COLUMNS;
offset = offset + cursorx;
offset = (cursory * NR_COLUMNS) + cursorx;
outb_p(CRTC_COMMAND, CRTC_CURLO);
outb_p(CRTC_DATA, offset);
outb_p(CRTC_COMMAND, CRTC_CURHI);
offset >>= 8;
outb_p(CRTC_DATA, offset);
}
asmlinkage void printk(const char* fmt, ...)
@ -343,6 +354,7 @@ void HalInitConsole(boot_param* bp)
* bp = Parameters setup by the boot loader
*/
{
int offset;
#ifdef SERIAL_DEBUGGING
/* turn on DTR and RTS */
@ -354,33 +366,17 @@ void HalInitConsole(boot_param* bp)
outb_p(SER_LCR, SERIAL_LINE_CONTROL);
#endif
cursorx=bp->cursorx;
cursory=bp->cursory;
}
void __goxy(unsigned x, unsigned y)
{
cursorx = x;
cursory = y;
}
unsigned __wherex (void)
{
return cursorx;
}
unsigned __wherey (void)
{
return cursory;
}
void __getscreensize (unsigned *maxx, unsigned *maxy)
{
*maxx = (unsigned)(NR_COLUMNS);
*maxy = (unsigned)(NR_ROWS);
/* Set cursor position */
cursorx=bp->cursorx;
cursory=bp->cursory;
#if 0
offset = (cursory * NR_COLUMNS) + cursorx;
outb_p(CRTC_COMMAND, CRTC_CURLO);
outb_p(CRTC_DATA, offset);
outb_p(CRTC_COMMAND, CRTC_CURHI);
offset >>= 8;
outb_p(CRTC_DATA, offset);
#endif
}