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

View file

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

View file

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