• R/O
  • SSH
  • HTTPS

chnosproject: コミット


コミットメタ情報

リビジョン310 (tree)
日時2011-12-31 21:14:12
作者hikarupsp

ログメッセージ

snprintfの実装ミスを修正。
両端を指定して線を引く関数を追加。
rand, srandを追加。適当に実装したので、動作速度や精度は心配だ。

変更サマリ

差分

--- beta/tolset_chn_000/chnos_010/chnos/draw08.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/draw08.c (revision 310)
@@ -107,3 +107,74 @@
107107 ((uchar *)vram)[y * xsize + x] = RGB_32_To_08_xy(c, x, y);
108108 return;
109109 }
110+
111+void Drawing08_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
112+{
113+ uint lx;
114+ uint i, j;
115+ uint a;
116+ uint c8;
117+
118+ c8 = RGB_32_To_08(c);
119+
120+ if(x1 < x0){
121+ lx = x0;
122+ x0 = x1;
123+ x1 = lx;
124+
125+ lx = y0;
126+ y0 = y1;
127+ y1 = lx;
128+ } else if(x1 == x0){
129+ if(y0 <= y1){
130+ for(i = 0; i < y1 - y0 + 1; i++){
131+ ((uchar *)vram)[(y0 + i) * xsize + x0] = c8;
132+ }
133+ } else{
134+ for(i = 0; i < y0 - y1 + 1; i++){
135+ ((uchar *)vram)[(y0 - i) * xsize + x0] = c8;
136+ }
137+ }
138+ return;
139+ }
140+
141+ lx = x1 - x0;
142+ if(lx == 0){
143+ lx = 1;
144+ }
145+
146+ if(y0 <= y1){ //+a
147+ a = ((y1 - y0) << 10) / lx;
148+ for(i = 0; i < lx; i++){
149+ ((uchar *)vram)[(y0 + ((i * a) >> 10)) * xsize + (x0 + i)] = c8;
150+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
151+ ((uchar *)vram)[(y0 + j) * xsize + (x0 + i)] = c8;
152+ }
153+ }
154+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
155+ ((uchar *)vram)[(y0 + j) * xsize + (x0 + i)] = c8;
156+ if(y1 >= y0 + j){
157+ break;
158+ }
159+ }
160+ } else{ //-a
161+ a = ((y0 - y1) << 10) / lx;
162+ for(i = 0; i < lx; i++){
163+ ((uchar *)vram)[(y0 - ((i * a) >> 10)) * xsize + (x0 + i)] = c8;
164+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
165+ ((uchar *)vram)[(y0 - j) * xsize + (x0 + i)] = c8;
166+ }
167+ }
168+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
169+ ((uchar *)vram)[(y0 - j) * xsize + (x0 + i)] = c8;
170+ if(y1 <= y0 - j){
171+ break;
172+ }
173+ }
174+ }
175+
176+ ((uchar *)vram)[y1 * xsize + x1] = c8;
177+
178+ return;
179+}
180+
--- beta/tolset_chn_000/chnos_010/chnos/serial.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/serial.c (revision 310)
@@ -36,7 +36,7 @@
3636 {
3737 uchar s[256];
3838
39- vsnprintf(s, format, sizeof(s), (uint *)(&format + 1));
39+ vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));
4040 SerialPort_Send(s);
4141 return;
4242 }
--- beta/tolset_chn_000/chnos_010/chnos/fmt_bmp.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/fmt_bmp.c (revision 310)
@@ -63,7 +63,7 @@
6363 read32 = (uint *)(&fheader->offset_to_data[0]);
6464 offset_to_data = *read32;
6565
66- //snprintf(s, "size:%d offset:%d", sizeof(s), filesize, offset_to_data);
66+ //snprintf(s, sizeof(s), "size:%d offset:%d", filesize, offset_to_data);
6767 //Drawing_Put_String(vram, xsize, x, y, 0x000000, s);
6868
6969 read32 = (uint *)(bmp + 0x0e);
@@ -91,12 +91,12 @@
9191 if(infoheader->bpp == 24){
9292 //Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, "24 bpp.");
9393 } else{
94- snprintf(s, "%d bpp(not implemented).", sizeof(s), infoheader->bpp);
94+ snprintf(s, sizeof(s), "%d bpp(not implemented).", infoheader->bpp);
9595 Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, s);
9696 return 6;
9797 }
9898
99- //snprintf(s, "xsize:%d ysize:%d", sizeof(s), infoheader->xsize, infoheader->ysize);
99+ //snprintf(s, sizeof(s), "xsize:%d ysize:%d", infoheader->xsize, infoheader->ysize);
100100 //Drawing_Put_String(vram, xsize, x, y + 16 * 5, 0x000000, s);
101101
102102 rgb24 = (DATA_Format_BMP_RGB24 *)(bmp + offset_to_data);
--- beta/tolset_chn_000/chnos_010/chnos/system.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/system.c (revision 310)
@@ -132,12 +132,12 @@
132132 TextMode_Put_String("\tInitialising Memory...\n", white);
133133 System_Check_Memory();
134134 i = System_Get_PhisycalMemorySize();
135- snprintf(s, "\tMemory:%uByte %uKiB %uMib\n", sizeof(s), i, i >> 10, i >> 20);
135+ snprintf(s, sizeof(s), "\tMemory:%uByte %uKiB %uMib\n", i, i >> 10, i >> 20);
136136 TextMode_Put_String(s, white);
137137 System.MemoryController = Memory_Initialise_Control((void *)PHYSICAL_MEMORY_ALLOCATION_START_ADDRESS, i - PHYSICAL_MEMORY_ALLOCATION_START_ADDRESS, SYSTEM_MEMORY_CONTROL_TAGS);
138138
139139 i = Memory_Get_FreeSize(System.MemoryController);
140- snprintf(s, "\tFreeMemory:%uByte %uKiB %uMib\n", sizeof(s), i, i >> 10, i >> 20);
140+ snprintf(s, sizeof(s), "\tFreeMemory:%uByte %uKiB %uMib\n", i, i >> 10, i >> 20);
141141 TextMode_Put_String(s, white);
142142
143143 TextMode_Put_String("\tInitialising GDT...\n", white);
@@ -186,7 +186,7 @@
186186 TextMode_Put_String("\t\tCPUID is Enabled.\n", white);
187187 CPUID(cpuid_buf, 0);
188188 System.Environment.CPUID.max_id = cpuid_buf[0];
189- snprintf(s, "\t\tMaxID =0x%X\n", sizeof(s), System.Environment.CPUID.max_id);
189+ snprintf(s, sizeof(s), "\t\tMaxID =0x%X\n", System.Environment.CPUID.max_id);
190190 TextMode_Put_String(s, white);
191191 CPUID(cpuid_buf, 0x80000000);
192192 if((cpuid_buf[0] & 0x80000000) == 0){
@@ -194,7 +194,7 @@
194194 } else{
195195 TextMode_Put_String("\t\tExtended CPUID is Enabled.\n", white);
196196 System.Environment.CPUID.max_eid = cpuid_buf[0];
197- snprintf(s, "\t\tMaxEID=0x%X\n", sizeof(s), System.Environment.CPUID.max_eid);
197+ snprintf(s, sizeof(s), "\t\tMaxEID=0x%X\n", System.Environment.CPUID.max_eid);
198198 TextMode_Put_String(s, white);
199199 }
200200 CPUID(s, 0);
@@ -205,7 +205,7 @@
205205 CPUID(cpuid_buf, 1);
206206 System.Environment.CPUID.function_flags.reg.edx = cpuid_buf[2];
207207 System.Environment.CPUID.function_flags.reg.ecx = cpuid_buf[3];
208- snprintf(s, "\t\tVME:%d\n", sizeof(s), System.Environment.CPUID.function_flags.bit.VME);
208+ snprintf(s, sizeof(s), "\t\tVME:%d\n", System.Environment.CPUID.function_flags.bit.VME);
209209 TextMode_Put_String(s, white);
210210 }
211211
--- beta/tolset_chn_000/chnos_010/chnos/error.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/error.c (revision 310)
@@ -179,7 +179,7 @@
179179 int i;
180180 uchar s[256];
181181
182- i = vsnprintf(s, format, sizeof(s), (uint *)(&format + 1));
182+ i = vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));
183183 if(Error_Output_Enable_SerialPort){
184184 SerialPort_Send(s);
185185 }
--- beta/tolset_chn_000/chnos_010/chnos/drawing.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/drawing.c (revision 310)
@@ -4,6 +4,10 @@
44 void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
55 void (*Drawing_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
66 void (*Drawing_Draw_Point)(void *vram, uint xsize, uint x, uint y, uint c);
7+void (*Drawing_Draw_Line_PQ)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
8+//Drawingに含まれる低レベル描画関数は全て、座標は符号なし整数であり、vramの左上の座標を原点(0, 0)として、xは右方向、yは下方向に増加する。
9+//また、二点の座標をとる関数は、(基本的に)全て引数左側がx成分の小さい側(原点に近い)でなければならない。
10+//高レベル描画関数では、それらを上手くラップすべきである。
711
812 void Initialise_Drawing(void)
913 {
@@ -15,18 +19,23 @@
1519 Drawing_Fill_Rectangle = Drawing08_Fill_Rectangle;
1620 Drawing_Put_String = Drawing08_Put_String;
1721 Drawing_Draw_Point = Drawing08_Draw_Point;
22+ Drawing_Draw_Line_PQ = Drawing08_Draw_Line_PQ;
23+ Drawing08_Initialise_Palette();
1824 } else if(dispctrl->bpp == 16){
1925 Drawing_Fill_Rectangle = Drawing16_Fill_Rectangle;
2026 Drawing_Put_String = Drawing16_Put_String;
2127 Drawing_Draw_Point = Drawing16_Draw_Point;
28+ Drawing_Draw_Line_PQ = Drawing16_Draw_Line_PQ;
2229 } else if(dispctrl->bpp == 32){
2330 Drawing_Fill_Rectangle = Drawing32_Fill_Rectangle;
2431 Drawing_Put_String = Drawing32_Put_String;
2532 Drawing_Draw_Point = Drawing32_Draw_Point;
33+ Drawing_Draw_Line_PQ = Drawing32_Draw_Line_PQ;
2634 } else{
2735 Drawing_Fill_Rectangle = Drawing_Invalid_Fill_Rectangle;
2836 Drawing_Put_String = Drawing_Invalid_Put_String;
2937 Drawing_Draw_Point = Drawing_Invalid_Draw_Point;
38+ Drawing_Draw_Line_PQ = Drawing_Invalid_Draw_Line_PQ;
3039 #ifdef CHNOSPROJECT_DEBUG_DRAWING
3140 debug("Initalise_Drawing:Not implemented %d bpp.\n", dispctrl->bpp);
3241 #endif
@@ -58,6 +67,14 @@
5867 return;
5968 }
6069
70+void Drawing_Invalid_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
71+{
72+ #ifdef CHNOSPROJECT_DEBUG_DRAWING
73+ debug("Drawing_Invalid_Draw_Line_PQ:[0x%X] xsize:%d color:0x%X\nDrawing_Invalid_Draw_Line_PQ: (%d, %d) -> (%d, %d)\n", vram, xsize, c, x0, y0, x1, y1);
74+ #endif
75+ return;
76+}
77+
6178 uchar RGB_32_To_08(uint c32)
6279 {
6380 uchar c8;
--- beta/tolset_chn_000/chnos_010/chnos/Makefile (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/Makefile (revision 310)
@@ -15,7 +15,7 @@
1515 GAS2NASK = $(TOOLPATH)gas2nask.exe -a
1616 OBJ2BIM = $(TOOLPATH)obj2bim.exe
1717 BIM2CHN = $(TOOLPATH)bim2chn.exe
18-RULEFILE = $(INCPATH)CHNOSP.rul
18+RULEFILE = $(INCPATH)chn010.rul
1919 EDIMG = $(TOOLPATH)edimg.exe bias:9
2020 IMGTOL = $(TOOLPATH)RWFD.EXE
2121 MAKEFONT = $(TOOLPATH)makefont.exe
--- beta/tolset_chn_000/chnos_010/chnos/core.h (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/core.h (revision 310)
@@ -20,10 +20,12 @@
2020 uint CallBIOS_Pop_Data_From_Stack(uint *esp);
2121
2222 /*cfunc.c vsnprintfの独自実装等*/
23-int snprintf(uchar s[], const uchar format[], uint n, ...);
24-int vsnprintf(uchar s[], const uchar format[], uint n, uint vargs[]);
23+void srand(uint seed);
24+uint rand(void);
25+int snprintf(uchar s[], uint n, const uchar format[], ...);
26+int vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[]);
2527 //
26-int CFunction_vsnprintf(uchar s[], const uchar format[], uint n, uint vargs[]);
28+int CFunction_vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[]);
2729 void CFunction_vsnprintf_Initialise_WorkArea(CFunction_vsnprintf_WorkArea *work, uchar s[], const uchar format[], uint n, uint vargs[]);
2830 int CFunction_vsnprintf_Check_FormatBuffer(CFunction_vsnprintf_WorkArea *work);
2931 int CFunction_vsnprintf_Check_DestinationBuffer(CFunction_vsnprintf_WorkArea *work);
@@ -46,6 +48,7 @@
4648 void Drawing08_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
4749 void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
4850 void Drawing08_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
51+void Drawing08_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
4952
5053 /*draw16.c 16bit描画関連*/
5154 void Drawing16_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
@@ -52,6 +55,7 @@
5255 void Drawing16_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
5356 void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
5457 void Drawing16_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
58+void Drawing16_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
5559
5660 /*draw32.c 32bit描画関連*/
5761 void Drawing32_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
@@ -58,14 +62,17 @@
5862 void Drawing32_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
5963 void Drawing32_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
6064 void Drawing32_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
65+void Drawing32_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
6166
6267 /*drawing.c 描画関連*/
6368 extern void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
6469 extern void (*Drawing_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
6570 extern void (*Drawing_Draw_Point)(void *vram, uint xsize, uint x, uint y, uint c);
71+extern void (*Drawing_Draw_Line_PQ)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
6672 void Drawing_Invalid_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
6773 void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
6874 void Drawing_Invalid_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
75+void Drawing_Invalid_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
6976 void Initialise_Drawing(void);
7077 uchar RGB_32_To_08(uint c32);
7178 uchar RGB_32_To_08_xy(uint c32, int x, int y);
--- beta/tolset_chn_000/chnos_010/chnos/cfunc.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/cfunc.c (revision 310)
@@ -1,8 +1,33 @@
1-//引数(uchar s[], const uchar format[], uint n, ...)
1+
2+#include "core.h"
3+
4+uint system_seed;
5+
6+#define RAND_A ((10 << 3) + 5)
7+#define RAND_B ((15 << 1) + 1)
8+#define RAND_C (1 << 24)
9+
10+void srand(uint seed)
11+{
12+ system_seed = seed;
13+ return;
14+}
15+
16+uint rand(void)
17+{
18+ uint seed2;
19+
20+ system_seed = ((system_seed * RAND_A) + RAND_B) % RAND_C;
21+ seed2 = ((system_seed * RAND_A) + RAND_B) % RAND_C;
22+ system_seed = (system_seed & 0xff5688) | ((seed2 >> 8) & 0xa977) | ((system_seed & 0x000ff000) << 12);
23+ return system_seed;
24+}
25+
26+//引数(uchar s[], uint n, const uchar format[], ...)
227 // s :結果を書き込む文字列の先頭アドレスを指定します。
3-// format :書式指定文字列の先頭アドレスを指定します。終端は0x00である必要があります。
428 // n :s[]の大きさを指定します。(n - 1)番目以降の文字は書き込まれません。
529 // :ただし、ゼロを指定した場合は、何も出力しません。この場合、s[]は0(null)を指定することもできます。
30+// format :書式指定文字列の先頭アドレスを指定します。終端は0x00である必要があります。
631 // ... :可変長引数です。
732 //
833 //誤ったフォーマットが指定された場合、その部分のフォーマット解釈を終了し、
@@ -27,19 +52,17 @@
2752 // n :このフォーマット指定子を含むフォーマット指定に達するまで、今回出力した文字数を、
2853 // :データをuint *として解釈し、ポインタが指し示す先のuint型変数に代入します。
2954
30-#include "core.h"
31-
32-int snprintf(uchar s[], const uchar format[], uint n, ...)
55+int snprintf(uchar s[], uint n, const uchar format[], ...)
3356 {
34- return CFunction_vsnprintf(s, format, n, (uint *)(&n + 1));
57+ return CFunction_vsnprintf(s, n, format, (uint *)(&format + 1));
3558 }
3659
37-int vsnprintf(uchar s[], const uchar format[], uint n, uint vargs[])
60+int vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[])
3861 {
39- return CFunction_vsnprintf(s, format, n, vargs);
62+ return CFunction_vsnprintf(s, n, format, vargs);
4063 }
4164
42-int CFunction_vsnprintf(uchar s[], const uchar format[], uint n, uint vargs[])
65+int CFunction_vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[])
4366 {
4467 uchar c;
4568 uint i;
@@ -340,5 +363,3 @@
340363 return;
341364 }
342365
343-
344-
--- beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 310)
@@ -35,7 +35,7 @@
3535 Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 1, 0x000000, "Please Select the VideoMode Number.");
3636 Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 2, 0x000000, "(Use cursor Up or Down, Select Enter.)");
3737 Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
38- snprintf(s, "%d:0x%X %dx%d-%dbits", sizeof(s), 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);
38+ 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);
3939 Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 3, 0x000000, s);
4040
4141 FIFO32_Put_Arguments(KBCT->fifo, 4, FIFOCMD_KBCT_SET_FOCUS_FIFO, mytask->fifo, MAIN_KEYBASE, 0);
@@ -55,7 +55,7 @@
5555 i--;
5656 }
5757 Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
58- snprintf(s, "%d:0x%X %dx%d-%dbits", sizeof(s), 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);
58+ 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);
5959 Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 3, 0x000000, s);
6060 } else if((data & KEYID_MASK_ID) == KEYID_CURSOR_D){
6161 if(i == disp_ctrl->VBE.list_vmode_tags - 1){
@@ -64,7 +64,7 @@
6464 i ++;
6565 }
6666 Drawing08_Fill_Rectangle(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);
67- snprintf(s, "%d:0x%X %dx%d-%dbits", sizeof(s), 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);
67+ 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);
6868 Drawing08_Put_String(VGA_VRAM_ADR, VGA08_VRAM_XSIZE, 10, 10 + 16 * 3, 0x000000, s);
6969 } else if((data & KEYID_MASK_ID) == KEYID_ENTER){
7070 if(!System_Display_VESA_Set_VideoMode(i)){
@@ -86,6 +86,11 @@
8686
8787 Format_BMP_DrawPicture(disp_ctrl->vram, disp_ctrl->xsize, 10, 26, 0, 0, chnlogo);
8888
89+ srand(123456);
90+ for(i = 0; i < 10; i++){
91+ Drawing_Draw_Line_PQ(disp_ctrl->vram, disp_ctrl->xsize, rand(), 100, 300 + (rand() % 50), 300, 220 + (rand() % 180));
92+ }
93+
8994 for(;;){
9095
9196 }
@@ -106,7 +111,7 @@
106111
107112 mytask = System_MultiTask_GetNowTask();
108113
109- snprintf(s, "KBCT:KeyboardControlTask Start Running.\nKBCT:UI_Task=0x%X\n", sizeof(s), mytask);
114+ snprintf(s, sizeof(s), "KBCT:KeyboardControlTask Start Running.\nKBCT:UI_Task=0x%X\n", mytask);
110115 TextMode_Put_String(s, white);
111116
112117 Keyboard_Set_ReceiveFIFO(mytask->fifo, 0x100);
--- beta/tolset_chn_000/chnos_010/chnos/draw32.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/draw32.c (revision 310)
@@ -49,3 +49,71 @@
4949 ((uint *)vram)[y * xsize + x] = c;
5050 return;
5151 }
52+
53+void Drawing32_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
54+{
55+ uint lx;
56+ uint i, j;
57+ uint a;
58+
59+ if(x1 < x0){
60+ lx = x0;
61+ x0 = x1;
62+ x1 = lx;
63+
64+ lx = y0;
65+ y0 = y1;
66+ y1 = lx;
67+ } else if(x1 == x0){
68+ if(y0 <= y1){
69+ for(i = 0; i < y1 - y0 + 1; i++){
70+ ((uint *)vram)[(y0 + i) * xsize + x0] = c;
71+ }
72+ } else{
73+ for(i = 0; i < y0 - y1 + 1; i++){
74+ ((uint *)vram)[(y0 - i) * xsize + x0] = c;
75+ }
76+ }
77+ return;
78+ }
79+
80+ lx = x1 - x0;
81+ if(lx == 0){
82+ lx = 1;
83+ }
84+
85+ if(y0 <= y1){ //+a
86+ a = ((y1 - y0) << 10) / lx;
87+ for(i = 0; i < lx; i++){
88+ ((uint *)vram)[(y0 + ((i * a) >> 10)) * xsize + (x0 + i)] = c;
89+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
90+ ((uint *)vram)[(y0 + j) * xsize + (x0 + i)] = c;
91+ }
92+ }
93+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
94+ ((uint *)vram)[(y0 + j) * xsize + (x0 + i)] = c;
95+ if(y1 >= y0 + j){
96+ break;
97+ }
98+ }
99+ } else{ //-a
100+ a = ((y0 - y1) << 10) / lx;
101+ for(i = 0; i < lx; i++){
102+ ((uint *)vram)[(y0 - ((i * a) >> 10)) * xsize + (x0 + i)] = c;
103+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
104+ ((uint *)vram)[(y0 - j) * xsize + (x0 + i)] = c;
105+ }
106+ }
107+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
108+ ((uint *)vram)[(y0 - j) * xsize + (x0 + i)] = c;
109+ if(y1 <= y0 - j){
110+ break;
111+ }
112+ }
113+ }
114+
115+ ((uint *)vram)[y1 * xsize + x1] = c;
116+
117+ return;
118+}
119+
--- beta/tolset_chn_000/chnos_010/chnos/draw16.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/draw16.c (revision 310)
@@ -51,3 +51,73 @@
5151 ((ushort *)vram)[y * xsize + x] = RGB_32_To_16(c);
5252 return;
5353 }
54+
55+void Drawing16_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
56+{
57+ uint lx;
58+ uint i, j;
59+ uint a;
60+ uint c16;
61+
62+ c16 = RGB_32_To_16(c);
63+
64+ if(x1 < x0){
65+ lx = x0;
66+ x0 = x1;
67+ x1 = lx;
68+
69+ lx = y0;
70+ y0 = y1;
71+ y1 = lx;
72+ } else if(x1 == x0){
73+ if(y0 <= y1){
74+ for(i = 0; i < y1 - y0 + 1; i++){
75+ ((ushort *)vram)[(y0 + i) * xsize + x0] = c16;
76+ }
77+ } else{
78+ for(i = 0; i < y0 - y1 + 1; i++){
79+ ((ushort *)vram)[(y0 - i) * xsize + x0] = c16;
80+ }
81+ }
82+ return;
83+ }
84+
85+ lx = x1 - x0;
86+ if(lx == 0){
87+ lx = 1;
88+ }
89+
90+ if(y0 <= y1){ //+a
91+ a = ((y1 - y0) << 10) / lx;
92+ for(i = 0; i < lx; i++){
93+ ((ushort *)vram)[(y0 + ((i * a) >> 10)) * xsize + (x0 + i)] = c16;
94+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
95+ ((ushort *)vram)[(y0 + j) * xsize + (x0 + i)] = c16;
96+ }
97+ }
98+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
99+ ((ushort *)vram)[(y0 + j) * xsize + (x0 + i)] = c16;
100+ if(y1 >= y0 + j){
101+ break;
102+ }
103+ }
104+ } else{ //-a
105+ a = ((y0 - y1) << 10) / lx;
106+ for(i = 0; i < lx; i++){
107+ ((ushort *)vram)[(y0 - ((i * a) >> 10)) * xsize + (x0 + i)] = c16;
108+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
109+ ((ushort *)vram)[(y0 - j) * xsize + (x0 + i)] = c16;
110+ }
111+ }
112+ for(j = ((i * a) >> 10) + 1; j < ((i + 1) * a) >> 10; j++){
113+ ((ushort *)vram)[(y0 - j) * xsize + (x0 + i)] = c16;
114+ if(y1 <= y0 - j){
115+ break;
116+ }
117+ }
118+ }
119+
120+ ((ushort *)vram)[y1 * xsize + x1] = c16;
121+
122+ return;
123+}
--- beta/tolset_chn_000/chnos_010/chnos/emu86.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/emu86.c (revision 310)
@@ -266,7 +266,7 @@
266266 int i;
267267 uchar s[256];
268268
269- i = vsnprintf(s, format, sizeof(s), (uint *)(&format + 1));
269+ i = vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));
270270 SerialPort_Send(s);
271271
272272 return i;
--- beta/tolset_chn_000/chnos_010/chnos/timer.c (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/timer.c (revision 310)
@@ -20,13 +20,13 @@
2020
2121 void InterruptHandler20(uint *esp)
2222 {
23- uchar s[32];
23+ //uchar s[32];
2424
2525 ProgrammableInterruptController_InterruptRequest_Complete(0x00);
2626 PIT_10ms_Tick++;
2727
28- snprintf(s, "10ms_Tick:%u", sizeof(s), PIT_10ms_Tick);
29- TextMode_Put_String_Absolute(s, white, 50, 0);
28+ //snprintf(s, sizeof(s), "10ms_Tick:%u", PIT_10ms_Tick);
29+ //TextMode_Put_String_Absolute(s, white, 50, 0);
3030
3131 if((PIT_10ms_Tick & 0x00000002) == 0){
3232 TaskSwitch();
--- beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 309)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 310)
@@ -5,11 +5,11 @@
55 #define CHNOSPROJECT_DEBUG /*定義するとデバッグモードで実行。それぞれのデバッグオプションも有効にする必要がある*/
66
77 #ifdef CHNOSPROJECT_DEBUG
8- //#define CHNOSPROJECT_DEBUG_MEMORY /*定義するとメモリ関連のデバッグをオンにする*/
9- //#define CHNOSPROJECT_DEBUG_EMULATOR_X86
10- //#define CHNOSPROJECT_DEBUG_CALLBIOS
11- //#define CHNOSPROJECT_DEBUG_FIFO
12- //#define CHNOSPROJECT_DEBUG_KBCT
8+ #define CHNOSPROJECT_DEBUG_MEMORY /*定義するとメモリ関連のデバッグをオンにする*/
9+ #define CHNOSPROJECT_DEBUG_EMULATOR_X86
10+ #define CHNOSPROJECT_DEBUG_CALLBIOS
11+ #define CHNOSPROJECT_DEBUG_FIFO
12+ #define CHNOSPROJECT_DEBUG_KBCT
1313 #define CHNOSPROJECT_DEBUG_DISPLAY
1414 #define CHNOSPROJECT_DEBUG_DRAWING
1515 #endif
旧リポジトリブラウザで表示