Implement 8x16 proof-of-concept.

This commit is contained in:
TomAwezome 2021-11-29 20:58:21 -05:00
parent 0e3a37d4cd
commit d037b9dfaa
10 changed files with 104 additions and 17 deletions

View file

@ -1065,7 +1065,7 @@ U0 AHCIInit()
CAHCIPort *port; CAHCIPort *port;
I64 i, bdf; I64 i, bdf;
"トトトトトトトトトトトトトトトトトトトトトト\n"; "______________________\n";
bdf = PCIClassFind(PCIC_STORAGE << 16 | PCISC_AHCI << 8 + 1, 0); //0x010601, last byte prog_if, AHCI version 1.0 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"; "Unknown\n";
} }
} }
"トトトトトトトトトトトトトトトトトトトトトト\n\n"; "______________________\n\n";
} }
Bool AHCIBootDVDProbeAll(CBlkDev *bd) Bool AHCIBootDVDProbeAll(CBlkDev *bd)
@ -1135,7 +1135,7 @@ Bool AHCIBootDVDProbeAll(CBlkDev *bd)
U8 *buf = CAlloc(DVD_BLK_SIZE); U8 *buf = CAlloc(DVD_BLK_SIZE);
CKernel *kernel; CKernel *kernel;
"トトトトトトトトトトトトトトトトトトトトトト\n"; "______________________\n";
for (i = 0; i < AHCI_MAX_PORTS; i++) for (i = 0; i < AHCI_MAX_PORTS; i++)
{ {
@ -1165,7 +1165,7 @@ Bool AHCIBootDVDProbeAll(CBlkDev *bd)
if (kernel->compile_time == sys_compile_time) if (kernel->compile_time == sys_compile_time)
{ {
"AHCI: Found sys_compile_time at BLK %d on Port %d\n", sys_boot_blk, i; "AHCI: Found sys_compile_time at BLK %d on Port %d\n", sys_boot_blk, i;
"トトトトトトトトトトトトトトトトトトトトトト\n"; "______________________\n";
return TRUE; return TRUE;
} }
else else

View file

@ -69,7 +69,10 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
} }
x = col * FONT_WIDTH; x = col * FONT_WIDTH;
y = row * FONT_HEIGHT; 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; framebuffer = text.fb_alias + sys_vbe_mode.width * y + x;
PUSHFD PUSHFD
@ -83,6 +86,10 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
if (i & (FONT_WIDTH - 1) == FONT_WIDTH - 1) if (i & (FONT_WIDTH - 1) == FONT_WIDTH - 1)
framebuffer += sys_vbe_mode.width - FONT_WIDTH; framebuffer += sys_vbe_mode.width - FONT_WIDTH;
ch_bitmap >>= 1; ch_bitmap >>= 1;
// 8x16 hack
if (i == FONT_WIDTH * FONT_HEIGHT / 2 - 1)
ch_bitmap = text.font[2 * ch & 0xFF + 1];
////////////
} }
POPFD POPFD
text.raw_col++; text.raw_col++;

View file

@ -95,8 +95,11 @@ U0 SysGrInit()
text.aux_font[10] = text.font[10]; //"Return" symbol text.aux_font[10] = text.font[10]; //"Return" symbol
text.aux_font[255] = text.font[255]; //Block symbol ÿ text.aux_font[255] = text.font[255]; //Block symbol ÿ
for (i = '³'; i < 'Û'; i++) // 8x16 hack
text.aux_font[i] = text.font[i]; // 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[2] (I64) = 'ÄͳºÚÉ¿»';
text.border_chars[10](U32) = 'ÀÈÙ¼'; text.border_chars[10](U32) = 'ÀÈÙ¼';
@ -167,7 +170,7 @@ U0 KMain()
//to debug. After this point, use $LK,"RawPrint",A="MN:RawPrint"$() //to debug. After this point, use $LK,"RawPrint",A="MN:RawPrint"$()
LBts(&sys_run_level, RLf_RAW); LBts(&sys_run_level, RLf_RAW);
"\nZealOS V%0.2f\t%D %T\n", sys_os_version, sys_compile_time, sys_compile_time; "\nZealOS V%0.2f\t%D %T\n", sys_os_version, sys_compile_time, sys_compile_time;
"ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\n\n"; "_________________________________\n\n";
"TimerInit;\n"; "TimerInit;\n";
TimerInit; TimerInit;

View file

@ -219,7 +219,10 @@ GET_IP: POP BX
//Get pointer to 8x8 VGA ROM font. //Get pointer to 8x8 VGA ROM font.
MOV AX, 0x1130 MOV AX, 0x1130
MOV BH, 3 // 8x16 hack
// MOV BH, 3
MOV BH, 6
////////////
INT 0x10 INT 0x10
MOV AX, ES MOV AX, ES
SHL EAX, 16 SHL EAX, 16

View file

@ -4261,7 +4261,10 @@ public class CTextGlobals
}; };
#define FONT_WIDTH 8 #define FONT_WIDTH 8
#define FONT_HEIGHT 8 // 8x16 hack
//#define FONT_HEIGHT 8
#define FONT_HEIGHT 16
////////////
#help_index "Graphics" #help_index "Graphics"
//z-values less than zero are in front of screen and not drawn. //z-values less than zero are in front of screen and not drawn.

View file

@ -10,6 +10,14 @@
U0 Tmp() U0 Tmp()
{ {
OnceExe; OnceExe;
// 8x16 hack
text.font[256] = -1;
text.font[257] = -1;
text.font[258] = text.font[259] = 0xFFFF0000FFFF0000 & 0x9999999999999999;
text.border_chars[2] (I64) = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
text.border_chars[10](U32) = '<EFBFBD><EFBFBD>';
////////////
switch (sys_boot_src.u16[0]) switch (sys_boot_src.u16[0])
{ {
case BOOT_SRC_ROM: case BOOT_SRC_ROM:

View file

@ -2,8 +2,13 @@
I64 DocCharDist(CDoc *doc, I64 x, I64 y) I64 DocCharDist(CDoc *doc, I64 x, I64 y)
{ {
#assert FONT_WIDTH == FONT_HEIGHT // 8x16 hack
return (SqrI64(doc->x - x) + SqrI64(doc->y - y)) * FONT_WIDTH * FONT_WIDTH; //#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) U0 DocDelToNum(CDoc *doc, I64 num)

View file

@ -149,9 +149,12 @@ _DC_BLOT_COLOR4::
_IS_PIX_COVERED0:: _IS_PIX_COVERED0::
PUSH RBP PUSH RBP
MOV RBP, RSP MOV RBP, RSP
#assert FONT_WIDTH == FONT_HEIGHT == 8 // 8x16 hack
//#assert FONT_WIDTH == FONT_HEIGHT == 8
MOV RCX, U64 SF_ARG3[RBP] MOV RCX, U64 SF_ARG3[RBP]
SAR RCX, 3 // SAR RCX, 3
SAR RCX, 4
////////////
MOV RAX, U64 SF_ARG2[RBP] MOV RAX, U64 SF_ARG2[RBP]
SAR RAX, 3 SAR RAX, 3
MOV RDX, U64 SF_ARG1[RBP] MOV RDX, U64 SF_ARG1[RBP]

View file

@ -184,6 +184,12 @@ U0 GrUpdateTextBG()
Bool blink_flag = Blink; Bool blink_flag = Blink;
U8 *dst2 = dst; 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) if (gr.pan_text_x || gr.hide_col)
{ {
gr.pan_text_x = ClampI64(gr.pan_text_x, -7, 7); 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; cur_ch.u8[1] = cur_ch.u8[1] << 4 + cur_ch.u8[1] >> 4;
} }
c = gr.to_8_colors[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 MOV U64 [RSI], R13
ADD RSI, R12 ADD RSI, R12
MOV U64 [RSI], R13 MOV U64 [RSI], R13
@ -267,11 +281,15 @@ U0 GrUpdateTextBG()
MOV U64 [RSI], R13 MOV U64 [RSI], R13
ADD RSI, R12 ADD RSI, R12
MOV U64 [RSI], R13 MOV U64 [RSI], R13
*/
////////////
dst(U8 *) += w2; dst(U8 *) += w2;
} }
src += w4; src += w4;
dst(U8 *) += w3; dst(U8 *) += w3;
} }
DCDel(dc);
} }
U0 GrUpdateTextFG() 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; U8 *dst_start = gr.dc2->body, *dst_end = dst_start + w1 * gr.dc2->height - 7 * w1 - 8;
Bool blink_flag = Blink; 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) if (gr.pan_text_x || gr.hide_col)
{ {
gr.pan_text_x = ClampI64(gr.pan_text_x, -7, 7); gr.pan_text_x = ClampI64(gr.pan_text_x, -7, 7);
@ -331,15 +355,46 @@ U0 GrUpdateTextFG()
i |= ~0x1F; i |= ~0x1F;
i = w1 * i + j; i = w1 * i + j;
if (dst_start <= dst(U8 *) + i < dst_end) 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 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; dst(U8 *) += 8;
} }
src += w4; src += w4;
dst(U8 *) += w2; dst(U8 *) += w2;
} }
DCDel(dc);
} }
U0 DCBlotColor8(CDC *dc, CDC *img) U0 DCBlotColor8(CDC *dc, CDC *img)

View file

@ -10,8 +10,8 @@ Cd(__DIR__);;
#include "GrDC" #include "GrDC"
#include "GrInitB" #include "GrInitB"
#include "GrMath" #include "GrMath"
#include "GrScreen"
#include "GrBitMap" #include "GrBitMap"
#include "GrScreen"
#include "GrPrimatives" #include "GrPrimatives"
#include "GrComposites" #include "GrComposites"
#include "ScreenCast" #include "ScreenCast"