• R/O
  • SSH
  • HTTPS

chnosproject: コミット


コミットメタ情報

リビジョン308 (tree)
日時2011-12-24 14:01:37
作者hikarupsp

ログメッセージ

8,16,32ビットのFill_RectangleとPut_Stringは整備した。
次はシート関係か、またはbmp表示を実装したい。

変更サマリ

差分

--- beta/tolset_chn_000/chnos_010/chnos/display.c (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/display.c (revision 308)
@@ -205,7 +205,7 @@
205205 return 4;
206206 }
207207
208- if(!(ctrl->VBE.list_vmode[index].bpp == 8)){
208+ if(!(ctrl->VBE.list_vmode[index].bpp == 8 || ctrl->VBE.list_vmode[index].bpp == 16 || ctrl->VBE.list_vmode[index].bpp == 32)){
209209 #ifdef CHNOSPROJECT_DEBUG_DISPLAY
210210 debug("SetVideo:Error:This VideoMode's BitsPerPixel is Not Supported in CHNOSProject.\n");
211211 #endif
--- beta/tolset_chn_000/chnos_010/chnos/draw08.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/draw08.c (revision 308)
@@ -0,0 +1,103 @@
1+
2+#include "core.h"
3+
4+void Drawing08_Initialise_Palette(void)
5+{
6+ static uchar table_rgb[16 * 3] = {
7+ 0x00, 0x00, 0x00,
8+ 0xff, 0x00, 0x00,
9+ 0x00, 0xff, 0x00,
10+ 0xff, 0xff, 0x00,
11+ 0x00, 0x00, 0xff,
12+ 0xff, 0x00, 0xff,
13+ 0x00, 0xff, 0xff,
14+ 0xff, 0xff, 0xff,
15+ 0xc6, 0xc6, 0xc6,
16+ 0x84, 0x00, 0x00,
17+ 0x00, 0x84, 0x00,
18+ 0x84, 0x84, 0x00,
19+ 0x00, 0x00, 0x84,
20+ 0x84, 0x00, 0x84,
21+ 0x00, 0x84, 0x84,
22+ 0x84, 0x84, 0x84
23+ };
24+ uchar table2[216 * 3];
25+ uint r, g, b;
26+
27+ Drawing08_Set_Palette(0, 15, table_rgb);
28+ for (b = 0; b < 6; b++) {
29+ for (g = 0; g < 6; g++) {
30+ for (r = 0; r < 6; r++) {
31+ table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
32+ table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
33+ table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
34+ }
35+ }
36+ }
37+ Drawing08_Set_Palette(16, 231, table2);
38+
39+ return;
40+}
41+
42+void Drawing08_Set_Palette(uint start, uint end, uchar *rgb)
43+{
44+ uint i, eflags;
45+
46+ eflags = IO_Load_EFlags();
47+ IO_CLI();
48+ IO_Out8(VGA_VDAC_WRITE_ADR, start);
49+ for (i = start; i <= end; i++) {
50+ IO_Out8(VGA_VDAC_DATA, rgb[0] >> 2);
51+ IO_Out8(VGA_VDAC_DATA, rgb[1] >> 2);
52+ IO_Out8(VGA_VDAC_DATA, rgb[2] >> 2);
53+ rgb += 3;
54+ }
55+ IO_Store_EFlags(eflags);
56+ return;
57+}
58+
59+void Drawing08_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
60+{
61+ uint x, y;
62+ c = RGB_32_To_08(c);
63+ for(y = y0; y <= y1; y++){
64+ for(x = x0; x <= x1; x++){
65+ ((uchar *)vram)[y * xsize + x] = (uchar)c;
66+ }
67+ }
68+ return;
69+}
70+
71+void Drawing08_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)
72+{
73+ int i;
74+ uchar d;
75+ uchar *p;
76+
77+ for (i = 0; i < 16; i++) {
78+ p = (uchar *)(vram + (y + i) * xsize + x);
79+ d = font[i];
80+ if ((d & 0x80) != 0) { p[0] = (uchar)c; }
81+ if ((d & 0x40) != 0) { p[1] = (uchar)c; }
82+ if ((d & 0x20) != 0) { p[2] = (uchar)c; }
83+ if ((d & 0x10) != 0) { p[3] = (uchar)c; }
84+ if ((d & 0x08) != 0) { p[4] = (uchar)c; }
85+ if ((d & 0x04) != 0) { p[5] = (uchar)c; }
86+ if ((d & 0x02) != 0) { p[6] = (uchar)c; }
87+ if ((d & 0x01) != 0) { p[7] = (uchar)c; }
88+ }
89+ return;
90+}
91+
92+void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])
93+{
94+ c = RGB_32_To_08(c);
95+ for(; *s != 0x00; s++){
96+ if(x > xsize - 8){
97+ break;
98+ }
99+ Drawing08_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);
100+ x += 8;
101+ }
102+ return;
103+}
--- beta/tolset_chn_000/chnos_010/chnos/makeset.txt (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/makeset.txt (revision 308)
@@ -0,0 +1,3 @@
1+
2+OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj callbios.obj cfunc.obj display.obj draw08.obj draw16.obj draw32.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj intrpt.obj keyboard.obj memory.obj mtask.obj serial.obj system.obj timer.obj vgatmode.obj xception.obj bootpack.obj
3+HEADS_BOOTPACK = core.h coredef0.h coredef1.h coredef2.h coredef3.h keyid.h
--- beta/tolset_chn_000/chnos_010/chnos/drawing.c (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/drawing.c (revision 308)
@@ -1,104 +1,46 @@
11
22 #include "core.h"
33
4-void Drawing08_Initialise_Palette(void)
5-{
6- static uchar table_rgb[16 * 3] = {
7- 0x00, 0x00, 0x00,
8- 0xff, 0x00, 0x00,
9- 0x00, 0xff, 0x00,
10- 0xff, 0xff, 0x00,
11- 0x00, 0x00, 0xff,
12- 0xff, 0x00, 0xff,
13- 0x00, 0xff, 0xff,
14- 0xff, 0xff, 0xff,
15- 0xc6, 0xc6, 0xc6,
16- 0x84, 0x00, 0x00,
17- 0x00, 0x84, 0x00,
18- 0x84, 0x84, 0x00,
19- 0x00, 0x00, 0x84,
20- 0x84, 0x00, 0x84,
21- 0x00, 0x84, 0x84,
22- 0x84, 0x84, 0x84
23- };
24- uchar table2[216 * 3];
25- uint r, g, b;
4+void (*Drawing_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
5+void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
266
27- Drawing08_Set_Palette(0, 15, table_rgb);
28- for (b = 0; b < 6; b++) {
29- for (g = 0; g < 6; g++) {
30- for (r = 0; r < 6; r++) {
31- table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
32- table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
33- table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
34- }
35- }
36- }
37- Drawing08_Set_Palette(16, 231, table2);
38-
39- return;
40-}
41-
42-void Drawing08_Set_Palette(uint start, uint end, uchar *rgb)
7+void Initialise_Drawing(void)
438 {
44- uint i, eflags;
9+ IO_DisplayControl *dispctrl;
4510
46- eflags = IO_Load_EFlags();
47- IO_CLI();
48- IO_Out8(VGA_VDAC_WRITE_ADR, start);
49- for (i = start; i <= end; i++) {
50- IO_Out8(VGA_VDAC_DATA, rgb[0] >> 2);
51- IO_Out8(VGA_VDAC_DATA, rgb[1] >> 2);
52- IO_Out8(VGA_VDAC_DATA, rgb[2] >> 2);
53- rgb += 3;
54- }
55- IO_Store_EFlags(eflags);
56- return;
57-}
11+ dispctrl = System_Display_Get_Controller();
5812
59-void Drawing08_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
60-{
61- uint x, y;
62- c = RGB_32_To_08(c);
63- for(y = y0; y <= y1; y++){
64- for(x = x0; x <= x1; x++){
65- ((uchar *)vram)[y * xsize + x] = (uchar)c;
66- }
13+ if(dispctrl->bpp == 8){
14+ Drawing_Put_String = Drawing08_Put_String;
15+ Drawing_Fill_Rectangle = Drawing08_Fill_Rectangle;
16+ } else if(dispctrl->bpp == 16){
17+ Drawing_Put_String = Drawing16_Put_String;
18+ Drawing_Fill_Rectangle = Drawing16_Fill_Rectangle;
19+ } else if(dispctrl->bpp == 32){
20+ Drawing_Put_String = Drawing32_Put_String;
21+ Drawing_Fill_Rectangle = Drawing32_Fill_Rectangle;
22+ } else{
23+ Drawing_Put_String = Drawing_Invalid_Put_String;
24+ Drawing_Fill_Rectangle = Drawing_Invalid_Fill_Rectangle;
25+ #ifdef CHNOSPROJECT_DEBUG_DRAWING
26+ debug("Initalise_Drawing:Not implemented %d bpp.\n", dispctrl->bpp);
27+ #endif
6728 }
6829 return;
6930 }
7031
71-void Drawing08_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)
32+void Drawing_Invalid_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s)
7233 {
73- int i;
74- uchar d;
75- uchar *p;
76-
77- for (i = 0; i < 16; i++) {
78- p = (uchar *)(vram + (y + i) * xsize + x);
79- d = font[i];
80- if ((d & 0x80) != 0) { p[0] = (uchar)c; }
81- if ((d & 0x40) != 0) { p[1] = (uchar)c; }
82- if ((d & 0x20) != 0) { p[2] = (uchar)c; }
83- if ((d & 0x10) != 0) { p[3] = (uchar)c; }
84- if ((d & 0x08) != 0) { p[4] = (uchar)c; }
85- if ((d & 0x04) != 0) { p[5] = (uchar)c; }
86- if ((d & 0x02) != 0) { p[6] = (uchar)c; }
87- if ((d & 0x01) != 0) { p[7] = (uchar)c; }
88- }
34+ #ifdef CHNOSPROJECT_DEBUG_DRAWING
35+ debug("Drawing_Invalid_Put_String:[0x%X] xsize:%d (%d, %d) color:0x%X\nDrawing_Invalid_Put_String:>%s\n", vram, xsize, x, y, c, s);
36+ #endif
8937 return;
9038 }
91-
92-void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s)
39+void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
9340 {
94- c = RGB_32_To_08(c);
95- for(; *s != 0x00; s++){
96- if(x > xsize - 8){
97- break;
98- }
99- Drawing08_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);
100- x += 8;
101- }
41+ #ifdef CHNOSPROJECT_DEBUG_DRAWING
42+ debug("Drawing_Invalid_Fill_Rectangle:[0x%X] xsize:%d color:0x%X\nDrawing_Invalid_Fill_Rectangle: (%d, %d) -> (%d, %d)\n", vram, xsize, c, x0, y0, x1, y1);
43+ #endif
10244 return;
10345 }
10446
@@ -163,3 +105,4 @@
163105
164106 return c16;
165107 }
108+
--- beta/tolset_chn_000/chnos_010/chnos/Makefile (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/Makefile (revision 308)
@@ -1,7 +1,10 @@
11
22 #OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj sheet.obj fifo.obj mtask.obj timer.obj keyboard.obj mouse.obj window.obj console.obj file.obj uuid.obj api.obj bootpack.obj
3-OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj callbios.obj cfunc.obj display.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj intrpt.obj keyboard.obj memory.obj mtask.obj serial.obj system.obj timer.obj vgatmode.obj xception.obj bootpack.obj
4-HEADS_BOOTPACK = core.h coredef0.h coredef1.h coredef2.h coredef3.h keyid.h
3+#OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj callbios.obj cfunc.obj display.obj draw08.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj intrpt.obj keyboard.obj memory.obj mtask.obj serial.obj system.obj timer.obj vgatmode.obj xception.obj bootpack.obj
4+#HEADS_BOOTPACK = core.h coredef0.h coredef1.h coredef2.h coredef3.h keyid.h
5+
6+include makeset.txt
7+
58 TOOLPATH = ../../z_tools/
69 INCPATH = ../../z_tools/CHNOSProject/
710
--- beta/tolset_chn_000/chnos_010/chnos/core.h (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/core.h (revision 308)
@@ -39,12 +39,29 @@
3939 IO_DisplayControl *Initialise_Display(void);
4040 uint Display_VESA_Set_VideoMode(IO_DisplayControl *ctrl, uint index);
4141
42-/*drawing.c 描画関連*/
42+/*draw08.c 8bit描画関連*/
4343 void Drawing08_Initialise_Palette(void);
4444 void Drawing08_Set_Palette(uint start, uint end, uchar *rgb);
4545 void Drawing08_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
4646 void Drawing08_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
47-void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
47+void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
48+
49+/*draw16.c 16bit描画関連*/
50+void Drawing16_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
51+void Drawing16_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
52+void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
53+
54+/*draw32.c 32bit描画関連*/
55+void Drawing32_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
56+void Drawing32_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
57+void Drawing32_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
58+
59+/*drawing.c 描画関連*/
60+extern void (*Drawing_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
61+extern void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
62+void Drawing_Invalid_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
63+void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
64+void Initialise_Drawing(void);
4865 uchar RGB_32_To_08(uint c32);
4966 uchar RGB_32_To_08_xy(uint c32, int x, int y);
5067 ushort RGB_32_To_16(uint c32);
--- beta/tolset_chn_000/chnos_010/chnos/draw32.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/draw32.c (revision 308)
@@ -0,0 +1,45 @@
1+
2+#include "core.h"
3+
4+void Drawing32_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
5+{
6+ uint x, y;
7+ for(y = y0; y <= y1; y++){
8+ for(x = x0; x <= x1; x++){
9+ ((uint *)vram)[y * xsize + x] = c;
10+ }
11+ }
12+ return;
13+}
14+
15+void Drawing32_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)
16+{
17+ int i;
18+ uchar d;
19+ uint *p;
20+ for (i = 0; i < 16; i++) {
21+ p = (uint *)vram + (y + i) * xsize + x;
22+ d = font[i];
23+ if ((d & 0x80) != 0) { p[0] = (uint)c; }
24+ if ((d & 0x40) != 0) { p[1] = (uint)c; }
25+ if ((d & 0x20) != 0) { p[2] = (uint)c; }
26+ if ((d & 0x10) != 0) { p[3] = (uint)c; }
27+ if ((d & 0x08) != 0) { p[4] = (uint)c; }
28+ if ((d & 0x04) != 0) { p[5] = (uint)c; }
29+ if ((d & 0x02) != 0) { p[6] = (uint)c; }
30+ if ((d & 0x01) != 0) { p[7] = (uint)c; }
31+ }
32+ return;
33+}
34+
35+void Drawing32_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])
36+{
37+ for(; *s != 0x00; s++){
38+ if(x > xsize - 8){
39+ break;
40+ }
41+ Drawing32_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);
42+ x += 8;
43+ }
44+ return;
45+}
--- beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 308)
@@ -78,6 +78,12 @@
7878 }
7979 }
8080 }
81+
82+ Initialise_Drawing();
83+
84+ Drawing_Fill_Rectangle(disp_ctrl->vram, disp_ctrl->xsize, 0xffffff, 0, 0, disp_ctrl->xsize - 1, disp_ctrl->ysize - 1);
85+ Drawing_Put_String(disp_ctrl->vram, disp_ctrl->xsize, 10, 10, 0x000000, "Welcome to CHNOSProject!");
86+
8187 for(;;){
8288
8389 }
--- beta/tolset_chn_000/chnos_010/chnos/draw16.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/draw16.c (revision 308)
@@ -0,0 +1,47 @@
1+
2+#include "core.h"
3+
4+void Drawing16_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
5+{
6+ uint x, y;
7+ c = RGB_32_To_16(c);
8+ for(y = y0; y <= y1; y++){
9+ for(x = x0; x <= x1; x++){
10+ ((ushort *)vram)[y * xsize + x] = (ushort)c;
11+ }
12+ }
13+ return;
14+}
15+
16+void Drawing16_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)
17+{
18+ int i;
19+ uchar d;
20+ ushort *p;
21+ for (i = 0; i < 16; i++) {
22+ p = (ushort *)vram + (y + i) * xsize + x;
23+ d = font[i];
24+ if ((d & 0x80) != 0) { p[0] = (ushort)c; }
25+ if ((d & 0x40) != 0) { p[1] = (ushort)c; }
26+ if ((d & 0x20) != 0) { p[2] = (ushort)c; }
27+ if ((d & 0x10) != 0) { p[3] = (ushort)c; }
28+ if ((d & 0x08) != 0) { p[4] = (ushort)c; }
29+ if ((d & 0x04) != 0) { p[5] = (ushort)c; }
30+ if ((d & 0x02) != 0) { p[6] = (ushort)c; }
31+ if ((d & 0x01) != 0) { p[7] = (ushort)c; }
32+ }
33+ return;
34+}
35+
36+void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])
37+{
38+ c = RGB_32_To_16(c);
39+ for(; *s != 0x00; s++){
40+ if(x > xsize - 8){
41+ break;
42+ }
43+ Drawing16_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);
44+ x += 8;
45+ }
46+ return;
47+}
--- beta/tolset_chn_000/chnos_010/chnos/timer.c (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/timer.c (revision 308)
@@ -49,3 +49,19 @@
4949 {
5050 return;
5151 }
52+
53+typedef struct UI_TIMER {
54+ uint tick;
55+ uint timeout;
56+ struct UI_TIMER *root_next;
57+ struct UI_TIMER *tree_next;
58+ DATA_FIFO32 *fifo;
59+ uint fifo_putdata;
60+ union UI_TIMER_FLAGS {
61+ uint flags;
62+ struct UI_TIMER_FLAGS_BITS {
63+ unsigned initialized : 1;
64+ unsigned configured : 1;
65+ } bit;
66+ } flags;
67+} UI_Timer;
--- beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 308)
@@ -11,6 +11,7 @@
1111 //#define CHNOSPROJECT_DEBUG_FIFO
1212 //#define CHNOSPROJECT_DEBUG_KBCT
1313 #define CHNOSPROJECT_DEBUG_DISPLAY
14+ #define CHNOSPROJECT_DEBUG_DRAWING
1415 #endif
1516
1617 /*defines*/
--- beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 307)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 308)
@@ -315,6 +315,11 @@
315315 int y;
316316 } DATA_Location2D;
317317
318+typedef struct DATA_LOCATION_2DU {
319+ uint x;
320+ uint y;
321+} DATA_Location2DU;
322+
318323 /*display*/
319324 typedef struct _INFO_VBE_BIOS {
320325 uchar sign[4];
旧リポジトリブラウザで表示