aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-05-31 20:43:06 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-05-31 20:43:06 -0400
commit2e86c6a805ef57686ad8af067f010e602adb5d84 (patch)
treeac9051e7bc664aab0624903e63e38e5ac1d7f9d6
parent2c34f41b01dec1a50fdf63645064fdf56475e33f (diff)
downloadseabios-hppa-2e86c6a805ef57686ad8af067f010e602adb5d84.zip
seabios-hppa-2e86c6a805ef57686ad8af067f010e602adb5d84.tar.gz
seabios-hppa-2e86c6a805ef57686ad8af067f010e602adb5d84.tar.bz2
VGA: No need to scroll multiple times when writing a tab.
A tab can only scroll the screen once. Inline the code from check_scroll into write_teletype. Also, move row check in write_string to handle_1013.
-rw-r--r--vgasrc/vga.c56
1 files changed, 21 insertions, 35 deletions
diff --git a/vgasrc/vga.c b/vgasrc/vga.c
index c28d891..403f047 100644
--- a/vgasrc/vga.c
+++ b/vgasrc/vga.c
@@ -176,78 +176,62 @@ biosfn_set_active_page(u8 page)
}
static struct cursorpos
-check_scroll(struct cursorpos cp)
+write_teletype(struct cursorpos cp, struct carattr ca)
{
// Get the dimensions
u16 nbrows = GET_BDA(video_rows) + 1;
u16 nbcols = GET_BDA(video_cols);
- // Do we need to wrap ?
- if (cp.x == nbcols) {
- cp.x = 0;
- cp.y++;
- }
- // Do we need to scroll ?
- if (cp.y == nbrows) {
- struct cursorpos ul = {0, 0, cp.page};
- struct cursorpos lr = {nbcols-1, nbrows-1, cp.page};
- vgafb_scroll(1, -1, ul, lr);
- cp.y--;
- }
-
- return cp;
-}
-
-static struct cursorpos
-write_teletype(struct cursorpos cp, struct carattr ca)
-{
switch (ca.car) {
case 7:
//FIXME should beep
break;
-
case 8:
if (cp.x > 0)
cp.x--;
break;
-
case '\r':
cp.x = 0;
break;
-
case '\n':
cp.y++;
break;
-
case '\t':
do {
struct carattr dummyca = {' ', ca.attr, ca.use_attr};
vgafb_write_char(cp, dummyca);
cp.x++;
- cp = check_scroll(cp);
- } while (cp.x % 8);
+ } while (cp.x < nbcols && cp.x % 8);
break;
-
default:
vgafb_write_char(cp, ca);
cp.x++;
}
- return check_scroll(cp);
+ // Do we need to wrap ?
+ if (cp.x == nbcols) {
+ cp.x = 0;
+ cp.y++;
+ }
+ // Do we need to scroll ?
+ if (cp.y == nbrows) {
+ struct cursorpos ul = {0, 0, cp.page};
+ struct cursorpos lr = {nbcols-1, nbrows-1, cp.page};
+ vgafb_scroll(1, -1, ul, lr);
+ cp.y--;
+ }
+
+ return cp;
}
static void
write_string(struct cursorpos cp, u8 flag, u8 attr, u16 count,
u16 seg, u8 *offset_far)
{
- // if row=0xff special case : use current cursor position
- if (cp.y == 0xff)
- cp = get_cursor_pos(cp.page);
-
- while (count-- != 0) {
+ while (count--) {
u8 car = GET_FARVAR(seg, *offset_far);
offset_far++;
- if ((flag & 0x02) != 0) {
+ if (flag & 0x02) {
attr = GET_FARVAR(seg, *offset_far);
offset_far++;
}
@@ -1006,8 +990,10 @@ handle_1012(struct bregs *regs)
static void
handle_1013(struct bregs *regs)
{
- // XXX - inline
struct cursorpos cp = {regs->dl, regs->dh, regs->bh};
+ // if row=0xff special case : use current cursor position
+ if (cp.y == 0xff)
+ cp = get_cursor_pos(cp.page);
write_string(cp, regs->al, regs->bl, regs->cx
, regs->es, (void*)(regs->bp + 0));
}