[SeaBIOS] [PATCH 09/10] vgabios: Minor - pass display address to stdvga_set_cursor_pos().

Kevin O'Connor kevin at koconnor.net
Sat Jan 28 05:30:33 CET 2012


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/stdvga.c  |    3 ++-
 vgasrc/stdvga.h  |    2 +-
 vgasrc/vgabios.c |    8 +++-----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c
index 13334ed..ed4dcd2 100644
--- a/vgasrc/stdvga.c
+++ b/vgasrc/stdvga.c
@@ -254,9 +254,10 @@ stdvga_set_cursor_shape(u8 start, u8 end)
 }
 
 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);
 }
diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h
index f6fda00..94b22ff 100644
--- a/vgasrc/stdvga.h
+++ b/vgasrc/stdvga.h
@@ -131,7 +131,7 @@ void stdvga_load_font(u16 seg, void *src_far, u16 count
 u16 stdvga_get_crtc(void);
 int stdvga_bpp_factor(struct vgamode_s *vmode_g);
 void stdvga_set_cursor_shape(u8 start, u8 end);
-void stdvga_set_cursor_pos(u16 address);
+void stdvga_set_cursor_pos(int address);
 void stdvga_set_scan_lines(u8 lines);
 u16 stdvga_get_vde(void);
 int stdvga_get_window(struct vgamode_s *vmode_g, int window);
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 3c63337..b801093 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -138,11 +138,9 @@ set_cursor_pos(struct cursorpos cp)
         return;
 
     // Calculate the memory address
-    u16 nbcols = GET_BDA(video_cols);
-    u16 address = (GET_BDA(video_pagesize) * cp.page
-                   + (cp.x + cp.y * nbcols) * 2);
-
-    stdvga_set_cursor_pos(address / 2);
+    int address = (GET_BDA(video_pagesize) * cp.page
+                   + (cp.x + cp.y * GET_BDA(video_cols)) * 2);
+    stdvga_set_cursor_pos(address);
 }
 
 static struct cursorpos
-- 
1.7.6.4




More information about the SeaBIOS mailing list