Blanker

Philip Blundell (pjb27@cam.ac.uk)
Thu, 7 Sep 1995 15:23:50 +0100 (BST)


There is a small problem with the current screen blanker on Hercules (and
probably MDA) cards. It tries to move the cursor off the end of screen
memory, in hopes that it won't be displayed. Unfortunately, on these cards
it simply wraps round to the start again, so the cursor appears at the top
left of the screen.

The attached diff provides a fix for this problem, by allowing the cursor
to be moved to a different place for *MDA cards. It's slightly ugly, but
it was the best I could think of. I tried simply having the cursor moved
to FFFF for all display types, but this seemed to produce bizarre effects
on one of my VGAs.

--- linux/drivers/char/console.c Wed Sep 6 14:26:33 1995
+++ linux/drivers/char/console.c Thu Sep 7 11:36:12 1995
@@ -76,6 +76,7 @@
* improved scrollback, plus colour palette handling, by Simon Tatham
* 17-Jun-95 <sgt20@cam.ac.uk>
*
+ * cursor blanking fixed for MDA, 7-Sep-95 Philip Blundell <pjb27@cam.ac.uk>
*/

#define BLANK 0x0020
@@ -161,6 +162,7 @@
static unsigned char video_type; /* Type of display being used */
static unsigned long video_mem_base; /* Base of video memory */
static unsigned long video_mem_term; /* End of video memory */
+static unsigned long cursor_blank_pos; /* Cursor position for blanking */
static unsigned char video_page; /* Initial video page (unused) */
/* these two also used in vesa_blank.c */
unsigned short video_port_reg; /* Video register select port */
@@ -631,17 +633,16 @@
}

/*
- * Put the cursor just beyond the end of the display adaptor memory.
+ * Move the cursor off the screen. On most cards, this means moving it just
+ * past the end of display-adaptor memory.
+ * If I were feeling more reckless, we could just move to 0xFFFF.
*/
static inline void hide_cursor(void)
{
- /* This is inefficient, we could just put the cursor at 0xffff,
- but perhaps the delays due to the inefficiency are useful for
- some hardware... */
outb_p(14, video_port_reg);
- outb_p(0xff&((video_mem_term-video_mem_base)>>9), video_port_val);
+ outb_p(0xff&((cursor_blank_pos-video_mem_base)>>9), video_port_val);
outb_p(15, video_port_reg);
- outb_p(0xff&((video_mem_term-video_mem_base)>>1), video_port_val);
+ outb_p(0xff&((cursor_blank_pos-video_mem_base)>>1), video_port_val);
}

static inline void set_cursor(int currcons)
@@ -2043,6 +2044,7 @@
{
video_type = VIDEO_TYPE_EGAM;
video_mem_term = 0xb8000;
+ cursor_blank_pos = video_mem_term;
display_desc = "EGA+";
request_region(0x3b0,16,"ega");
}
@@ -2050,6 +2052,7 @@
{
video_type = VIDEO_TYPE_MDA;
video_mem_term = 0xb2000;
+ cursor_blank_pos = 0xb1000;
display_desc = "*MDA";
request_region(0x3b0,12,"mda");
request_region(0x3bf, 1,"mda");
@@ -2117,6 +2120,7 @@
display_desc = "*CGA";
request_region(0x3d4,2,"cga");
}
+ cursor_blank_pos = video_mem_term;
}

/* Initialize the variables used for scrolling (mostly EGA/VGA) */

--
Philip Blundell <pjb27@cam.ac.uk>       phone +44 1223 302522
.sig under construction