diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2012-01-07 18:27:19 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2012-01-14 17:19:20 -0500 |
commit | 83047be58ee787b2f3651f6b40e08d54371ecd3a (patch) | |
tree | 25d6a61ad6e09a82c0821a70f0835815d5370307 /vgasrc/vgafb.c | |
parent | bb17d8446807d6fa5d03d42c9e60bff8c185469b (diff) | |
download | qemu-seabios-83047be58ee787b2f3651f6b40e08d54371ecd3a.tar.gz |
vgabios: Unify page size calculations; remove page size from vgamode_s.
The previous code could obtain the page size in different ways - from
vmode_g->sslength, from SCREEN_MEM_START, or by manually multiplying
cols and rows. Add a new func (calc_page_size) and use that in areas
that need to calculate the page size.
Convert readers of the page size to read it from the "video_pagesize"
entry in the BDA instead of recalculating it.
Remove the page size from struct vgamode_s (slength) as it is now
calculated dynamically. The new calculated versions are different
from the existing values exported in video_param_table. However, the
existing values (for CGA) did not look correct - I compared the values
to those exported by two other VGA BIOS manufacturers and used the
values that look more standard.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/vgafb.c')
-rw-r--r-- | vgasrc/vgafb.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index eb4ced8..b933738 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -139,10 +139,8 @@ scroll_text(struct vgamode_s *vmode_g, int nblines, int attr { int cheight = 1; int cwidth = 2; - u16 nbrows = GET_BDA(video_rows) + 1; - u16 nbcols = GET_BDA(video_cols); - int stride = nbcols * cwidth; - void *src_far, *dest_far = (void*)SCREEN_MEM_START(nbcols, nbrows, ul.page); + int stride = GET_BDA(video_cols) * cwidth; + void *src_far, *dest_far = (void*)(GET_BDA(video_pagesize) * ul.page); if (nblines >= 0) { dest_far += ul.y * cheight * stride + ul.x * cwidth; src_far = dest_far + nblines * cheight * stride; @@ -330,12 +328,9 @@ static void write_text_char(struct vgamode_s *vmode_g , struct cursorpos cp, struct carattr ca) { - // Get the dimensions - u16 nbrows = GET_BDA(video_rows) + 1; - u16 nbcols = GET_BDA(video_cols); - // Compute the address - void *address_far = (void*)(SCREEN_MEM_START(nbcols, nbrows, cp.page) + u16 nbcols = GET_BDA(video_cols); + void *address_far = (void*)(GET_BDA(video_pagesize) * cp.page + (cp.x + cp.y * nbcols) * 2); if (ca.use_attr) { @@ -386,12 +381,9 @@ vgafb_read_char(struct cursorpos cp) goto fail; } - // Get the dimensions - u16 nbrows = GET_BDA(video_rows) + 1; - u16 nbcols = GET_BDA(video_cols); - // Compute the address - u16 *address_far = (void*)(SCREEN_MEM_START(nbcols, nbrows, cp.page) + u16 nbcols = GET_BDA(video_cols); + u16 *address_far = (void*)(GET_BDA(video_pagesize) * cp.page + (cp.x + cp.y * nbcols) * 2); u16 v = GET_FARVAR(GET_GLOBAL(vmode_g->sstart), *address_far); struct carattr ca = {v, v>>8, 0}; |