#include "biosvar.h" // GET_BDA
#include "util.h" // memset_far
-#include "vgabios.h" // find_vga_entry
+#include "vgahw.h" // vgahw_find_mode
#include "stdvga.h" // stdvga_grdc_write
, struct cursorpos ul, struct cursorpos lr)
{
int cheight = GET_GLOBAL(vmode_g->cheight) / 2;
- int cwidth = GET_GLOBAL(vmode_g->pixbits);
+ int cwidth = GET_GLOBAL(vmode_g->depth);
int stride = GET_BDA(video_cols) * cwidth;
void *src_far, *dest_far;
if (nblines >= 0) {
{
int cheight = 1;
int cwidth = 2;
- u16 nbrows = GET_BDA(video_rows) + 1;
- u16 nbcols = GET_BDA(video_cols);
- int stride = nbcols * cwidth;
- void *src_far, *dest_far = (void*)SCREEN_MEM_START(nbcols, nbrows, ul.page);
+ int stride = GET_BDA(video_cols) * cwidth;
+ void *src_far, *dest_far = (void*)(GET_BDA(video_pagesize) * ul.page);
if (nblines >= 0) {
dest_far += ul.y * cheight * stride + ul.x * cwidth;
src_far = dest_far + nblines * cheight * stride;
vgafb_scroll(int nblines, int attr, struct cursorpos ul, struct cursorpos lr)
{
// Get the mode
- struct vgamode_s *vmode_g = find_vga_entry(GET_BDA(video_mode));
+ struct vgamode_s *vmode_g = vgahw_find_mode(GET_BDA(video_mode));
if (!vmode_g)
return;
return;
u8 *fdata_g = vgafont8;
- u8 bpp = GET_GLOBAL(vmode_g->pixbits);
+ u8 bpp = GET_GLOBAL(vmode_g->depth);
u16 addr = (cp.x * bpp) + cp.y * 320;
u16 src = ca.car * 8;
u8 i;
write_text_char(struct vgamode_s *vmode_g
, struct cursorpos cp, struct carattr ca)
{
- // Get the dimensions
- u16 nbrows = GET_BDA(video_rows) + 1;
- u16 nbcols = GET_BDA(video_cols);
-
// Compute the address
- void *address_far = (void*)(SCREEN_MEM_START(nbcols, nbrows, cp.page)
+ u16 nbcols = GET_BDA(video_cols);
+ void *address_far = (void*)(GET_BDA(video_pagesize) * cp.page
+ (cp.x + cp.y * nbcols) * 2);
if (ca.use_attr) {
vgafb_write_char(struct cursorpos cp, struct carattr ca)
{
// Get the mode
- struct vgamode_s *vmode_g = find_vga_entry(GET_BDA(video_mode));
+ struct vgamode_s *vmode_g = vgahw_find_mode(GET_BDA(video_mode));
if (!vmode_g)
return;
vgafb_read_char(struct cursorpos cp)
{
// Get the mode
- struct vgamode_s *vmode_g = find_vga_entry(GET_BDA(video_mode));
+ struct vgamode_s *vmode_g = vgahw_find_mode(GET_BDA(video_mode));
if (!vmode_g)
goto fail;
goto fail;
}
- // Get the dimensions
- u16 nbrows = GET_BDA(video_rows) + 1;
- u16 nbcols = GET_BDA(video_cols);
-
// Compute the address
- u16 *address_far = (void*)(SCREEN_MEM_START(nbcols, nbrows, cp.page)
+ u16 nbcols = GET_BDA(video_cols);
+ u16 *address_far = (void*)(GET_BDA(video_pagesize) * cp.page
+ (cp.x + cp.y * nbcols) * 2);
u16 v = GET_FARVAR(GET_GLOBAL(vmode_g->sstart), *address_far);
struct carattr ca = {v, v>>8, 0};
vgafb_write_pixel(u8 color, u16 x, u16 y)
{
// Get the mode
- struct vgamode_s *vmode_g = find_vga_entry(GET_BDA(video_mode));
+ struct vgamode_s *vmode_g = vgahw_find_mode(GET_BDA(video_mode));
if (!vmode_g)
return;
stdvga_grdc_write(0x03, 0x00);
break;
case MM_CGA:
- if (GET_GLOBAL(vmode_g->pixbits) == 2)
+ if (GET_GLOBAL(vmode_g->depth) == 2)
addr_far = (void*)((x >> 2) + (y >> 1) * 80);
else
addr_far = (void*)((x >> 3) + (y >> 1) * 80);
if (y & 1)
addr_far += 0x2000;
data = GET_FARVAR(SEG_CTEXT, *addr_far);
- if (GET_GLOBAL(vmode_g->pixbits) == 2) {
+ if (GET_GLOBAL(vmode_g->depth) == 2) {
attr = (color & 0x03) << ((3 - (x & 0x03)) * 2);
mask = 0x03 << ((3 - (x & 0x03)) * 2);
} else {
vgafb_read_pixel(u16 x, u16 y)
{
// Get the mode
- struct vgamode_s *vmode_g = find_vga_entry(GET_BDA(video_mode));
+ struct vgamode_s *vmode_g = vgahw_find_mode(GET_BDA(video_mode));
if (!vmode_g)
return 0;
if (y & 1)
addr_far += 0x2000;
data = GET_FARVAR(SEG_CTEXT, *addr_far);
- if (GET_GLOBAL(vmode_g->pixbits) == 2)
+ if (GET_GLOBAL(vmode_g->depth) == 2)
attr = (data >> ((3 - (x & 0x03)) * 2)) & 0x03;
else
attr = (data >> (7 - (x & 0x07))) & 0x01;