Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2829 → Rev 2828

/programs/emulator/e80/trunk/system/kolibri.c
10,183 → 10,193
 
void kol_exit()
{
asm volatile ("int $0x40"::"a"(-1));
asm ("int $0x40"::"a"(-1));
}
 
 
void kol_sleep(unsigned d)
{
asm volatile ("int $0x40"::"a"(5), "b"(d));
asm ("int $0x40"::"a"(5), "b"(d));
}
 
 
// define a window
// x, y - position; w, h - size; cs - color and style; c - caption; b - boder
void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned cs, unsigned b, char *t)
void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c)
{
asm volatile ("int $0x40"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(cs), "D"(t), "S"(b) );
asm ("nop"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(c));
asm ("movl $0xffffff, %esi \n int $0x40");
}
 
 
void kol_wnd_move(unsigned x, unsigned y)
{
asm volatile ("int $0x40"::"a"(67), "b"(x), "c"(y), "d"(-1), "S"(-1));
asm ("nop"::"a"(67), "b"(x), "c"(y));
asm ("movl $-1, %edx \n movl $-1, %esi \n int $0x40");
}
 
 
void kol_event_mask(unsigned e)
{
asm volatile ("int $0x40"::"a"(40), "b"(e));
asm ("int $0x40"::"a"(40), "b"(e));
}
 
 
unsigned kol_event_wait()
{
asm volatile ("int $0x40"::"a"(10));
asm ("int $0x40"::"a"(10));
}
 
 
unsigned kol_event_wait_time(unsigned time)
{
asm volatile ("int $0x40"::"a"(23), "b"(time));
asm ("int $0x40"::"a"(23), "b"(time));
}
 
 
unsigned kol_event_check()
{
asm volatile ("int $0x40"::"a"(11));
asm ("int $0x40"::"a"(11));
}
 
 
void __attribute__((__always_inline__)) kol_paint_start()
void kol_paint_start()
{
asm volatile ("int $0x40"::"a"(12), "b"(1));
asm ("int $0x40"::"a"(12), "b"(1));
}
 
 
void __attribute__((__always_inline__)) kol_paint_end()
void kol_paint_end()
{
asm volatile ("int $0x40"::"a"(12), "b"(2));
asm ("int $0x40"::"a"(12), "b"(2));
}
 
 
void kol_paint_pixel(unsigned x, unsigned y, unsigned c)
{
asm volatile ("int $0x40"::"a"(1), "b"(x), "c"(y), "d"(c));
asm ("int $0x40"::"a"(1), "b"(x), "c"(y), "d"(c));
}
 
 
void kol_paint_bar(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c)
{
asm volatile ("int $0x40"::"a"(13), "b"(x*65536+w), "c"(y*65536+h), "d"(c));
asm ("int $0x40"::"a"(13), "b"(x*65536+w), "c"(y*65536+h), "d"(c));
}
 
 
void kol_paint_line(unsigned x1, unsigned y1, unsigned x2, unsigned y2, unsigned c)
{
asm volatile ("int $0x40"::"a"(38), "b"(x1*65536+x2), "c"(y1*65536+y2), "d"(c));
asm ("int $0x40"::"a"(38), "b"(x1*65536+x2), "c"(y1*65536+y2), "d"(c));
}
 
 
void kol_paint_string(unsigned x, unsigned y, char *s, unsigned c)
{
asm volatile ("int $0x40"::"a"(4), "b"(x*65536+y), "c"(c), "d"(s));
asm ("int $0x40"::"a"(4), "b"(x*65536+y), "c"(c), "d"(s));
}
 
 
void kol_paint_image(unsigned x, unsigned y, unsigned w, unsigned h, char *d)
{
asm volatile ("int $0x40"::"a"(7), "c"(w*65536+h), "d"(x*65536+y), "b"(d));
asm ("int $0x40"::"a"(7), "c"(w*65536+h), "d"(x*65536+y), "b"(d));
}
 
 
void kol_paint_image_pal(unsigned x, unsigned y, unsigned w, unsigned h, char *d, unsigned *palette)
{
asm volatile ("int $0x40"::"a"(65), "b"(d), "c"(w*65536+h), "d"(x*65536+y), "D"(palette), "S"(8));
asm ("nop"::"c"(w*65536+h), "d"(x*65536+y), "b"(d));
asm ("nop"::"a"(palette));
asm ("movl %eax, %edi");
asm ("xor %eax, %eax");
asm ("movl %eax, %ebp");
asm ("pushl $8");
asm ("popl %esi");
asm ("int $0x40"::"a"(65));
}
 
 
unsigned kol_key_get()
{
asm volatile ("int $0x40"::"a"(2));
asm ("int $0x40"::"a"(2));
}
 
 
unsigned kol_key_control()
{
asm volatile ("int $0x40"::"a"(66), "b"(3));
asm ("int $0x40"::"a"(66), "b"(3));
}
 
 
void kol_key_lang_set(unsigned lang)
{
asm volatile ("int $0x40"::"a"(21), "b"(2), "c"(9), "d"(lang));
asm ("int $0x40"::"a"(21), "b"(2), "c"(9), "d"(lang));
}
 
 
unsigned kol_key_lang_get()
{
asm volatile ("int $0x40"::"a"(26), "b"(2), "c"(9));
asm ("int $0x40"::"a"(26), "b"(2), "c"(9));
}
 
 
void kol_key_mode_set(unsigned mode)
{
asm volatile ("int $0x40"::"a"(66), "b"(1), "c"(mode));
asm ("int $0x40"::"a"(66), "b"(1), "c"(mode));
}
 
 
unsigned kol_key_mode_get()
{
asm volatile ("int $0x40"::"a"(66), "b"(2));
asm ("int $0x40"::"a"(66), "b"(2));
}
 
 
unsigned kol_btn_get()
{
asm volatile ("int $0x40"::"a"(17));
asm ("int $0x40"::"a"(17));
}
 
 
void kol_btn_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned d, unsigned c)
{
asm volatile ("int $0x40"::"a"(8), "b"(x*65536+w), "c"(y*65536+h), "d"(d), "S"(c));
asm ("nop"::"b"(x*65536+w), "c"(y*65536+h), "d"(d));
asm ("nop"::"a"(c));
asm ("movl %eax, %esi");
asm ("int $0x40"::"a"(8));
}
 
 
void kol_btn_type(unsigned t)
{
asm volatile ("int $0x40"::"a"(48), "b"(1), "c"(t));
asm ("int $0x40"::"a"(48), "b"(1), "c"(t));
}
 
 
void kol_wnd_caption(char *s)
{
asm volatile ("int $0x40"::"a"(71), "b"(1), "c"(s));
asm ("int $0x40"::"a"(71), "b"(1), "c"(s));
}
 
 
unsigned kol_mouse_pos()
{
asm volatile ("int $0x40"::"a"(37), "b"(0));
asm ("int $0x40"::"a"(37), "b"(0));
}
 
 
unsigned kol_mouse_posw()
{
asm volatile ("int $0x40"::"a"(37), "b"(1));
asm ("int $0x40"::"a"(37), "b"(1));
}
 
 
unsigned kol_mouse_btn()
{
asm volatile ("int $0x40"::"a"(37), "b"(2));
asm ("int $0x40"::"a"(37), "b"(2));
}
 
 
void kol_board_putc(char c)
{
asm volatile ("int $0x40"::"a"(63), "b"(1), "c"(c));
asm ("int $0x40"::"a"(63), "b"(1), "c"(c));
}
 
 
196,7 → 206,7
i = 0;
while (*(s+i))
{
asm volatile ("int $0x40"::"a"(63), "b"(1), "c"(*(s+i)));
asm ("int $0x40"::"a"(63), "b"(1), "c"(*(s+i)));
i++;
}
}
205,25 → 215,26
void kol_board_puti(int n)
{
char c;
 
if ( n > 1 )
kol_board_puti(n / 10);
 
int i = 0;
do
{
c = n % 10 + '0';
asm volatile ("int $0x40"::"a"(63), "b"(1), "c"(c));
 
asm ("int $0x40"::"a"(63), "b"(1), "c"(c));
i++;
}
while ((n /= 10) > 0);
}
 
 
int kol_file_70(kol_struct70 *k)
{
asm volatile ("int $0x40"::"a"(70), "b"(k));
asm ("int $0x40"::"a"(70), "b"(k));
}
 
 
kol_struct_import* kol_cofflib_load(char *name)
{
asm volatile ("int $0x40"::"a"(68), "b"(19), "c"(name));
asm ("int $0x40"::"a"(68), "b"(19), "c"(name));
}
 
 
274,37 → 285,37
 
unsigned kol_system_cpufreq()
{
asm volatile ("int $0x40"::"a"(18), "b"(5));
asm ("int $0x40"::"a"(18), "b"(5));
}
 
 
unsigned kol_system_mem()
{
asm volatile ("int $0x40"::"a"(18), "b"(17));
asm ("int $0x40"::"a"(18), "b"(17));
}
 
 
unsigned kol_system_memfree()
{
asm volatile ("int $0x40"::"a"(18), "b"(16));
asm ("int $0x40"::"a"(18), "b"(16));
}
 
 
unsigned kol_system_time_get()
{
asm volatile ("int $0x40"::"a"(3));
asm ("int $0x40"::"a"(3));
}
 
 
unsigned kol_system_date_get()
{
asm volatile ("int $0x40"::"a"(29));
asm ("int $0x40"::"a"(29));
}
 
 
unsigned kol_system_end(unsigned param)
{
asm volatile ("int $0x40"::"a"(18), "b"(9), "c"(param));
asm ("int $0x40"::"a"(18), "b"(9), "c"(param));
}
 
 
347,9 → 358,9
 
 
 
void __attribute__((__always_inline__)) kol_screen_wait_rr()
void kol_screen_wait_rr()
{
asm volatile ("int $0x40"::"a"(18), "b"(14));
asm ("int $0x40"::"a"(18), "b"(14));
}
 
 
357,7 → 368,7
void kol_screen_get_size(unsigned *w, unsigned *h)
{
unsigned size;
asm volatile ("int $0x40":"=a"(size):"a"(14));
asm ("int $0x40":"=a"(size):"a"(14));
*w = size / 65536;
*h = size % 65536;
}
366,58 → 377,36
 
unsigned kol_skin_height()
{
asm volatile ("int $0x40"::"a"(48), "b"(4));
asm ("int $0x40"::"a"(48), "b"(4));
}
 
 
unsigned kol_thread_start(unsigned start, unsigned stack)
{
asm volatile ("int $0x40"::"a"(51), "b"(1), "c"(start), "d"(stack));
asm ("int $0x40"::"a"(51), "b"(1), "c"(start), "d"(stack));
}
 
 
unsigned kol_time_tick()
{
asm volatile ("int $0x40"::"a"(26), "b"(9));
asm ("int $0x40"::"a"(26), "b"(9));
}
 
 
unsigned kol_sound_speaker(char data[])
{
asm volatile ("movl %0, %%esi"::"a"(data));
asm volatile ("int $0x40"::"a"(55), "b"(55));
asm ("movl %0, %%esi"::"a"(data));
asm ("int $0x40"::"a"(55), "b"(55));
}
 
 
unsigned kol_process_info(unsigned slot, char buf1k[])
{
asm volatile ("int $0x40"::"a"(9), "b"(buf1k), "c"(slot));
asm ("int $0x40"::"a"(9), "b"(buf1k), "c"(slot));
}
 
 
int kol_process_kill_pid(unsigned process)
{
asm volatile ("int $0x40"::"a"(18), "b"(18), "c"(process));
asm ("int $0x40"::"a"(18), "b"(18), "c"(process));
}
 
int kol_kill_process(unsigned process)
{
asm volatile ("int $0x40"::"a"(18), "b"(2), "c"(process));
}
 
void kol_get_kernel_ver(char buff16b[])
{
asm volatile ("int $0x40"::"a"(18), "b"(13), "c"(buff16b));
}
 
int kol_buffer_open(char name[], int mode, int size, char **buf)
{
int error;
asm volatile ("int $0x40":"=a"(*buf), "=d"(error):"a"(68), "b"(22), "c"(name), "d"(size), "S"(mode));
return error;
}
 
void kol_buffer_close(char name[])
{
asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(name));
}