mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 15:10:28 +00:00
Compare commits
4 commits
38c41e551a
...
5658469acb
Author | SHA1 | Date | |
---|---|---|---|
|
5658469acb | ||
|
2ffd423f7b | ||
|
a95d5559de | ||
|
5bd76304ec |
7 changed files with 60 additions and 56 deletions
|
@ -8,9 +8,7 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
||||||
*/
|
*/
|
||||||
I64 i, row, col, x, y;
|
I64 i, row, col, x, y;
|
||||||
U32 *framebuffer;
|
U32 *framebuffer;
|
||||||
U64 ch_bitmap, fb_width_from_pitch;
|
U64 ch_bitmap;
|
||||||
|
|
||||||
fb_width_from_pitch = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8);
|
|
||||||
|
|
||||||
if (!(text.raw_flags & RAWF_SHOW_DOLLAR))
|
if (!(text.raw_flags & RAWF_SHOW_DOLLAR))
|
||||||
{
|
{
|
||||||
|
@ -62,17 +60,17 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
||||||
{//Scroll screen down
|
{//Scroll screen down
|
||||||
|
|
||||||
MemCopy(text.fb_alias,
|
MemCopy(text.fb_alias,
|
||||||
text.fb_alias + fb_width_from_pitch * FONT_HEIGHT,
|
text.fb_alias + sys_framebuffer_pidth * FONT_HEIGHT,
|
||||||
(text.screen_size - fb_width_from_pitch * FONT_HEIGHT) * sizeof(U32));
|
(text.screen_size - sys_framebuffer_pidth * FONT_HEIGHT) * sizeof(U32));
|
||||||
|
|
||||||
MemSetU32(text.fb_alias + text.screen_size - fb_width_from_pitch * FONT_HEIGHT, BLACK32, fb_width_from_pitch * FONT_HEIGHT);
|
MemSetU32(text.fb_alias + text.screen_size - sys_framebuffer_pidth * FONT_HEIGHT, BLACK32, sys_framebuffer_pidth * FONT_HEIGHT);
|
||||||
text.raw_col -= text.cols ;
|
text.raw_col -= text.cols ;
|
||||||
row = text.rows - 1;
|
row = text.rows - 1;
|
||||||
}
|
}
|
||||||
x = col * FONT_WIDTH;
|
x = col * FONT_WIDTH;
|
||||||
y = row * FONT_HEIGHT;
|
y = row * FONT_HEIGHT;
|
||||||
ch_bitmap = text.font[ch & 0xFF];
|
ch_bitmap = text.font[ch & 0xFF];
|
||||||
framebuffer = text.fb_alias + fb_width_from_pitch * y + x;
|
framebuffer = text.fb_alias + sys_framebuffer_pidth * y + x;
|
||||||
|
|
||||||
PUSHFD
|
PUSHFD
|
||||||
CLI
|
CLI
|
||||||
|
@ -83,7 +81,7 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
||||||
else
|
else
|
||||||
*framebuffer++ = BLACK32;
|
*framebuffer++ = BLACK32;
|
||||||
if (i & (FONT_WIDTH - 1) == FONT_WIDTH - 1)
|
if (i & (FONT_WIDTH - 1) == FONT_WIDTH - 1)
|
||||||
framebuffer += fb_width_from_pitch - FONT_WIDTH;
|
framebuffer += sys_framebuffer_pidth - FONT_WIDTH;
|
||||||
ch_bitmap >>= 1;
|
ch_bitmap >>= 1;
|
||||||
}
|
}
|
||||||
POPFD
|
POPFD
|
||||||
|
|
|
@ -91,7 +91,8 @@ U0 SysGrInit()
|
||||||
text.cols = sys_framebuffer_width / FONT_WIDTH;
|
text.cols = sys_framebuffer_width / FONT_WIDTH;
|
||||||
text.rows = sys_framebuffer_height / FONT_HEIGHT;
|
text.rows = sys_framebuffer_height / FONT_HEIGHT;
|
||||||
|
|
||||||
text.screen_size = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8) * sys_framebuffer_height;
|
sys_framebuffer_pidth = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8);
|
||||||
|
text.screen_size = sys_framebuffer_pidth * sys_framebuffer_height;
|
||||||
text.buffer_size = text.screen_size * 4; //buffer for 32-bit, but only 16 colors now.
|
text.buffer_size = text.screen_size * 4; //buffer for 32-bit, but only 16 colors now.
|
||||||
text.raw_screen = CAlloc(text.buffer_size);
|
text.raw_screen = CAlloc(text.buffer_size);
|
||||||
text.fb_alias = sys_framebuffer_addr;
|
text.fb_alias = sys_framebuffer_addr;
|
||||||
|
|
|
@ -249,7 +249,7 @@ public _extern SYS_FRAMEBUFFER_WIDTH U64 sys_framebuffer_width;
|
||||||
public _extern SYS_FRAMEBUFFER_HEIGHT U64 sys_framebuffer_height;
|
public _extern SYS_FRAMEBUFFER_HEIGHT U64 sys_framebuffer_height;
|
||||||
public _extern SYS_FRAMEBUFFER_PITCH U64 sys_framebuffer_pitch;
|
public _extern SYS_FRAMEBUFFER_PITCH U64 sys_framebuffer_pitch;
|
||||||
public _extern SYS_FRAMEBUFFER_BPP U8 sys_framebuffer_bpp;
|
public _extern SYS_FRAMEBUFFER_BPP U8 sys_framebuffer_bpp;
|
||||||
|
public U64 sys_framebuffer_pidth;
|
||||||
_extern SYS_FRAMEBUFFER_LIST CVideoInfo sys_framebuffer_list[VBE_MODES_NUM];
|
_extern SYS_FRAMEBUFFER_LIST CVideoInfo sys_framebuffer_list[VBE_MODES_NUM];
|
||||||
|
|
||||||
#help_index "Processor/SMBIOS"
|
#help_index "Processor/SMBIOS"
|
||||||
|
|
|
@ -56,3 +56,5 @@ DefinePrint("TEXT_ROWS", "%d", text.rows);;
|
||||||
HashPublic("TEXT_ROWS", HTT_DEFINE_STR);;
|
HashPublic("TEXT_ROWS", HTT_DEFINE_STR);;
|
||||||
DefinePrint("TEXT_COLS", "%d", text.cols);;
|
DefinePrint("TEXT_COLS", "%d", text.cols);;
|
||||||
HashPublic("TEXT_COLS", HTT_DEFINE_STR);;
|
HashPublic("TEXT_COLS", HTT_DEFINE_STR);;
|
||||||
|
|
||||||
|
sys_framebuffer_pidth = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8);
|
|
@ -142,8 +142,8 @@ public U0 GrScaleZoom(F64 scale)
|
||||||
mouse.offset.x = mouse.pos.x - (mouse.pos.x - mouse.offset.x) * s;
|
mouse.offset.x = mouse.pos.x - (mouse.pos.x - mouse.offset.x) * s;
|
||||||
mouse.offset.y = mouse.pos.y - (mouse.pos.y - mouse.offset.y) * s;
|
mouse.offset.y = mouse.pos.y - (mouse.pos.y - mouse.offset.y) * s;
|
||||||
mouse.offset.z = mouse.pos.z - (mouse.pos.z - mouse.offset.z) * s;
|
mouse.offset.z = mouse.pos.z - (mouse.pos.z - mouse.offset.z) * s;
|
||||||
gr.sx = mouse.pos.x - gr.zoomed_dc->width >> 1 / gr.screen_zoom;
|
gr.sx = mouse.pos.x - GR_WIDTH >> 1 / gr.screen_zoom;
|
||||||
gr.sy = mouse.pos.y - gr.zoomed_dc->height >> 1 / gr.screen_zoom;
|
gr.sy = mouse.pos.y - GR_HEIGHT >> 1 / gr.screen_zoom;
|
||||||
GrFixZoomScale;
|
GrFixZoomScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ U0 GrZoomInScreen()
|
||||||
|
|
||||||
GrFixZoomScale;
|
GrFixZoomScale;
|
||||||
|
|
||||||
src = gr.dc2->body + gr.sx + gr.sy * gr.dc2->width_internal;
|
src = gr.dc2->body + gr.sx + gr.sy * GR_WIDTH;
|
||||||
dst = gr.zoomed_dc->body;
|
dst = gr.zoomed_dc->body;
|
||||||
|
|
||||||
for (i = 0; i < GR_HEIGHT / gr.screen_zoom; i++)
|
for (i = 0; i < GR_HEIGHT / gr.screen_zoom; i++)
|
||||||
|
@ -359,34 +359,35 @@ U0 DCBlotColor8(CDC *dc, CDC *img)
|
||||||
|
|
||||||
U0 GrCalcScreenUpdates()
|
U0 GrCalcScreenUpdates()
|
||||||
{
|
{
|
||||||
U8 *screen, *last_screen = gr.screen_cache;
|
U8 *screen, reg RCX *last_screen = gr.screen_cache;
|
||||||
U32 i, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT;
|
U32 *src = text.raw_screen, *dst = text.fb_alias;
|
||||||
U64 x, y, w = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8);
|
U64 i, j, x, y, yi;
|
||||||
|
|
||||||
if (gr.screen_zoom == 1)
|
if (gr.screen_zoom == 1)
|
||||||
screen = gr.dc2->body;
|
screen = gr.dc2->body;
|
||||||
else
|
else
|
||||||
screen = gr.zoomed_dc->body;
|
screen = gr.zoomed_dc->body;
|
||||||
|
|
||||||
for (y = 0; y < GR_HEIGHT; y++)
|
for (y = yi = 0; y < GR_HEIGHT; yi = ++y * GR_WIDTH)
|
||||||
{
|
{
|
||||||
for (x = 0; x < GR_WIDTH; x++)
|
for (x = 0; x < GR_WIDTH; x++)
|
||||||
{
|
{
|
||||||
i = x + y * GR_WIDTH;
|
i = x + yi;
|
||||||
|
j = x + y * sys_framebuffer_pidth;
|
||||||
if (screen[i] != last_screen[i])
|
if (screen[i] != last_screen[i])
|
||||||
{
|
{
|
||||||
dst = text.fb_alias + x + y * w;
|
dst = text.fb_alias + j;
|
||||||
src = text.raw_screen + x + y * w;
|
src = text.raw_screen + j;
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemCopy(gr.screen_cache, screen, diffs_size);
|
MemCopy(gr.screen_cache, screen, GR_WIDTH * GR_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 GrUpdateScreen32()
|
U0 GrUpdateScreen32()
|
||||||
{
|
{
|
||||||
U64 x, y, wi, yi, w = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8);
|
U64 x, y, j, i;
|
||||||
U32 *dst;
|
U32 *dst;
|
||||||
U8 *src;
|
U8 *src;
|
||||||
|
|
||||||
|
@ -397,12 +398,12 @@ U0 GrUpdateScreen32()
|
||||||
GrZoomInScreen;
|
GrZoomInScreen;
|
||||||
src = gr.zoomed_dc->body;
|
src = gr.zoomed_dc->body;
|
||||||
}
|
}
|
||||||
for (y = 0; y < GR_HEIGHT; y++)
|
for (y = j = i = 0; y < GR_HEIGHT; j = ++y * sys_framebuffer_pidth, i = y * GR_WIDTH)
|
||||||
{
|
{
|
||||||
for (x = 0; x < GR_WIDTH; x++)
|
for (x = 0; x < GR_WIDTH; x++)
|
||||||
{
|
{
|
||||||
dst = text.raw_screen + x + y * w;
|
dst = text.raw_screen + x + j;
|
||||||
*dst = gr_palette[src[x + y * GR_WIDTH] & 0xFF];
|
*dst = gr_palette[src[x + i] & 0xFF];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,6 +431,6 @@ U0 GrUpdateScreen()
|
||||||
(*gr.fp_final_screen_update)(dc);
|
(*gr.fp_final_screen_update)(dc);
|
||||||
DCDel(dc);
|
DCDel(dc);
|
||||||
|
|
||||||
DCBlotColor4(gr.dc1->body, gr.dc2->body, gr.dc_cache->body, gr.dc2->height * gr.dc2->width_internal >> 3);
|
DCBlotColor4(gr.dc1->body, gr.dc2->body, gr.dc_cache->body, GR_HEIGHT * GR_WIDTH >> 3);
|
||||||
GrUpdateScreen32;
|
GrUpdateScreen32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +1,40 @@
|
||||||
# Nuke built-in rules and variables.
|
# Nuke built-in rules and variables.
|
||||||
override MAKEFLAGS += -rR
|
MAKEFLAGS += -rR
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
# This is the name that our final executable will have.
|
# This is the name that our final executable will have.
|
||||||
# Change as needed.
|
# Change as needed.
|
||||||
override OUTPUT := kernel
|
override OUTPUT := kernel
|
||||||
|
|
||||||
# Convenience macro to reliably declare user overridable variables.
|
# Convenience macro to reliably declare user overridable variables.
|
||||||
define DEFAULT_VAR =
|
override USER_VARIABLE = $(if $(filter $(origin $(1)),default undefined),$(eval override $(1) := $(2)))
|
||||||
ifeq ($(origin $1),default)
|
|
||||||
override $(1) := $(2)
|
|
||||||
endif
|
|
||||||
ifeq ($(origin $1),undefined)
|
|
||||||
override $(1) := $(2)
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
|
|
||||||
# User controllable C compiler command.
|
# User controllable C compiler command.
|
||||||
override DEFAULT_KCC := cc
|
$(call USER_VARIABLE,KCC,cc)
|
||||||
$(eval $(call DEFAULT_VAR,KCC,$(DEFAULT_KCC)))
|
|
||||||
|
|
||||||
# User controllable linker command.
|
# User controllable linker command.
|
||||||
override DEFAULT_KLD := ld
|
$(call USER_VARIABLE,KLD,ld)
|
||||||
$(eval $(call DEFAULT_VAR,KLD,$(DEFAULT_KLD)))
|
|
||||||
|
|
||||||
# User controllable C flags.
|
# User controllable C flags.
|
||||||
override DEFAULT_KCFLAGS := -g -O2 -pipe
|
$(call USER_VARIABLE,KCFLAGS,-g -O2 -pipe)
|
||||||
$(eval $(call DEFAULT_VAR,KCFLAGS,$(DEFAULT_KCFLAGS)))
|
|
||||||
|
|
||||||
# User controllable C preprocessor flags. We set none by default.
|
# User controllable C preprocessor flags. We set none by default.
|
||||||
override DEFAULT_KCPPFLAGS :=
|
$(call USER_VARIABLE,KCPPFLAGS,)
|
||||||
$(eval $(call DEFAULT_VAR,KCPPFLAGS,$(DEFAULT_KCPPFLAGS)))
|
|
||||||
|
|
||||||
# User controllable nasm flags.
|
# User controllable nasm flags.
|
||||||
override DEFAULT_KNASMFLAGS := -F dwarf -g
|
$(call USER_VARIABLE,KNASMFLAGS,-F dwarf -g)
|
||||||
$(eval $(call DEFAULT_VAR,KNASMFLAGS,$(DEFAULT_KNASMFLAGS)))
|
|
||||||
|
|
||||||
# User controllable linker flags. We set none by default.
|
# User controllable linker flags. We set none by default.
|
||||||
override DEFAULT_KLDFLAGS :=
|
$(call USER_VARIABLE,KLDFLAGS,)
|
||||||
$(eval $(call DEFAULT_VAR,KLDFLAGS,$(DEFAULT_KLDFLAGS)))
|
|
||||||
|
# Check if KCC is Clang.
|
||||||
|
override KCC_IS_CLANG := $(shell ! $(KCC) --version 2>/dev/null | grep 'clang' >/dev/null 2>&1; echo $$?)
|
||||||
|
|
||||||
|
# If the C compiler is Clang, set the target as needed.
|
||||||
|
ifeq ($(KCC_IS_CLANG),1)
|
||||||
|
override KCC += \
|
||||||
|
-target x86_64-unknown-none
|
||||||
|
endif
|
||||||
|
|
||||||
# Internal C flags that should not be changed by the user.
|
# Internal C flags that should not be changed by the user.
|
||||||
override KCFLAGS += \
|
override KCFLAGS += \
|
||||||
|
|
|
@ -9,9 +9,10 @@ ENTRY(kmain)
|
||||||
/* process. */
|
/* process. */
|
||||||
PHDRS
|
PHDRS
|
||||||
{
|
{
|
||||||
text PT_LOAD;
|
requests PT_LOAD;
|
||||||
rodata PT_LOAD;
|
text PT_LOAD;
|
||||||
data PT_LOAD;
|
rodata PT_LOAD;
|
||||||
|
data PT_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
@ -22,6 +23,16 @@ SECTIONS
|
||||||
/* that is the beginning of the region. */
|
/* that is the beginning of the region. */
|
||||||
. = 0xffffffff80000000;
|
. = 0xffffffff80000000;
|
||||||
|
|
||||||
|
/* Define a section to contain the Limine requests and assign it to its own PHDR */
|
||||||
|
.requests : {
|
||||||
|
KEEP(*(.requests_start_marker))
|
||||||
|
KEEP(*(.requests))
|
||||||
|
KEEP(*(.requests_end_marker))
|
||||||
|
} :requests
|
||||||
|
|
||||||
|
/* Move to the next memory page for .text */
|
||||||
|
. = ALIGN(CONSTANT(MAXPAGESIZE));
|
||||||
|
|
||||||
.text : {
|
.text : {
|
||||||
*(.text .text.*)
|
*(.text .text.*)
|
||||||
} :text
|
} :text
|
||||||
|
@ -38,12 +49,6 @@ SECTIONS
|
||||||
|
|
||||||
.data : {
|
.data : {
|
||||||
*(.data .data.*)
|
*(.data .data.*)
|
||||||
|
|
||||||
/* Place the sections that contain the Limine requests as part of the .data */
|
|
||||||
/* output section. */
|
|
||||||
KEEP(*(.requests_start_marker))
|
|
||||||
KEEP(*(.requests))
|
|
||||||
KEEP(*(.requests_end_marker))
|
|
||||||
} :data
|
} :data
|
||||||
|
|
||||||
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
|
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
|
||||||
|
|
Loading…
Reference in a new issue