vgabios: Minor - pass display address to stdvga_set_cursor_pos().
[seabios.git] / vgasrc / stdvga.c
index a310167aca13ee38a4dfbd2f657c7db9c68d0428..ed4dcd298a8ab15b6a3f64bc4296bff89b9c112e 100644 (file)
@@ -254,17 +254,10 @@ stdvga_set_cursor_shape(u8 start, u8 end)
 }
 
 void
-stdvga_set_active_page(u16 address)
-{
-    u16 crtc_addr = stdvga_get_crtc();
-    stdvga_crtc_write(crtc_addr, 0x0c, address >> 8);
-    stdvga_crtc_write(crtc_addr, 0x0d, address);
-}
-
-void
-stdvga_set_cursor_pos(u16 address)
+stdvga_set_cursor_pos(int address)
 {
     u16 crtc_addr = stdvga_get_crtc();
+    address /= 2;  // Assume we're in text mode.
     stdvga_crtc_write(crtc_addr, 0x0e, address >> 8);
     stdvga_crtc_write(crtc_addr, 0x0f, address);
 }
@@ -313,6 +306,25 @@ stdvga_set_linelength(struct vgamode_s *vmode_g, int val)
     return 0;
 }
 
+int
+stdvga_get_displaystart(struct vgamode_s *vmode_g)
+{
+    u16 crtc_addr = stdvga_get_crtc();
+    int addr = (stdvga_crtc_read(crtc_addr, 0x0c) << 8
+                | stdvga_crtc_read(crtc_addr, 0x0d));
+    return addr * stdvga_bpp_factor(vmode_g);
+}
+
+int
+stdvga_set_displaystart(struct vgamode_s *vmode_g, int val)
+{
+    u16 crtc_addr = stdvga_get_crtc();
+    val /= stdvga_bpp_factor(vmode_g);
+    stdvga_crtc_write(crtc_addr, 0x0c, val >> 8);
+    stdvga_crtc_write(crtc_addr, 0x0d, val);
+    return 0;
+}
+
 
 /****************************************************************
  * Save/Restore/Set state