4 uint hrb_api(uint edi, uint esi, uint ebp, uint esp, uint ebx, uint edx, uint ecx, uint eax)
\r
6 UI_Task *task = task_now();
\r
13 uint *reg = &eax + 1;
\r
15 for(i = 0; i < MAX_CONSOLES; i++){
\r
16 if(system.ui.console.consoles[i].task == task)break;
\r
18 cons = &system.ui.console.consoles[i];
\r
21 cons_put_char(cons, (uchar)(eax & 0xff));
\r
22 } else if(edx == 2){
\r
23 cons_put_str(cons, (uchar *)(ebx + cons->app_ds_base));
\r
24 } else if(edx == 4){
\r
25 return (uint)&(task->tss.esp0);
\r
26 } else if(edx == 5){
\r
27 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
28 win->app_buf = (uchar *)(ebx + cons->app_ds_base);
\r
29 win->app_buf_bits = 8;
\r
30 boxfill8(win->app_buf, esi, COL8_FFFFFF, 0, 0, esi, edi);
\r
31 reg[7] = GetWindowNumber(win);
\r
32 sprintf(s, "winID = %u\n", reg[7]);
\r
33 cons_put_str(cons, s);
\r
34 } else if(edx == 6){
\r
36 app_s = (uchar *)(ebp + cons->app_ds_base);
\r
37 if(GetWindowInfo(ebx)->app_buf_bits == 8){
\r
38 for (; *app_s != 0x00; app_s++) {
\r
39 putfont8(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));
\r
42 } else if(GetWindowInfo(ebx)->app_buf_bits == 16){
\r
43 for (; *app_s != 0x00; app_s++) {
\r
44 putfont16(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));
\r
47 } else if(GetWindowInfo(ebx)->app_buf_bits == 32){
\r
48 for (; *app_s != 0x00; app_s++) {
\r
49 putfont32(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));
\r
54 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
55 sheet_refresh(GetWindowInfo(ebx)->win, i, edi, esi, edi + 16);
\r
57 } else if(edx == 7){
\r
58 boxfill_bpp(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, ebp, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf_bits);
\r
60 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
61 sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);
\r
63 } else if(edx == 8){
\r
64 memman_init((IO_MemoryControl *)(ebx + cons->app_ds_base));
\r
66 memman_free((IO_MemoryControl *)(ebx + cons->app_ds_base), (uchar *)eax, ecx);
\r
67 } else if(edx == 9){
\r
68 ecx = (ecx + 0x0f) & 0xfffffff0;
\r
69 reg[7] = (uint)memman_alloc((IO_MemoryControl *)(ebx + cons->app_ds_base), ecx);
\r
70 } else if(edx == 10){
\r
71 ecx = (ecx + 0x0f) & 0xfffffff0;
\r
72 memman_free((IO_MemoryControl *)(ebx + cons->app_ds_base), (uchar *)eax, ecx);
\r
73 } else if(edx == 11){
\r
74 point_bpp(GetWindowInfo(ebx)->app_buf, esi, edi, eax, GetWindowInfo(ebx)->winxsize, GetWindowInfo(ebx)->app_buf_bits);
\r
76 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
77 sheet_refresh(GetWindowInfo(ebx)->win, esi, edi, esi + 1, edi + 1);
\r
79 } else if(edx == 12){
\r
80 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
81 sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);
\r
82 } else if(edx == 13){
\r
83 line_bpp(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, ebp, GetWindowInfo(ebx)->app_buf_bits);
\r
85 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
86 sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);
\r
88 } else if(edx == 14){
\r
89 sys_memman_free(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize * GetWindowInfo(ebx)->winysize * (system.data.info.vesa.BitsPerPixel >> 3));
\r
90 free_window_app(GetWindowInfo(ebx));
\r
91 } else if(edx == 15){
\r
94 if(fifo32_status(&cons->task->fifo) == 0){
\r
97 reg[7] = 0xFFFFFFFF;
\r
100 task_sleep(cons->task);
\r
103 i = fifo32_get(&cons->task->fifo);
\r
106 if(cons->cursor_on){
\r
107 if(cons->cursor_state){
\r
108 cons->cursor_c = CONSOLE_COLOR_CHAR;
\r
109 cons->cursor_state = false;
\r
111 cons->cursor_c = CONSOLE_COLOR_BACKGROUND;
\r
112 cons->cursor_state = true;
\r
114 boxfill_win(cons->win, cons->cursor_c, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);
\r
116 timer_settime(cons->timer, 50);
\r
117 } else if(i == CONSOLE_FIFO_CURSOR_START){
\r
118 cons->cursor_on = true;
\r
119 } else if(i == CONSOLE_FIFO_CURSOR_STOP){
\r
120 cons->cursor_on = false;
\r
121 boxfill_win(cons->win, CONSOLE_COLOR_BACKGROUND, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);
\r
122 } else if(CONSOLE_FIFO_START_KEYB <= i && i <= CONSOLE_FIFO_START_KEYB + DATA_BYTE){
\r
123 i -= CONSOLE_FIFO_START_KEYB;
\r
130 cons_put_str(cons, "Unknown api number.");
\r
131 return (uint)&(task->tss.esp0);
\r
136 uint GetWindowNumber(UI_Window *win)
\r
138 return (uint)((win - system.ui.window.ctrl.winfos) << 1);
\r
141 UI_Window *GetWindowInfo(uint n)
\r
143 return &system.ui.window.ctrl.winfos[n >> 1];
\r