From 1692007a5ff81cfd88d80d495c11fc8ad25aa35b Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 27 Jan 2012 22:59:46 -0500 Subject: [PATCH] vgabios: Minor - pass display address to stdvga_set_cursor_pos(). Signed-off-by: Kevin O'Connor --- 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 25d9729..2f24e78 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 -- 2.25.1