summaryrefslogtreecommitdiff
path: root/com32/lib/sys
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-11 08:58:19 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-01 11:43:37 -0700
commit0859aaf6e9e8cccd8c67cca35d0d6998a71ab388 (patch)
treee293c4f22fa40249a5311013f13ca97ce45d2398 /com32/lib/sys
parent788da3035b2cf325658d6123b1bef73c67290f68 (diff)
downloadsyslinux-0859aaf6e9e8cccd8c67cca35d0d6998a71ab388.tar.gz
ansicon: allow to pass page # to write functions
Some video modes support up to 8 different pages, the current one being stored at 0x462. The display page value is passed in BH when invoking the INT 10h Video Service routines. This patch changes the interface of ansicon_write_char and ansicon_set_cursor to allow the caller to specify the page. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/lib/sys')
-rw-r--r--com32/lib/sys/ansi.c4
-rw-r--r--com32/lib/sys/ansi.h9
-rw-r--r--com32/lib/sys/ansicon_write.c18
3 files changed, 15 insertions, 16 deletions
diff --git a/com32/lib/sys/ansi.c b/com32/lib/sys/ansi.c
index 7d580856..43b3b654 100644
--- a/com32/lib/sys/ansi.c
+++ b/com32/lib/sys/ansi.c
@@ -123,7 +123,7 @@ void __ansi_putchar(const struct term_info *ti, uint8_t ch)
if (st->vtgraphics && (ch & 0xe0) == 0x60)
ch = decvt_to_cp437[ch - 0x60];
- op->write_char(xy.x, xy.y, ch, st);
+ op->write_char(xy.x, xy.y, BIOS_PAGE, ch, st);
xy.x++;
}
break;
@@ -430,6 +430,6 @@ void __ansi_putchar(const struct term_info *ti, uint8_t ch)
}
/* Update cursor position */
- op->set_cursor(xy.x, xy.y, st->cursor);
+ op->set_cursor(xy.x, xy.y, BIOS_PAGE, st->cursor);
st->xy = xy;
}
diff --git a/com32/lib/sys/ansi.h b/com32/lib/sys/ansi.h
index 0d1f1025..1e034246 100644
--- a/com32/lib/sys/ansi.h
+++ b/com32/lib/sys/ansi.h
@@ -9,6 +9,11 @@
#define ANSI_MAX_PARMS 16
+#define BIOS_CURXY ((struct curxy *)0x450) /* Array for each page */
+#define BIOS_ROWS (*(uint8_t *)0x484) /* Minus one; if zero use 24 (= 25 lines) */
+#define BIOS_COLS (*(uint16_t *)0x44A) /* Number of columns on screen */
+#define BIOS_PAGE (*(uint8_t *)0x462) /* Current page number */
+
enum ansi_state {
st_init,
st_esc,
@@ -43,10 +48,10 @@ struct term_state {
struct ansi_ops {
void (*erase) (const struct term_state * st, int x0, int y0, int x1,
int y1);
- void (*write_char) (int x, int y, uint8_t ch, const struct term_state * st);
+ void (*write_char) (int x, int y, int page, uint8_t ch, const struct term_state * st);
void (*showcursor) (const struct term_state * st);
void (*scroll_up) (const struct term_state * st);
- void (*set_cursor) (int x, int y, int visible);
+ void (*set_cursor) (int x, int y, int page, int visible);
void (*beep) (void);
};
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c
index 7c2754e7..8ec16b0a 100644
--- a/com32/lib/sys/ansicon_write.c
+++ b/com32/lib/sys/ansicon_write.c
@@ -44,10 +44,10 @@
#include "ansi.h"
static void ansicon_erase(const struct term_state *, int, int, int, int);
-static void ansicon_write_char(int, int, uint8_t, const struct term_state *);
+static void ansicon_write_char(int, int, int, uint8_t, const struct term_state *);
static void ansicon_showcursor(const struct term_state *);
static void ansicon_scroll_up(const struct term_state *);
-static void ansicon_set_cursor(int, int, int);
+static void ansicon_set_cursor(int, int, int, int);
static struct term_state ts;
struct ansi_ops __ansicon_ops = {
@@ -65,11 +65,6 @@ static struct term_info ti = {
.op = &__ansicon_ops
};
-#define BIOS_CURXY ((struct curxy *)0x450) /* Array for each page */
-#define BIOS_ROWS (*(uint8_t *)0x484) /* Minus one; if zero use 24 (= 25 lines) */
-#define BIOS_COLS (*(uint16_t *)0x44A)
-#define BIOS_PAGE (*(uint8_t *)0x462)
-
/* Reference counter to the screen, to keep track of if we need
reinitialization. */
static int ansicon_counter = 0;
@@ -176,9 +171,8 @@ static void ansicon_showcursor(const struct term_state *st)
__intcall(0x10, &ireg, NULL);
}
-static void ansicon_set_cursor(int x, int y, int visible)
+static void ansicon_set_cursor(int x, int y, int page, int visible)
{
- const int page = BIOS_PAGE;
struct curxy xy = BIOS_CURXY[page];
static com32sys_t ireg;
@@ -193,16 +187,16 @@ static void ansicon_set_cursor(int x, int y, int visible)
}
}
-static void ansicon_write_char(int x, int y, uint8_t ch,
+static void ansicon_write_char(int x, int y, int page, uint8_t ch,
const struct term_state *st)
{
static com32sys_t ireg;
- ansicon_set_cursor(x, y, 0);
+ ansicon_set_cursor(x, y, 0, page);
ireg.eax.b[1] = 0x09;
ireg.eax.b[0] = ch;
- ireg.ebx.b[1] = BIOS_PAGE;
+ ireg.ebx.b[1] = page;
ireg.ebx.b[0] = ansicon_attribute(st);
ireg.ecx.w[0] = 1;
__intcall(0x10, &ireg, NULL);