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;
}
/* 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;
}
#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,
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);
};
#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 = {
.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;
__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;
}
}
-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);