• R/O
  • SSH
  • HTTPS

chnosproject: コミット


コミットメタ情報

リビジョン318 (tree)
日時2012-03-31 10:13:02
作者hikarupsp

ログメッセージ

マウスカーソルの描画を追加した。
シートにtopmost属性を追加した(マウスカーソルに使用)。
実装に伴い、メモリ確保に対する問題があることが判明したので、修正した。
具体的には、メモリを空きブロックから確保しても、その空きブロックの残量が減らないという問題だった。
その解決に伴い、debug.cを追加した。
デバッグ関係の関数として、メモリダンプ関数と、CPUのデバッグレジスタを使用してブレークポイントを設定する関数を追加した。
また、CHNOSPROJECT_DEBUGが定義されているときは、デバッグ例外を再開可能な例外とするようにし、情報表示後は何かキーを押すことで、再開できるようにし、デバッグの効率化を図った。

変更サマリ

差分

--- beta/tolset_chn_000/chnos_010/chnos/draw08.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/draw08.c (revision 318)
@@ -60,7 +60,7 @@
6060 {
6161 uint x, y;
6262
63-//if negative position
63+//if negative location
6464 if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){
6565 return;
6666 }
@@ -80,7 +80,7 @@
8080 uchar d;
8181 uchar *p;
8282
83-//if negative position
83+//if negative location
8484 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
8585 return;
8686 }
@@ -102,7 +102,7 @@
102102
103103 void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])
104104 {
105-//if negative position
105+//if negative location
106106 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
107107 return;
108108 }
@@ -120,7 +120,7 @@
120120
121121 void Drawing08_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)
122122 {
123-//if negative position
123+//if negative location
124124 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
125125 return;
126126 }
--- beta/tolset_chn_000/chnos_010/chnos/sht08.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/sht08.c (revision 318)
@@ -20,6 +20,11 @@
2020 sheet->size.y = ysize;
2121 sheet->bpp = bpp;
2222
23+ if(sheet->flags.bit.vram_auto_allocated){
24+ System_Memory_Free(sheet->vram, sheet->vramsize);
25+ sheet->flags.bit.vram_auto_allocated = False;
26+ }
27+
2328 if(vram == Null){
2429 sheet->vram = System_Memory_Allocate(xsize * ysize * 1);
2530 sheet->flags.bit.vram_auto_allocated = True;
@@ -35,6 +40,10 @@
3540 sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;
3641 sheet->flags.bit.using_invcol = False;
3742
43+ sheet->Drawing.Fill_Rectangle = &Sheet08_Drawing_Fill_Rectangle;
44+ sheet->Drawing.Put_String = &Sheet08_Drawing_Put_String;
45+ sheet->Drawing.Draw_Point = &Sheet08_Drawing_Draw_Point;
46+
3847 sheet->flags.bit.buffer_configured = True;
3948
4049 return 0;
--- beta/tolset_chn_000/chnos_010/chnos/sheet.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/sheet.c (revision 318)
@@ -15,6 +15,12 @@
1515 debug("Sheet_Initialise:[0x%08X]\n", sheet);
1616 #endif
1717
18+ sheet->Drawing.Fill_Rectangle = &Sheet_Drawing_Fill_Rectangle_Invalid;
19+ sheet->Drawing.Put_String = &Sheet_Drawing_Put_String_Invalid;
20+ sheet->Drawing.Draw_Point = &Sheet_Drawing_Draw_Point_Invalid;
21+
22+ sheet->RefreshSheet = &Sheet_Internal_RefreshSheet_Invalid;
23+
1824 return sheet;
1925 }
2026
@@ -80,6 +86,7 @@
8086 uint Sheet_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp)
8187 {
8288 uint retv;
89+ UI_Sheet *search;
8390
8491 if(sheet == Null){
8592 #ifdef CHNOSPROJECT_DEBUG_SHEET
@@ -94,6 +101,10 @@
94101 return 2;
95102 }
96103
104+ for(search = sheet->child; search != Null; search = search->next){
105+ search->RefreshSheet = &Sheet_Internal_RefreshSheet_Invalid;
106+ }
107+
97108 retv = 0;
98109 if(bpp == 8){
99110 retv = Sheet08_Internal_SetBuffer(sheet, vram, xsize, ysize, bpp);
@@ -115,6 +126,15 @@
115126 return 10 + retv;
116127 }
117128
129+ if(sheet->flags.bit.using_map){
130+ Sheet_Internal_MapInitialise(sheet);
131+ }
132+
133+ for(search = sheet->child; search != Null; search = search->next){
134+ search->Config_Functions(search);
135+ Sheet_RefreshSheet_All(search);
136+ }
137+
118138 #ifdef CHNOSPROJECT_DEBUG_SHEET
119139 debug("Sheet_SetBuffer:[0x%08X]\n", sheet);
120140 debug("Sheet_SetBuffer:vram:[0x%08X] xsize:%d ysize:%d bpp:%d\n", vram, xsize, ysize, bpp);
@@ -125,8 +145,6 @@
125145
126146 uint Sheet_SetParent(UI_Sheet *sheet, UI_Sheet *parent)
127147 {
128- uint retv;
129-
130148 if(sheet == Null){
131149 #ifdef CHNOSPROJECT_DEBUG_SHEET
132150 debug("Sheet_SetParent:Null sheet.\n");
@@ -156,20 +174,10 @@
156174
157175 sheet->parent = parent;
158176
159- if(!parent->flags.bit.using_map){
160- Sheet_Internal_MapInitialise(sheet->parent);
161- }
162-
163177 #ifdef CHNOSPROJECT_DEBUG_SHEET
164178 debug("Sheet_SetParent:[0x%08X] parent:[0x%08X]\n", sheet, parent);
165179 #endif
166180
167- retv = sheet->Config_Functions(sheet);
168-
169- if(retv != 0){
170- return 10 + retv;
171- }
172-
173181 return 0;
174182 }
175183
@@ -177,10 +185,8 @@
177185 {
178186 UI_Sheet **search;
179187 uint i;
180- bool no_change_height;
188+ uint retv;
181189
182- no_change_height = False;
183-
184190 if(sheet == Null){
185191 #ifdef CHNOSPROJECT_DEBUG_SHEET
186192 debug("Sheet_Show:Null sheet.\n");
@@ -210,15 +216,17 @@
210216 return 4;
211217 }
212218
219+ retv = sheet->Config_Functions(sheet);
220+
221+ if(retv != 0){
222+ return 10 + retv;
223+ }
224+
213225 //At First, clear old height link.
214226
215227 search = &sheet->parent->child;
216228 for(i = 0; i < SHEET_MAX_CHILDREN; i++){
217229 if(*search == sheet){
218- if(i == height){
219- no_change_height = True;
220- break;
221- }
222230 *search = sheet->next;
223231 break;
224232 }
@@ -226,7 +234,7 @@
226234 }
227235
228236 //Next, set new height link.
229- if(!no_change_height){
237+ if(!sheet->flags.bit.topmost){
230238 search = &sheet->parent->child;
231239 for(i = 0; i < SHEET_MAX_CHILDREN; i++){
232240 if(i == height){
@@ -241,18 +249,34 @@
241249 #endif
242250 break;
243251 }
252+ if((*search)->flags.bit.topmost){
253+ #ifdef CHNOSPROJECT_DEBUG_SHEET
254+ debug("Sheet_Show:Search:Break(Under topmost sheet).\n");
255+ #endif
256+ break;
257+ }
244258 search = &(*search)->next;
245259 }
246- if(i == SHEET_MAX_CHILDREN){
247- #ifdef CHNOSPROJECT_DEBUG_SHEET
248- debug("Sheet_Show:Number of sheets is over SHEET_MAX_CHILDREN.\n");
249- #endif
250- return 3;
260+ } else{ /*topmost sheet. ignore height.*/
261+ search = &sheet->parent->child;
262+ for(i = 0; i < SHEET_MAX_CHILDREN; i++){
263+ if(*search == Null){
264+ #ifdef CHNOSPROJECT_DEBUG_SHEET
265+ debug("Sheet_Show:Search:Break(Top most).\n");
266+ #endif
267+ break;
268+ }
269+ search = &(*search)->next;
251270 }
252-
253- sheet->next = *search;
254- *search = sheet;
255271 }
272+ if(i == SHEET_MAX_CHILDREN){
273+ #ifdef CHNOSPROJECT_DEBUG_SHEET
274+ debug("Sheet_Show:Number of sheets is over SHEET_MAX_CHILDREN.\n");
275+ #endif
276+ return 3;
277+ }
278+ sheet->next = *search;
279+ *search = sheet;
256280
257281 if(px != SHEET_LOCATION_NOCHANGE){
258282 sheet->location.x = px;
@@ -261,6 +285,11 @@
261285 sheet->location.y = py;
262286 }
263287 sheet->flags.bit.visible = True;
288+
289+ if(!sheet->parent->flags.bit.using_map){
290+ Sheet_Internal_MapInitialise(sheet->parent);
291+ }
292+
264293 Sheet_Internal_MapRefresh(sheet, sheet->location.x, sheet->location.y, sheet->location.x + sheet->size.x - 1, sheet->location.y + sheet->size.y - 1);
265294
266295 Sheet_RefreshSheet_All(sheet);
@@ -274,6 +303,10 @@
274303
275304 uint Sheet_RefreshSheet_All(UI_Sheet *sheet)
276305 {
306+ #ifdef CHNOSPROJECT_DEBUG_CALLLINK
307+ debug("Sheet_RefreshSheet_All:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));
308+ #endif
309+
277310 if(sheet == Null){
278311 #ifdef CHNOSPROJECT_DEBUG_SHEET
279312 debug("Sheet_RefreshSheet_All:Null sheet.\n");
@@ -288,6 +321,10 @@
288321 {
289322 uint retv;
290323
324+ #ifdef CHNOSPROJECT_DEBUG_CALLLINK
325+ debug("Sheet_Slide_Absolute:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));
326+ #endif
327+
291328 if(sheet == Null){
292329 #ifdef CHNOSPROJECT_DEBUG_SHEET
293330 debug("Sheet_Slide_Absolute:Null sheet.\n");
@@ -325,6 +362,10 @@
325362 {
326363 uint retv;
327364
365+ #ifdef CHNOSPROJECT_DEBUG_CALLLINK
366+ debug("Sheet_Slide_Relative:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));
367+ #endif
368+
328369 if(sheet == Null){
329370 #ifdef CHNOSPROJECT_DEBUG_SHEET
330371 debug("Sheet_Slide_Relative:Null sheet.\n");
@@ -394,13 +435,13 @@
394435 {
395436 if(sheet == Null){
396437 #ifdef CHNOSPROJECT_DEBUG_SHEET
397- debug("Sheet_RefreshSheet:Null sheet.\n");
438+ debug("Sheet_RefreshSheet:[0x%08X]Null sheet.\n", sheet);
398439 #endif
399440 return 1;
400441 }
401442 if(!sheet->flags.bit.buffer_configured){
402443 #ifdef CHNOSPROJECT_DEBUG_SHEET
403- debug("Sheet_RefreshSheet:Not buffer_configured sheet.\n");
444+ debug("Sheet_RefreshSheet:[0x%08X]Not buffer_configured sheet.\n", sheet);
404445 #endif
405446 return 2;
406447 }
@@ -490,3 +531,16 @@
490531 sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;
491532 return sheet->invcol;
492533 }
534+
535+uint Sheet_SetTopmost(UI_Sheet *sheet, bool topmost)
536+{
537+ if(topmost){
538+ sheet->flags.bit.topmost = True;
539+ if(sheet->flags.bit.visible){
540+ Sheet_Show(sheet, SHEET_MAX_CHILDREN, SHEET_LOCATION_NOCHANGE, SHEET_LOCATION_NOCHANGE);
541+ }
542+ } else{
543+ sheet->flags.bit.topmost = False;
544+ }
545+ return 0;
546+}
--- beta/tolset_chn_000/chnos_010/chnos/shtfunc.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/shtfunc.c (revision 318)
@@ -76,11 +76,14 @@
7676
7777 parent->mapsize = parent->size.x * parent->size.y * 4;
7878 parent->map = (uint *)System_Memory_Allocate(parent->mapsize);
79- MOVSD_ZeroFill(parent->map, parent->mapsize);
8079 parent->flags.bit.using_map = True;
8180
8281 Sheet_Internal_MapRebuild(parent, 0, 0, parent->size.x - 1, parent->size.y - 1);
8382
83+ #ifdef CHNOSPROJECT_DEBUG_SHEET
84+ debug("Sheet_Internal_MapInitialise:[0x%08X] map:[0x%08X]\n", parent, parent->map);
85+ #endif
86+
8487 return 0;
8588 }
8689
@@ -416,9 +419,13 @@
416419 {
417420 uint retv;
418421
422+ #ifdef CHNOSPROJECT_DEBUG_CALLLINK
423+ debug("Sheet_Internal_RefreshSheet:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));
424+ #endif
425+
419426 if(sheet->parent == Null){
420427 #ifdef CHNOSPROJECT_DEBUG_SHEET
421- debug("Sheet_Internal_RefreshSheet:Null parent.\n");
428+ debug("Sheet_Internal_RefreshSheet:[0x%08X]Null parent.\n", sheet);
422429 #endif
423430 return 1;
424431 }
@@ -425,7 +432,7 @@
425432
426433 if(!sheet->parent->flags.bit.buffer_configured){
427434 #ifdef CHNOSPROJECT_DEBUG_SHEET
428- debug("Sheet_RefreshSheet:Not buffer_configured parent.\n");
435+ debug("Sheet_Internal_RefreshSheet:[0x%08X]Not buffer_configured parent.\n", sheet);
429436 #endif
430437 return 2;
431438 }
@@ -432,7 +439,7 @@
432439
433440 if(sheet->RefreshSheet == Null){
434441 #ifdef CHNOSPROJECT_DEBUG_SHEET
435- debug("Sheet_Internal_RefreshSheet:Null Refresh function.\n");
442+ debug("Sheet_Internal_RefreshSheet:[0x%08X]Null Refresh function.\n", sheet);
436443 #endif
437444 return 3;
438445 }
@@ -458,6 +465,10 @@
458465 DATA_Location2D A, B;
459466 int apx, apy;
460467
468+ #ifdef CHNOSPROJECT_DEBUG_CALLLINK
469+ debug("Sheet_Internal_SlideSub:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));
470+ #endif
471+
461472 xsize = (int)sheet->size.x;
462473 ysize = (int)sheet->size.y;
463474
@@ -617,3 +628,11 @@
617628 {
618629 return True;
619630 }
631+
632+uint Sheet_Internal_RefreshSheet_Invalid(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1)
633+{
634+ #ifdef CHNOSPROJECT_DEBUG_SHEET
635+ debug("Sheet_Internal_RefreshSheet_Invalid:Invalid refresh request.\n");
636+ #endif
637+ return 0;
638+}
--- beta/tolset_chn_000/chnos_010/chnos/mtask.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/mtask.c (revision 318)
@@ -1,6 +1,8 @@
11
22 #include "core.h"
33
4+//FIFOによるタスクの自動起動は既定で有効ですが、タスクが明示的に実行されるまでは無効になっています。
5+
46 UI_TaskControl *Initialise_MultiTask_Control(IO_MemoryControl sysmemctrl)
57 {
68 UI_TaskControl *ctrl;
@@ -18,6 +20,8 @@
1820 ctrl->now = maintask;
1921
2022 maintask->flags.linked = True;
23+ maintask->flags.first_run = False;
24+ FIFO32_Set_Task(maintask->fifo, maintask);
2125
2226 return ctrl;
2327 }
@@ -80,10 +84,10 @@
8084 task->count = 0;
8185
8286 task->fifo = FIFO32_Initialise(ctrl->sysmemctrl, TASK_FIFOSIZE);
83- FIFO32_Set_Task(task->fifo, task);
8487
8588 task->flags.initialized = True;
8689 task->flags.linked = False;
90+ task->flags.first_run = True;
8791
8892 return task;
8993 }
@@ -92,6 +96,10 @@
9296 {
9397 UI_Task **last;
9498
99+ #ifdef CHNOSPROJECT_DEBUG_CALLLINK
100+ debug("MultiTask_Task_Run:Called from[0x%08X].\n", *((uint *)(&ctrl - 1)));
101+ #endif
102+
95103 #ifdef CHNOSPROJECT_DEBUG_MULTITASK
96104 debug("MultiTask_Task_Run:Start Running Rq(sel:0x%X).\n", task->selector);
97105 #endif
@@ -119,6 +127,14 @@
119127 debug("MultiTask_Task_Run:Start Running(sel:0x%X last:0x%X start:0x%X).\n", task->selector, last, ctrl->start);
120128 #endif
121129
130+ if(task->flags.first_run){
131+ #ifdef CHNOSPROJECT_DEBUG_MULTITASK
132+ debug("MultiTask_Task_Run:FIFO task autorun is enabled.\n");
133+ #endif
134+ FIFO32_Set_Task(task->fifo, task);
135+ task->flags.first_run = False;
136+ }
137+
122138 task->next = Null;
123139 *last = task;
124140 task->flags.linked = True;
@@ -191,4 +207,18 @@
191207 return ctrl->now;
192208 }
193209
210+uint MultiTask_Push_Arguments(UI_Task *task, uint args, ...)
211+{
212+ uint *vargs;
213+ uint i;
194214
215+ vargs = (uint *)(&args + 1);
216+
217+ task->tss->esp -= 4 * (args + 1);
218+
219+ for(i = 1; i < args + 1; i++){
220+ *((uint *)(task->tss->esp + (i * 4))) = vargs[i - 1];
221+ }
222+
223+ return 0;
224+}
--- beta/tolset_chn_000/chnos_010/chnos/serial.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/serial.c (revision 318)
@@ -30,14 +30,3 @@
3030
3131 return;
3232 }
33-
34-#ifdef CHNOSPROJECT_DEBUG
35-void debug(const uchar format[], ...)
36-{
37- uchar s[256];
38-
39- vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));
40- SerialPort_Send(s);
41- return;
42-}
43-#endif
--- beta/tolset_chn_000/chnos_010/chnos/system.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/system.c (revision 318)
@@ -110,6 +110,7 @@
110110 uchar s[128];
111111 uint cpuid_buf[4];
112112 CPU_EFlags eflags;
113+ CPU_ControlRegister4 cr4;
113114
114115 IO_CLI();
115116
@@ -129,6 +130,11 @@
129130 debug("CHNOSProject is Running in Debug Mode.\n");
130131 #endif
131132
133+//Config Control Register4
134+ cr4.cr4 = Load_CR4();
135+ cr4.bit.DE = True;
136+ Store_CR4(cr4.cr4);
137+
132138 TextMode_Put_String("\tInitialising Memory...\n", white);
133139 System_Check_Memory();
134140 i = System_Get_PhisycalMemorySize();
@@ -328,6 +334,9 @@
328334
329335 void System_MultiTask_Task_Run(UI_Task *task)
330336 {
337+ #ifdef CHNOSPROJECT_DEBUG_CALLLINK
338+ debug("System_MultiTask_Task_Run:Called from[0x%08X].\n", *((uint *)(&task - 1)));
339+ #endif
331340 MultiTask_Task_Run(System.TaskController, task);
332341 return;
333342 }
--- beta/tolset_chn_000/chnos_010/chnos/debug.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/debug.c (revision 318)
@@ -0,0 +1,163 @@
1+#include "core.h"
2+
3+//DR7:RWn Breakpoint Condition
4+// CR4.DE==1
5+// 00:Execute Instruction
6+// 01:Write Data
7+// 10:I/O R/W
8+// 11:Data R/W
9+// CR4.DE==0
10+// 00:Execute Operation
11+// 01:Write Data
12+// 10:(Undefined)
13+// 11:Data R/W
14+
15+//DR7:LENn Address Location Size
16+// 00:Byte(or Instruction)
17+// 01:Word
18+// 10:(Undefined)
19+// 11:Double Word
20+
21+#ifdef CHNOSPROJECT_DEBUG
22+
23+extern uchar *cpu_exception_infos[16]; //error.c
24+extern uint Error_Output_Display_GraphicMode_UsedLines; //error.c
25+
26+uint debug_exception_last_addr;
27+
28+void debug(const uchar format[], ...)
29+{
30+ uchar s[256];
31+
32+ vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));
33+ SerialPort_Send(s);
34+ return;
35+}
36+
37+void Debug_PhysicalMemoryDump(void *addr, uint bytes)
38+{
39+ uchar *p;
40+ uint i, j;
41+ uint eflags;
42+
43+ bytes += (uint)addr - ((uint)addr & 0xfffffff0);
44+ (uint)addr &= 0xfffffff0;
45+
46+ j = (bytes + 0x0f) >> 4;
47+
48+ eflags = IO_Load_EFlags();
49+ IO_CLI();
50+
51+ debug("\n***PhysicalMemoryDump Start***\n");
52+ debug("Dump from[0x%08X] for 0x%X bytes.\n", addr, j << 4);
53+ debug("Address+|00|01|02|03|04|05|06|07|08|09|0A|0B|0C|0D|0E|0F|\n");
54+ for(i = 0; i < j; i++){
55+ p = (uchar *)((uint)addr + (i << 4));
56+ debug("%08X:%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X|\n", p, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
57+ }
58+ debug("***PhysicalMemoryDump End***\n");
59+
60+ IO_Store_EFlags(eflags);
61+
62+ return;
63+}
64+
65+void Debug_Set_Breakpoint(uint reg, void *addr, uint rw, uint len)
66+{
67+ CPU_DebugRegister7 dr7;
68+
69+ dr7.dr7 = Load_DR7();
70+
71+ dr7.bit.LE = True;
72+ dr7.bit.GE = True;
73+
74+ switch(reg){
75+ case 0:
76+ Store_DR0((uint)addr);
77+ dr7.bit.L0 = True;
78+ dr7.bit.G0 = True;
79+ dr7.bit.RW0 = rw;
80+ dr7.bit.LEN0 = len;
81+ debug("Debug_Set_Breakpoint:Breakpoint%d Enabled(target:[0x%08X] rw:%d len:%d).\n", reg, addr, dr7.bit.RW0, dr7.bit.LEN0);
82+ break;
83+ }
84+
85+ Store_DR7(dr7.dr7);
86+
87+ return;
88+}
89+
90+void Debug_ExceptionHandler(uint *esp)
91+{
92+ uint i, j;
93+ IO_SegmentDescriptor *gdt;
94+
95+ gdt = (IO_SegmentDescriptor *)ADR_GDT;
96+
97+ if(esp[0x0a] == debug_exception_last_addr){
98+ debug("Debug_ExceptionHandler:Ignore debug exception(same eip.)\n");
99+ return;
100+ }
101+
102+ Error_Put_String("Exception 0x01 Debug. CHNOSProject is running in debug mode.");
103+
104+ Error_Put_String("#PUSHAD by _asm_CPU_ExceptionHandler");
105+ for(i = 0; i < 4; i++){
106+ Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);
107+ }
108+
109+ Error_Put_String("#PUSH by _asm_CPU_ExceptionHandler");
110+ for(; i < 5; i++){
111+ Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);
112+ }
113+
114+ Error_Put_String("#PUSH by CPU");
115+ Error_Put_String("%s:0x%08X", cpu_exception_infos[(i << 1) + 1], esp[i << 1]);
116+ i++;
117+ for(; i < 8; i++){
118+ Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[(i << 1) - 1], cpu_exception_infos[(i << 1) + 1], esp[i << 1]);
119+ }
120+
121+ Error_Put_String("#Control Registers");
122+ Error_Put_String("CR0 = 0x%08X", Load_CR0());
123+ Error_Put_String("CR2 = 0x%08X", Load_CR2());
124+ Error_Put_String("CR3 = 0x%08X", Load_CR3());
125+ Error_Put_String("#Debug Registers");
126+ Error_Put_String("DR0 = 0x%08X", Load_DR0());
127+ Error_Put_String("DR1 = 0x%08X", Load_DR1());
128+ Error_Put_String("DR2 = 0x%08X", Load_DR2());
129+ Error_Put_String("DR3 = 0x%08X", Load_DR3());
130+ Error_Put_String("DR6 = 0x%08X", Load_DR6());
131+ Error_Put_String("DR7 = 0x%08X", Load_DR7());
132+
133+
134+ Error_Put_String("Opcode[0x%X:0x%X]:0x%X", SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3]), esp[0x0a], ((uchar *)(SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3])))[esp[0x0a]]);
135+ Error_Put_String("Press any key to continue.");
136+
137+ debug_exception_last_addr = esp[0x0a];
138+
139+ if(((uchar *)(SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3])))[esp[0x0a]] == 0x89){
140+ esp[0x0a] += 3;
141+ }
142+
143+Debug_PhysicalMemoryDump((void *)Load_DR0(), 32);
144+
145+//Wait press any key.
146+ for(;;){
147+ if((IO_In8(PORT_KEYSTA) & 0x01) != 0){
148+ break;
149+ }
150+ }
151+
152+//Clear Display.
153+ j = Error_Output_Display_GraphicMode_UsedLines;
154+ Error_Output_Display_GraphicMode_UsedLines = 0;
155+ for(i = 0; i < j; i++){
156+ Error_Put_String("");
157+ }
158+ Error_Output_Display_GraphicMode_UsedLines = 0;
159+
160+ return;
161+}
162+
163+#endif
--- beta/tolset_chn_000/chnos_010/chnos/makeset.txt (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/makeset.txt (revision 318)
@@ -1,3 +1,3 @@
11
2-OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj chnlogo.obj callbios.obj cfunc.obj color.obj display.obj draw08.obj draw16.obj draw32.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj fmt_bmp.obj intrpt.obj keyboard.obj memory.obj mtask.obj serial.obj sheet.obj sht08.obj sht16.obj sht32.obj shtfunc.obj system.obj timer.obj vgatmode.obj xception.obj bootpack.obj
2+OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj chnlogo.obj callbios.obj cfunc.obj color.obj debug.obj display.obj draw08.obj draw16.obj draw32.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj fmt_bmp.obj intrpt.obj keyboard.obj memory.obj mouse.obj mtask.obj serial.obj sheet.obj sht08.obj sht16.obj sht32.obj shtdraw.obj shtfunc.obj system.obj timer.obj vgatmode.obj xception.obj bootpack.obj
33 HEADS_BOOTPACK = core.h coredef0.h coredef1.h coredef2.h coredef3.h keyid.h
--- beta/tolset_chn_000/chnos_010/chnos/error.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/error.c (revision 318)
@@ -12,7 +12,7 @@
1212
1313 uchar *cpu_exceptions[0x20] = {
1414 "Divided by zero.",
15- "Reserved.",
15+ "Debug.",
1616 "Nonmaskable interrupt.",
1717 "Breakpoint.",
1818 "Overflow.",
@@ -72,11 +72,17 @@
7272 va_args = &error_no + 1;
7373
7474 if(error_no <= ERROR_CPU_EXCEPTIONS){
75+ #ifdef CHNOSPROJECT_DEBUG
76+ if(error_no == ERROR_CPU_EXCEPTION_01){
77+ Debug_ExceptionHandler((uint *)*va_args);
78+ return 0;
79+ }
80+ #endif
7581 Error_Put_String("Exception 0x%02X:%s", error_no, cpu_exceptions[error_no]);
7682 if(error_no == ERROR_CPU_EXCEPTION_00){
7783 Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);
7884 } else if(error_no == ERROR_CPU_EXCEPTION_01){
79- Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);
85+ Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);
8086 } else if(error_no == ERROR_CPU_EXCEPTION_02){
8187 Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);
8288 } else if(error_no == ERROR_CPU_EXCEPTION_03){
@@ -225,7 +231,7 @@
225231
226232 IO_SegmentDescriptor *gdt;
227233
228- gdt = (IO_SegmentDescriptor *)0x00270000;
234+ gdt = (IO_SegmentDescriptor *)ADR_GDT;
229235
230236 Error_Put_String("#PUSHAD by _asm_CPU_ExceptionHandler");
231237 for(i = 0; i < 4; i++){
@@ -258,7 +264,7 @@
258264
259265 IO_SegmentDescriptor *gdt;
260266
261- gdt = (IO_SegmentDescriptor *)0x00270000;
267+ gdt = (IO_SegmentDescriptor *)ADR_GDT;
262268
263269 Error_Put_String("#PUSHAD by _asm_CPU_ExceptionHandler");
264270 for(i = 0; i < 4; i++){
--- beta/tolset_chn_000/chnos_010/chnos/core.h (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/core.h (revision 318)
@@ -8,7 +8,6 @@
88
99 /*functions*/
1010 /*bootpack.c 基幹部分*/
11-void KeyboardControlTask(void);
1211
1312 /*callbios.c 32bitからBIOSをコールするための関数群*/
1413
@@ -48,6 +47,14 @@
4847 uchar RGB_32_To_08_xy(uint c32, int x, int y);
4948 ushort RGB_32_To_16(uint c32);
5049
50+/*debug.c デバッグ支援*/
51+#ifdef CHNOSPROJECT_DEBUG
52+void debug(const uchar format[], ...);
53+void Debug_PhysicalMemoryDump(void *addr, uint bytes);
54+void Debug_Set_Breakpoint(uint reg, void *addr, uint rw, uint len);
55+void Debug_ExceptionHandler(uint *esp);
56+#endif
57+
5158 /*display.c ディスプレイ制御関連*/
5259 IO_DisplayControl *Initialise_Display(void);
5360 uint Display_VESA_Set_VideoMode(IO_DisplayControl *ctrl, uint index);
@@ -191,6 +198,7 @@
191198 void KeyboardController_SetLED(uchar leds);
192199 void KeyboardController_Wait_SendReady(void);
193200 void KeyboardController_SendData(uchar data);
201+void KeyboardController_SendCommand(uchar cmd);
194202
195203 /*memory.c メモリ関連*/
196204 uint Memory_Test(uint start, uint end);
@@ -201,6 +209,12 @@
201209 void *Memory_Allocate_Aligned(IO_MemoryControl ctrl, uint size, uint align);
202210 uint Memory_Get_FreeSize(IO_MemoryControl ctrl);
203211
212+/*mouse.c マウス関連*/
213+void Mouse_SendCommand(uint data);
214+UI_MouseCursor *MouseCursor_Initialise(UI_Sheet *parent);
215+uint MouseCursor_Show(UI_MouseCursor *mcursor);
216+uint MouseCursor_Move_Relative(UI_MouseCursor *mcursor, int apx, int apy);
217+
204218 /*mtask.c マルチタスク関連*/
205219 UI_TaskControl *Initialise_MultiTask_Control(IO_MemoryControl sysmemctrl);
206220 UI_Task *MultiTask_Task_Initialise(UI_TaskControl *ctrl, uint tss_additional_size);
@@ -208,14 +222,11 @@
208222 void MultiTask_TaskSwitch(UI_TaskControl *ctrl);
209223 void MultiTask_Task_Sleep(UI_TaskControl *ctrl, UI_Task *task);
210224 UI_Task *MultiTask_GetNowTask(UI_TaskControl *ctrl);
225+uint MultiTask_Push_Arguments(UI_Task *task, uint args, ...);
211226
212227 /*serial.c シリアル通信関連*/
213228 void Initialise_SerialPort(void);
214229 void SerialPort_Send(const uchar s[]);
215-//
216-#ifdef CHNOSPROJECT_DEBUG
217-void debug(const uchar format[], ...);
218-#endif
219230
220231 /*sheet.c シート関連*/
221232 UI_Sheet *Sheet_Initialise(void);
@@ -232,6 +243,7 @@
232243 uint Sheet_RefreshMap_All(UI_Sheet *sheet);
233244 uint Sheet_Enable_InvisibleColor(UI_Sheet *sheet, uint invcol);
234245 uint Sheet_Disable_InvisibleColor(UI_Sheet *sheet);
246+uint Sheet_SetTopmost(UI_Sheet *sheet, bool topmost);
235247
236248 /*sht08.c 8bitカラー シート関連*/
237249 uint Sheet08_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);
@@ -257,6 +269,27 @@
257269 uint Sheet32_Internal_RefreshSheet_To_08_xy(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
258270 bool Sheet32_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py);
259271
272+/*shtdraw シート描画関数*/
273+uint Sheet_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);
274+uint Sheet_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);
275+uint Sheet_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);
276+//
277+uint Sheet_Drawing_Fill_Rectangle_Invalid(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);
278+uint Sheet_Drawing_Put_String_Invalid(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);
279+uint Sheet_Drawing_Draw_Point_Invalid(UI_Sheet *sheet, int x, int y, uint c);
280+//
281+uint Sheet08_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);
282+uint Sheet08_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);
283+uint Sheet08_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);
284+//
285+uint Sheet16_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);
286+uint Sheet16_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);
287+uint Sheet16_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);
288+//
289+uint Sheet32_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);
290+uint Sheet32_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);
291+uint Sheet32_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);
292+
260293 /*shtfunc.c シート内部関数*/
261294 uint Sheet_Internal_GetLocationP(UI_Sheet *sheet, DATA_Location2D *dest);
262295 uint Sheet_Internal_GetLocationQ(UI_Sheet *sheet, DATA_Location2D *dest);
@@ -272,6 +305,7 @@
272305 uint Sheet_Internal_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);
273306 uint Sheet_Internal_SlideSub(UI_Sheet *sheet, int rpx, int rpy);
274307 bool Sheet_Internal_IsVisiblePixel_Invalid(UI_Sheet *sheet, int px, int py);
308+uint Sheet_Internal_RefreshSheet_Invalid(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1);
275309
276310 /*system.c システムデータ・初期化関連*/
277311 void Initialise_System(void);
@@ -378,6 +412,18 @@
378412 void Store_CR3(uint cr3); //コントロールレジスタ3をcr3に変更する。特権命令。
379413 uint Load_CR4(void); //コントロールレジスタ4を読み込む。特権命令。
380414 void Store_CR4(uint cr4); //コントロールレジスタ4をcr4に変更する。特権命令。
415+uint Load_DR0(void);
416+void Store_DR0(uint dr0);
417+uint Load_DR1(void);
418+void Store_DR1(uint dr1);
419+uint Load_DR2(void);
420+void Store_DR2(uint dr2);
421+uint Load_DR3(void);
422+void Store_DR3(uint dr3);
423+uint Load_DR6(void);
424+void Store_DR6(uint dr6);
425+uint Load_DR7(void);
426+void Store_DR7(uint dr7);
381427 void Load_GDTR(uint limit, uint addr); //グローバル・ディスクリプタ・テーブル・レジスタ(GDTR)に、addrからlimitの範囲をGDTとしてロードさせる。特権命令。
382428 void Load_IDTR(uint limit, uint addr); //インタラプト・ディスクリプタ・テーブル・レジスタ(IDTR)に、addrからlimitの範囲をIDTとしてロードさせる。特権命令。
383429 void Load_TR(uint tr); //セグメント・セレクタtrを、タスクレジスタに現在のタスクとしてロードさせる。特権命令。
--- beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 318)
@@ -2,11 +2,15 @@
22 #include "core.h"
33
44 #define MAIN_KEYBASE 0x100
5+
6+void KeyboardControlTask(void);
7+void MouseControlTask(UI_MouseCursor *mcursor);
8+
59 void CHNMain(void)
610 {
711 uchar s[128];
812 uint data;
9- UI_Task *KBCT;
13+ UI_Task *KBCT, *MCT;
1014 UI_Task *mytask;
1115 uint i;
1216 IO_DisplayControl *disp_ctrl;
@@ -15,11 +19,31 @@
1519 int x, y;
1620 UI_Timer *timer1, *timer2, *timer3;
1721 uint counter1, counter2, counter3;
22+ UI_MouseCursor *mcursor;
1823
24+ i = 0;
25+ data = 0;
26+
1927 Initialise_System();
2028
2129 mytask = System_MultiTask_GetNowTask();
30+ disp_ctrl = System_Display_Get_Controller();
2231
32+ vramsheet = Sheet_Initialise();
33+ Sheet_SetBuffer(vramsheet, disp_ctrl->vram, disp_ctrl->xsize, disp_ctrl->ysize, disp_ctrl->bpp);
34+
35+ testsheet2 = Sheet_Initialise();
36+ Sheet_SetBuffer(testsheet2, Null, 128, 64, 8);
37+ for(y = 0; y < testsheet2->size.y; y++){
38+ for(x = 0; x < testsheet2->size.x; x++){
39+ ((uchar *)testsheet2->vram)[y * testsheet2->size.x + x] = y * 2 + x;
40+ }
41+ }
42+ Drawing08_Fill_Rectangle(testsheet2->vram, testsheet2->size.x, 0xc6c6c6, 4, 24, testsheet2->size.x - 4 - 1, testsheet2->size.y - 4 - 1);
43+ Drawing08_Put_String(testsheet2->vram, testsheet2->size.x, 4, 4, 0xffffff, "TestSheet2");
44+ Sheet_SetParent(testsheet2, vramsheet);
45+ Sheet_Show(testsheet2, 2, 80, 80);
46+
2347 KBCT = System_MultiTask_Task_Initialise(0);
2448 KBCT->tss->eip = (uint)&KeyboardControlTask;
2549 KBCT->tss->cs = SYSTEM_CS << 3;
@@ -28,20 +52,28 @@
2852 KBCT->tss->esp = (uint)System_Memory_Allocate(1024 * 32) + (1024 * 32);
2953 System_MultiTask_Task_Run(KBCT);
3054
31- disp_ctrl = System_Display_Get_Controller();
55+//Debug_Set_Breakpoint(0, KBCT, DR7_RW_WRITE_DATA, DR7_LEN_BYTE);
3256
33- i = 0;
34- data = 0;
57+ mcursor = MouseCursor_Initialise(vramsheet);
3558
36- Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0xffffff, 0, 0, VGA08_VRAM_XSIZE - 1, VGA08_VRAM_YSIZE - 1);
37- Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10, 0x000000, "Welcome to CHNOSProject!");
59+ MCT = System_MultiTask_Task_Initialise(0);
60+ MCT->tss->eip = (uint)&MouseControlTask;
61+ MCT->tss->cs = SYSTEM_CS << 3;
62+ MCT->tss->ss = SYSTEM_DS << 3;
63+ MCT->tss->ds = SYSTEM_DS << 3;
64+ MCT->tss->esp = (uint)System_Memory_Allocate(1024 * 32) + (1024 * 32);
65+ MultiTask_Push_Arguments(MCT, 1, mcursor);
66+ System_MultiTask_Task_Run(MCT);
3867
68+ Sheet_Drawing_Fill_Rectangle(vramsheet, 0xffffff, 0, 0, vramsheet->size.x - 1, vramsheet->size.y - 1);
69+ Sheet_Drawing_Put_String(vramsheet, 10, 10, 0x000000, "Welcome to CHNOSProject!");
70+
3971 if(disp_ctrl->display_mode == DISPLAYMODE_VBE_LINEAR){
40- Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 1, 0x000000, "Please Select the VideoMode Number.");
41- Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 2, 0x000000, "(Use cursor Up or Down, Select Enter.)");
42- Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
72+ Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 1, 0x000000, "Please Select the VideoMode Number.");
73+ Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 2, 0x000000, "(Use cursor Up or Down, Select Enter.)");
74+ Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
4375 snprintf(s, sizeof(s), "%d:0x%X %dx%d-%dbits", i, disp_ctrl->VBE.list_vmode[i].mode_number, disp_ctrl->VBE.list_vmode[i].xsize, disp_ctrl->VBE.list_vmode[i].ysize, disp_ctrl->VBE.list_vmode[i].bpp);
44- Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 3, 0x000000, s);
76+ Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 3, 0x000000, s);
4577
4678 FIFO32_Put_Arguments(KBCT->fifo, 4, FIFOCMD_KBCT_SET_FOCUS_FIFO, mytask->fifo, MAIN_KEYBASE, 0);
4779
@@ -59,9 +91,9 @@
5991 } else{
6092 i--;
6193 }
62- Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
94+ Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
6395 snprintf(s, sizeof(s), "%d:0x%X %dx%d-%dbits", i, disp_ctrl->VBE.list_vmode[i].mode_number, disp_ctrl->VBE.list_vmode[i].xsize, disp_ctrl->VBE.list_vmode[i].ysize, disp_ctrl->VBE.list_vmode[i].bpp);
64- Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 3, 0x000000, s);
96+ Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 3, 0x000000, s);
6597 } else if((data & KEYID_MASK_ID) == KEYID_CURSOR_D){
6698 if(i == disp_ctrl->VBE.list_vmode_tags - 1){
6799 i = 0;
@@ -68,15 +100,16 @@
68100 } else{
69101 i ++;
70102 }
71- Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
103+ Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
72104 snprintf(s, sizeof(s), "%d:0x%X %dx%d-%dbits", i, disp_ctrl->VBE.list_vmode[i].mode_number, disp_ctrl->VBE.list_vmode[i].xsize, disp_ctrl->VBE.list_vmode[i].ysize, disp_ctrl->VBE.list_vmode[i].bpp);
73- Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 3, 0x000000, s);
105+ Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 3, 0x000000, s);
74106 } else if((data & KEYID_MASK_ID) == KEYID_ENTER){
75- if(!System_Display_VESA_Set_VideoMode(i)){
107+ if(System_Display_VESA_Set_VideoMode(i) == 0){
108+ Sheet_SetBuffer(vramsheet, disp_ctrl->vram, disp_ctrl->xsize, disp_ctrl->ysize, disp_ctrl->bpp);
76109 break;
77110 }
78- Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 4 - 1);
79- Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 4, 0x000000, "Function Failed. Try again.");
111+ Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 4 - 1);
112+ Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 4, 0x000000, "Function Failed. Try again.");
80113 }
81114 }
82115 }
@@ -84,8 +117,8 @@
84117 }
85118 }
86119
87- Drawing_Fill_Rectangle(disp_ctrl->vram, disp_ctrl->xsize, 0xffffff, 0, 0, disp_ctrl->xsize - 1, disp_ctrl->ysize - 1);
88- Drawing_Put_String(disp_ctrl->vram, disp_ctrl->xsize, 10, 10, 0x000000, "Welcome to CHNOSProject!");
120+ Sheet_Drawing_Fill_Rectangle(vramsheet, 0xffffff, 0, 0, disp_ctrl->xsize - 1, disp_ctrl->ysize - 1);
121+ Sheet_Drawing_Put_String(vramsheet, 10, 10, 0x000000, "Welcome to CHNOSProject!");
89122
90123 Format_BMP_DrawPicture(disp_ctrl->vram, disp_ctrl->xsize, 10, 26, 0, 0, chnlogo);
91124
@@ -94,17 +127,13 @@
94127 Drawing_Draw_Circle(disp_ctrl->vram, disp_ctrl->xsize, 100, 250, 0xc6c6c6, i);
95128 }
96129
97- vramsheet = Sheet_Initialise();
98130 testsheet = Sheet_Initialise();
99- testsheet2 = Sheet_Initialise();
100131 sheet_desktop = Sheet_Initialise();
101132 sheet08 = Sheet_Initialise();
102133 sheet16 = Sheet_Initialise();
103134 sheet32 = Sheet_Initialise();
104135
105- Sheet_SetBuffer(vramsheet, disp_ctrl->vram, disp_ctrl->xsize, disp_ctrl->ysize, disp_ctrl->bpp);
106136 Sheet_SetBuffer(testsheet, Null, 256, 128, 8);
107- Sheet_SetBuffer(testsheet2, Null, 128, 64, 8);
108137 Sheet_SetBuffer(sheet_desktop, Null, disp_ctrl->xsize, disp_ctrl->ysize, disp_ctrl->bpp);
109138 Sheet_SetBuffer(sheet08, Null, 128, 128, 8);
110139 Sheet_SetBuffer(sheet16, Null, 128, 128, 16);
@@ -119,22 +148,13 @@
119148 ((uchar *)testsheet->vram)[y * testsheet->size.x + x] = x * 2;
120149 }
121150 }
151+
122152 Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 4, 24, testsheet->size.x - 4 - 1, testsheet->size.y - 4 - 1);
123153
124- for(y = 0; y < testsheet2->size.y; y++){
125- for(x = 0; x < testsheet2->size.x; x++){
126- ((uchar *)testsheet2->vram)[y * testsheet2->size.x + x] = y * 2 + x;
127- }
128- }
129- Drawing08_Fill_Rectangle(testsheet2->vram, testsheet2->size.x, 0xc6c6c6, 4, 24, testsheet2->size.x - 4 - 1, testsheet2->size.y - 4 - 1);
130-
131154 Drawing08_Put_String(testsheet->vram, testsheet->size.x, 4, 4, 0xffffff, "TestSheet");
132155 snprintf(s, sizeof(s), "Memory:%d Bytes", System_Get_PhisycalMemorySize());
133156 Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24 + 16 * 4, 0xffffff, s);
134157
135- Drawing08_Put_String(testsheet2->vram, testsheet2->size.x, 4, 4, 0xffffff, "TestSheet2");
136-
137-
138158 for(y = 0; y < sheet08->size.y; y++){
139159 for(x = 0; x < sheet08->size.x; x++){
140160 ((uchar *)sheet08->vram)[y * sheet08->size.x + x] = RGB_32_To_08(((x * 2) << 16) | ((y * 2) << 8) | (x + y));
@@ -156,9 +176,6 @@
156176 Sheet_SetParent(sheet_desktop, vramsheet);
157177 Sheet_Show(sheet_desktop, 0, 0, 0);
158178
159- Sheet_SetParent(testsheet2, vramsheet);
160- Sheet_Show(testsheet2, 2, 80, 80);
161-
162179 Sheet_SetParent(sheet08, vramsheet);
163180 Sheet_Show(sheet08, 3, 20, vramsheet->size.y >> 1);
164181
@@ -187,6 +204,8 @@
187204 counter3 = 0;
188205 Timer_Run(timer3);
189206
207+ MouseCursor_Move_Relative(mcursor, vramsheet->size.x >> 1, vramsheet->size.y >> 1);
208+
190209 for(;;){
191210 if(FIFO32_MyTaskFIFO_Status() == 0){
192211 System_MultiTask_Task_Sleep(mytask);
@@ -257,7 +276,6 @@
257276 void KeyboardControlTask(void)
258277 {
259278 UI_Task *mytask;
260- uchar s[128];
261279 uint data, offset;
262280 DATA_FIFO32 *sendto;
263281 uint args[5];
@@ -269,8 +287,9 @@
269287
270288 mytask = System_MultiTask_GetNowTask();
271289
272- snprintf(s, sizeof(s), "KBCT:KeyboardControlTask Start Running.\nKBCT:UI_Task=0x%X\n", mytask);
273- TextMode_Put_String(s, white);
290+ #ifdef CHNOSPROJECT_DEBUG
291+ debug("KBCT:KeyboardControlTask Start Running.\nKBCT:UI_Task=0x%X\n", mytask);
292+ #endif
274293
275294 Keyboard_Set_ReceiveFIFO(mytask->fifo, 0x100);
276295
@@ -305,3 +324,35 @@
305324 }
306325 }
307326 }
327+
328+void MouseControlTask(UI_MouseCursor *mcursor)
329+{
330+ UI_Task *mytask;
331+ uint data;
332+
333+ data = 0;
334+
335+ mytask = System_MultiTask_GetNowTask();
336+
337+ #ifdef CHNOSPROJECT_DEBUG
338+ debug("MCT:MouseControlTask Start Running.\nMCT:UI_Task=0x%X\n", mytask);
339+ #endif
340+
341+ MouseCursor_Show(mcursor);
342+
343+ for(;;){
344+ if(FIFO32_MyTaskFIFO_Status() == 0){
345+ System_MultiTask_Task_Sleep(mytask);
346+ } else{
347+ data = FIFO32_MyTaskFIFO_Get();
348+ #ifdef CHNOSPROJECT_DEBUG_KBCT
349+ debug("MCT:Receive data from FIFO(data:0x%X).\n", data);
350+ #endif
351+ if(0x100 <= data && data <= 0x1ff){
352+
353+ }
354+ }
355+ }
356+}
357+
358+
--- beta/tolset_chn_000/chnos_010/chnos/draw32.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/draw32.c (revision 318)
@@ -5,7 +5,7 @@
55 {
66 uint x, y;
77
8-//if negative position
8+//if negative location
99 if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){
1010 return;
1111 }
@@ -24,7 +24,7 @@
2424 uchar d;
2525 uint *p;
2626
27-//if negative position
27+//if negative location
2828 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
2929 return;
3030 }
@@ -46,7 +46,7 @@
4646
4747 void Drawing32_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])
4848 {
49-//if negative position
49+//if negative location
5050 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
5151 return;
5252 }
@@ -63,7 +63,7 @@
6363
6464 void Drawing32_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)
6565 {
66-//if negative position
66+//if negative location
6767 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
6868 return;
6969 }
--- beta/tolset_chn_000/chnos_010/chnos/sht32.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/sht32.c (revision 318)
@@ -20,6 +20,11 @@
2020 sheet->size.y = ysize;
2121 sheet->bpp = bpp;
2222
23+ if(sheet->flags.bit.vram_auto_allocated){
24+ System_Memory_Free(sheet->vram, sheet->vramsize);
25+ sheet->flags.bit.vram_auto_allocated = False;
26+ }
27+
2328 if(vram == Null){
2429 sheet->vram = System_Memory_Allocate(xsize * ysize * 4);
2530 sheet->flags.bit.vram_auto_allocated = True;
@@ -35,6 +40,10 @@
3540 sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;
3641 sheet->flags.bit.using_invcol = False;
3742
43+ sheet->Drawing.Fill_Rectangle = &Sheet32_Drawing_Fill_Rectangle;
44+ sheet->Drawing.Put_String = &Sheet32_Drawing_Put_String;
45+ sheet->Drawing.Draw_Point = &Sheet32_Drawing_Draw_Point;
46+
3847 sheet->flags.bit.buffer_configured = True;
3948
4049 return 0;
--- beta/tolset_chn_000/chnos_010/chnos/draw16.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/draw16.c (revision 318)
@@ -5,7 +5,7 @@
55 {
66 uint x, y;
77
8-//if negative position
8+//if negative location
99 if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){
1010 return;
1111 }
@@ -25,7 +25,7 @@
2525 uchar d;
2626 ushort *p;
2727
28-//if negative position
28+//if negative location
2929 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
3030 return;
3131 }
@@ -47,7 +47,7 @@
4747
4848 void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])
4949 {
50-//if negative position
50+//if negative location
5151 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
5252 return;
5353 }
@@ -65,7 +65,7 @@
6565
6666 void Drawing16_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)
6767 {
68-//if negative position
68+//if negative location
6969 if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){
7070 return;
7171 }
--- beta/tolset_chn_000/chnos_010/chnos/sht16.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/sht16.c (revision 318)
@@ -20,6 +20,11 @@
2020 sheet->size.y = ysize;
2121 sheet->bpp = bpp;
2222
23+ if(sheet->flags.bit.vram_auto_allocated){
24+ System_Memory_Free(sheet->vram, sheet->vramsize);
25+ sheet->flags.bit.vram_auto_allocated = False;
26+ }
27+
2328 if(vram == Null){
2429 sheet->vram = System_Memory_Allocate(xsize * ysize * 2);
2530 sheet->flags.bit.vram_auto_allocated = True;
@@ -35,6 +40,10 @@
3540 sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;
3641 sheet->flags.bit.using_invcol = False;
3742
43+ sheet->Drawing.Fill_Rectangle = &Sheet16_Drawing_Fill_Rectangle;
44+ sheet->Drawing.Put_String = &Sheet16_Drawing_Put_String;
45+ sheet->Drawing.Draw_Point = &Sheet16_Drawing_Draw_Point;
46+
3847 sheet->flags.bit.buffer_configured = True;
3948
4049 return 0;
--- beta/tolset_chn_000/chnos_010/chnos/memory.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/memory.c (revision 318)
@@ -35,6 +35,11 @@
3535 return i;
3636 }
3737
38+//Memory Control System
39+//ctrl[0].addr = 0;
40+//ctrl[0].size = tags;
41+//Memory Control配列は、管理対象のメモリの終端に配置される。
42+
3843 IO_MemoryControl Memory_Initialise_Control(void *start, uint size, uint tags)
3944 {
4045 IO_MemoryControl ctrl;
@@ -41,14 +46,17 @@
4146
4247 size = (size + 7) & ~7;
4348
49+//Memory Control配列が入る分より多く、管理対象のメモリを与えられているかチェック。
4450 if((tags * sizeof(IO_MemoryControlTag)) > size){
4551 return 0;
4652 }
4753
54+//管理の都合上、3タグ以上ないと管理が成立しないので、そのチェック。
4855 if(tags < 3){
4956 return 0;
5057 }
5158
59+//管理対象メモリ範囲の最後から、Memory Control配列の大きさ分だけさかのぼった地点をMemoryControl配列の先頭とする。
5260 ctrl = (IO_MemoryControl)(start + (size - (tags * sizeof(IO_MemoryControlTag))));
5361 ctrl[0].addr = 0;
5462 ctrl[0].size = tags;
@@ -227,18 +235,21 @@
227235 addr = ctrl[i].addr;
228236 if(ctrl[i].size == size){ /*ぴったりだったので空き情報を破棄*/
229237 for(; i < ctrl[0].size - 1; i++){
238+ //終端を発見したらBreak.
230239 if(ctrl[i].size == 0xffffffff){
231240 break;
232241 }
242+ //タグをコピーして前に詰める。
233243 ctrl[i] = ctrl[i + 1];
234244 }
235- if(i != ctrl[0].size - 1){
236- ctrl[i].addr = 0;
237- ctrl[i].size = 0xffffffff;
238- }
245+ //詰めた結果、終端タグが必要だったら追加する(そんなことないはずだよね?…)
246+ //if(i != ctrl[0].size){
247+ // ctrl[i].addr = 0;
248+ // ctrl[i].size = 0xffffffff;
249+ //}
239250 } else{ /*まだ残っているので空き情報を調整*/
240251 ctrl[i].addr += size;
241- ctrl[1].size -= size;
252+ ctrl[i].size -= size;
242253 }
243254 IO_Store_EFlags(eflags);
244255 //メモリをゼロクリア。
@@ -299,3 +310,5 @@
299310 return size;
300311 }
301312
313+
314+
--- beta/tolset_chn_000/chnos_010/chnos/shtdraw.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/shtdraw.c (revision 318)
@@ -0,0 +1,91 @@
1+
2+#include "core.h"
3+
4+uint Sheet_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)
5+{
6+ return sheet->Drawing.Fill_Rectangle(sheet, c, px0, py0, px1, py1);
7+}
8+
9+uint Sheet_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])
10+{
11+ return sheet->Drawing.Put_String(sheet, x, y, fc, s);
12+}
13+
14+uint Sheet_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)
15+{
16+ return sheet->Drawing.Draw_Point(sheet, x, y, c);
17+}
18+
19+//invalid
20+uint Sheet_Drawing_Fill_Rectangle_Invalid(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)
21+{
22+ return 0;
23+}
24+
25+uint Sheet_Drawing_Put_String_Invalid(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])
26+{
27+ return 0;
28+}
29+
30+uint Sheet_Drawing_Draw_Point_Invalid(UI_Sheet *sheet, int x, int y, uint c)
31+{
32+ return 0;
33+}
34+
35+
36+//8-bit
37+uint Sheet08_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)
38+{
39+ Drawing08_Fill_Rectangle(sheet->vram, sheet->size.x, c, (uint)px0, (uint)py0, (uint)px1, (uint)py1);
40+ return 0;
41+}
42+
43+uint Sheet08_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])
44+{
45+ Drawing08_Put_String(sheet->vram, sheet->size.x, (uint)x, (uint)y, fc, s);
46+ return 0;
47+}
48+
49+uint Sheet08_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)
50+{
51+ Drawing08_Draw_Point(sheet->vram, sheet->size.x, (uint)x, (uint)y, c);
52+ return 0;
53+}
54+
55+//16-bit
56+uint Sheet16_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)
57+{
58+ Drawing16_Fill_Rectangle(sheet->vram, sheet->size.x, c, (uint)px0, (uint)py0, (uint)px1, (uint)py1);
59+ return 0;
60+}
61+
62+uint Sheet16_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])
63+{
64+ Drawing16_Put_String(sheet->vram, sheet->size.x, (uint)x, (uint)y, fc, s);
65+ return 0;
66+}
67+
68+uint Sheet16_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)
69+{
70+ Drawing16_Draw_Point(sheet->vram, sheet->size.x, (uint)x, (uint)y, c);
71+ return 0;
72+}
73+
74+//32-bit
75+uint Sheet32_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)
76+{
77+ Drawing32_Fill_Rectangle(sheet->vram, sheet->size.x, c, (uint)px0, (uint)py0, (uint)px1, (uint)py1);
78+ return 0;
79+}
80+
81+uint Sheet32_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])
82+{
83+ Drawing32_Put_String(sheet->vram, sheet->size.x, (uint)x, (uint)y, fc, s);
84+ return 0;
85+}
86+
87+uint Sheet32_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)
88+{
89+ Drawing32_Draw_Point(sheet->vram, sheet->size.x, (uint)x, (uint)y, c);
90+ return 0;
91+}
--- beta/tolset_chn_000/chnos_010/chnos/fifo.c (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/fifo.c (revision 318)
@@ -1,7 +1,7 @@
11
22 #include "core.h"
33
4-//指定サイズは、バイト単位。
4+//指定サイズは、バイト単位。4バイト切り捨て。
55 //内部サイズは、エントリ(uint=4byte)単位。
66
77 DATA_FIFO32 *FIFO32_Initialise(IO_MemoryControl memctrl, uint size)
--- beta/tolset_chn_000/chnos_010/chnos/mouse.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/mouse.c (revision 318)
@@ -0,0 +1,116 @@
1+
2+#include "core.h"
3+
4+uchar Mouse_Pattern_Standard[24][24] = {
5+ ".**.....................",
6+ "*O**....................",
7+ "*OO**...................",
8+ "*OOO**..................",
9+ "*OOOO**.................",
10+ "*OOOOO**................",
11+ "*OOOOOO**...............",
12+ "*OOOOOOO**..............",
13+ "*OOOOOOOO**.............",
14+ "*OOOOOOOOO**............",
15+ "*OOOOOOOOOO**...........",
16+ "*OOOOOOOOOOO**..........",
17+ "*OOOOOOOOOOOO**.........",
18+ "*OOOOOOOOOOOOO**........",
19+ "*OOOOOOOOOOOOOO**.......",
20+ "*OOOOOOOOOOOOOOO**......",
21+ "*OOOOOOOOOOOOOOOO**.....",
22+ "*OOOOOO************.....",
23+ "*OOOOO**................",
24+ "*OOOO**.................",
25+ "*OOO**..................",
26+ "*OO**...................",
27+ "*O**....................",
28+ "***.....................",
29+};
30+
31+void Mouse_SendCommand(uint data)
32+{
33+ KeyboardController_SendCommand(KEYCMD_SENDTO_MOUSE);
34+ KeyboardController_SendData(data);
35+ return;
36+}
37+
38+UI_MouseCursor *MouseCursor_Initialise(UI_Sheet *parent)
39+{
40+ UI_MouseCursor *mcursor;
41+ uint x, y;
42+
43+ if(parent == Null){
44+ return Null;
45+ }
46+
47+ mcursor = System_Memory_Allocate(sizeof(UI_MouseCursor));
48+ mcursor->cursor_sheet = Sheet_Initialise();
49+
50+ mcursor->cursors[0] = System_Memory_Allocate(24 * 24 * (8 >> 3));
51+ for(y = 0; y < 24; y++){
52+ for(x = 0; x < 24; x++){
53+ if(Mouse_Pattern_Standard[y][x] == '.'){
54+ (mcursor->cursors[0])[y * 24 + x] = RGB_32_To_08(0x00ff00);
55+ } else if(Mouse_Pattern_Standard[y][x] == 'O'){
56+ (mcursor->cursors[0])[y * 24 + x] = RGB_32_To_08(0xffffff);
57+ } else if(Mouse_Pattern_Standard[y][x] == '*'){
58+ (mcursor->cursors[0])[y * 24 + x] = RGB_32_To_08(0x000000);
59+ }
60+ }
61+ }
62+
63+ Sheet_SetBuffer(mcursor->cursor_sheet, mcursor->cursors[0], 24, 24, 8);
64+ Sheet_SetParent(mcursor->cursor_sheet, parent);
65+ Sheet_Enable_InvisibleColor(mcursor->cursor_sheet, 0x00ff00);
66+ Sheet_SetTopmost(mcursor->cursor_sheet, True);
67+ Sheet_Slide_Absolute(mcursor->cursor_sheet, mcursor->cursor_sheet->parent->size.x >> 1, mcursor->cursor_sheet->parent->size.y >> 1);
68+
69+ return mcursor;
70+}
71+
72+uint MouseCursor_Show(UI_MouseCursor *mcursor)
73+{
74+ if(mcursor == Null){
75+ return 1;
76+ }
77+
78+ if(mcursor->cursor_sheet->location.x < 0){
79+ mcursor->cursor_sheet->location.x = 0;
80+ } else if((uint)mcursor->cursor_sheet->location.x > mcursor->cursor_sheet->parent->size.x - 1){
81+ mcursor->cursor_sheet->location.x = mcursor->cursor_sheet->parent->size.x - 1;
82+ }
83+
84+ if(mcursor->cursor_sheet->location.y < 0){
85+ mcursor->cursor_sheet->location.y = 0;
86+ } else if((uint)mcursor->cursor_sheet->location.y > mcursor->cursor_sheet->parent->size.y - 1){
87+ mcursor->cursor_sheet->location.y = mcursor->cursor_sheet->parent->size.y - 1;
88+ }
89+
90+ Sheet_Show(mcursor->cursor_sheet, SHEET_MAX_CHILDREN, SHEET_LOCATION_NOCHANGE, SHEET_LOCATION_NOCHANGE);
91+
92+ return 0;
93+}
94+
95+uint MouseCursor_Move_Relative(UI_MouseCursor *mcursor, int apx, int apy)
96+{
97+ if(mcursor == Null){
98+ return 1;
99+ }
100+
101+ if(apx < 0){
102+ apx = 0;
103+ } else if((uint)apx > mcursor->cursor_sheet->parent->size.x - 1){
104+ apx = mcursor->cursor_sheet->parent->size.x - 1;
105+ }
106+
107+ if(apy < 0){
108+ apy = 0;
109+ } else if((uint)apy > mcursor->cursor_sheet->parent->size.y - 1){
110+ apy = mcursor->cursor_sheet->parent->size.y - 1;
111+ }
112+
113+ Sheet_Slide_Absolute(mcursor->cursor_sheet, apx, apy);
114+
115+ return 0;
116+}
--- beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 318)
@@ -5,6 +5,7 @@
55 #define CHNOSPROJECT_DEBUG /*定義するとデバッグモードで実行。それぞれのデバッグオプションも有効にする必要がある*/
66
77 #ifdef CHNOSPROJECT_DEBUG
8+ //#define CHNOSPROJECT_DEBUG_CALLLINK
89 //#define CHNOSPROJECT_DEBUG_MEMORY
910 //#define CHNOSPROJECT_DEBUG_MEMORY_ALLOCATE_AND_FREE
1011 //#define CHNOSPROJECT_DEBUG_EMULATOR_X86
@@ -69,6 +70,16 @@
6970 #define AR_TYPE_CODE_E_CONFORMING 0x000c
7071 #define AR_TYPE_CODE_ER_CONFORMING 0x000e
7172
73+/*DebugRegister Settings*/
74+#define DR7_RW_EXECUTE_INSTRUCTION 0
75+#define DR7_RW_WRITE_DATA 1
76+#define DR7_RW_IO_RW 2
77+#define DR7_RW_DATA_RW 3
78+
79+#define DR7_LEN_BYTE 0
80+#define DR7_LEN_WORD 1
81+#define DR7_LEN_DWORD 3
82+
7283 /*CPU Opcodes*/
7384 #define OPCODE_REG_EAX 0
7485 #define OPCODE_REG_ECX 1
@@ -301,7 +312,7 @@
301312 #define SIGNAL_ARGUMENTS_END 0xfefe1234
302313
303314 /*task*/
304-#define TASK_FIFOSIZE 128
315+#define TASK_FIFOSIZE (4 * 64)
305316
306317 /*exceptions esp[] data with errorcode*/
307318 #define EXCEPTION_INFO_EDI 0x00
@@ -326,4 +337,3 @@
326337 #define SHEET_MAX_YSIZE 65535
327338 #define SHEET_MAX_CHILDREN 255
328339 #define SHEET_LOCATION_NOCHANGE 0x7ffffffe
329-
--- beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 317)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 318)
@@ -106,6 +106,52 @@
106106 } bit;
107107 } CPU_ControlRegister4;
108108
109+typedef union CPU_DEBUG_REGISTER6 {
110+ uint dr6;
111+ struct CPU_DEBUG_REGISTER6_BIT {
112+ unsigned B0 : 1;
113+ unsigned B1 : 1;
114+ unsigned B2 : 1;
115+ unsigned B3 : 1;
116+ unsigned bit4_11 : 8; //1
117+ unsigned bit12 : 1; //0
118+ unsigned BD : 1;
119+ unsigned BS : 1;
120+ unsigned BT : 1;
121+ unsigned bit16_31 : 16;
122+ } bit;
123+} CPU_DebugRegister6;
124+
125+typedef union CPU_DEBUG_REGISTER7 {
126+ uint dr7;
127+ struct CPU_DEBUG_REGISTER7_BIT {
128+ unsigned L0 : 1;
129+ unsigned G0 : 1;
130+ unsigned L1 : 1;
131+ unsigned G1 : 1;
132+ unsigned L2 : 1;
133+ unsigned G2 : 1;
134+ unsigned L3 : 1;
135+ unsigned G3 : 1;
136+ unsigned LE : 1; //must be 1
137+ unsigned GE : 1; //must be 1
138+ unsigned bit10 : 1; //1
139+ unsigned bit11 : 1; //0
140+ unsigned bit12 : 1; //0
141+ unsigned GD : 1;
142+ unsigned bit14 : 1; //0
143+ unsigned bit15 : 1; //0
144+ unsigned RW0 : 2;
145+ unsigned LEN0 : 2;
146+ unsigned RW1 : 2;
147+ unsigned LEN1 : 2;
148+ unsigned RW2 : 2;
149+ unsigned LEN2 : 2;
150+ unsigned RW3 : 2;
151+ unsigned LEN3 : 2;
152+ } bit;
153+} CPU_DebugRegister7;
154+
109155 typedef union CPU_EFLAGS {
110156 uint eflags;
111157 struct CPU_EFLAGS_BIT {
@@ -215,6 +261,7 @@
215261 struct UI_TASK_STATE_FLAGS {
216262 unsigned initialized : 1;
217263 unsigned linked : 1;
264+ unsigned first_run : 1;
218265 } flags;
219266 } UI_Task;
220267
@@ -419,6 +466,7 @@
419466 unsigned using_map : 1;
420467 unsigned vram_auto_allocated : 1;
421468 unsigned using_invcol : 1;
469+ unsigned topmost : 1;
422470 } bit;
423471 } flags;
424472 void *vram;
@@ -429,6 +477,11 @@
429477 uint (*Config_Functions)(struct UI_SHEET *sheet);
430478 uint (*RefreshSheet)(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1);
431479 bool (*IsVisiblePixel)(struct UI_SHEET *sheet, int px, int py);
480+ struct UI_SHEET_DRAWING {
481+ uint (*Fill_Rectangle)(struct UI_SHEET *sheet, uint c, int px0, int py0, int px1, int py1);
482+ uint (*Put_String)(struct UI_SHEET *sheet, int x, int y, uint fc, const uchar s[]);
483+ uint (*Draw_Point)(struct UI_SHEET *sheet, int x, int y, uint c);
484+ } Drawing;
432485 } UI_Sheet;
433486
434487 /*timer*/
@@ -457,7 +510,6 @@
457510 } UI_TimerControl;
458511
459512 /*color*/
460-
461513 typedef union RGB_32BIT {
462514 uint c32;
463515 struct RGB_32BIT_RGBA {
@@ -467,3 +519,13 @@
467519 uchar a;
468520 } bit;
469521 } RGB32;
522+
523+/*mouse*/
524+
525+typedef struct UI_MOUSE_CURSOR {
526+ UI_Sheet *cursor_sheet;
527+ struct UI_MOUSE_CURSOR_FLAGS {
528+ unsigned mode : 2;
529+ } flags;
530+ uchar *cursors[4];
531+} UI_MouseCursor;
旧リポジトリブラウザで表示