diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-05-25 09:06:50 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-05-25 09:06:50 -0400 |
commit | deb9cb929d3db99839e4b65f48d41dea942d3e5a (patch) | |
tree | 8d0f33f5bcdd3ac6c456c01be1211246232b70c5 /vgasrc | |
parent | 124b6f7c9fd56c0f8884a26e3d99d5660a0fd2f3 (diff) | |
download | seabios-hppa-deb9cb929d3db99839e4b65f48d41dea942d3e5a.zip seabios-hppa-deb9cb929d3db99839e4b65f48d41dea942d3e5a.tar.gz seabios-hppa-deb9cb929d3db99839e4b65f48d41dea942d3e5a.tar.bz2 |
VGA: Replace biosfn_load_text_* with vgafb_load_font().
The functions font loading functions are nearly identical - replace
with one common function.
Diffstat (limited to 'vgasrc')
-rw-r--r-- | vgasrc/vga.c | 23 | ||||
-rw-r--r-- | vgasrc/vgafb.c | 66 | ||||
-rw-r--r-- | vgasrc/vgatables.h | 6 |
3 files changed, 30 insertions, 65 deletions
diff --git a/vgasrc/vga.c b/vgasrc/vga.c index fd4ae28..0909c32 100644 --- a/vgasrc/vga.c +++ b/vgasrc/vga.c @@ -7,6 +7,7 @@ // TODO: +// * remove recursion from biosfn_write_teletype() // * review correctness of converted asm by comparing with RBIL // * refactor redundant code into sub-functions // * See if there is a method to the in/out stuff that can be encapsulated. @@ -14,8 +15,6 @@ // * verify all funcs static // // * convert vbe/clext code -// -// * extract hw code from bios interfaces #include "bregs.h" // struct bregs #include "biosvar.h" // GET_BDA @@ -774,20 +773,20 @@ handle_1010(struct bregs *regs) static void handle_101100(struct bregs *regs) { - biosfn_load_text_user_pat(regs->es, regs->bp - , regs->cx, regs->dx, regs->bl, regs->bh); + vgafb_load_font(regs->es, (void*)(regs->bp+0), regs->cx + , regs->dx, regs->bl, regs->bh); } static void handle_101101(struct bregs *regs) { - biosfn_load_text_8_14_pat(regs->bl); + vgafb_load_font(get_global_seg(), vgafont14, 0x100, 0, regs->bl, 14); } static void handle_101102(struct bregs *regs) { - biosfn_load_text_8_8_pat(regs->bl); + vgafb_load_font(get_global_seg(), vgafont8, 0x100, 0, regs->bl, 8); } static void @@ -799,35 +798,35 @@ handle_101103(struct bregs *regs) static void handle_101104(struct bregs *regs) { - biosfn_load_text_8_16_pat(regs->bl); + vgafb_load_font(get_global_seg(), vgafont16, 0x100, 0, regs->bl, 16); } static void handle_101110(struct bregs *regs) { - biosfn_load_text_user_pat(regs->es, regs->bp - , regs->cx, regs->dx, regs->bl, regs->bh); + vgafb_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) { - biosfn_load_text_8_14_pat(regs->bl); + vgafb_load_font(get_global_seg(), vgafont14, 0x100, 0, regs->bl, 14); set_scan_lines(14); } static void handle_101112(struct bregs *regs) { - biosfn_load_text_8_8_pat(regs->bl); + vgafb_load_font(get_global_seg(), vgafont8, 0x100, 0, regs->bl, 8); set_scan_lines(8); } static void handle_101114(struct bregs *regs) { - biosfn_load_text_8_16_pat(regs->bl); + vgafb_load_font(get_global_seg(), vgafont16, 0x100, 0, regs->bl, 16); set_scan_lines(16); } diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index 6e10702..605a3b6 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -9,6 +9,16 @@ #include "util.h" // memset_far #include "vgatables.h" // find_vga_entry +// TODO +// * extract hw code from framebuffer code +// * use clear_screen() in scroll code +// * merge car/attr/with_attr into one param +// * merge page/x/y into one param +// * combine biosfn_write_char_attr/_only() +// * 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 inline void memcpy16_far(u16 d_seg, void *d_far, u16 s_seg, const void *s_far, size_t len) @@ -604,57 +614,15 @@ biosfn_read_pixel(u8 BH, u16 CX, u16 DX, u16 *AX) ****************************************************************/ void -biosfn_load_text_user_pat(u16 ES, u16 BP, u16 CX, u16 DX, u8 BL, u8 BH) -{ - get_font_access(); - u16 blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); - u16 i; - for (i = 0; i < CX; i++) { - void *src_far = (void*)(BP + i * BH); - void *dest_far = (void*)(blockaddr + (DX + i) * 32); - memcpy_far(SEG_GRAPH, dest_far, ES, src_far, BH); - } - release_font_access(); -} - -void -biosfn_load_text_8_14_pat(u8 BL) -{ - get_font_access(); - u16 blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); - u16 i; - for (i = 0; i < 0x100; i++) { - u16 src = i * 14; - void *dest_far = (void*)(blockaddr + i * 32); - memcpy_far(SEG_GRAPH, dest_far, get_global_seg(), &vgafont14[src], 14); - } - release_font_access(); -} - -void -biosfn_load_text_8_8_pat(u8 BL) +vgafb_load_font(u16 seg, void *src_far, u16 count + , u16 start, u8 destflags, u8 fontsize) { get_font_access(); - u16 blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); + u16 blockaddr = ((destflags & 0x03) << 14) + ((destflags & 0x04) << 11); + void *dest_far = (void*)(blockaddr + start*32); u16 i; - for (i = 0; i < 0x100; i++) { - u16 src = i * 8; - void *dest_far = (void*)(blockaddr + i * 32); - memcpy_far(SEG_GRAPH, dest_far, get_global_seg(), &vgafont8[src], 8); - } - release_font_access(); -} - -void -biosfn_load_text_8_16_pat(u8 BL) -{ - get_font_access(); - u16 blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); - u16 i; - for (i = 0; i < 0x100; i++) { - u16 src = i * 16; - void *dest_far = (void*)(blockaddr + i * 32); - memcpy_far(SEG_GRAPH, dest_far, get_global_seg(), &vgafont16[src], 16); - } + for (i = 0; i < count; i++) + memcpy_far(SEG_GRAPH, dest_far + i*32 + , seg, src_far + i*fontsize, fontsize); release_font_access(); } diff --git a/vgasrc/vgatables.h b/vgasrc/vgatables.h index 03ea613..df09686 100644 --- a/vgasrc/vgatables.h +++ b/vgasrc/vgatables.h @@ -172,10 +172,8 @@ void biosfn_write_char_only(u8 car, u8 page, u8 attr, u16 count); void biosfn_read_char_attr(u8 page, u16 *car); void biosfn_write_pixel(u8 BH, u8 AL, u16 CX, u16 DX); void biosfn_read_pixel(u8 BH, u16 CX, u16 DX, u16 *AX); -void biosfn_load_text_user_pat(u16 ES, u16 BP, u16 CX, u16 DX, u8 BL, u8 BH); -void biosfn_load_text_8_14_pat(u8 BL); -void biosfn_load_text_8_8_pat(u8 BL); -void biosfn_load_text_8_16_pat(u8 BL); +void vgafb_load_font(u16 seg, void *src_far, u16 count + , u16 start, u8 destflags, u8 fontsize); // vgaio.c void vgahw_screen_disable(); |