progress on all fronts
[com32] / src / contty.c
index b36a9c2..2ed22e7 100644 (file)
@@ -46,6 +46,7 @@ static void scroll(void);
 static void crtc_cursor(int x, int y);
 static void crtc_getcursor(int *x, int *y);
 static void crtc_setstart(int y);
+static int crtc_getstart(void);
 static inline unsigned char crtc_read(int reg);
 static inline void crtc_write(int reg, unsigned char val);
 
@@ -56,6 +57,7 @@ static unsigned char cy0, cy1;
 static int curvis;
 static int scr_on = 1;
 
+
 int con_init(void)
 {
 #ifdef CON_SERIAL
@@ -68,9 +70,9 @@ int con_init(void)
        cy0 &= 0x1f;
        cy1 = crtc_read(CRTC_REG_CUREND) & 0x1f;
 
+       start_line = crtc_getstart();
        crtc_getcursor(&cursor_x, &cursor_y);
        con_show_cursor(1);
-       crtc_setstart(0);
        scr_on = 1;
 #endif
 
@@ -285,6 +287,16 @@ static void crtc_setstart(int y)
        crtc_write(CRTC_REG_START_H, addr >> 8);
 }
 
+static int crtc_getstart(void)
+{
+       unsigned int addr;
+
+       addr = crtc_read(CRTC_REG_START_L);
+       addr |= (unsigned int)crtc_read(CRTC_REG_START_H) << 8;
+
+       return addr / NCOLS;
+}
+
 static inline unsigned char crtc_read(int reg)
 {
        outp(CRTC_ADDR, reg);