X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=vgasrc%2Fvgafb.c;h=f0bd71ef563dfadfee6db5bf3644eefbb8c31981;hb=4a73f933968e5cf6f2a6ce1ad87448dd6b136e48;hp=eb4ced8f7734328a88088ea67bc70043a1c3e1f3;hpb=80da87da8db00f7e5a88aeae7f17dbbb074518b8;p=seabios.git diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index eb4ced8..f0bd71e 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -7,8 +7,7 @@ #include "biosvar.h" // GET_BDA #include "util.h" // memset_far -#include "vgabios.h" // find_vga_entry -#include "stdvga.h" // stdvga_grdc_write +#include "stdvga.h" // stdvga_planar4_plane /**************************************************************** @@ -55,19 +54,22 @@ scroll_pl4(struct vgamode_s *vmode_g, int nblines, int attr src_far = dest_far - nblines * cheight * stride; stride = -stride; } + if (attr < 0) + attr = 0; int cols = lr.x - ul.x + 1; int rows = lr.y - ul.y + 1; - if (nblines < rows) { - stdvga_grdc_write(0x05, 0x01); - dest_far = memcpy_stride(SEG_GRAPH, dest_far, src_far, cols * cwidth + int i; + for (i=0; i<4; i++) { + stdvga_planar4_plane(i); + void *dest = dest_far; + if (nblines < rows) + dest = memcpy_stride(SEG_GRAPH, dest, src_far, cols * cwidth , stride, (rows - nblines) * cheight); + u8 pixels = (attr & (1<= 0) { dest_far += ul.y * cheight * stride + ul.x * cwidth; src_far = dest_far + nblines * cheight * stride; @@ -153,15 +153,15 @@ scroll_text(struct vgamode_s *vmode_g, int nblines, int attr src_far = dest_far - nblines * cheight * stride; stride = -stride; } + if (attr < 0) + attr = 0x07; + attr = (attr << 8) | ' '; int cols = lr.x - ul.x + 1; int rows = lr.y - ul.y + 1; u16 seg = GET_GLOBAL(vmode_g->sstart); if (nblines < rows) dest_far = memcpy_stride(seg, dest_far, src_far, cols * cwidth , stride, (rows - nblines) * cheight); - if (attr < 0) - attr = 0x07; - attr = (attr << 8) | ' '; memset16_stride(seg, dest_far, attr, cols * cwidth , stride, nblines * cheight); } @@ -170,7 +170,7 @@ void 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 = get_current_mode(); if (!vmode_g) return; @@ -219,29 +219,20 @@ write_gfx_char_pl4(struct vgamode_s *vmode_g } u16 addr = cp.x + cp.y * cheight * nbcols; u16 src = ca.car * cheight; - stdvga_sequ_write(0x02, 0x0f); - stdvga_grdc_write(0x05, 0x02); - if (ca.attr & 0x80) - stdvga_grdc_write(0x03, 0x18); - else - stdvga_grdc_write(0x03, 0x00); - u8 i; - for (i = 0; i < cheight; i++) { - u8 *dest_far = (void*)(addr + i * nbcols); - u8 j; - for (j = 0; j < 8; j++) { - u8 mask = 0x80 >> j; - stdvga_grdc_write(0x08, mask); - GET_FARVAR(SEG_GRAPH, *(volatile u8*)dest_far); - if (GET_GLOBAL(fdata_g[src + i]) & mask) - SET_FARVAR(SEG_GRAPH, *dest_far, ca.attr & 0x0f); - else - SET_FARVAR(SEG_GRAPH, *dest_far, 0x00); + int i; + for (i=0; i<4; i++) { + stdvga_planar4_plane(i); + u8 colors = ((ca.attr & (1<sstart), *address_far); struct carattr ca = {v, v>>8, 0}; @@ -411,24 +396,24 @@ void 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 = get_current_mode(); if (!vmode_g) return; - u8 *addr_far, mask, attr, data; + u8 *addr_far, mask, attr, data, i; switch (GET_GLOBAL(vmode_g->memmodel)) { case MM_PLANAR: addr_far = (void*)(x / 8 + y * GET_BDA(video_cols)); mask = 0x80 >> (x & 0x07); - stdvga_grdc_write(0x08, mask); - stdvga_grdc_write(0x05, 0x02); - GET_FARVAR(SEG_GRAPH, *(volatile u8*)addr_far); - if (color & 0x80) - stdvga_grdc_write(0x03, 0x18); - SET_FARVAR(SEG_GRAPH, *addr_far, color); - stdvga_grdc_write(0x08, 0xff); - stdvga_grdc_write(0x05, 0x00); - stdvga_grdc_write(0x03, 0x00); + for (i=0; i<4; i++) { + stdvga_planar4_plane(i); + u8 colors = (color & (1<depth) == 2) @@ -467,7 +452,7 @@ u8 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 = get_current_mode(); if (!vmode_g) return 0; @@ -478,11 +463,12 @@ vgafb_read_pixel(u16 x, u16 y) mask = 0x80 >> (x & 0x07); attr = 0x00; for (i = 0; i < 4; i++) { - stdvga_grdc_write(0x04, i); + stdvga_planar4_plane(i); data = GET_FARVAR(SEG_GRAPH, *addr_far) & mask; if (data > 0) attr |= (0x01 << i); } + stdvga_planar4_plane(-1); break; case MM_CGA: addr_far = (void*)((x >> 2) + (y >> 1) * 80);