Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9836 → Rev 9835

/programs/develop/ktcc/trunk/libc.obj/include/sys/ksys.h
382,9 → 382,7
KOSAPI void _ksys_create_window(uint32_t x, uint32_t y, uint32_t w, uint32_t h, const char* name, ksys_color_t workcolor, uint32_t style)
{
asm_inline(
"int $0x40"
:
: "a"(0),
"int $0x40" ::"a"(0),
"b"((x << 16) | ((w - 1) & 0xFFFF)),
"c"((y << 16) | ((h - 1) & 0xFFFF)),
"d"((style << 24) | (workcolor & 0xFFFFFF)),
397,7 → 395,8
 
KOSAPI void _ksys_draw_pixel(uint32_t x, uint32_t y, ksys_color_t color)
{
asm_inline("int $0x40" ::"a"(1), "b"(x), "c"(y), "d"(color));
asm_inline(
"int $0x40" ::"a"(1), "b"(x), "c"(y), "d"(color));
}
 
/*============ Function 2 - get the code of the pressed key. ===========*/
429,9 → 428,7
KOSAPI void _ksys_draw_text(const char* text, uint32_t x, uint32_t y, uint32_t len, ksys_color_t color)
{
asm_inline(
"int $0x40"
:
: "a"(4), "d"(text),
"int $0x40" ::"a"(4), "d"(text),
"b"((x << 16) | y),
"S"(len), "c"(color)
: "memory");
442,9 → 439,7
KOSAPI void _ksys_delay(uint32_t time)
{
asm_inline(
"int $0x40"
:
: "a"(5), "b"(time)
"int $0x40" ::"a"(5), "b"(time)
: "memory");
}
 
453,9 → 448,7
KOSAPI void _ksys_draw_bitmap(void* bitmap, int x, int y, int w, int h)
{
asm_inline(
"int $0x40"
:
: "a"(7), "b"(bitmap),
"int $0x40" ::"a"(7), "b"(bitmap),
"c"((w << 16) | h),
"d"((x << 16) | y)
: "memory");
466,9 → 459,7
KOSAPI void _ksys_define_button(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t id, ksys_color_t color)
{
asm_inline(
"int $0x40"
:
: "a"(8),
"int $0x40" ::"a"(8),
"b"((x << 16) + w),
"c"((y << 16) + h),
"d"(id),
477,7 → 468,8
 
KOSAPI void _ksys_delete_button(uint32_t id)
{
asm_inline("int $0x40" ::"a"(8), "d"(id & 0x00FFFFFF | 0x80000000));
asm_inline(
"int $0x40" ::"a"(8), "d"(id & 0x00FFFFFF | 0x80000000));
}
 
/*============ Function 9 - information on execution thread. ===========*/
546,9 → 538,7
KOSAPI void _ksys_draw_bar(uint32_t x, uint32_t y, uint32_t w, uint32_t h, ksys_color_t color)
{
asm_inline(
"int $0x40"
:
: "a"(13), "d"(color),
"int $0x40" ::"a"(13), "d"(color),
"b"((x << 16) | w),
"c"((y << 16) | h));
}
569,7 → 559,8
 
KOSAPI void _ksys_bg_set_size(uint32_t w, uint32_t h)
{
asm_inline("int $0x40" ::"a"(15), "b"(1), "c"(w), "d"(h));
asm_inline(
"int $0x40" ::"a"(15), "b"(1), "c"(w), "d"(h));
}
 
/*=== Function 15, subfunction 2 - put pixel on the background image. ==*/
576,7 → 567,8
 
KOSAPI void _ksys_bg_put_pixel(uint32_t x, uint32_t y, uint32_t w, ksys_color_t color)
{
asm_inline("int $0x40" ::"a"(15), "b"(2), "c"((x + y * w) * 3), "d"(color));
asm_inline(
"int $0x40" ::"a"(15), "b"(2), "c"((x + y * w) * 3), "d"(color));
}
 
/*=========== Function 15, subfunction 3 - redraw background. ==========*/
583,7 → 575,8
 
KOSAPI void _ksys_bg_redraw(void)
{
asm_inline("int $0x40" ::"a"(15), "b"(3));
asm_inline(
"int $0x40" ::"a"(15), "b"(3));
}
 
/*== Function 15, subfunction 4 - set drawing mode for the background. =*/
595,7 → 588,8
 
KOSAPI void _ksys_bg_set_mode(uint32_t mode)
{
asm_inline("int $0x40" ::"a"(15), "b"(4), "c"(mode));
asm_inline(
"int $0x40" ::"a"(15), "b"(4), "c"(mode));
}
 
/*===================== Function 15, subfunction 5 =====================*/
604,9 → 598,7
KOSAPI void _ksys_bg_put_bitmap(ksys_bitmap_t* bitmap, size_t bitmap_size, uint32_t x, uint32_t y, uint32_t w)
{
asm_inline(
"int $0x40"
:
: "a"(15), "b"(5), "c"(bitmap), "d"((x + y * w) * 3), "S"(bitmap_size));
"int $0x40" ::"a"(15), "b"(5), "c"(bitmap), "d"((x + y * w) * 3), "S"(bitmap_size));
}
 
/*===================== Function 15, subfunction 6 =====================*/
640,9 → 632,7
KOSAPI void _ksys_bg_redraw_bar(ksys_pos_t angle1, ksys_pos_t angle2)
{
asm_inline(
"int $0x40"
:
: "a"(15), "b"(9),
"int $0x40" ::"a"(15), "b"(9),
"c"(angle1.x * (1 << 16) + angle2.x),
"d"(angle1.y * (1 << 16) + angle2.y));
}
676,7 → 666,8
 
KOSAPI void _ksys_unfocus_window(int slot)
{
asm_inline("int $0x40" ::"a"(18), "b"(1), "c"(slot));
asm_inline(
"int $0x40" ::"a"(18), "b"(1), "c"(slot));
}
 
/*= Function 18, subfunction 2 - terminate process/thread by the slot. =*/
692,7 → 683,8
 
KOSAPI void _ksys_focus_window(int slot)
{
asm_inline("int $0x40" ::"a"(18), "b"(3), "c"(slot));
asm_inline(
"int $0x40" ::"a"(18), "b"(3), "c"(slot));
}
 
/*===================== Function 18, subfunction 4 =====================*/
743,7 → 735,8
 
KOSAPI void _ksys_shutdown(uint32_t shd_param)
{
asm_inline("int $0x40" ::"a"(18), "b"(9), "c"(shd_param));
asm_inline(
"int $0x40" ::"a"(18), "b"(9), "c"(shd_param));
}
 
/*========= Function 18, subfunction 16 - get size of free RAM. ========*/
859,8 → 852,7
KOSAPI ksys_date_t _ksys_get_date(void)
{
ksys_date_t val;
asm_inline(
"int $0x40"
asm_inline("int $0x40"
: "=a"(val)
: "a"(29));
return val;
871,7 → 863,8
 
KOSAPI void _ksys_setcwd(char* dir)
{
asm_inline("int $0x40" ::"a"(30), "b"(1), "c"(dir));
asm_inline(
"int $0x40" ::"a"(30), "b"(1), "c"(dir));
}
 
/*--------- Subfunction 2 - get current folder for the thread. ---------*/
1024,9 → 1017,7
KOSAPI void _ksys_draw_line(int xs, int ys, int xe, int ye, ksys_color_t color)
{
asm_inline(
"int $0x40"
:
: "a"(38), "d"(color),
"int $0x40" ::"a"(38), "d"(color),
"b"((xs << 16) | xe),
"c"((ys << 16) | ye));
}
1038,9 → 1029,7
unsigned fmt;
fmt = len << 16 | 0x80000000; // no leading zeros + width
asm_inline(
"int $0x40"
:
: "a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color));
"int $0x40" ::"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color));
}
 
KOSAPI void _ksys_draw_number_bg(unsigned number, int x, int y, int len, ksys_color_t color, ksys_color_t bg)
1048,9 → 1037,7
unsigned fmt;
fmt = len << 16 | 0x80000000; // no leading zeros + width
asm_inline(
"int $0x40"
:
: "a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color), "D"(bg));
"int $0x40" ::"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color), "D"(bg));
}
 
/*====== Function 48, subfunction 3 - get standard window colors. ======*/
1057,7 → 1044,8
 
KOSAPI void _ksys_get_system_colors(ksys_colors_table_t* color_table)
{
asm_inline("int $0x40" ::"a"(48), "b"(3), "c"(color_table), "d"(40));
asm_inline(
"int $0x40" ::"a"(48), "b"(3), "c"(color_table), "d"(40));
}
 
/*============ Function 48, subfunction 4 - get skin height. ===========*/
1179,24 → 1167,6
}
}
 
/*========= Function 65 - draw image with the palette in window. =============*/
 
KOSAPI void ksys_draw_bitmap_palette(void* bitmap, int x, int y, int w, int h, int bpp, void* palette, int offset)
{
asm_inline(
"pushl %%ebp,\n\t" // save EBP register
"movl 0x24(%%ebp), %%ebp\n\t" // 0x24 - "offset" param
"int $0x40\n\t"
"popl %%ebp" // restore EBP register
:
: "a"(65),
"b"(bitmap),
"c"((w << 16) + h),
"d"((x << 16) + y),
"S"(bpp),
"D"(palette));
}
 
/*========= Function 66, subfunction 1 - set keyboard input mode. ==============*/
 
typedef enum KSYS_KEY_INPUT_MODE {
1206,7 → 1176,8
 
KOSAPI void _ksys_set_key_input_mode(ksys_key_input_mode_t mode)
{
asm_inline("int $0x40" ::"a"(66), "b"(1), "c"(mode));
asm_inline(
"int $0x40" ::"a"(66), "b"(1), "c"(mode));
}
 
/*========= Function 66, subfunction 3 - get the state of the control keys. ========*/
1255,8 → 1226,7
KSYS_SYS_HOTKEY_ALT_RIGHTONLY = 0x400,
};
 
KOSAPI int _ksys_set_sys_hotkey(uint8_t scancode, uint16_t control_key_states)
{
KOSAPI int _ksys_set_sys_hotkey(uint8_t scancode, uint16_t control_key_states) {
int res;
asm_inline(
"int $0x40"
1268,8 → 1238,7
 
/*========= Function 66, subfunction 5 - delete installed hotkey. ========*/
 
KOSAPI int _ksys_del_sys_hotkey(uint8_t scancode, uint16_t control_key_states)
{
KOSAPI int _ksys_del_sys_hotkey(uint8_t scancode, uint16_t control_key_states) {
int res;
asm_inline(
"int $0x40"
1283,7 → 1252,8
 
KOSAPI void _ksys_change_window(int new_x, int new_y, int new_w, int new_h)
{
asm_inline("int $0x40" ::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w), "S"(new_h));
asm_inline(
"int $0x40" ::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w), "S"(new_h));
}
 
/*===== Function 68, subfunction 1 - switch to the next thread of execution ====*/
1321,11 → 1291,7
 
KOSAPI void _ksys_wait_signal(ksys_signal_info_t* signal)
{
asm_inline(
"int $0x40"
:
: "a"(68), "b"(14), "c"(signal)
: "memory");
asm_inline("int $0x40" :: "a"(68),"b"(14),"c"(signal) : "memory");
}
 
/*============= Function 68, subfunction 16 - load driver. =============*/
1606,10 → 1572,7
 
KOSAPI void _ksys_set_window_title(const char* title)
{
asm_inline(
"int $0x40"
:
: "a"(71), "b"(1), "c"(title)
asm_inline("int $0x40" ::"a"(71), "b"(1), "c"(title)
: "memory");
}
 
1617,8 → 1580,7
 
/*============= Function 77, subfunction 0 - create futex object =============*/
 
KOSAPI void* _ksys_futex_create(void* futex_control_addr)
{
KOSAPI void* _ksys_futex_create(void* futex_control_addr) {
void* futex_desc;
asm_inline(
"int $0x40"
1630,8 → 1592,7
 
/*============= Function 77, subfunction 1 - destroy futex object =============*/
 
KOSAPI int _ksys_futex_destroy(void* futex_desc)
{
KOSAPI int _ksys_futex_destroy(void* futex_desc) {
int res;
asm_inline(
"int $0x40"
1643,8 → 1604,7
 
/*============= Function 77, subfunction 2 - futex wait =============*/
 
KOSAPI int _ksys_futex_wait(void* futex_desc, int control_val, int timeout)
{
KOSAPI int _ksys_futex_wait(void* futex_desc, int control_val, int timeout) {
int res;
asm_inline(
"int $0x40"
1656,8 → 1616,7
 
/*============= Function 77, subfunction 3 - futex wake =============*/
 
KOSAPI int _ksys_futex_wake(void* futex_desc, int max_wake_count)
{
KOSAPI int _ksys_futex_wake(void* futex_desc, int max_wake_count) {
int count;
asm_inline(
"int $0x40"