Signed-off-by: Kevin O'Connor kevin@koconnor.net --- vgasrc/stdvga.c | 24 ++++++++++++++++++++++-- vgasrc/stdvga.h | 4 ++-- vgasrc/vgabios.c | 20 ++++++++++---------- vgasrc/vgabios.h | 2 -- vgasrc/vgafb.c | 19 ------------------- 5 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c index fd8514e..9b91559 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -10,6 +10,7 @@ #include "farptr.h" // SET_FARVAR #include "biosvar.h" // GET_BDA #include "vgabios.h" // VGAREG_* +#include "util.h" // memcpy_far
// TODO // * replace direct in/out calls with wrapper functions @@ -288,7 +289,12 @@ stdvga_set_text_block_specifier(u8 spec) outw((spec << 8) | 0x03, VGAREG_SEQU_ADDRESS); }
-void + +/**************************************************************** + * Font loading + ****************************************************************/ + +static void get_font_access(void) { outw(0x0100, VGAREG_SEQU_ADDRESS); @@ -300,7 +306,7 @@ get_font_access(void) outw(0x0406, VGAREG_GRDC_ADDRESS); }
-void +static void release_font_access(void) { outw(0x0100, VGAREG_SEQU_ADDRESS); @@ -313,6 +319,20 @@ release_font_access(void) outw(0x1005, VGAREG_GRDC_ADDRESS); }
+void +stdvga_load_font(u16 seg, void *src_far, u16 count + , u16 start, u8 destflags, u8 fontsize) +{ + get_font_access(); + u16 blockaddr = ((destflags & 0x03) << 14) + ((destflags & 0x04) << 11); + void *dest_far = (void*)(blockaddr + start*32); + u16 i; + for (i = 0; i < count; i++) + memcpy_far(SEG_GRAPH, dest_far + i*32 + , seg, src_far + i*fontsize, fontsize); + release_font_access(); +} +
/**************************************************************** * CRTC registers diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h index 7fa612e..0d5f59b 100644 --- a/vgasrc/stdvga.h +++ b/vgasrc/stdvga.h @@ -127,8 +127,8 @@ void stdvga_restore_dac_state(u16 seg, struct saveDACcolors *info); void stdvga_sequ_write(u8 index, u8 value); void stdvga_grdc_write(u8 index, u8 value); void stdvga_set_text_block_specifier(u8 spec); -void get_font_access(void); -void release_font_access(void); +void stdvga_load_font(u16 seg, void *src_far, u16 count + , u16 start, u8 destflags, u8 fontsize); void stdvga_set_cursor_shape(u8 start, u8 end); void stdvga_set_active_page(u16 address); void stdvga_set_cursor_pos(u16 address); diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index 5f646cd..5083292 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -792,20 +792,20 @@ handle_1010(struct bregs *regs) static void handle_101100(struct bregs *regs) { - vgafb_load_font(regs->es, (void*)(regs->bp+0), regs->cx - , regs->dx, regs->bl, regs->bh); + stdvga_load_font(regs->es, (void*)(regs->bp+0), regs->cx + , regs->dx, regs->bl, regs->bh); }
static void handle_101101(struct bregs *regs) { - vgafb_load_font(get_global_seg(), vgafont14, 0x100, 0, regs->bl, 14); + stdvga_load_font(get_global_seg(), vgafont14, 0x100, 0, regs->bl, 14); }
static void handle_101102(struct bregs *regs) { - vgafb_load_font(get_global_seg(), vgafont8, 0x100, 0, regs->bl, 8); + stdvga_load_font(get_global_seg(), vgafont8, 0x100, 0, regs->bl, 8); }
static void @@ -817,35 +817,35 @@ handle_101103(struct bregs *regs) static void handle_101104(struct bregs *regs) { - vgafb_load_font(get_global_seg(), vgafont16, 0x100, 0, regs->bl, 16); + stdvga_load_font(get_global_seg(), vgafont16, 0x100, 0, regs->bl, 16); }
static void handle_101110(struct bregs *regs) { - vgafb_load_font(regs->es, (void*)(regs->bp+0), regs->cx - , regs->dx, regs->bl, regs->bh); + stdvga_load_font(regs->es, (void*)(regs->bp+0), regs->cx + , regs->dx, regs->bl, regs->bh); set_scan_lines(regs->bh); }
static void handle_101111(struct bregs *regs) { - vgafb_load_font(get_global_seg(), vgafont14, 0x100, 0, regs->bl, 14); + stdvga_load_font(get_global_seg(), vgafont14, 0x100, 0, regs->bl, 14); set_scan_lines(14); }
static void handle_101112(struct bregs *regs) { - vgafb_load_font(get_global_seg(), vgafont8, 0x100, 0, regs->bl, 8); + stdvga_load_font(get_global_seg(), vgafont8, 0x100, 0, regs->bl, 8); set_scan_lines(8); }
static void handle_101114(struct bregs *regs) { - vgafb_load_font(get_global_seg(), vgafont16, 0x100, 0, regs->bl, 16); + stdvga_load_font(get_global_seg(), vgafont16, 0x100, 0, regs->bl, 16); set_scan_lines(16); }
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h index 5cf1f04..d31161e 100644 --- a/vgasrc/vgabios.h +++ b/vgasrc/vgabios.h @@ -58,8 +58,6 @@ void vgafb_write_char(struct cursorpos cp, struct carattr ca); struct carattr vgafb_read_char(struct cursorpos cp); void vgafb_write_pixel(u8 color, u16 x, u16 y); u8 vgafb_read_pixel(u16 x, u16 y); -void vgafb_load_font(u16 seg, void *src_far, u16 count - , u16 start, u8 destflags, u8 fontsize);
// clext.c int cirrus_set_video_mode(u8 mode, u8 noclearmem); diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index c9a257a..19ab1df 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -489,22 +489,3 @@ vgafb_read_pixel(u16 x, u16 y) } return attr; } - - -/**************************************************************** - * Font loading - ****************************************************************/ - -void -vgafb_load_font(u16 seg, void *src_far, u16 count - , u16 start, u8 destflags, u8 fontsize) -{ - get_font_access(); - u16 blockaddr = ((destflags & 0x03) << 14) + ((destflags & 0x04) << 11); - void *dest_far = (void*)(blockaddr + start*32); - u16 i; - for (i = 0; i < count; i++) - memcpy_far(SEG_GRAPH, dest_far + i*32 - , seg, src_far + i*fontsize, fontsize); - release_font_access(); -}