From d037b9dfaab0d51b921701704d1b48ca5a787fee Mon Sep 17 00:00:00 2001 From: TomAwezome Date: Mon, 29 Nov 2021 20:58:21 -0500 Subject: [PATCH] Implement 8x16 proof-of-concept. --- src/Kernel/BlkDev/DiskAHCI.CC | 8 ++--- src/Kernel/Display.CC | 9 ++++- src/Kernel/KMain.CC | 9 +++-- src/Kernel/KStart16.CC | 5 ++- src/Kernel/KernelA.HH | 5 ++- src/Once.CC | 8 +++++ src/System/DolDoc/DocRecalcLib.CC | 9 +++-- src/System/Gr/GrAsm.CC | 7 ++-- src/System/Gr/GrScreen.CC | 59 +++++++++++++++++++++++++++++-- src/System/Gr/MakeGr.CC | 2 +- 10 files changed, 104 insertions(+), 17 deletions(-) diff --git a/src/Kernel/BlkDev/DiskAHCI.CC b/src/Kernel/BlkDev/DiskAHCI.CC index afc9d59b..8631efaf 100755 --- a/src/Kernel/BlkDev/DiskAHCI.CC +++ b/src/Kernel/BlkDev/DiskAHCI.CC @@ -1065,7 +1065,7 @@ U0 AHCIInit() CAHCIPort *port; I64 i, bdf; - "\n"; + "______________________\n"; bdf = PCIClassFind(PCIC_STORAGE << 16 | PCISC_AHCI << 8 + 1, 0); //0x010601, last byte prog_if, AHCI version 1.0 @@ -1125,7 +1125,7 @@ U0 AHCIInit() "Unknown\n"; } } - "\n\n"; + "______________________\n\n"; } Bool AHCIBootDVDProbeAll(CBlkDev *bd) @@ -1135,7 +1135,7 @@ Bool AHCIBootDVDProbeAll(CBlkDev *bd) U8 *buf = CAlloc(DVD_BLK_SIZE); CKernel *kernel; - "\n"; + "______________________\n"; for (i = 0; i < AHCI_MAX_PORTS; i++) { @@ -1165,7 +1165,7 @@ Bool AHCIBootDVDProbeAll(CBlkDev *bd) if (kernel->compile_time == sys_compile_time) { "AHCI: Found sys_compile_time at BLK %d on Port %d\n", sys_boot_blk, i; - "\n"; + "______________________\n"; return TRUE; } else diff --git a/src/Kernel/Display.CC b/src/Kernel/Display.CC index 0d41dc83..1bce69ed 100755 --- a/src/Kernel/Display.CC +++ b/src/Kernel/Display.CC @@ -69,7 +69,10 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$(). } x = col * FONT_WIDTH; y = row * FONT_HEIGHT; - ch_bitmap = text.font[ch & 0xFF]; + // 8x16 hack +// ch_bitmap = text.font[ch & 0xFF]; + ch_bitmap = text.font[2 * ch & 0xFF]; + //////////// framebuffer = text.fb_alias + sys_vbe_mode.width * y + x; PUSHFD @@ -83,6 +86,10 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$(). if (i & (FONT_WIDTH - 1) == FONT_WIDTH - 1) framebuffer += sys_vbe_mode.width - FONT_WIDTH; ch_bitmap >>= 1; + // 8x16 hack + if (i == FONT_WIDTH * FONT_HEIGHT / 2 - 1) + ch_bitmap = text.font[2 * ch & 0xFF + 1]; + //////////// } POPFD text.raw_col++; diff --git a/src/Kernel/KMain.CC b/src/Kernel/KMain.CC index 0f44bd76..ffc6afc0 100755 --- a/src/Kernel/KMain.CC +++ b/src/Kernel/KMain.CC @@ -95,8 +95,11 @@ U0 SysGrInit() text.aux_font[10] = text.font[10]; //"Return" symbol text.aux_font[255] = text.font[255]; //Block symbol - for (i = ''; i < ''; i++) - text.aux_font[i] = text.font[i]; +// 8x16 hack +// for (i = ''; i < ''; i++) +// text.aux_font[i] = text.font[i]; + SwapI64(&text.font, &text.aux_font); +//////////// text.border_chars[2] (I64) = 'ͳɿ'; text.border_chars[10](U32) = 'ټ'; @@ -167,7 +170,7 @@ U0 KMain() //to debug. After this point, use $LK,"RawPrint",A="MN:RawPrint"$() LBts(&sys_run_level, RLf_RAW); "\nZealOS V%0.2f\t%D %T\n", sys_os_version, sys_compile_time, sys_compile_time; - "\n\n"; + "_________________________________\n\n"; "TimerInit;\n"; TimerInit; diff --git a/src/Kernel/KStart16.CC b/src/Kernel/KStart16.CC index 54c8d9d7..7aa59bcc 100755 --- a/src/Kernel/KStart16.CC +++ b/src/Kernel/KStart16.CC @@ -219,7 +219,10 @@ GET_IP: POP BX //Get pointer to 8x8 VGA ROM font. MOV AX, 0x1130 - MOV BH, 3 + // 8x16 hack +// MOV BH, 3 + MOV BH, 6 + //////////// INT 0x10 MOV AX, ES SHL EAX, 16 diff --git a/src/Kernel/KernelA.HH b/src/Kernel/KernelA.HH index f3ef5695..533b81d4 100755 --- a/src/Kernel/KernelA.HH +++ b/src/Kernel/KernelA.HH @@ -4261,7 +4261,10 @@ public class CTextGlobals }; #define FONT_WIDTH 8 -#define FONT_HEIGHT 8 +// 8x16 hack +//#define FONT_HEIGHT 8 +#define FONT_HEIGHT 16 +//////////// #help_index "Graphics" //z-values less than zero are in front of screen and not drawn. diff --git a/src/Once.CC b/src/Once.CC index be0b6d7b..f3cf08e2 100755 --- a/src/Once.CC +++ b/src/Once.CC @@ -10,6 +10,14 @@ U0 Tmp() { OnceExe; + // 8x16 hack + text.font[256] = -1; + text.font[257] = -1; + text.font[258] = text.font[259] = 0xFFFF0000FFFF0000 & 0x9999999999999999; + text.border_chars[2] (I64) = ''; + text.border_chars[10](U32) = ''; + //////////// + switch (sys_boot_src.u16[0]) { case BOOT_SRC_ROM: diff --git a/src/System/DolDoc/DocRecalcLib.CC b/src/System/DolDoc/DocRecalcLib.CC index 7437ac19..bcd62930 100755 --- a/src/System/DolDoc/DocRecalcLib.CC +++ b/src/System/DolDoc/DocRecalcLib.CC @@ -2,8 +2,13 @@ I64 DocCharDist(CDoc *doc, I64 x, I64 y) { -#assert FONT_WIDTH == FONT_HEIGHT - return (SqrI64(doc->x - x) + SqrI64(doc->y - y)) * FONT_WIDTH * FONT_WIDTH; +// 8x16 hack +//#assert FONT_WIDTH == FONT_HEIGHT +// return (SqrI64(doc->x - x) + SqrI64(doc->y - y)) * FONT_WIDTH * FONT_WIDTH; + return (SqrI64(doc->x - x) * FONT_WIDTH + SqrI64(doc->y - y)) * FONT_HEIGHT; +//////////// + + } U0 DocDelToNum(CDoc *doc, I64 num) diff --git a/src/System/Gr/GrAsm.CC b/src/System/Gr/GrAsm.CC index 92ebe9ad..0195f689 100755 --- a/src/System/Gr/GrAsm.CC +++ b/src/System/Gr/GrAsm.CC @@ -149,9 +149,12 @@ _DC_BLOT_COLOR4:: _IS_PIX_COVERED0:: PUSH RBP MOV RBP, RSP -#assert FONT_WIDTH == FONT_HEIGHT == 8 +// 8x16 hack +//#assert FONT_WIDTH == FONT_HEIGHT == 8 MOV RCX, U64 SF_ARG3[RBP] - SAR RCX, 3 +// SAR RCX, 3 + SAR RCX, 4 +//////////// MOV RAX, U64 SF_ARG2[RBP] SAR RAX, 3 MOV RDX, U64 SF_ARG1[RBP] diff --git a/src/System/Gr/GrScreen.CC b/src/System/Gr/GrScreen.CC index aa344e04..48f81bed 100755 --- a/src/System/Gr/GrScreen.CC +++ b/src/System/Gr/GrScreen.CC @@ -184,6 +184,12 @@ U0 GrUpdateTextBG() Bool blink_flag = Blink; U8 *dst2 = dst; + // 8x16 hack + CDC *dc = DCAlias(gr.dc2); + dc->flags |= DCF_ON_TOP; + DCFill(dc, WHITE); + //////////// + if (gr.pan_text_x || gr.hide_col) { gr.pan_text_x = ClampI64(gr.pan_text_x, -7, 7); @@ -252,6 +258,14 @@ U0 GrUpdateTextBG() cur_ch.u8[1] = cur_ch.u8[1] << 4 + cur_ch.u8[1] >> 4; } c = gr.to_8_colors[cur_ch.u8[1] >> 4]; + + // 8x16 hack + dc->color = cur_ch.u8[1] >> 4; + GrRect(dc, + GR_WIDTH - col * FONT_WIDTH - FONT_WIDTH, + GR_HEIGHT - row * FONT_HEIGHT - FONT_HEIGHT, + FONT_WIDTH, FONT_HEIGHT); + /* MOV U64 [RSI], R13 ADD RSI, R12 MOV U64 [RSI], R13 @@ -267,11 +281,15 @@ U0 GrUpdateTextBG() MOV U64 [RSI], R13 ADD RSI, R12 MOV U64 [RSI], R13 + */ + //////////// + dst(U8 *) += w2; } src += w4; dst(U8 *) += w3; } + DCDel(dc); } U0 GrUpdateTextFG() @@ -282,6 +300,12 @@ U0 GrUpdateTextFG() U8 *dst_start = gr.dc2->body, *dst_end = dst_start + w1 * gr.dc2->height - 7 * w1 - 8; Bool blink_flag = Blink; + // 8x16 hack + CDC *dc = DCAlias(gr.dc2); + dc->flags |= DCF_ON_TOP; + I64 x_shift; + //////////// + if (gr.pan_text_x || gr.hide_col) { gr.pan_text_x = ClampI64(gr.pan_text_x, -7, 7); @@ -331,15 +355,46 @@ U0 GrUpdateTextFG() i |= ~0x1F; i = w1 * i + j; if (dst_start <= dst(U8 *) + i < dst_end) - GrRopEquU8NoClipping(cur_ch & (ATTRF_UNDERLINE + 0xFFF), dst(U8 *) + i, w1); + { +// GrRopEquU8NoClipping(cur_ch & (ATTRF_UNDERLINE + 0xFFF), dst(U8 *) + i, w1); + // 8x16 hack + dc->color = cur_ch.u8[1] & 0xF; + x_shift = cur_ch.u8[2] & 0x1F; + GrPutChar(dc, + GR_WIDTH - col * FONT_WIDTH - FONT_WIDTH + x_shift, + GR_HEIGHT - row * FONT_HEIGHT - FONT_HEIGHT, + cur_ch(U8)); + if (Bt(&cur_ch, ATTRf_UNDERLINE)) + GrHLine(dc, + GR_WIDTH - col * FONT_WIDTH - FONT_WIDTH, + GR_WIDTH - col * FONT_WIDTH, + GR_HEIGHT - row * FONT_HEIGHT - 2); + } + //////////// } else - GrRopEquU8NoClipping(cur_ch & (ATTRF_UNDERLINE + 0xFFF), dst, w1); + { +// GrRopEquU8NoClipping(cur_ch & (ATTRF_UNDERLINE + 0xFFF), dst, w1); + // 8x16 hack + dc->color = cur_ch.u8[1] & 0xF; + x_shift = cur_ch.u8[2] & 0x1F; + GrPutChar(dc, + GR_WIDTH - col * FONT_WIDTH - FONT_WIDTH + x_shift, + GR_HEIGHT - row * FONT_HEIGHT - FONT_HEIGHT, + cur_ch(U8)); + if (Bt(&cur_ch, ATTRf_UNDERLINE)) + GrHLine(dc, + GR_WIDTH - col * FONT_WIDTH - FONT_WIDTH, + GR_WIDTH - col * FONT_WIDTH, + GR_HEIGHT - row * FONT_HEIGHT - 2); + } + //////////// dst(U8 *) += 8; } src += w4; dst(U8 *) += w2; } + DCDel(dc); } U0 DCBlotColor8(CDC *dc, CDC *img) diff --git a/src/System/Gr/MakeGr.CC b/src/System/Gr/MakeGr.CC index 020b0ef6..3dcad14d 100755 --- a/src/System/Gr/MakeGr.CC +++ b/src/System/Gr/MakeGr.CC @@ -10,8 +10,8 @@ Cd(__DIR__);; #include "GrDC" #include "GrInitB" #include "GrMath" -#include "GrScreen" #include "GrBitMap" +#include "GrScreen" #include "GrPrimatives" #include "GrComposites" #include "ScreenCast"