diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-08-04 16:25:33 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-08-04 16:27:03 -0400 |
commit | 27129d003f63d96624a90d052b9899bc7f900e07 (patch) | |
tree | 452b573b3aa01c11a56824c85fe931cd4bcf85ca /vgasrc/vgafb.c | |
parent | 4e3a1a5df143f910dc2dfce4ecbd202f5e1efb29 (diff) | |
download | seabios-27129d003f63d96624a90d052b9899bc7f900e07.tar.gz |
swcursor: Move swcursor code from vgafb.c to new file swcursor.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/vgafb.c')
-rw-r--r-- | vgasrc/vgafb.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index bd1c8dd6..46a1ab80 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -497,30 +497,6 @@ fail: return (struct carattr){0, 0, 0}; } -// Draw/undraw a cursor on the framebuffer by xor'ing the cursor cell -void -gfx_set_swcursor(struct vgamode_s *vmode_g, int enable, struct cursorpos cp) -{ - u16 cursor_type = get_cursor_shape(); - u8 start = cursor_type >> 8, end = cursor_type & 0xff; - struct gfx_op op; - init_gfx_op(&op, vmode_g); - op.x = cp.x * 8; - int cheight = GET_BDA(char_height); - op.y = cp.y * cheight + start; - - int i; - for (i = start; i < cheight && i <= end; i++, op.y++) { - op.op = GO_READ8; - handle_gfx_op(&op); - int j; - for (j = 0; j < 8; j++) - op.pixels[j] ^= 0x07; - op.op = GO_WRITE8; - handle_gfx_op(&op); - } -} - // Set the pixel at the given position. void vgafb_write_pixel(u8 color, u16 x, u16 y) @@ -686,36 +662,3 @@ vgafb_read_char(struct cursorpos cp) u16 v = GET_FARVAR(GET_GLOBAL(vmode_g->sstart), *dest_far); return (struct carattr){v, v>>8, 0}; } - -// Draw/undraw a cursor on the screen -void -vgafb_set_swcursor(int enable) -{ - if (!vga_emulate_text()) - return; - u8 flags = GET_BDA_EXT(flags); - if (!!(flags & BF_SWCURSOR) == enable) - // Already in requested mode. - return; - struct vgamode_s *vmode_g = get_current_mode(); - if (!vmode_g) - return; - struct cursorpos cp = get_cursor_pos(GET_BDA(video_page)); - if (cp.x >= GET_BDA(video_cols) || cp.y > GET_BDA(video_rows) - || GET_BDA(cursor_type) >= 0x2000) - // Cursor not visible - return; - - SET_BDA_EXT(flags, (flags & ~BF_SWCURSOR) | (enable ? BF_SWCURSOR : 0)); - - if (GET_GLOBAL(vmode_g->memmodel) != MM_TEXT) { - gfx_set_swcursor(vmode_g, enable, cp); - return; - } - - // In text mode, swap foreground and background attributes for cursor - void *dest_far = text_address(cp) + 1; - u8 attr = GET_FARVAR(GET_GLOBAL(vmode_g->sstart), *(u8*)dest_far); - attr = (attr >> 4) | (attr << 4); - SET_FARVAR(GET_GLOBAL(vmode_g->sstart), *(u8*)dest_far, attr); -} |