+++ /dev/null
-\r
-#include "core.h"\r
-\r
-uint hrb_api(uint edi, uint esi, uint ebp, uint esp, uint ebx, uint edx, uint ecx, uint eax)\r
-{\r
- UI_Task *task = task_now();\r
- UI_Console *cons;\r
- UI_Window *win;\r
- uchar s[64];\r
- uchar *app_s;\r
- uint i;\r
-\r
- uint *reg = &eax + 1;\r
-\r
- for(i = 0; i < MAX_CONSOLES; i++){\r
- if(system.ui.console.consoles[i].task == task)break;\r
- }\r
- cons = &system.ui.console.consoles[i];\r
-\r
- if(edx == 1){\r
- cons_put_char(cons, (uchar)(eax & 0xff));\r
- } else if(edx == 2){\r
- cons_put_str(cons, (uchar *)(ebx + cons->app_ds_base));\r
- } else if(edx == 4){\r
- return (uint)&(task->tss.esp0);\r
- } else if(edx == 5){\r
- win = make_window_app_compatible_hrb((uchar *)(ecx + cons->app_ds_base), esi, edi, 200, 100, sheet_get_topheight(), true, sys_memman_alloc(esi * edi * (system.data.info.vesa.BitsPerPixel >> 3)), task);\r
- win->app_buf = (uchar *)(ebx + cons->app_ds_base);\r
- win->app_buf_bits = 8;\r
- boxfill8(win->app_buf, esi, COL8_FFFFFF, 0, 0, esi, edi);\r
- reg[7] = GetWindowNumber(win);\r
- sprintf(s, "winID = %u\n", reg[7]);\r
- cons_put_str(cons, s);\r
- } else if(edx == 6){\r
- i = esi;\r
- app_s = (uchar *)(ebp + cons->app_ds_base);\r
- if(GetWindowInfo(ebx)->app_buf_bits == 8){\r
- for (; *app_s != 0x00; app_s++) {\r
- putfont8(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));\r
- esi += 8;\r
- }\r
- } else if(GetWindowInfo(ebx)->app_buf_bits == 16){\r
- for (; *app_s != 0x00; app_s++) {\r
- putfont16(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));\r
- esi += 8;\r
- }\r
- } else if(GetWindowInfo(ebx)->app_buf_bits == 32){\r
- for (; *app_s != 0x00; app_s++) {\r
- putfont32(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));\r
- esi += 8;\r
- }\r
- }\r
- if((ebx & 1) == 0){\r
- putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, i, edi, esi, edi + 16, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
- sheet_refresh(GetWindowInfo(ebx)->win, i, edi, esi, edi + 16);\r
- }\r
- } else if(edx == 7){\r
- boxfill_bpp(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, ebp, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf_bits);\r
- if((ebx & 1) == 0){\r
- putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
- sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);\r
- }\r
- } else if(edx == 8){\r
- memman_init((IO_MemoryControl *)(ebx + cons->app_ds_base));\r
- ecx &= 0xfffffff0;\r
- memman_free((IO_MemoryControl *)(ebx + cons->app_ds_base), (uchar *)eax, ecx);\r
- } else if(edx == 9){\r
- ecx = (ecx + 0x0f) & 0xfffffff0;\r
- reg[7] = (uint)memman_alloc((IO_MemoryControl *)(ebx + cons->app_ds_base), ecx);\r
- } else if(edx == 10){\r
- ecx = (ecx + 0x0f) & 0xfffffff0;\r
- memman_free((IO_MemoryControl *)(ebx + cons->app_ds_base), (uchar *)eax, ecx);\r
- } else if(edx == 11){\r
- point_bpp(GetWindowInfo(ebx)->app_buf, esi, edi, eax, GetWindowInfo(ebx)->winxsize, GetWindowInfo(ebx)->app_buf_bits);\r
- if((ebx & 1) == 0){\r
- putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, esi, edi, esi + 1, edi + 1, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
- sheet_refresh(GetWindowInfo(ebx)->win, esi, edi, esi + 1, edi + 1);\r
- }\r
- } else if(edx == 12){\r
- putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
- sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);\r
- } else if(edx == 13){\r
- line_bpp(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, ebp, GetWindowInfo(ebx)->app_buf_bits);\r
- if((ebx & 1) == 0){\r
- putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
- sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);\r
- }\r
- } else if(edx == 14){\r
- sys_memman_free(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize * GetWindowInfo(ebx)->winysize * (system.data.info.vesa.BitsPerPixel >> 3));\r
- free_window_app(GetWindowInfo(ebx));\r
- } else if(edx == 15){\r
- for(;;){\r
- io_cli();\r
- if(fifo32_status(&cons->task->fifo) == 0){\r
- if(eax == 0){\r
- io_sti();\r
- reg[7] = 0xFFFFFFFF;\r
- return 0;\r
- } else{\r
- task_sleep(cons->task);\r
- }\r
- } else {\r
- i = fifo32_get(&cons->task->fifo);\r
- io_sti();\r
- if(i == 1){\r
- if(cons->cursor_on){\r
- if(cons->cursor_state){\r
- cons->cursor_c = CONSOLE_COLOR_CHAR;\r
- cons->cursor_state = false;\r
- } else{\r
- cons->cursor_c = CONSOLE_COLOR_BACKGROUND;\r
- cons->cursor_state = true;\r
- }\r
- boxfill_win(cons->win, cons->cursor_c, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);\r
- }\r
- timer_settime(cons->timer, 50);\r
- } else if(i == CONSOLE_FIFO_CURSOR_START){\r
- cons->cursor_on = true;\r
- } else if(i == CONSOLE_FIFO_CURSOR_STOP){\r
- cons->cursor_on = false;\r
- boxfill_win(cons->win, CONSOLE_COLOR_BACKGROUND, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);\r
- } else if(CONSOLE_FIFO_START_KEYB <= i && i <= CONSOLE_FIFO_START_KEYB + DATA_BYTE){\r
- i -= CONSOLE_FIFO_START_KEYB;\r
- reg[7] = i;\r
- return 0;\r
- }\r
- }\r
- }\r
- } else {\r
- cons_put_str(cons, "Unknown api number.");\r
- return (uint)&(task->tss.esp0);\r
- }\r
- return 0;\r
-}\r
-\r
-uint GetWindowNumber(UI_Window *win)\r
-{\r
- return (uint)((win - system.ui.window.ctrl.winfos) << 1);\r
-}\r
-\r
-UI_Window *GetWindowInfo(uint n)\r
-{\r
- return &system.ui.window.ctrl.winfos[n >> 1];\r
-}\r