Rev 5963 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5963 | Rev 6099 | ||
---|---|---|---|
Line 50... | Line 50... | ||
50 | int inp_size; |
50 | int inp_size; |
51 | void *output; |
51 | void *output; |
52 | int out_size; |
52 | int out_size; |
53 | }ioctl_t; |
53 | }ioctl_t; |
Line -... | Line 54... | ||
- | 54 | ||
- | 55 | static inline void begin_draw(void) |
|
- | 56 | { |
|
- | 57 | __asm__ __volatile__( |
|
- | 58 | "int $0x40" ::"a"(12),"b"(1)); |
|
- | 59 | }; |
|
- | 60 | ||
- | 61 | static inline |
|
- | 62 | void end_draw(void) |
|
- | 63 | { |
|
- | 64 | __asm__ __volatile__( |
|
- | 65 | "int $0x40" ::"a"(12),"b"(2)); |
|
- | 66 | }; |
|
- | 67 | ||
- | 68 | static inline |
|
- | 69 | void sys_create_window(int x, int y, int w, int h, const char *name, |
|
- | 70 | color_t workcolor, uint32_t style) |
|
- | 71 | { |
|
- | 72 | __asm__ __volatile__( |
|
- | 73 | "int $0x40" |
|
- | 74 | ::"a"(0), |
|
- | 75 | "b"((x << 16) | ((w-1) & 0xFFFF)), |
|
- | 76 | "c"((y << 16) | ((h-1) & 0xFFFF)), |
|
- | 77 | "d"((style << 24) | (workcolor & 0xFFFFFF)), |
|
- | 78 | "D"(name), |
|
- | 79 | "S"(0) : "memory"); |
|
Line 54... | Line 80... | ||
54 | 80 | }; |
|
55 | 81 | ||
56 | static inline |
82 | static inline |
57 | void define_button(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color) |
83 | void define_button(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color) |
Line 62... | Line 88... | ||
62 | "b"(x_w), |
88 | "b"(x_w), |
63 | "c"(y_h), |
89 | "c"(y_h), |
64 | "d"(id), |
90 | "d"(id), |
65 | "S"(color)); |
91 | "S"(color)); |
66 | }; |
92 | }; |
67 | static inline void DefineButton(void) __attribute__ ((alias ("define_button"))); |
- | |
Line 68... | Line 93... | ||
68 | 93 | ||
69 | static inline |
94 | static inline |
70 | uint32_t get_skin_height(void) |
95 | void draw_line(int xs, int ys, int xe, int ye, color_t color) |
- | 96 | { |
|
71 | { |
97 | __asm__ __volatile__( |
- | 98 | "int $0x40" |
|
- | 99 | ::"a"(38), "d"(color), |
|
- | 100 | "b"((xs << 16) | xe), |
|
- | 101 | "c"((ys << 16) | ye)); |
|
Line -... | Line 102... | ||
- | 102 | } |
|
- | 103 | ||
- | 104 | static inline |
|
72 | uint32_t height; |
105 | void draw_bar(int x, int y, int w, int h, color_t color) |
73 | 106 | { |
|
74 | __asm__ __volatile__( |
107 | __asm__ __volatile__( |
75 | "int $0x40 \n\t" |
108 | "int $0x40" |
76 | :"=a"(height) |
109 | ::"a"(13), "d"(color), |
77 | :"a"(48),"b"(4)); |
110 | "b"((x << 16) | w), |
78 | return height; |
- | |
Line 79... | Line 111... | ||
79 | }; |
111 | "c"((y << 16) | h)); |
80 | static inline uint32_t GetSkinHeight(void) __attribute__ ((alias ("get_skin_height"))); |
112 | } |
81 | 113 | ||
82 | static inline |
114 | static inline |
- | 115 | void draw_bitmap(void *bitmap, int x, int y, int w, int h) |
|
83 | void BeginDraw(void) |
116 | { |
- | 117 | __asm__ __volatile__( |
|
- | 118 | "int $0x40" |
|
84 | { |
119 | ::"a"(7), "b"(bitmap), |
Line 85... | Line 120... | ||
85 | __asm__ __volatile__( |
120 | "c"((w << 16) | h), |
86 | "int $0x40" ::"a"(12),"b"(1)); |
121 | "d"((x << 16) | y)); |
87 | }; |
122 | } |
88 | 123 | ||
- | 124 | static inline |
|
89 | static inline |
125 | void draw_text_sys(const char *text, int x, int y, int len, color_t color) |
- | 126 | { |
|
- | 127 | __asm__ __volatile__( |
|
- | 128 | "int $0x40" |
|
90 | void EndDraw(void) |
129 | ::"a"(4),"d"(text), |
Line 91... | Line 130... | ||
91 | { |
130 | "b"((x << 16) | y), |
92 | __asm__ __volatile__( |
131 | "S"(len),"c"(color) |
93 | "int $0x40" ::"a"(12),"b"(2)); |
132 | :"memory"); |
- | 133 | } |
|
Line 94... | Line 134... | ||
94 | }; |
134 | |
95 | 135 | static inline |
|
96 | static inline void DrawWindow(int x, int y, int w, int h, const char *name, |
136 | uint32_t get_skin_height(void) |
97 | color_t workcolor, uint32_t style) |
- | |
98 | { |
- | |
99 | - | ||
100 | __asm__ __volatile__( |
137 | { |
101 | "int $0x40" |
138 | uint32_t height; |
102 | ::"a"(0), |
139 | |
Line -... | Line 140... | ||
- | 140 | __asm__ __volatile__( |
|
- | 141 | "int $0x40 \n\t" |
|
- | 142 | :"=a"(height) |
|
- | 143 | :"a"(48),"b"(4)); |
|
- | 144 | return height; |
|
- | 145 | }; |
|
- | 146 | ||
- | 147 | static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw"))); |
|
- | 148 | static inline void EndDraw(void) __attribute__ ((alias ("end_draw"))); |
|
- | 149 | static inline void DrawWindow(int x, int y, int w, int h, const char *name, |
|
- | 150 | color_t workcolor, uint32_t style) |
|
- | 151 | __attribute__ ((alias ("sys_create_window"))); |
|
- | 152 | static inline void DefineButton(void) __attribute__ ((alias ("define_button"))); |
|
- | 153 | static inline void DrawLine(int xs, int ys, int xe, int ye, color_t color) |
|
- | 154 | __attribute__ ((alias ("draw_line"))); |
|
103 | "b"((x << 16) | ((w-1) & 0xFFFF)), |
155 | static inline void DrawBar(int x, int y, int w, int h, color_t color) |
104 | "c"((y << 16) | ((h-1) & 0xFFFF)), |
156 | __attribute__ ((alias ("draw_bar"))); |
Line 105... | Line 157... | ||
105 | "d"((style << 24) | (workcolor & 0xFFFFFF)), |
157 | static inline void DrawBitmap(void *bitmap, int x, int y, int w, int h) |
106 | "D"(name), |
158 | __attribute__ ((alias ("draw_bitmap"))); |
Line 120... | Line 172... | ||
120 | "rol $16, %%eax" |
172 | "rol $16, %%eax" |
121 | :"=a"(val) |
173 | :"=a"(val) |
122 | :"a"(37),"b"(origin)); |
174 | :"a"(37),"b"(origin)); |
123 | return val; |
175 | return val; |
124 | } |
176 | } |
125 | static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos"))); |
- | |
Line 126... | Line 177... | ||
126 | 177 | ||
127 | static inline |
178 | static inline |
128 | uint32_t get_mouse_buttons(void) |
179 | uint32_t get_mouse_buttons(void) |
129 | { |
180 | { |
Line 133... | Line 184... | ||
133 | "int $0x40" |
184 | "int $0x40" |
134 | :"=a"(val) |
185 | :"=a"(val) |
135 | :"a"(37),"b"(2)); |
186 | :"a"(37),"b"(2)); |
136 | return val; |
187 | return val; |
137 | }; |
188 | }; |
138 | static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons"))); |
- | |
Line 139... | Line 189... | ||
139 | 189 | ||
140 | static inline |
190 | static inline |
141 | uint32_t get_mouse_wheels(void) |
191 | uint32_t get_mouse_wheels(void) |
142 | { |
192 | { |
Line 146... | Line 196... | ||
146 | "int $0x40 \n\t" |
196 | "int $0x40 \n\t" |
147 | :"=a"(val) |
197 | :"=a"(val) |
148 | :"a"(37),"b"(7)); |
198 | :"a"(37),"b"(7)); |
149 | return val; |
199 | return val; |
150 | }; |
200 | }; |
- | 201 | ||
- | 202 | static inline uint32_t load_cursor(void *path, uint32_t flags) |
|
- | 203 | { |
|
- | 204 | uint32_t val; |
|
- | 205 | __asm__ __volatile__( |
|
- | 206 | "int $0x40" |
|
- | 207 | :"=a"(val) |
|
- | 208 | :"a"(37), "b"(4), "c"(path), "d"(flags)); |
|
- | 209 | return val; |
|
- | 210 | } |
|
- | 211 | ||
- | 212 | static inline uint32_t set_cursor(uint32_t cursor) |
|
- | 213 | { |
|
- | 214 | uint32_t old; |
|
- | 215 | __asm__ __volatile__( |
|
- | 216 | "int $0x40" |
|
- | 217 | :"=a"(old) |
|
- | 218 | :"a"(37), "b"(5), "c"(cursor)); |
|
- | 219 | return old; |
|
- | 220 | }; |
|
- | 221 | ||
- | 222 | static inline int destroy_cursor(uint32_t cursor) |
|
- | 223 | { |
|
- | 224 | int ret; |
|
- | 225 | __asm__ __volatile__( |
|
- | 226 | "int $0x40" |
|
- | 227 | :"=a"(ret) |
|
- | 228 | :"a"(37), "b"(6), "c"(cursor) |
|
- | 229 | :"memory"); |
|
- | 230 | return ret; |
|
- | 231 | }; |
|
- | 232 | ||
- | 233 | static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos"))); |
|
- | 234 | static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons"))); |
|
151 | static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels"))); |
235 | static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels"))); |
Line -... | Line 236... | ||
- | 236 | ||
- | 237 | static inline uint32_t LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor"))); |
|
- | 238 | static inline uint32_t SetCursor(uint32_t cursor) __attribute__ ((alias ("set_cursor"))); |
|
- | 239 | static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor"))); |
|
- | 240 | ||
152 | 241 | ||
153 | static inline |
242 | static inline |
154 | uint32_t wait_for_event(uint32_t time) |
243 | uint32_t wait_for_event(uint32_t time) |
155 | { |
244 | { |
156 | uint32_t val; |
245 | uint32_t val; |
Line 250... | Line 339... | ||
250 | 339 | ||
251 | return retval; |
340 | return retval; |
Line 252... | Line -... | ||
252 | }; |
- | |
253 | - | ||
254 | - | ||
255 | static inline |
- | |
256 | void draw_line(int xs, int ys, int xe, int ye, color_t color) |
- | |
257 | { |
- | |
258 | __asm__ __volatile__( |
- | |
259 | "int $0x40" |
- | |
260 | ::"a"(38), "d"(color), |
- | |
261 | "b"((xs << 16) | xe), |
- | |
262 | "c"((ys << 16) | ye)); |
- | |
263 | } |
- | |
264 | - | ||
265 | - | ||
266 | - | ||
267 | static inline |
- | |
268 | void draw_bar(int x, int y, int w, int h, color_t color) |
- | |
269 | { |
- | |
270 | __asm__ __volatile__( |
- | |
271 | "int $0x40" |
- | |
272 | ::"a"(13), "d"(color), |
- | |
273 | "b"((x << 16) | w), |
- | |
274 | "c"((y << 16) | h)); |
- | |
275 | } |
- | |
276 | - | ||
277 | static inline |
- | |
278 | void draw_bitmap(void *bitmap, int x, int y, int w, int h) |
- | |
279 | { |
- | |
280 | __asm__ __volatile__( |
- | |
281 | "int $0x40" |
- | |
282 | ::"a"(7), "b"(bitmap), |
- | |
283 | "c"((w << 16) | h), |
- | |
284 | "d"((x << 16) | y)); |
- | |
285 | } |
- | |
286 | - | ||
287 | static inline |
- | |
288 | void draw_text_sys(const char *text, int x, int y, int len, color_t color) |
- | |
289 | { |
- | |
290 | __asm__ __volatile__( |
- | |
291 | "int $0x40" |
- | |
292 | ::"a"(4),"d"(text), |
- | |
293 | "b"((x << 16) | y), |
- | |
294 | "S"(len),"c"(color) |
- | |
295 | :"memory"); |
341 | }; |
296 | } |
342 | |
297 | 343 | ||
298 | static inline void yield(void) |
344 | static inline void yield(void) |
299 | { |
345 | { |
Line 318... | Line 364... | ||
318 | "int $0x40" |
364 | "int $0x40" |
319 | :"=a"(val) |
365 | :"=a"(val) |
320 | :"a"(68),"b"(12),"c"(size)); |
366 | :"a"(68),"b"(12),"c"(size)); |
321 | return val; |
367 | return val; |
322 | } |
368 | } |
323 | static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc"))); |
- | |
Line 324... | Line 369... | ||
324 | 369 | ||
325 | static inline |
370 | static inline |
326 | int user_free(void *mem) |
371 | int user_free(void *mem) |
327 | { |
372 | { |
Line 330... | Line 375... | ||
330 | "int $0x40" |
375 | "int $0x40" |
331 | :"=a"(val) |
376 | :"=a"(val) |
332 | :"a"(68),"b"(13),"c"(mem)); |
377 | :"a"(68),"b"(13),"c"(mem)); |
333 | return val; |
378 | return val; |
334 | } |
379 | } |
- | 380 | ||
- | 381 | static inline |
|
335 | static inline int UserFree(void *mem) __attribute__ ((alias ("user_free"))); |
382 | void* user_realloc(void *mem, size_t size) |
- | 383 | { |
|
- | 384 | void *val; |
|
- | 385 | __asm__ __volatile__( |
|
- | 386 | "int $0x40" |
|
- | 387 | :"=a"(val) |
|
- | 388 | :"a"(68),"b"(20),"c"(size),"d"(mem) |
|
- | 389 | :"memory"); |
|
- | 390 | ||
- | 391 | return val; |
|
- | 392 | }; |
|
Line 336... | Line 393... | ||
336 | 393 | ||
337 | static inline |
394 | static inline |
338 | int *user_unmap(void *base, size_t offset, size_t size) |
395 | int *user_unmap(void *base, size_t offset, size_t size) |
339 | { |
396 | { |
Line 342... | Line 399... | ||
342 | "int $0x40" |
399 | "int $0x40" |
343 | :"=a"(val) |
400 | :"=a"(val) |
344 | :"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size)); |
401 | :"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size)); |
345 | return val; |
402 | return val; |
346 | }; |
403 | }; |
- | 404 | ||
- | 405 | static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc"))); |
|
- | 406 | static inline int UserFree(void *mem) __attribute__ ((alias ("user_free"))); |
|
- | 407 | static inline void* UserRealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc"))); |
|
347 | static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap"))); |
408 | static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap"))); |
Line 348... | Line 409... | ||
348 | 409 | ||
349 | typedef union |
410 | typedef union |
350 | { |
411 | { |
Line 354... | Line 415... | ||
354 | size_t size; |
415 | size_t size; |
355 | }; |
416 | }; |
356 | unsigned long long raw; |
417 | unsigned long long raw; |
357 | }ufile_t; |
418 | }ufile_t; |
Line 358... | Line -... | ||
358 | - | ||
359 | 419 | ||
360 | static inline ufile_t load_file(const char *path) |
420 | static inline ufile_t load_file(const char *path) |
361 | { |
421 | { |
Line 362... | Line 422... | ||
362 | ufile_t uf; |
422 | ufile_t uf; |
Line 379... | Line 439... | ||
379 | :"=a"(retval) |
439 | :"=a"(retval) |
380 | :"a"(61), "b"(1)); |
440 | :"a"(61), "b"(1)); |
381 | return retval; |
441 | return retval; |
382 | } |
442 | } |
Line 383... | Line -... | ||
383 | - | ||
384 | static inline |
- | |
385 | uint32_t load_cursor(void *path, uint32_t flags) |
- | |
386 | { |
- | |
387 | uint32_t val; |
- | |
388 | __asm__ __volatile__( |
- | |
389 | "int $0x40" |
- | |
390 | :"=a"(val) |
- | |
391 | :"a"(37), "b"(4), "c"(path), "d"(flags)); |
- | |
392 | return val; |
- | |
393 | } |
- | |
394 | static inline |
- | |
395 | uint32_t LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor"))); |
- | |
396 | - | ||
397 | static inline |
- | |
398 | uint32_t set_cursor(uint32_t cursor) |
- | |
399 | { |
- | |
400 | uint32_t old; |
- | |
401 | __asm__ __volatile__( |
- | |
402 | "int $0x40" |
- | |
403 | :"=a"(old) |
- | |
404 | :"a"(37), "b"(5), "c"(cursor)); |
- | |
405 | return old; |
- | |
406 | }; |
- | |
407 | static inline uint32_t SetCursor(uint32_t cursor) __attribute__ ((alias ("set_cursor"))); |
- | |
408 | - | ||
409 | static inline |
- | |
410 | int destroy_cursor(uint32_t cursor) |
- | |
411 | { |
- | |
412 | int ret; |
- | |
413 | __asm__ __volatile__( |
- | |
414 | "int $0x40" |
- | |
415 | :"=a"(ret) |
- | |
416 | :"a"(37), "b"(6), "c"(cursor) |
- | |
417 | :"memory"); |
- | |
418 | return ret; |
- | |
419 | }; |
- | |
Line 420... | Line 443... | ||
420 | static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor"))); |
443 | |
421 | 444 | ||
422 | static inline void get_proc_info(char *info) |
445 | static inline void get_proc_info(char *info) |
423 | { |
446 | { |
Line 427... | Line 450... | ||
427 | :"a"(9), "b"(info), "c"(-1) |
450 | :"a"(9), "b"(info), "c"(-1) |
428 | :"memory"); |
451 | :"memory"); |
429 | }; |
452 | }; |
430 | static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info"))); |
453 | static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info"))); |
Line 431... | Line -... | ||
431 | - | ||
432 | static inline |
- | |
433 | void* user_realloc(void *mem, size_t size) |
- | |
434 | { |
- | |
435 | void *val; |
- | |
436 | __asm__ __volatile__( |
- | |
437 | "int $0x40" |
- | |
438 | :"=a"(val) |
- | |
439 | :"a"(68),"b"(20),"c"(size),"d"(mem) |
- | |
440 | :"memory"); |
- | |
441 | - | ||
442 | return val; |
- | |
443 | }; |
- | |
444 | static inline void* UserRealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc"))); |
- | |
445 | - | ||
Line 446... | Line 454... | ||
446 | void *get_resource(void *data, uint32_t id); |
454 | |
447 | 455 | ||
448 | struct blit_call |
456 | struct blit_call |
449 | { |
457 | { |
Line 481... | Line 489... | ||
481 | __asm__ __volatile__( |
489 | __asm__ __volatile__( |
482 | "int $0x40" |
490 | "int $0x40" |
483 | ::"a"(73),"b"(0),"c"(&bc.dstx)); |
491 | ::"a"(73),"b"(0),"c"(&bc.dstx)); |
484 | }; |
492 | }; |
Line -... | Line 493... | ||
- | 493 | ||
- | 494 | int create_thread(int (*proc)(void *param), void *param, int stack_size); |
|
485 | 495 | ||
Line 486... | Line 496... | ||
486 | void* load_library(const char *name); |
496 | void* load_library(const char *name); |
Line 487... | Line 497... | ||
487 | 497 |