VGA: Remove vmode_g->class - store info in vmode_g->memmodel.
diff --git a/vgasrc/vga.c b/vgasrc/vga.c
index 70c6b93..9d7ca30 100644
--- a/vgasrc/vga.c
+++ b/vgasrc/vga.c
@@ -149,7 +149,7 @@
struct cursorpos cp = get_cursor_pos(page);
u16 address;
- if (GET_GLOBAL(vmode_g->class) == TEXT) {
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT) {
// Get the dimensions
u16 nbcols = GET_BDA(video_cols);
u16 nbrows = GET_BDA(video_rows) + 1;
@@ -229,7 +229,7 @@
}
// Do we need to scroll ?
if (cp.y == nbrows) {
- if (GET_GLOBAL(vmode_g->class) == TEXT)
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT)
biosfn_scroll(0x01, 0x07, 0, 0, nbrows - 1, nbcols - 1, page,
SCROLL_UP);
else
@@ -427,7 +427,7 @@
SET_BDA(video_pal, 0x00); // Unavailable on vanilla vga, but...
// Set cursor shape
- if (GET_GLOBAL(vmode_g->class) == TEXT)
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT)
biosfn_set_cursor_shape(0x06, 0x07);
// Set cursor pos for page 0..7
int i;
@@ -440,7 +440,7 @@
biosfn_set_active_page(0x00);
// Write the fonts in memory
- if (GET_GLOBAL(vmode_g->class) == TEXT) {
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT) {
call16_vgaint(0x1104, 0);
call16_vgaint(0x1103, 0);
}
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c
index fbc1807..231ba1e 100644
--- a/vgasrc/vgafb.c
+++ b/vgasrc/vgafb.c
@@ -13,7 +13,6 @@
// * extract hw code from framebuffer code
// * use clear_screen() in scroll code
// * read/write_char should take a position; should not take count
-// * remove vmode_g->class (integrate into vmode_g->memmodel)
// * normalize params (don't use AX/BX/CX/etc.)
// XXX
@@ -88,7 +87,7 @@
void
clear_screen(struct vgamode_s *vmode_g)
{
- if (GET_GLOBAL(vmode_g->class) == TEXT) {
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT) {
memset16_far(GET_GLOBAL(vmode_g->sstart), 0, 0x0720, 32*1024);
return;
}
@@ -134,7 +133,7 @@
nblines = 0;
u8 cols = clr - cul + 1;
- if (GET_GLOBAL(vmode_g->class) == TEXT) {
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT) {
// Compute the address
void *address_far = (void*)(SCREEN_MEM_START(nbcols, nbrows, page));
dprintf(3, "Scroll, address %p (%d %d %02x)\n"
@@ -390,7 +389,7 @@
u16 nbrows = GET_BDA(video_rows) + 1;
u16 nbcols = GET_BDA(video_cols);
- if (GET_GLOBAL(vmode_g->class) == TEXT) {
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT) {
// Compute the address
void *address_far = (void*)(SCREEN_MEM_START(nbcols, nbrows, cp.page)
+ (cp.x + cp.y * nbcols) * 2);
@@ -445,7 +444,7 @@
u16 nbrows = GET_BDA(video_rows) + 1;
u16 nbcols = GET_BDA(video_cols);
- if (GET_GLOBAL(vmode_g->class) == TEXT) {
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT) {
// Compute the address
u16 *address_far = (void*)(SCREEN_MEM_START(nbcols, nbrows, cp.page)
+ (cp.x + cp.y * nbcols) * 2);
@@ -473,7 +472,7 @@
struct vgamode_s *vmode_g = find_vga_entry(GET_BDA(video_mode));
if (!vmode_g)
return;
- if (GET_GLOBAL(vmode_g->class) == TEXT)
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT)
return;
u8 *addr_far, mask, attr, data;
@@ -529,7 +528,7 @@
struct vgamode_s *vmode_g = find_vga_entry(GET_BDA(video_mode));
if (!vmode_g)
return;
- if (GET_GLOBAL(vmode_g->class) == TEXT)
+ if (GET_GLOBAL(vmode_g->memmodel) & TEXT)
return;
u8 *addr_far, mask, attr=0, data, i;
diff --git a/vgasrc/vgatables.c b/vgasrc/vgatables.c
index 129f9dc..0587e65 100644
--- a/vgasrc/vgatables.c
+++ b/vgasrc/vgatables.c
@@ -383,23 +383,23 @@
#define VPARAM(x) &video_param_table[x]
static struct vgamode_s vga_modes[] VAR16 = {
- //mode vparam class model bits sstart pelm dac
- {0x00, VPARAM(0x17), TEXT, CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
- {0x01, VPARAM(0x17), TEXT, CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
- {0x02, VPARAM(0x18), TEXT, CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
- {0x03, VPARAM(0x18), TEXT, CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
- {0x04, VPARAM(0x04), GRAPH, CGA, 2, SEG_CTEXT, 0xFF, PAL(palette1)},
- {0x05, VPARAM(0x05), GRAPH, CGA, 2, SEG_CTEXT, 0xFF, PAL(palette1)},
- {0x06, VPARAM(0x06), GRAPH, CGA, 1, SEG_CTEXT, 0xFF, PAL(palette1)},
- {0x07, VPARAM(0x07), TEXT, MTEXT, 4, SEG_MTEXT, 0xFF, PAL(palette0)},
- {0x0D, VPARAM(0x0d), GRAPH, PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette1)},
- {0x0E, VPARAM(0x0e), GRAPH, PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette1)},
- {0x0F, VPARAM(0x11), GRAPH, PLANAR1, 1, SEG_GRAPH, 0xFF, PAL(palette0)},
- {0x10, VPARAM(0x12), GRAPH, PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette2)},
- {0x11, VPARAM(0x1a), GRAPH, PLANAR1, 1, SEG_GRAPH, 0xFF, PAL(palette2)},
- {0x12, VPARAM(0x1b), GRAPH, PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette2)},
- {0x13, VPARAM(0x1c), GRAPH, LINEAR8, 8, SEG_GRAPH, 0xFF, PAL(palette3)},
- {0x6A, VPARAM(0x1d), GRAPH, PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette2)},
+ //mode vparam model bits sstart pelm dac
+ {0x00, VPARAM(0x17), CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
+ {0x01, VPARAM(0x17), CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
+ {0x02, VPARAM(0x18), CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
+ {0x03, VPARAM(0x18), CTEXT, 4, SEG_CTEXT, 0xFF, PAL(palette2)},
+ {0x04, VPARAM(0x04), CGA, 2, SEG_CTEXT, 0xFF, PAL(palette1)},
+ {0x05, VPARAM(0x05), CGA, 2, SEG_CTEXT, 0xFF, PAL(palette1)},
+ {0x06, VPARAM(0x06), CGA, 1, SEG_CTEXT, 0xFF, PAL(palette1)},
+ {0x07, VPARAM(0x07), MTEXT, 4, SEG_MTEXT, 0xFF, PAL(palette0)},
+ {0x0D, VPARAM(0x0d), PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette1)},
+ {0x0E, VPARAM(0x0e), PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette1)},
+ {0x0F, VPARAM(0x11), PLANAR1, 1, SEG_GRAPH, 0xFF, PAL(palette0)},
+ {0x10, VPARAM(0x12), PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette2)},
+ {0x11, VPARAM(0x1a), PLANAR1, 1, SEG_GRAPH, 0xFF, PAL(palette2)},
+ {0x12, VPARAM(0x1b), PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette2)},
+ {0x13, VPARAM(0x1c), LINEAR8, 8, SEG_GRAPH, 0xFF, PAL(palette3)},
+ {0x6A, VPARAM(0x1d), PLANAR4, 4, SEG_GRAPH, 0xFF, PAL(palette2)},
};
struct vgamode_s *
diff --git a/vgasrc/vgatables.h b/vgasrc/vgatables.h
index 8b35f0e..81e9c3a 100644
--- a/vgasrc/vgatables.h
+++ b/vgasrc/vgatables.h
@@ -49,15 +49,12 @@
#define SEG_MTEXT 0xB000
/*
- *
* Tables of default values for each mode
- *
*/
-#define TEXT 0x00
-#define GRAPH 0x01
+#define TEXT 0x80
-#define CTEXT 0x00
-#define MTEXT 0x01
+#define CTEXT (0x00 | TEXT)
+#define MTEXT (0x01 | TEXT)
#define CGA 0x02
#define PLANAR1 0x03
#define PLANAR4 0x04
@@ -71,8 +68,6 @@
#define SCROLL_DOWN 0
#define SCROLL_UP 1
-#define NO_ATTR 2
-#define WITH_ATTR 3
#define SCREEN_SIZE(x,y) (((x*y*2)|0x00ff)+1)
#define SCREEN_MEM_START(x,y,p) ((((x*y*2)|0x00ff)+1)*p)
@@ -94,7 +89,6 @@
struct vgamode_s {
u8 svgamode;
struct VideoParam_s *vparam;
- u8 class; /* TEXT, GRAPH */
u8 memmodel; /* CTEXT,MTEXT,CGA,PL1,PL2,PL4,P8,P15,P16,P24,P32 */
u8 pixbits;
u16 sstart;