aboutsummaryrefslogtreecommitdiff
path: root/vgasrc/vgafb.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2012-01-01 11:04:42 -0500
committerKevin O'Connor <kevin@koconnor.net>2012-01-01 11:04:42 -0500
commitb93739776593eb470bd18ce8f8b028054cee0e3d (patch)
treea299828c7a0b4a18e0adfba92f7bd0b4379961e9 /vgasrc/vgafb.c
parent68ab041138e564aaeae159cea8b7bfc696b498d8 (diff)
downloadseabios-hppa-b93739776593eb470bd18ce8f8b028054cee0e3d.zip
seabios-hppa-b93739776593eb470bd18ce8f8b028054cee0e3d.tar.gz
seabios-hppa-b93739776593eb470bd18ce8f8b028054cee0e3d.tar.bz2
vgabios: Add scrolling for linear (packed pixel) graphics mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/vgafb.c')
-rw-r--r--vgasrc/vgafb.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c
index 2104b44..85e4ab3 100644
--- a/vgasrc/vgafb.c
+++ b/vgasrc/vgafb.c
@@ -105,6 +105,35 @@ scroll_cga(struct vgamode_s *vmode_g, int nblines, int attr
}
static void
+scroll_lin(struct vgamode_s *vmode_g, int nblines, int attr
+ , struct cursorpos ul, struct cursorpos lr)
+{
+ int cheight = 8;
+ int cwidth = 8;
+ int stride = GET_BDA(video_cols) * cwidth;
+ void *src_far, *dest_far;
+ if (nblines >= 0) {
+ dest_far = (void*)(ul.y * cheight * stride + ul.x * cwidth);
+ src_far = dest_far + nblines * cheight * stride;
+ } else {
+ // Scroll down
+ nblines = -nblines;
+ dest_far = (void*)(lr.y * cheight * stride + ul.x * cwidth);
+ src_far = dest_far - nblines * cheight * stride;
+ stride = -stride;
+ }
+ int cols = lr.x - ul.x + 1;
+ int rows = lr.y - ul.y + 1;
+ if (nblines < rows)
+ dest_far = memcpy_stride(SEG_GRAPH, dest_far, src_far, cols * cwidth
+ , stride, (rows - nblines) * cheight);
+ if (attr < 0)
+ attr = 0;
+ memset_stride(SEG_GRAPH, dest_far, attr, cols * cwidth
+ , stride, nblines * cheight);
+}
+
+static void
scroll_text(struct vgamode_s *vmode_g, int nblines, int attr
, struct cursorpos ul, struct cursorpos lr)
{
@@ -158,8 +187,9 @@ vgafb_scroll(int nblines, int attr, struct cursorpos ul, struct cursorpos lr)
case CGA:
scroll_cga(vmode_g, nblines, attr, ul, lr);
break;
- default:
- dprintf(1, "Scroll in graphics mode\n");
+ case LINEAR8:
+ scroll_lin(vmode_g, nblines, attr, ul, lr);
+ break;
}
}