mewlib: update ksys.h

added functions:
+ 18.10
+ 18.13
+ 18.15
+ 18.20
+ 18.22
+ 18.23
+ 18.24
+ 18.25
+ 21.2
+ 21.5
+ 21.11
+ 21.12
+ 22
+ 26.2
+ 26.5
+ 26.11
+ 26.12
This commit is contained in:
2026-03-08 18:14:40 +05:00
parent 9fcf6b705f
commit 2280831b88

View File

@@ -240,6 +240,30 @@ typedef union {
};
} ksys_signal_info_t;
typedef struct {
uint8_t a, b, c, d;
uint8_t debug_label;
uint8_t ABI_low;
uint8_t ABI_high;
uint32_t commit_id;
uint16_t reserved;
uint16_t commit_count;
} ksys_kernel_version_t;
typedef struct
{
uint32_t total_ram_pages;
uint32_t free_ram_pages;
uint32_t page_faults;
uint32_t kernel_heap_size;
uint32_t kernel_heap_free;
uint32_t kernel_heap_total_blocks;
uint32_t kernel_heap_free_blocks;
uint32_t kernel_heap_largest_free_block;
uint32_t kernel_heap_largest_alloc_block;
} ksys_memory_info_t;
#pragma pack(pop)
typedef rgb_t ksys_bitmap_t;
@@ -785,6 +809,40 @@ KOSAPI void _ksys_shutdown(uint32_t shd_param)
asm_inline("int $0x40" ::"a"(18), "b"(9), "c"(shd_param));
}
/*====== Function 18, subfunction 10 - minimize current window. ========*/
KOSAPI void _ksys_minimize_current_windows()
{
asm_inline(
"int $0x40" ::"a"(18), "b"(10));
}
/*========== Function 18, subfunction 13 - get kernel version. =========*/
KOSAPI int _ksys_get_kernel_version(ksys_kernel_version_t* info)
{
int err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(18), "b"(13), "c"(info)
: "memory");
return err;
}
/*========= Function 18, subfunction 15 - move mouse to center. ========*/
KOSAPI int _ksys_center_mouse()
{
int a;
asm_inline(
"int $0x40"
: "=a"(a)
: "a"(18), "b"(15));
return a;
}
/*========= Function 18, subfunction 16 - get size of free RAM. ========*/
KOSAPI size_t _ksys_get_ram_size(void)
@@ -843,6 +901,254 @@ KOSAPI uint32_t _ksys_set_mouse_settings(ksys_mouse_settings_t settings, uint32_
#define _ksys_set_mouse_pos(X, Y) _ksys_set_mouse_settings(KSYS_MOUSE_SET_POS, X * 65536 + Y)
/*===================== Function 18, subfunction 20 ====================*/
KOSAPI int _ksys_get_memory_info(ksys_memory_info_t* info)
{
int total;
asm_inline(
"int $0x40"
: "=a"(total)
: "a"(18), "b"(20), "c"(info)
: "memory");
return total;
}
/*===================== Function 18, subfunction 21 ====================*/
/*=====Get the slot number of the process / thread by identifier.. =====*/
KOSAPI int _ksys_get_thread_slot(int PID)
{
int val;
asm_inline(
"int $0x40"
: "=a"(val)
: "a"(18), "b"(21), "c"(PID));
return val;
}
/*===================== Function 18, subfunction 22 ====================*/
typedef enum KSYS_WIN_REMOTE_CONTROL {
WIN_MINIMIZE_BY_SLOT = 0,
WIN_MINIMIZE_BY_PID = 1,
WIN_RESTORE_BY_SLOT = 2,
WIN_RESTORE_BY_PID = 3
} ksys_win_remote_control_t;
KOSAPI int _ksys_window_remote_control(ksys_win_remote_control_t type, uint32_t param)
{
int result;
asm_inline(
"int $0x40"
: "=a"(result)
: "a"(18), "b"(22), "c"(type), "d"(param));
return result;
}
/*===================== Function 18, subfunction 23 ====================*/
KOSAPI int _ksys_minimize_all_windows()
{
int count;
asm_inline(
"int $0x40"
: "=a"(count)
: "a"(18), "b"(23));
return count;
}
/*===================== Function 18, subfunction 24 ====================*/
KOSAPI void _ksys_set_draw_limits(unsigned int x, unsigned int y)
{
asm_inline(
"int $0x40" ::"a"(18), "b"(24), "c"(x), "d"(y));
}
/*===================== Function 18, subfunction 25 ====================*/
typedef enum KSYS_ZPOS {
KSYS_ZPOS_DESKTOP = -2,
KSYS_ZPOS_ALWAYS_BACK = -1,
KSYS_ZPOS_NORMAL = 0,
KSYS_ZPOS_ALWAYS_TOP = 1
} ksys_zpos_t;
/*=========== Function 18, subfunction 25, subsubfunction 1 ============*/
KOSAPI ksys_zpos_t _ksys_get_window_zposition(int32_t pid)
{
ksys_zpos_t result_eax;
asm_inline(
"int $0x40"
: "=a"(result_eax)
: "a"(18), "b"(25), "c"(1), "d"(pid));
return result_eax;
}
/*=========== Function 18, subfunction 25, subsubfunction 2 ============*/
KOSAPI int _ksys_set_window_zposition(int32_t pid, ksys_zpos_t position)
{
int err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(18), "b"(25), "c"(2), "d"(pid), "S"(position));
return err;
}
/*==================== Function 21, subfunction 2 =====================*/
typedef enum KSYS_KEYBOARD_LAYOUT {
KSYS_KEYBOARD_LAYOUT_NORMAL = 1,
KSYS_KEYBOARD_LAYOUT_SHIFT = 2,
KSYS_KEYBOARD_LAYOUT_ALT = 3
} ksys_keyboard_layout_t;
KOSAPI int _ksys_set_keyboard_layout(ksys_keyboard_layout_t mode, char* table)
{
int err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(21), "b"(2), "c"(mode), "d"(table));
return err;
}
typedef enum KSYS_LANG {
KSYS_LANG_ENG = 1,
KSYS_LANG_FI = 2,
KSYS_LANG_GER = 3,
KSYS_LANG_RU = 4
} ksys_lang_t;
KOSAPI int _ksys_set_keyboard_lang(ksys_lang_t lang)
{
int err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(21), "b"(2), "c"(9), "d"(lang));
return err;
}
/*==================== Function 21, subfunction 5 =====================*/
KOSAPI int _ksys_set_lang(ksys_lang_t lang)
{
int err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(21), "b"(5), "c"(lang));
return err;
}
/*==================== Function 21, subfunction 11 =====================*/
KOSAPI int _ksys_allow_HD(int param)
{
int err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(21), "b"(11), "c"(param));
return err;
}
/*==================== Function 21, subfunction 12 =====================*/
KOSAPI int _ksys_allow_PCI(int param)
{
int err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(21), "b"(12), "c"(param));
return err;
}
typedef enum KSYS_SET_TIME_ERR {
KSYS_SET_TIME_OK = 0,
KSYS_SET_TIME_WRONG_PARAM = 1,
KSYS_SET_TIME_CMOS = 2
} ksys_set_time_err;
/*============================ Function 22 ============================*/
KOSAPI ksys_set_time_err _ksys_set_time(ksys_time_bcd_t time)
{
ksys_set_time_err err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(22), "b"(0), "c"(time));
}
KOSAPI ksys_set_time_err _ksys_set_date(ksys_date_bcd_t date)
{
ksys_set_time_err err;
asm_inline(
"int $0x40"
: "=a"(err)
: "a"(22), "b"(1), "c"(date));
}
/*============= Function 23 - wait for event with timeout. =============*/
KOSAPI uint32_t _ksys_wait_event_timeout(uint32_t timeout)
{
unsigned val;
asm_inline(
"int $0x40"
: "=a"(val)
: "a"(23), "b"(timeout));
return val;
}
/*========= Function 26, subfunction 2 - get keyboard layout. ==========*/
KOSAPI uint32_t _ksys_keyboard_layout(ksys_keyboard_layout_t layout, unsigned char* buf)
{
asm_inline("int $0x40" ::"a"(26), "b"(2), "c"(layout), "d"(buf) : "memory");
}
KOSAPI ksys_lang_t _ksys_get_keyboard_lang()
{
ksys_lang_t lang;
asm_inline(
"int $0x40"
: "=a"(lang)
: "a"(26), "b"(2), "c"(9));
return lang;
}
/*======= Function 26, subfunction 5 - get the system language. ========*/
KOSAPI ksys_lang_t _ksys_get_lang()
{
ksys_lang_t lang;
asm_inline(
"int $0x40"
: "=a"(lang)
: "a"(26), "b"(5));
return lang;
}
/*===================== Function 18, subfunction 21 ====================*/
/*=====Get the slot number of the process / thread by identifier.. =====*/