mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-04-18 05:38:36 +01:00
working VBE implementation. Not exactly polished.
This commit is contained in:
parent
9063280cc5
commit
ba94931c1b
13 changed files with 319 additions and 510 deletions
src
Binary file not shown.
Binary file not shown.
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
|
@ -6,8 +6,9 @@ the normal screen text output routine.
|
|||
|
||||
See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
||||
*/
|
||||
I64 i,row,col;
|
||||
U8 *ptr,*ptr1,*ptr2;
|
||||
I64 i,row,col,x,y;
|
||||
U32 *framebuffer;
|
||||
U64 ch_bitmap;
|
||||
|
||||
if (!(text.raw_flags&RAWF_SHOW_DOLLAR)) {
|
||||
if (ch=='$$') {
|
||||
|
@ -26,61 +27,56 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
|||
if (text.raw_flags&RAWF_IN_DOLLAR)
|
||||
return;
|
||||
}
|
||||
if (ch=='\t') {
|
||||
if (ch=='\t')
|
||||
{
|
||||
RawPutChar(CH_SPACE);
|
||||
while (text.raw_col & 7)
|
||||
RawPutChar(CH_SPACE);
|
||||
} else if (ch==CH_BACKSPACE) {
|
||||
}
|
||||
else if (ch==CH_BACKSPACE)
|
||||
{
|
||||
text.raw_col--;
|
||||
RawPutChar(CH_SPACE);
|
||||
text.raw_col--;
|
||||
} else if (ch=='\n') {
|
||||
}
|
||||
else if (ch=='\n')
|
||||
{
|
||||
RawPutChar(CH_SPACE);
|
||||
while (text.raw_col % text.cols)
|
||||
RawPutChar(CH_SPACE);
|
||||
}
|
||||
else if (Bt(char_bmp_displayable,ch))
|
||||
{
|
||||
row = text.raw_col / text.cols % text.rows;
|
||||
col = text.raw_col % text.cols;
|
||||
|
||||
} else if (Bt(char_bmp_displayable,ch)) {
|
||||
row=text.raw_col/text.cols%text.rows;
|
||||
col=text.raw_col%text.cols;
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) { //if text mode
|
||||
if (text.raw_flags&RAWF_SCROLL && text.raw_col && !row && !col) {
|
||||
MemCopy(text.vga_text_alias,text.vga_text_alias+text.cols*2,
|
||||
text.cols*(text.rows-1)*2);
|
||||
MemSet(text.vga_text_alias+text.cols*(text.rows-1)*2,0,text.cols*2);
|
||||
text.raw_col-=text.cols;
|
||||
row=text.rows-1;
|
||||
}
|
||||
ptr=text.vga_text_alias+(row*text.cols+col)*2;
|
||||
ptr[0]=ch;
|
||||
ptr[1]=BLACK<<4+WHITE;
|
||||
} else {
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F); //All planes -- WHITE
|
||||
if (text.raw_flags&RAWF_SCROLL && text.raw_col && !row && !col) {
|
||||
//Scroll cached image
|
||||
MemCopy(text.raw_screen_image,
|
||||
text.raw_screen_image+GR_WIDTH*FONT_HEIGHT>>3,
|
||||
GR_WIDTH*(GR_HEIGHT-FONT_HEIGHT)>>3);
|
||||
MemSet(text.raw_screen_image+GR_WIDTH*(GR_HEIGHT-FONT_HEIGHT)>>3,0,
|
||||
GR_WIDTH*FONT_HEIGHT>>3);
|
||||
|
||||
MemCopy(text.vga_alias,text.raw_screen_image,GR_WIDTH*GR_HEIGHT>>3);
|
||||
text.raw_col-=text.cols;
|
||||
row=text.rows-1;
|
||||
}
|
||||
PUSHFD
|
||||
CLI
|
||||
ptr=ptr1=col+row*GR_WIDTH*FONT_HEIGHT>>3;
|
||||
ptr+=text.vga_alias;
|
||||
ptr1+=text.raw_screen_image; //Write to cached image as well
|
||||
ptr2=&text.font[ch&255];
|
||||
for (i=0;i<FONT_HEIGHT;i++) {
|
||||
*ptr=*ptr1=rev_bits_table[*ptr2++];
|
||||
ptr+=GR_WIDTH>>3;
|
||||
ptr1+=GR_WIDTH>>3;
|
||||
}
|
||||
POPFD
|
||||
if (text.raw_flags&RAWF_SCROLL && text.raw_col && !row && !col)
|
||||
{//Scroll screen down
|
||||
MemCopy(text.fb_alias,
|
||||
text.fb_alias + sys_vbe_mode.width * FONT_HEIGHT,
|
||||
(text.screen_size - sys_vbe_mode.width * FONT_HEIGHT) * sizeof(U32));
|
||||
MemSetU32(text.fb_alias + text.screen_size - sys_vbe_mode.width * FONT_HEIGHT, BLACK32, sys_vbe_mode.width * FONT_HEIGHT);
|
||||
text.raw_col-=text.cols;
|
||||
row=text.rows-1;
|
||||
}
|
||||
x = col * FONT_WIDTH;
|
||||
y = row * FONT_HEIGHT;
|
||||
ch_bitmap = text.font[ch & 0xFF];
|
||||
framebuffer = text.fb_alias + sys_vbe_mode.width * y + x;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
for (i = 0; i < FONT_WIDTH * FONT_HEIGHT; i++)
|
||||
{
|
||||
if (ch_bitmap & 1)
|
||||
*framebuffer++ = WHITE32;
|
||||
else
|
||||
*framebuffer++ = BLACK32;
|
||||
if (i & (FONT_WIDTH-1) == FONT_WIDTH-1)
|
||||
framebuffer += sys_vbe_mode.width - FONT_WIDTH;
|
||||
ch_bitmap >>= 1;
|
||||
}
|
||||
POPFD
|
||||
text.raw_col++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,42 +97,8 @@ U0 SysGrInit()
|
|||
|
||||
MemSetU32(text.fb_alias, BLACK32, text.screen_size);
|
||||
text.vga_alias = CAlloc(text.rows * text.cols * 8);
|
||||
text.vga_text_alias = CAlloc(text.rows * text.cols * 2);
|
||||
}
|
||||
|
||||
/*U0 SysGrInit()
|
||||
{
|
||||
I64 i, j;
|
||||
text.font = MAlloc(256 * 8); //256 U64s
|
||||
MemCopy(text.font, *SYS_FONT_PTR(U32), 256 * 8);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
for (j = 0; j < 8; j++)
|
||||
text.font[i].u8[j] = rev_bits_table[text.font[i].u8[j]];
|
||||
|
||||
text.aux_font=sys_font_std;
|
||||
text.font['' - 1] = text.aux_font['' - 1]; //Shift-space
|
||||
text.font[10] = text.aux_font[10]; //"Return" symbol
|
||||
text.font[255] = text.aux_font[255]; //auxillary block character
|
||||
|
||||
text.border_chars[2] (I64)='ÄͳºÚÉ¿»';
|
||||
text.border_chars[10](U32)='ÀÈÙ¼';
|
||||
text.vga_alias =dev.uncached_alias+VGAM_GRAPHICS;
|
||||
text.vga_text_alias =dev.uncached_alias+VGAM_TEXT;
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) { //if text mode
|
||||
text.cols=80;
|
||||
text.rows=25;
|
||||
MemSet(text.vga_text_alias,0,text.rows*text.cols<<1);
|
||||
} else { //if 640x480 16 color
|
||||
text.cols=GR_WIDTH/FONT_WIDTH;
|
||||
text.rows=GR_HEIGHT/FONT_HEIGHT;
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
MemSet(text.vga_alias,0,GR_WIDTH*GR_HEIGHT>>3);
|
||||
text.raw_screen_image=CAlloc(GR_WIDTH*GR_HEIGHT/8);
|
||||
}
|
||||
}*/
|
||||
|
||||
U0 TimerInit()
|
||||
{//See $LK,"::/Doc/PIT.DD",A="FI:::/Doc/PIT.DD"$.
|
||||
OutU8(PIT_CMD, PIT_CMDF_CHANNEL0 | PIT_CMDF_OPMODE_RATE_GEN | PIT_CMDF_ACCESS_WORD);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3721,10 +3721,10 @@ public class CTextGlobals
|
|||
{
|
||||
I64 raw_col,raw_flags;
|
||||
U8 *raw_screen_image;
|
||||
U32 *raw_screen, *fb_alias;
|
||||
U32 *raw_screen, *fb_alias;
|
||||
I64 rows,cols; //Use TEXT_ROWS,TEXT_COLS
|
||||
U64 *font,*aux_font,screen_size, buffer_size;
|
||||
U8 *vga_alias,*vga_text_alias;
|
||||
U8 *vga_alias;
|
||||
U8 border_chars[16];
|
||||
};
|
||||
|
||||
|
@ -3732,9 +3732,6 @@ public class CTextGlobals
|
|||
#define FONT_HEIGHT 8
|
||||
|
||||
#help_index "Graphics"
|
||||
#define GR_WIDTH 640
|
||||
#define GR_HEIGHT 480
|
||||
|
||||
//z-vals less than zero are in front of screen and not drawn.
|
||||
//we want to shift all Z-vals into a drawable range.
|
||||
//GR_Z_ALL is set to half of the Z-range which is an I32.
|
||||
|
|
|
@ -21,8 +21,8 @@ U0 MouseUpdate(I64 x,I64 y,I64 z,Bool l,Bool r)
|
|||
mouse.pos.z=mouse.presnap.z;
|
||||
}
|
||||
|
||||
mouse.pos.x=ClampI64(mouse.pos.x,0,GR_WIDTH-1);
|
||||
mouse.pos.y=ClampI64(mouse.pos.y,0,GR_HEIGHT-1);
|
||||
mouse.pos.x=ClampI64(mouse.pos.x,0,sys_vbe_mode.width-1);
|
||||
mouse.pos.y=ClampI64(mouse.pos.y,0,sys_vbe_mode.height-1);
|
||||
mouse.pos_text.x=mouse.pos.x/FONT_WIDTH;
|
||||
if (mouse.pos_text.x>=text.cols) {
|
||||
mouse.pos_text.x=text.cols-1;
|
||||
|
@ -41,9 +41,9 @@ U0 MouseUpdate(I64 x,I64 y,I64 z,Bool l,Bool r)
|
|||
|
||||
U0 MouseSet(I64 x=I64_MAX,I64 y=I64_MAX,I64 z=I64_MAX,I64 l=I64_MAX,I64 r=I64_MAX)
|
||||
{//Note: Generates a message. See $LK,"MouseSet",A="FF:::/Demo/Games/Zing.CC,MouseSet"$().
|
||||
if (!(0<=x<GR_WIDTH))
|
||||
if (!(0<=x<sys_vbe_mode.width))
|
||||
x=mouse.pos.x;
|
||||
if (!(0<=y<GR_HEIGHT))
|
||||
if (!(0<=y<sys_vbe_mode.height))
|
||||
y=mouse.pos.y;
|
||||
if (z==I64_MAX)
|
||||
z=mouse.pos.z;
|
||||
|
@ -211,14 +211,14 @@ U0 MouseHardSetPost()
|
|||
//TODO mouse_grid.x_offset?
|
||||
if (i<0)
|
||||
mouse.offset.x-=i;
|
||||
else if (i>=GR_WIDTH)
|
||||
mouse.offset.x+=GR_WIDTH-1-i;
|
||||
else if (i>=sys_vbe_mode.width)
|
||||
mouse.offset.x+=sys_vbe_mode.width-1-i;
|
||||
|
||||
i=Trunc(mouse.scale.y*mouse_hard.pos.y/mouse_grid.y)*mouse_grid.y+mouse.offset.y;
|
||||
if (i<0)
|
||||
mouse.offset.y-=i;
|
||||
else if (i>=GR_HEIGHT)
|
||||
mouse.offset.y+=GR_HEIGHT-1-i;
|
||||
else if (i>=sys_vbe_mode.height)
|
||||
mouse.offset.y+=sys_vbe_mode.height-1-i;
|
||||
|
||||
if (mouse_hard.pos.x!=mouse_hard_last.pos.x || mouse_hard.pos.y!=mouse_hard_last.pos.y ||
|
||||
mouse_hard.pos.z!=mouse_hard_last.pos.z) {
|
||||
|
@ -301,7 +301,7 @@ Bool MouseEnable(Bool val=TRUE)
|
|||
}
|
||||
else
|
||||
{
|
||||
KbdCmdSend(KBD_CTRL, KBDC_DISABLE_MS);
|
||||
KbdCmdSend(KBD_CTRL, KBDC_DISABLE_MS);
|
||||
mouse_hard.enabled = FALSE;
|
||||
}
|
||||
return old_val;
|
||||
|
@ -375,10 +375,10 @@ U0 KbdMouseInit()
|
|||
mouse_hard.scale.x=0.5;
|
||||
mouse_hard.scale.y=0.5;
|
||||
mouse_hard.scale.z=1.0;
|
||||
mouse_hard.prescale.x=GR_WIDTH/mouse_hard.scale.x/2.0;
|
||||
mouse_hard.prescale.y=GR_HEIGHT/mouse_hard.scale.y/2.0;
|
||||
mouse_hard.prescale.x=sys_vbe_mode.width/mouse_hard.scale.x/2.0;
|
||||
mouse_hard.prescale.y=sys_vbe_mode.height/mouse_hard.scale.y/2.0;
|
||||
mouse_hard.prescale.z=0/mouse_hard.scale.z;
|
||||
mouse_hard.pos.x=GR_WIDTH>>1;
|
||||
mouse_hard.pos.y=GR_HEIGHT>>1;
|
||||
mouse_hard.pos.x=sys_vbe_mode.width>>1;
|
||||
mouse_hard.pos.y=sys_vbe_mode.height>>1;
|
||||
MemCopy(&mouse_hard_last,&mouse_hard,sizeof(CMouseHardStateGlobals));
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -67,16 +67,7 @@ U0 GrSetUpTables()
|
|||
if (((x-1)^(y-1))&1 && SqrI64(y*2-k)+SqrI64(x*2-k)<rr)
|
||||
GrPlot0(dc,x-1,y-1);
|
||||
}
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) { //if text mode
|
||||
MemSet(text.vga_text_alias,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
} else {
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
//Virtual Box crashes on the following for some reason.
|
||||
// MemSet(text.vga_alias,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
}
|
||||
|
||||
for (i=1;i<=GR_SCREEN_ZOOM_MAX;i++) {
|
||||
dst=gr.screen_zoom_tables[i]=MAlloc(256*i);
|
||||
for (j=0;j<256;j++) {
|
||||
|
@ -177,15 +168,13 @@ U0 GrInit2()
|
|||
HashDefineListAdd("ST_SPRITE_ELEM_CODES",SPHT_ELEM_CODE,gr.sprite_hash);
|
||||
gr.screen_zoom=1;
|
||||
|
||||
PaletteSetStd;
|
||||
fp_set_std_palette=&PaletteSetStd;
|
||||
GrPaletteIndicesSet;
|
||||
PaletteSetPastel;
|
||||
|
||||
gr.to_8_bits =MAlloc(256*sizeof(I64));
|
||||
gr.to_8_colors=MAlloc(256*sizeof(I64));
|
||||
|
||||
gr.screen_cache = MAlloc(sys_vbe_mode.width * sys_vbe_mode.height);
|
||||
|
||||
|
||||
gr.text_base=CAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U32));
|
||||
gr.vga_text_cache=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
gr.win_uncovered_bitmap=CAlloc(65536/8);
|
||||
|
|
|
@ -1,65 +1,7 @@
|
|||
#help_index "Graphics/Color"
|
||||
public U8 gr_rainbow_10[10]={
|
||||
BLACK,BROWN,RED,LTRED,YELLOW,GREEN,BLUE,PURPLE,LTGRAY,WHITE};
|
||||
public U8 gr_rainbow_10[10] = {BLACK,BROWN,RED,LTRED,YELLOW,GREEN,BLUE,PURPLE,LTGRAY,WHITE};
|
||||
|
||||
DefineListLoad("ST_RAINBOW_10",
|
||||
"BLACK\0BROWN\0RED\0LTRED\0YELLOW\0GREEN\0BLUE\0PURPLE\0LTGRAY\0WHITE\0");
|
||||
|
||||
U0 GrPaletteIndicesSet()
|
||||
{//There is a level of indirection that we identity map.
|
||||
// Set 16-colors to use first 16 DAC BGR entries, so we
|
||||
// never need to worry about indexes, just DAC palette settings.
|
||||
I64 i;
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SEMA_VGA],0))
|
||||
Yield;
|
||||
InU8(VGAP_INPUT_STAT); //Resets attr index/data
|
||||
for (i=0;i<COLORS_NUM;i++) {
|
||||
OutU8(VGAP_ATTR_INDEX,i);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,i);
|
||||
}
|
||||
OutU8(VGAP_ATTR_INDEX,0x20);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,0); //Dummy write
|
||||
InU8(VGAP_INPUT_STAT); //Resets attr index/data
|
||||
LBtr(&sys_semas[SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public U0 GrPaletteColorSet(I64 color_num,CBGR48 bgr48)
|
||||
{//VGA has 6-bits for blue, for green, and for red.
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_WRITE,color_num);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr48.r>>10);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr48.g>>10);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr48.b>>10);
|
||||
LBtr(&sys_semas[SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||
{//VGA has 6-bits for blue, for green, and for red.
|
||||
CBGR48 res=0;
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) return 0;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_READ,color_num);
|
||||
res.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
LBtr(&sys_semas[SEMA_VGA],0);
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
DefineListLoad("ST_RAINBOW_10","BLACK\0BROWN\0RED\0LTRED\0YELLOW\0GREEN\0BLUE\0PURPLE\0LTGRAY\0WHITE\0");
|
||||
|
||||
public CBGR48 gr_palette_std[COLORS_NUM]={
|
||||
0x000000000000,0x00000000AAAA,0x0000AAAA0000,0x0000AAAAAAAA,
|
||||
|
@ -67,43 +9,39 @@ public CBGR48 gr_palette_std[COLORS_NUM]={
|
|||
0x555555555555,0x55555555FFFF,0x5555FFFF5555,0x5555FFFFFFFF,
|
||||
0xFFFF55555555,0xFFFF5555FFFF,0xFFFFFFFF5555,0xFFFFFFFFFFFF};
|
||||
|
||||
public CBGR48 gr_palette_pastel[COLORS_NUM]={
|
||||
0xE8E8E8E8D3D3,0x81819797BFBF,0x1919CBCB0000,0x666687879999,
|
||||
0xCFCF6A6A4C4C,0x87878787AFAF,0xFAFAD0D07A7A,0x525252525252,
|
||||
0x888888888888,0xACACCACAFFFF,0x2323FDFD0000,0x8080BFBFAFAF,
|
||||
0xFFFF9D9D8080,0xC4C4C4C4FFFF,0xFFFFEFEFBFBF,0x151515151515};
|
||||
public CBGR24 gr_palette_pastel[COLORS_NUM]={
|
||||
0xE8E8D3, 0x8197BF, 0x19CB00, 0x668799, 0xCF6A4C, 0x8787AF, 0xFAD07A, 0x525252,
|
||||
0x888888, 0xACCAFF, 0x23FD00, 0x80BFAF, 0xFF9D80, 0xC4C4FF, 0xFFEFBF, 0x151515
|
||||
};
|
||||
|
||||
public CBGR48 gr_palette_gray[COLORS_NUM]={
|
||||
0x000000000000,0x111111111111,0x222222222222,0x333333333333,
|
||||
0x444444444444,0x555555555555,0x666666666666,0x777777777777,
|
||||
0x888888888888,0x999999999999,0xAAAAAAAAAAAA,0xBBBBBBBBBBBB,
|
||||
0xCCCCCCCCCCCC,0xDDDDDDDDDDDD,0xEEEEEEEEEEEE,0xFFFFFFFFFFFF};
|
||||
|
||||
public CBGR24 gr32_palette_gray[COLORS_NUM] = {
|
||||
public CBGR24 gr_palette_gray[COLORS_NUM] = {
|
||||
0x000000, 0x111111, 0x222222, 0x333333, 0x444444, 0x555555, 0x666666, 0x777777,
|
||||
0x888888, 0x999999, 0xAAAAAA, 0xBBBBBB, 0xCCCCCC, 0xDDDDDD, 0xEEEEEE, 0xFFFFFF
|
||||
};
|
||||
|
||||
public U0 GrPaletteGet(CBGR48 *bgr48)
|
||||
public U0 GrPaletteGet(CBGR24 *bgr24)
|
||||
{//16 colors
|
||||
I64 i;
|
||||
for (i=0;i<COLORS_NUM;i++)
|
||||
bgr48[i]=GrPaletteColorGet(i);
|
||||
MemCopy(bgr24, &gr_palette, sizeof(CBGR24) * 16);
|
||||
}
|
||||
|
||||
public U0 GrPaletteSet(CBGR48 *bgr48)
|
||||
public U0 GrPaletteSet(CBGR48 *bgr24)
|
||||
{//16 colors
|
||||
I64 i;
|
||||
for (i=0;i<COLORS_NUM;i++)
|
||||
GrPaletteColorSet(i,bgr48[i]);
|
||||
MemCopy(&gr_palette, bgr24, sizeof(CBGR24) * 16);
|
||||
}
|
||||
|
||||
public U0 PaletteSetStd()
|
||||
{//Activate std palette.
|
||||
GrPaletteSet(gr_palette_std);
|
||||
public U0 PaletteSetGray(Bool persistent=TRUE)
|
||||
{//Activate gray palette.
|
||||
GrPaletteSet(gr_palette_gray);
|
||||
VGAFlush;
|
||||
if (persistent)
|
||||
fp_set_std_palette = &PaletteSetGray;
|
||||
}
|
||||
public U0 PaletteSetPastel()
|
||||
public U0 PaletteSetPastel(Bool persistent=TRUE)
|
||||
{//Activate std palette.
|
||||
GrPaletteSet(gr_palette_pastel);
|
||||
fp_set_std_palette=&PaletteSetPastel;
|
||||
VGAFlush;
|
||||
if (persistent)
|
||||
fp_set_std_palette = &PaletteSetPastel;
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ U0 GrUpdateTextBG()
|
|||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
dst(U8 *)+=w2;
|
||||
dst(U8 *)+=w2;
|
||||
}
|
||||
src+=w4;
|
||||
dst(U8 *)+=w3;
|
||||
|
@ -324,77 +324,6 @@ U0 DCBlotColor8(CDC *dc,CDC *img)
|
|||
}
|
||||
}
|
||||
|
||||
U0 GrUpdateTextModeText()
|
||||
{
|
||||
U32 *src=gr.text_base;
|
||||
I64 cur_ch,i=TEXT_COLS*TEXT_ROWS;
|
||||
U16 *dst=text.vga_text_alias,*dst2=gr.vga_text_cache;
|
||||
Bool blink_flag=Blink;
|
||||
if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
while (i--) {
|
||||
cur_ch=*src++;
|
||||
if (cur_ch & ATTRF_SEL)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
|
||||
if (cur_ch & ATTRF_INVERT)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & ATTRF_BLINK)
|
||||
if (blink_flag)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
*dst++=*dst2++=cur_ch&0x7FFF;
|
||||
}
|
||||
} else {
|
||||
while (i--) {
|
||||
cur_ch=*src++;
|
||||
if (cur_ch & ATTRF_SEL)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
|
||||
if (cur_ch & ATTRF_INVERT)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & ATTRF_BLINK)
|
||||
if (blink_flag)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
cur_ch&=0x7FFF;
|
||||
if (*dst2!=cur_ch)
|
||||
*dst++=*dst2++=cur_ch;
|
||||
else {
|
||||
dst++;
|
||||
dst2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrUpdateVGAGraphics()
|
||||
{//Update Graphic Card
|
||||
I64 row,plane,d=gr.zoomed_dc->width_internal>>6;
|
||||
U32 *src,*vga,*dst;
|
||||
if (gr.screen_zoom==1)
|
||||
src=gr.dc1->body;
|
||||
else {
|
||||
GrZoomInScreen;
|
||||
src=gr.zoomed_dc->body;
|
||||
}
|
||||
dst=gr.screen_image->body;
|
||||
if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=text.vga_alias;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64FlushCache(&vga,&src,d,&dst);
|
||||
}
|
||||
} else {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=text.vga_alias;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64(&vga,&src,d,&dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrCalcScreenUpdates()
|
||||
{
|
||||
U16 *screen = gr.dc2->body, *last_screen = gr.screen_cache;
|
||||
|
@ -423,7 +352,7 @@ U0 GrUpdateScreen32()
|
|||
//}
|
||||
dst = text.raw_screen;
|
||||
while (src < size) //draw 2 pixels at a time
|
||||
*dst++ = gr32_palette_gray[*src++ & 0xFF] | gr32_palette_gray[*src++ & 0xFF] << 32;
|
||||
*dst++ = gr_palette[*src++ & 0xFF] | gr_palette[*src++ & 0xFF] << 32;
|
||||
|
||||
GrCalcScreenUpdates;
|
||||
|
||||
|
@ -434,14 +363,10 @@ U0 GrUpdateScreen32()
|
|||
U0 GrUpdateScreen()
|
||||
{//Called by the Window Manager $LK,"HERE",A="FF:::/Zenith/WinMgr.CC,GrUpdateScreen"$, 30 times a second.
|
||||
CDC *dc;
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) //if text mode
|
||||
GrUpdateTasks;
|
||||
else {
|
||||
GrUpdateTextBG;
|
||||
GrUpdateTextFG;
|
||||
GrUpdateTasks;
|
||||
DCBlotColor8(gr.dc2,gr.dc);
|
||||
}
|
||||
GrUpdateTextBG;
|
||||
GrUpdateTextFG;
|
||||
GrUpdateTasks;
|
||||
DCBlotColor8(gr.dc2,gr.dc);
|
||||
|
||||
dc=DCAlias(gr.dc2,Fs);
|
||||
dc->flags|=DCF_ON_TOP;
|
||||
|
@ -449,12 +374,6 @@ U0 GrUpdateScreen()
|
|||
(*gr.fp_final_screen_update)(dc);
|
||||
DCDel(dc);
|
||||
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) //if text mode
|
||||
GrUpdateTextModeText;
|
||||
else {
|
||||
DCBlotColor4(gr.dc1->body,gr.dc2->body,gr.dc_cache->body,
|
||||
gr.dc2->height*gr.dc2->width_internal>>3);
|
||||
GrUpdateVGAGraphics;
|
||||
GrUpdateScreen32;
|
||||
}
|
||||
DCBlotColor4(gr.dc1->body,gr.dc2->body,gr.dc_cache->body, gr.dc2->height*gr.dc2->width_internal>>3);
|
||||
GrUpdateScreen32;
|
||||
}
|
||||
|
|
|
@ -179,22 +179,19 @@ U0 DrawMouse(CDC *dc)
|
|||
x=mouse.pos.x;
|
||||
y=mouse.pos.y;
|
||||
POPFD
|
||||
if (mouse.show && mouse_hard.installed) {
|
||||
if (!Bt(&sys_run_level,RLf_VESA)) //if text mode
|
||||
gr.text_base[mouse.pos_text.x+mouse.pos_text.y*TEXT_COLS]^=0x7F00;
|
||||
else {
|
||||
if (gr.fp_draw_mouse) {
|
||||
if (mouse.lb)
|
||||
dc->color=ROP_XOR+LTPURPLE^TRANSPARENT;
|
||||
else if (mouse.rb)
|
||||
dc->color=ROP_XOR+LTCYAN^TRANSPARENT;
|
||||
else
|
||||
dc->color=ROP_XOR+BLACK^TRANSPARENT;
|
||||
if (winmgr.grab_scroll && gr.fp_draw_grab_mouse)
|
||||
(*gr.fp_draw_grab_mouse)(dc,x,y,winmgr.grab_scroll_closed);
|
||||
else
|
||||
(*gr.fp_draw_mouse)(dc,x,y);
|
||||
}
|
||||
if (mouse.show && mouse_hard.installed)
|
||||
{
|
||||
if (gr.fp_draw_mouse) {
|
||||
if (mouse.lb)
|
||||
dc->color=LTGREEN;
|
||||
else if (mouse.rb)
|
||||
dc->color=LTRED;
|
||||
else
|
||||
dc->color=BLACK;
|
||||
if (winmgr.grab_scroll && gr.fp_draw_grab_mouse)
|
||||
(*gr.fp_draw_grab_mouse)(dc,x,y,winmgr.grab_scroll_closed);
|
||||
else
|
||||
(*gr.fp_draw_mouse)(dc,x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue