More wrappers, move uninitialized data to .bss section.
This commit is contained in:
110
kofu.c
110
kofu.c
@@ -298,6 +298,90 @@ void kofu_display_number(int argc, const char **argv) {
|
|||||||
umka_sys_display_number(is_pointer, base, digits_to_display, is_qword, show_leading_zeros, number_or_pointer, x, y, color, fill_background, font, draw_to_buffer, scale_factor, background_color_or_buffer);
|
umka_sys_display_number(is_pointer, base, digits_to_display, is_qword, show_leading_zeros, number_or_pointer, x, y, color, fill_background, font, draw_to_buffer, scale_factor, background_color_or_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kofu_set_window_colors(int argc, const char **argv) {
|
||||||
|
if (argc != (1 + sizeof(system_colors_t)/4)) {
|
||||||
|
printf("10 colors required\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
system_colors_t colors;
|
||||||
|
colors.frame = strtoul(argv[1], NULL, 16);
|
||||||
|
colors.grab = strtoul(argv[2], NULL, 16);
|
||||||
|
colors.work_3d_dark = strtoul(argv[3], NULL, 16);
|
||||||
|
colors.work_3d_light = strtoul(argv[4], NULL, 16);
|
||||||
|
colors.grab_text = strtoul(argv[5], NULL, 16);
|
||||||
|
colors.work = strtoul(argv[6], NULL, 16);
|
||||||
|
colors.work_button = strtoul(argv[7], NULL, 16);
|
||||||
|
colors.work_button_text = strtoul(argv[8], NULL, 16);
|
||||||
|
colors.work_text = strtoul(argv[9], NULL, 16);
|
||||||
|
colors.work_graph = strtoul(argv[10], NULL, 16);
|
||||||
|
umka_sys_set_window_colors(&colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_get_window_colors(int argc, const char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
system_colors_t colors;
|
||||||
|
umka_sys_get_window_colors(&colors);
|
||||||
|
printf("0x%.8" PRIx32 " frame\n", colors.frame);
|
||||||
|
printf("0x%.8" PRIx32 " grab\n", colors.grab);
|
||||||
|
printf("0x%.8" PRIx32 " work_3d_dark\n", colors.work_3d_dark);
|
||||||
|
printf("0x%.8" PRIx32 " work_3d_light\n", colors.work_3d_light);
|
||||||
|
printf("0x%.8" PRIx32 " grab_text\n", colors.grab_text);
|
||||||
|
printf("0x%.8" PRIx32 " work\n", colors.work);
|
||||||
|
printf("0x%.8" PRIx32 " work_button\n", colors.work_button);
|
||||||
|
printf("0x%.8" PRIx32 " work_button_text\n", colors.work_button_text);
|
||||||
|
printf("0x%.8" PRIx32 " work_text\n", colors.work_text);
|
||||||
|
printf("0x%.8" PRIx32 " work_graph\n", colors.work_graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_get_skin_height(int argc, const char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
uint32_t skin_height = umka_sys_get_skin_height();
|
||||||
|
printf("%" PRIu32 "\n", skin_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_get_screen_area(int argc, const char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
rect_t wa;
|
||||||
|
umka_sys_get_screen_area(&wa);
|
||||||
|
printf("%" PRIu32 " left\n", wa.left);
|
||||||
|
printf("%" PRIu32 " top\n", wa.top);
|
||||||
|
printf("%" PRIu32 " right\n", wa.right);
|
||||||
|
printf("%" PRIu32 " bottom\n", wa.bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_set_screen_area(int argc, const char **argv) {
|
||||||
|
if (argc != 5) {
|
||||||
|
printf("left top right bottom\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rect_t wa;
|
||||||
|
wa.left = strtoul(argv[1], NULL, 0);
|
||||||
|
wa.top = strtoul(argv[2], NULL, 0);
|
||||||
|
wa.right = strtoul(argv[3], NULL, 0);
|
||||||
|
wa.bottom = strtoul(argv[4], NULL, 0);
|
||||||
|
umka_sys_set_screen_area(&wa);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_get_skin_margins(int argc, const char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
rect_t wa;
|
||||||
|
umka_sys_get_skin_margins(&wa);
|
||||||
|
printf("%" PRIu32 " left\n", wa.left);
|
||||||
|
printf("%" PRIu32 " top\n", wa.top);
|
||||||
|
printf("%" PRIu32 " right\n", wa.right);
|
||||||
|
printf("%" PRIu32 " bottom\n", wa.bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_set_button_style(int argc, const char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
uint32_t style = strtoul(argv[1], NULL, 0);
|
||||||
|
umka_sys_set_button_style(style);
|
||||||
|
}
|
||||||
|
|
||||||
void kofu_set_skin(int argc, const char **argv) {
|
void kofu_set_skin(int argc, const char **argv) {
|
||||||
(void)argc;
|
(void)argc;
|
||||||
const char *path = argv[1];
|
const char *path = argv[1];
|
||||||
@@ -309,14 +393,27 @@ void kofu_get_font_smoothing(int argc, const char **argv) {
|
|||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
const char *names[] = {"off", "anti-aliasing", "subpixel"};
|
const char *names[] = {"off", "anti-aliasing", "subpixel"};
|
||||||
int type = umka_sys_get_smoothing();
|
int type = umka_sys_get_font_smoothing();
|
||||||
printf("font smoothing: %i - %s\n", type, names[type]);
|
printf("font smoothing: %i - %s\n", type, names[type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kofu_set_font_smoothing(int argc, const char **argv) {
|
void kofu_set_font_smoothing(int argc, const char **argv) {
|
||||||
(void)argc;
|
(void)argc;
|
||||||
int type = strtol(argv[1], NULL, 0);
|
int type = strtol(argv[1], NULL, 0);
|
||||||
umka_sys_set_smoothing(type);
|
umka_sys_set_font_smoothing(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_get_font_size(int argc, const char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
size_t size = umka_sys_get_font_size();
|
||||||
|
printf("%upx\n", size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kofu_set_font_size(int argc, const char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
uint32_t size = strtoul(argv[1], NULL, 0);
|
||||||
|
umka_sys_set_font_size(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kofu_button(int argc, const char **argv) {
|
void kofu_button(int argc, const char **argv) {
|
||||||
@@ -718,9 +815,18 @@ func_table_t funcs[] = {
|
|||||||
{ "draw_rect", kofu_draw_rect },
|
{ "draw_rect", kofu_draw_rect },
|
||||||
{ "draw_line", kofu_draw_line },
|
{ "draw_line", kofu_draw_line },
|
||||||
{ "display_number", kofu_display_number },
|
{ "display_number", kofu_display_number },
|
||||||
|
{ "set_button_style", kofu_set_button_style },
|
||||||
|
{ "set_window_colors", kofu_set_window_colors },
|
||||||
|
{ "get_window_colors", kofu_get_window_colors },
|
||||||
|
{ "get_skin_height", kofu_get_skin_height },
|
||||||
|
{ "get_screen_area", kofu_get_screen_area },
|
||||||
|
{ "set_screen_area", kofu_set_screen_area },
|
||||||
|
{ "get_skin_margins", kofu_get_skin_margins },
|
||||||
{ "set_skin", kofu_set_skin },
|
{ "set_skin", kofu_set_skin },
|
||||||
{ "get_font_smoothing", kofu_get_font_smoothing },
|
{ "get_font_smoothing", kofu_get_font_smoothing },
|
||||||
{ "set_font_smoothing", kofu_set_font_smoothing },
|
{ "set_font_smoothing", kofu_set_font_smoothing },
|
||||||
|
{ "get_font_size", kofu_get_font_size },
|
||||||
|
{ "set_font_size", kofu_set_font_size },
|
||||||
{ "put_image_palette", kofu_put_image_palette },
|
{ "put_image_palette", kofu_put_image_palette },
|
||||||
{ "move_window", kofu_move_window },
|
{ "move_window", kofu_move_window },
|
||||||
{ "set_window_caption", kofu_set_window_caption },
|
{ "set_window_caption", kofu_set_window_caption },
|
||||||
|
180
kolibri.asm
180
kolibri.asm
@@ -22,6 +22,17 @@ macro int n {
|
|||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app_tls = 0
|
||||||
|
app_code = 0
|
||||||
|
app_data = 0
|
||||||
|
graph_data = 0
|
||||||
|
os_code = 0
|
||||||
|
|
||||||
|
MAX_PRIORITY = 0 ; highest, used for kernel tasks
|
||||||
|
USER_PRIORITY = 1 ; default
|
||||||
|
IDLE_PRIORITY = 2 ; lowest, only IDLE thread goes here
|
||||||
|
NR_SCHED_QUEUES = 3 ; MUST equal IDLE_PRIORYTY + 1
|
||||||
|
|
||||||
purge mov,add,sub
|
purge mov,add,sub
|
||||||
purge mov,add,sub
|
purge mov,add,sub
|
||||||
section '.text' executable align 32
|
section '.text' executable align 32
|
||||||
@@ -32,32 +43,48 @@ coverage_begin:
|
|||||||
public coverage_begin
|
public coverage_begin
|
||||||
|
|
||||||
include 'macros.inc'
|
include 'macros.inc'
|
||||||
macro diff16 blah1,blah2,blah3 {
|
macro diff16 msg,blah2,blah3 {
|
||||||
|
if msg eq "end of .data segment"
|
||||||
|
section '.bss' writeable align 64
|
||||||
|
end if
|
||||||
}
|
}
|
||||||
include 'proc32.inc'
|
include 'proc32.inc'
|
||||||
include 'struct.inc'
|
include 'struct.inc'
|
||||||
|
macro BOOT_LO a {}
|
||||||
|
macro BOOT a {}
|
||||||
include 'const.inc'
|
include 'const.inc'
|
||||||
LFB_BASE = lfb_base
|
purge BOOT_LO,BOOT
|
||||||
SLOT_BASE = os_base + 0x00080000
|
|
||||||
window_data = os_base + 0x00001000
|
LFB_BASE = lfb_base
|
||||||
WIN_STACK = os_base + 0x0000C000
|
|
||||||
WIN_POS = os_base + 0x0000C400
|
window_data = os_base + 0x00001000
|
||||||
KEY_COUNT = os_base + 0x0000F400
|
CURRENT_TASK = os_base + 0x00003000
|
||||||
KEY_BUFF = os_base + 0x0000F401 ; 120*2 + 2*2 = 244 bytes, actually 255 bytes
|
TASK_COUNT = os_base + 0x00003004
|
||||||
BTN_COUNT = os_base + 0x0000F500
|
TASK_BASE = os_base + 0x00003010
|
||||||
BTN_BUFF = os_base + 0x0000F501
|
TASK_DATA = os_base + 0x00003020
|
||||||
BTN_ADDR = os_base + 0x0000FE88
|
TASK_EVENT = os_base + 0x00003020
|
||||||
TASK_BASE = os_base + 0x00003010
|
CDDataBuf = os_base + 0x00005000
|
||||||
CURRENT_TASK = os_base + 0x00003000
|
idts = os_base + 0x0000B100
|
||||||
TASK_COUNT = os_base + 0x00003004
|
WIN_STACK = os_base + 0x0000C000
|
||||||
TASK_BASE = os_base + 0x00003010
|
WIN_POS = os_base + 0x0000C400
|
||||||
WIN_STACK = os_base + 0x0000C000
|
FDD_BUFF = os_base + 0x0000D000
|
||||||
WIN_POS = os_base + 0x0000C400
|
WIN_TEMP_XY = os_base + 0x0000F300
|
||||||
HEAP_BASE = os_base + 0x00800000
|
KEY_COUNT = os_base + 0x0000F400
|
||||||
|
KEY_BUFF = os_base + 0x0000F401 ; 120*2 + 2*2 = 244 bytes, actually 255 bytes
|
||||||
|
BTN_COUNT = os_base + 0x0000F500
|
||||||
|
BTN_BUFF = os_base + 0x0000F501
|
||||||
|
BTN_ADDR = os_base + 0x0000FE88
|
||||||
|
MEM_AMOUNT = os_base + 0x0000FE8C
|
||||||
|
SYS_SHUTDOWN = os_base + 0x0000FF00
|
||||||
|
TASK_ACTIVATE = os_base + 0x0000FF01
|
||||||
|
sys_proc = os_base + 0x0006F000
|
||||||
|
SLOT_BASE = os_base + 0x00080000
|
||||||
|
VGABasePtr = os_base + 0x000A0000
|
||||||
|
UPPER_KERNEL_PAGES = os_base + 0x00400000
|
||||||
|
HEAP_BASE = os_base + 0x00800000
|
||||||
|
|
||||||
include 'system.inc'
|
include 'system.inc'
|
||||||
include 'fdo.inc'
|
include 'fdo.inc'
|
||||||
; block and fs
|
|
||||||
include 'blkdev/disk.inc'
|
include 'blkdev/disk.inc'
|
||||||
include 'blkdev/disk_cache.inc'
|
include 'blkdev/disk_cache.inc'
|
||||||
include 'fs/fs_lfn.inc'
|
include 'fs/fs_lfn.inc'
|
||||||
@@ -67,12 +94,14 @@ include 'core/malloc.inc'
|
|||||||
include 'core/heap.inc'
|
include 'core/heap.inc'
|
||||||
include 'core/dll.inc'
|
include 'core/dll.inc'
|
||||||
include 'core/taskman.inc'
|
include 'core/taskman.inc'
|
||||||
|
include 'core/clipboard.inc'
|
||||||
include 'core/syscall.inc'
|
include 'core/syscall.inc'
|
||||||
include 'video/framebuffer.inc'
|
include 'video/framebuffer.inc'
|
||||||
include 'video/vesa20.inc'
|
include 'video/vesa20.inc'
|
||||||
include 'video/vga.inc'
|
include 'video/vga.inc'
|
||||||
include 'video/blitter.inc'
|
include 'video/blitter.inc'
|
||||||
include 'video/cursors.inc'
|
include 'video/cursors.inc'
|
||||||
|
include 'sound/playnote.inc'
|
||||||
include 'unpacker.inc'
|
include 'unpacker.inc'
|
||||||
include 'gui/window.inc'
|
include 'gui/window.inc'
|
||||||
include 'gui/button.inc'
|
include 'gui/button.inc'
|
||||||
@@ -182,7 +211,6 @@ proc kos_time_to_epoch c uses ebx esi edi ebp, _time
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
public kos_init
|
public kos_init
|
||||||
proc kos_init c uses ebx esi edi ebp
|
proc kos_init c uses ebx esi edi ebp
|
||||||
mov edi, endofcode
|
mov edi, endofcode
|
||||||
@@ -203,68 +231,86 @@ proc kos_init c uses ebx esi edi ebp
|
|||||||
call init_kernel_heap
|
call init_kernel_heap
|
||||||
call init_malloc
|
call init_malloc
|
||||||
|
|
||||||
|
mov [BOOT.bpp], 32
|
||||||
|
mov [BOOT.x_res], 400
|
||||||
|
mov [BOOT.y_res], 300
|
||||||
|
mov [BOOT.pitch], 400*4
|
||||||
|
mov [BOOT.lfb], LFB_BASE
|
||||||
|
call init_video
|
||||||
|
|
||||||
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
|
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
|
||||||
(unpack.lc+unpack.lp)))*4
|
(unpack.lc+unpack.lp)))*4
|
||||||
mov [unpack.p], eax
|
mov [unpack.p], eax
|
||||||
|
|
||||||
|
call init_events
|
||||||
|
mov eax, srv.fd-SRV.fd
|
||||||
|
mov [srv.fd], eax
|
||||||
|
mov [srv.bk], eax
|
||||||
|
|
||||||
mov dword[sysdir_name], 'sys'
|
mov dword[sysdir_name], 'sys'
|
||||||
mov dword[sysdir_path], 'RD/1'
|
mov dword[sysdir_path], 'RD/1'
|
||||||
mov word[sysdir_path+4], 0
|
mov word[sysdir_path+4], 0
|
||||||
|
|
||||||
|
mov dword[CURRENT_TASK], 2
|
||||||
|
mov dword[TASK_COUNT], 2
|
||||||
|
mov dword[TASK_BASE], CURRENT_TASK + 2*sizeof.TASKDATA
|
||||||
|
mov [current_slot], SLOT_BASE + 256*2
|
||||||
|
|
||||||
|
;call ramdisk_init
|
||||||
|
|
||||||
mov ebx, SLOT_BASE + 2*256
|
mov ebx, SLOT_BASE + 2*256
|
||||||
mov [current_slot], ebx
|
|
||||||
stdcall kernel_alloc, 0x2000
|
stdcall kernel_alloc, 0x2000
|
||||||
mov [ebx+APPDATA.process], eax
|
mov [ebx+APPDATA.process], eax
|
||||||
mov word[cur_dir.path], '/'
|
mov word[cur_dir.path], '/'
|
||||||
mov [ebx+APPDATA.cur_dir], cur_dir
|
mov [ebx+APPDATA.cur_dir], cur_dir
|
||||||
mov [ebx+APPDATA.wnd_clientbox.left], 0
|
mov [ebx+APPDATA.wnd_clientbox.left], 0
|
||||||
mov [ebx+APPDATA.wnd_clientbox.top], 0
|
mov [ebx+APPDATA.wnd_clientbox.top], 0
|
||||||
mov dword[CURRENT_TASK], 2
|
|
||||||
mov dword[TASK_COUNT], 2
|
|
||||||
mov dword[TASK_BASE], CURRENT_TASK + 2*sizeof.TASKDATA
|
|
||||||
|
|
||||||
mov [_display.x], 0
|
|
||||||
mov [_display.y], 0
|
|
||||||
mov [_display.width], DISPLAY_WIDTH
|
|
||||||
mov [_display.lfb_pitch], DISPLAY_WIDTH*4
|
|
||||||
mov [_display.height], DISPLAY_HEIGHT
|
|
||||||
mov [PUTPIXEL], Vesa20_putpixel32
|
|
||||||
mov [GETPIXEL], Vesa20_getpixel32
|
|
||||||
mov [_display.bytes_per_pixel], 4
|
|
||||||
mov [_display.bits_per_pixel], 32
|
|
||||||
mov [MOUSE_PICTURE], dword mousepointer
|
|
||||||
call calculate_fast_getting_offset_for_WinMapAddress
|
|
||||||
call calculate_fast_getting_offset_for_LFB
|
|
||||||
mov [X_UNDER], 500
|
mov [X_UNDER], 500
|
||||||
mov [Y_UNDER], 500
|
mov [Y_UNDER], 500
|
||||||
mov word[MOUSE_X], 40
|
mov word[MOUSE_X], 40
|
||||||
mov word[MOUSE_Y], 30
|
mov word[MOUSE_Y], 30
|
||||||
|
|
||||||
mov eax, [_display.width]
|
stdcall kernel_alloc, [_display.win_map_size]
|
||||||
mul [_display.height]
|
|
||||||
mov [_display.win_map_size], eax
|
|
||||||
|
|
||||||
mov [_display.check_mouse], check_mouse_area_for_putpixel_new
|
|
||||||
mov [_display.check_m_pixel], check_mouse_area_for_getpixel_new
|
|
||||||
|
|
||||||
stdcall kernel_alloc, eax
|
|
||||||
mov [_display.win_map], eax
|
mov [_display.win_map], eax
|
||||||
|
|
||||||
|
; set background
|
||||||
|
movi eax, 1
|
||||||
mov [BgrDrawMode], eax
|
mov [BgrDrawMode], eax
|
||||||
mov [BgrDataWidth], eax
|
mov [BgrDataWidth], eax
|
||||||
mov [BgrDataHeight], eax
|
mov [BgrDataHeight], eax
|
||||||
mov [mem_BACKGROUND], 4
|
mov [mem_BACKGROUND], 4
|
||||||
mov [img_background], static_background_data
|
mov [img_background], static_background_data
|
||||||
|
|
||||||
|
; set clipboard
|
||||||
|
xor eax, eax
|
||||||
|
mov [clipboard_slots], eax
|
||||||
|
mov [clipboard_write_lock], eax
|
||||||
|
stdcall kernel_alloc, 4096
|
||||||
|
test eax, eax
|
||||||
|
jnz @f
|
||||||
|
|
||||||
|
dec eax
|
||||||
|
@@:
|
||||||
|
mov [clipboard_main_list], eax
|
||||||
|
|
||||||
|
|
||||||
|
call set_window_defaults
|
||||||
|
call init_background
|
||||||
|
call calculatebackground
|
||||||
|
call init_display
|
||||||
|
mov eax, [def_cursor]
|
||||||
|
mov [SLOT_BASE+APPDATA.cursor+256], eax
|
||||||
|
mov [SLOT_BASE+APPDATA.cursor+256*2], eax
|
||||||
|
|
||||||
; from set_variables
|
; from set_variables
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [BTN_ADDR], dword BUTTON_INFO ; address of button list
|
mov [BTN_ADDR], dword BUTTON_INFO ; address of button list
|
||||||
mov byte [KEY_COUNT], al ; keyboard buffer
|
mov byte [KEY_COUNT], al ; keyboard buffer
|
||||||
mov byte [BTN_COUNT], al ; button buffer
|
mov byte [BTN_COUNT], al ; button buffer
|
||||||
|
|
||||||
call set_window_defaults
|
;call load_default_skin
|
||||||
mov [skin_data], 0
|
; call stack_init
|
||||||
; call load_default_skin
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@@ -454,20 +500,12 @@ proc map_page _one, _two, _three
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
app_tls = 0
|
|
||||||
app_code = 0
|
|
||||||
app_data = 0
|
|
||||||
os_code = 0
|
|
||||||
USER_PRIORITY = 0
|
|
||||||
MAX_PRIORITY = 1
|
|
||||||
|
|
||||||
sysfn_terminate:
|
sysfn_terminate:
|
||||||
scheduler_add_thread:
|
|
||||||
kb_write_wait_ack:
|
kb_write_wait_ack:
|
||||||
sys_msg_board_str:
|
sys_msg_board_str:
|
||||||
protect_from_terminate:
|
protect_from_terminate:
|
||||||
unprotect_from_terminate:
|
unprotect_from_terminate:
|
||||||
change_task:
|
|
||||||
ReadCDWRetr:
|
ReadCDWRetr:
|
||||||
WaitUnitReady:
|
WaitUnitReady:
|
||||||
prevent_medium_removal:
|
prevent_medium_removal:
|
||||||
@@ -486,6 +524,11 @@ unlock_application_table:
|
|||||||
get_pg_addr:
|
get_pg_addr:
|
||||||
free_page:
|
free_page:
|
||||||
map_memEx:
|
map_memEx:
|
||||||
|
setup_os_slot:
|
||||||
|
idle_thread:
|
||||||
|
irq_eoi:
|
||||||
|
change_task:
|
||||||
|
scheduler_add_thread:
|
||||||
ret
|
ret
|
||||||
sys_getkey:
|
sys_getkey:
|
||||||
sys_clock:
|
sys_clock:
|
||||||
@@ -514,8 +557,6 @@ sys_outport:
|
|||||||
syscall_reserveportarea:
|
syscall_reserveportarea:
|
||||||
sys_apm:
|
sys_apm:
|
||||||
syscall_threads:
|
syscall_threads:
|
||||||
sys_clipboard:
|
|
||||||
sound_interface:
|
|
||||||
sys_pcibios:
|
sys_pcibios:
|
||||||
sys_IPC:
|
sys_IPC:
|
||||||
sys_gs:
|
sys_gs:
|
||||||
@@ -556,25 +597,26 @@ display_height_standard dd 0
|
|||||||
do_not_touch_winmap db 0
|
do_not_touch_winmap db 0
|
||||||
window_minimize db 0
|
window_minimize db 0
|
||||||
sound_flag db 0
|
sound_flag db 0
|
||||||
timer_ticks dd 0
|
|
||||||
;hotkey_buffer rd 120*2 ; buffer for 120 hotkeys
|
|
||||||
PID_lock_input dd 0x0
|
PID_lock_input dd 0x0
|
||||||
process_number dd 0
|
process_number dd 0
|
||||||
|
timer_ticks dd 0
|
||||||
fpu_owner dd ?
|
fpu_owner dd ?
|
||||||
|
|
||||||
|
public win_stack_addr as 'kos_win_stack'
|
||||||
|
win_stack_addr dd WIN_STACK
|
||||||
|
public win_pos_addr as 'kos_win_pos'
|
||||||
|
win_pos_addr dd WIN_POS
|
||||||
|
public lfb_base_addr as 'kos_lfb_base'
|
||||||
|
lfb_base_addr dd lfb_base
|
||||||
|
|
||||||
|
uglobal
|
||||||
;section '.bss' writeable align 16
|
;section '.bss' writeable align 16
|
||||||
;IncludeUGlobals
|
;IncludeUGlobals
|
||||||
; crap
|
|
||||||
DiskNumber db ?
|
DiskNumber db ?
|
||||||
ChannelNumber db ?
|
ChannelNumber db ?
|
||||||
DevErrorCode dd ?
|
DevErrorCode dd ?
|
||||||
CDSectorAddress dd ?
|
CDSectorAddress dd ?
|
||||||
CDDataBuf_pointer dd ?
|
CDDataBuf_pointer dd ?
|
||||||
;DRIVE_DATA: rb 0x4000
|
|
||||||
;cdpos dd ?
|
|
||||||
;cd_appl_data dd ?
|
|
||||||
;current_slot dd ?
|
|
||||||
;pg_data PG_DATA
|
|
||||||
ide_channel1_mutex MUTEX
|
ide_channel1_mutex MUTEX
|
||||||
ide_channel2_mutex MUTEX
|
ide_channel2_mutex MUTEX
|
||||||
ide_channel3_mutex MUTEX
|
ide_channel3_mutex MUTEX
|
||||||
@@ -584,12 +626,7 @@ ide_channel6_mutex MUTEX
|
|||||||
ide_channel7_mutex MUTEX
|
ide_channel7_mutex MUTEX
|
||||||
ide_channel8_mutex MUTEX
|
ide_channel8_mutex MUTEX
|
||||||
os_base rb 0x400000
|
os_base rb 0x400000
|
||||||
public win_stack_addr as 'kos_win_stack'
|
BOOT boot_data
|
||||||
win_stack_addr dd WIN_STACK
|
|
||||||
public win_pos_addr as 'kos_win_pos'
|
|
||||||
win_pos_addr dd WIN_POS
|
|
||||||
public lfb_base_addr as 'kos_lfb_base'
|
|
||||||
lfb_base_addr dd lfb_base
|
|
||||||
lfb_base rd MAX_SCREEN_WIDTH*MAX_SCREEN_HEIGHT
|
lfb_base rd MAX_SCREEN_WIDTH*MAX_SCREEN_HEIGHT
|
||||||
cur_dir:
|
cur_dir:
|
||||||
.encoding rb 1
|
.encoding rb 1
|
||||||
@@ -601,5 +638,6 @@ SB16Buffer rb 65536
|
|||||||
SB16Buffer equ
|
SB16Buffer equ
|
||||||
BUTTON_INFO rb 64*1024
|
BUTTON_INFO rb 64*1024
|
||||||
BUTTON_INFO equ
|
BUTTON_INFO equ
|
||||||
|
endg
|
||||||
|
|
||||||
include 'data32.inc'
|
include 'data32.inc'
|
||||||
|
31
kolibri.h
31
kolibri.h
@@ -16,22 +16,27 @@ typedef struct {
|
|||||||
} box_t;
|
} box_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t cpu_usage; // +0
|
uint32_t cpu_usage;
|
||||||
uint16_t window_stack_position; // +4
|
uint16_t window_stack_position;
|
||||||
uint16_t window_stack_value; // +6
|
uint16_t window_stack_value;
|
||||||
uint16_t pad; // +8
|
uint16_t pad;
|
||||||
char process_name[12]; // +10
|
char process_name[12];
|
||||||
uint32_t memory_start; // +22
|
uint32_t memory_start;
|
||||||
uint32_t used_memory; // +26
|
uint32_t used_memory;
|
||||||
uint32_t pid; // +30
|
uint32_t pid;
|
||||||
box_t box; // +34
|
box_t box;
|
||||||
uint16_t slot_state; // +50
|
uint16_t slot_state;
|
||||||
uint16_t pad2; // +52
|
uint16_t pad2;
|
||||||
box_t client_box; // +54
|
box_t client_box;
|
||||||
uint8_t wnd_state; // +70
|
uint8_t wnd_state;
|
||||||
uint8_t pad3[1024-71];
|
uint8_t pad3[1024-71];
|
||||||
} __attribute__((packed)) process_information_t;
|
} __attribute__((packed)) process_information_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t frame, grab, work_3d_dark, work_3d_light, grab_text, work,
|
||||||
|
work_button, work_button_text, work_text, work_graph;
|
||||||
|
} system_colors_t;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
CP866,
|
CP866,
|
||||||
|
112
syscalls.h
112
syscalls.h
@@ -155,6 +155,93 @@ static inline void umka_sys_display_number(int is_pointer, int base,
|
|||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void umka_sys_set_button_style(int style) {
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
:
|
||||||
|
: "a"(48),
|
||||||
|
"b"(1),
|
||||||
|
"c"(style)
|
||||||
|
: "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void umka_sys_set_window_colors(void *colors) {
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
:
|
||||||
|
: "a"(48),
|
||||||
|
"b"(2),
|
||||||
|
"c"(colors),
|
||||||
|
"d"(40)
|
||||||
|
: "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void umka_sys_get_window_colors(void *colors) {
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
:
|
||||||
|
: "a"(48),
|
||||||
|
"b"(3),
|
||||||
|
"c"(colors),
|
||||||
|
"d"(40)
|
||||||
|
: "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t umka_sys_get_skin_height() {
|
||||||
|
uint32_t skin_height;
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
: "=a"(skin_height)
|
||||||
|
: "a"(48),
|
||||||
|
"b"(4)
|
||||||
|
: "memory");
|
||||||
|
return skin_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void umka_sys_get_screen_area(rect_t *wa) {
|
||||||
|
uint32_t eax, ebx;
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
: "=a"(eax),
|
||||||
|
"=b"(ebx)
|
||||||
|
: "a"(48),
|
||||||
|
"b"(5)
|
||||||
|
: "memory");
|
||||||
|
wa->left = eax >> 16;
|
||||||
|
wa->right = eax & 0xffffu;
|
||||||
|
wa->top = ebx >> 16;
|
||||||
|
wa->bottom = ebx & 0xffffu;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void umka_sys_set_screen_area(rect_t *wa) {
|
||||||
|
uint32_t ecx, edx;
|
||||||
|
ecx = (wa->left << 16) + wa->right;
|
||||||
|
edx = (wa->top << 16) + wa->bottom;
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
:
|
||||||
|
: "a"(48),
|
||||||
|
"b"(6),
|
||||||
|
"c"(ecx),
|
||||||
|
"d"(edx)
|
||||||
|
: "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void umka_sys_get_skin_margins(rect_t *wa) {
|
||||||
|
uint32_t eax, ebx;
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
: "=a"(eax),
|
||||||
|
"=b"(ebx)
|
||||||
|
: "a"(48),
|
||||||
|
"b"(7)
|
||||||
|
: "memory");
|
||||||
|
wa->left = eax >> 16;
|
||||||
|
wa->right = eax & 0xffffu;
|
||||||
|
wa->top = ebx >> 16;
|
||||||
|
wa->bottom = ebx & 0xffffu;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int32_t umka_sys_set_skin(const char *path) {
|
static inline int32_t umka_sys_set_skin(const char *path) {
|
||||||
int32_t status;
|
int32_t status;
|
||||||
__asm__ __inline__ __volatile__ (
|
__asm__ __inline__ __volatile__ (
|
||||||
@@ -167,7 +254,7 @@ static inline int32_t umka_sys_set_skin(const char *path) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int umka_sys_get_smoothing() {
|
static inline int umka_sys_get_font_smoothing() {
|
||||||
int type;
|
int type;
|
||||||
__asm__ __inline__ __volatile__ (
|
__asm__ __inline__ __volatile__ (
|
||||||
"call i40"
|
"call i40"
|
||||||
@@ -178,7 +265,7 @@ static inline int umka_sys_get_smoothing() {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void umka_sys_set_smoothing(int type) {
|
static inline void umka_sys_set_font_smoothing(int type) {
|
||||||
__asm__ __inline__ __volatile__ (
|
__asm__ __inline__ __volatile__ (
|
||||||
"call i40"
|
"call i40"
|
||||||
:
|
:
|
||||||
@@ -188,6 +275,27 @@ static inline void umka_sys_set_smoothing(int type) {
|
|||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int umka_sys_get_font_size() {
|
||||||
|
uint32_t size;
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
: "=a" (size)
|
||||||
|
: "a"(48),
|
||||||
|
"b"(11)
|
||||||
|
: "memory");
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void umka_sys_set_font_size(uint32_t size) {
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
:
|
||||||
|
: "a"(48),
|
||||||
|
"b"(12),
|
||||||
|
"c"(size)
|
||||||
|
: "memory");
|
||||||
|
}
|
||||||
|
|
||||||
static inline void umka_sys_put_image_palette(void *image,
|
static inline void umka_sys_put_image_palette(void *image,
|
||||||
size_t xsize, size_t ysize,
|
size_t xsize, size_t ysize,
|
||||||
size_t x, size_t y,
|
size_t x, size_t y,
|
||||||
|
@@ -10,7 +10,10 @@ draw_rect 60 20 30 20 0x00ff00
|
|||||||
put_image chess_image.rgb 8 8 5 15
|
put_image chess_image.rgb 8 8 5 15
|
||||||
put_image_palette chess_image.rgb 12 12 5 30 9 0
|
put_image_palette chess_image.rgb 12 12 5 30 9 0
|
||||||
write_text 10 70 0xffff00 hello 0 0 0 0 0 5 0
|
write_text 10 70 0xffff00 hello 0 0 0 0 0 5 0
|
||||||
|
set_button_style 0
|
||||||
button 55 40 5 20 0xc0ffee 0xffffff 1 0
|
button 55 40 5 20 0xc0ffee 0xffffff 1 0
|
||||||
|
set_button_style 1
|
||||||
|
button 100 40 5 20 0xc1ffee 0xffffff 1 0
|
||||||
display_number 0 10 4 0 0 1234 5 45 0xffff00 1 1 0 0 0x0000ff
|
display_number 0 10 4 0 0 1234 5 45 0xffff00 1 1 0 0 0x0000ff
|
||||||
blit_bitmap chess_image.rgba 20 35 8 8 0 0 8 8 0 0 0 1 32
|
blit_bitmap chess_image.rgba 20 35 8 8 0 0 8 8 0 0 0 1 32
|
||||||
window_redraw 2
|
window_redraw 2
|
||||||
@@ -21,6 +24,9 @@ get_font_smoothing
|
|||||||
set_font_smoothing 0
|
set_font_smoothing 0
|
||||||
get_font_smoothing
|
get_font_smoothing
|
||||||
|
|
||||||
|
get_window_colors
|
||||||
|
set_window_colors 0 0 0 0 0 0 0 0 0 0
|
||||||
|
|
||||||
window_redraw 1
|
window_redraw 1
|
||||||
draw_window 0 300 0 200 0x000088 1 1 1 0 1 4 hello
|
draw_window 0 300 0 200 0x000088 1 1 1 0 1 4 hello
|
||||||
set_pixel 0 0 0x0000ff
|
set_pixel 0 0 0x0000ff
|
||||||
@@ -34,6 +40,15 @@ dump_win_stack 5
|
|||||||
dump_win_pos 5
|
dump_win_pos 5
|
||||||
|
|
||||||
process_info -1
|
process_info -1
|
||||||
|
get_skin_height
|
||||||
|
get_screen_area
|
||||||
|
set_screen_area 0 20 350 250
|
||||||
|
get_screen_area
|
||||||
|
get_skin_margins
|
||||||
|
|
||||||
|
get_font_size
|
||||||
|
set_font_size 16
|
||||||
|
get_font_size
|
||||||
|
|
||||||
scrot umka.rgba
|
scrot umka.rgba
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user