• R/O
  • SSH
  • HTTPS

chnosproject: コミット


コミットメタ情報

リビジョン309 (tree)
日時2011-12-28 21:33:34
作者hikarupsp

ログメッセージ

一応ビットマップ画像表示(埋め込んだリソースだけだが)を実装した。
適当にロゴを作って表示するようにしている。改めてロゴはきちんと作る予定。

変更サマリ

差分

--- beta/tolset_chn_000/chnos_010/chnos/coredef2.h (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef2.h (revision 309)
@@ -2,3 +2,4 @@
22 /*システム外部リソース宣言*/
33
44 extern uchar hankaku[4096]; /*hankaku.txt*/
5+extern uchar chnlogo[]; /*chnlogo.bmp*/
--- beta/tolset_chn_000/chnos_010/chnos/draw08.c (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/draw08.c (revision 309)
@@ -101,3 +101,9 @@
101101 }
102102 return;
103103 }
104+
105+void Drawing08_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)
106+{
107+ ((uchar *)vram)[y * xsize + x] = RGB_32_To_08_xy(c, x, y);
108+ return;
109+}
--- beta/tolset_chn_000/chnos_010/chnos/fmt_bmp.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/fmt_bmp.c (revision 309)
@@ -0,0 +1,117 @@
1+
2+#include "core.h"
3+
4+//パディングの関係でこんなことになってる
5+typedef struct DATA_FORMAT_BMP_FILE_HEADER {
6+ uchar sign[2];
7+ uchar filesize[4];
8+ uchar reserved0[2];
9+ uchar reserved1[2];
10+ uchar offset_to_data[4];
11+} DATA_Format_BMP_FileHeader;
12+
13+//OS/2 Type
14+typedef struct DATA_FORMAT_BMP_CORE_HEADER {
15+ uint headersize;
16+ short xsize;
17+ short ysize;
18+ ushort planes;
19+ ushort bpp;
20+} DATA_Format_BMP_CoreHeader;
21+
22+//Windows Type
23+typedef struct DATA_FORMAT_BMP_INFO_HEADER {
24+ uint headersize;
25+ int xsize;
26+ int ysize;
27+ ushort planes;
28+ ushort bpp;
29+ uint compression_type; //0:no compression, 1:RLE8 2:RLE4 3:bit field
30+ uint image_data_size;
31+ uint pixel_per_meter_x;
32+ uint pixel_per_meter_y;
33+ uint colors_in_palette;
34+ uint index_of_important_color;
35+} DATA_Format_BMP_InformationHeader;
36+
37+typedef struct DATA_FORMAT_BMP_RGB24 {
38+ uchar b;
39+ uchar g;
40+ uchar r;
41+} DATA_Format_BMP_RGB24;
42+
43+uint Format_BMP_DrawPicture(void *vram, uint xsize, uint x, uint y, uint pxsize, uint pysize, void *bmp)
44+{
45+ uchar s[128];
46+ DATA_Format_BMP_FileHeader *fheader;
47+ DATA_Format_BMP_InformationHeader *infoheader;
48+ uint *read32;
49+ DATA_Format_BMP_RGB24 *rgb24;
50+ uint ix, iy;
51+
52+ uint offset_to_data, filesize;
53+
54+ fheader = (DATA_Format_BMP_FileHeader *)bmp;
55+
56+ if(fheader->sign[0] != 'B' || fheader->sign[1] != 'M'){
57+ Drawing_Put_String(vram, xsize, x, y, 0x000000, "BMP:Unknown File Format.");
58+ return 1;
59+ }
60+
61+ read32 = (uint *)(&fheader->filesize[0]);
62+ filesize = *read32;
63+ read32 = (uint *)(&fheader->offset_to_data[0]);
64+ offset_to_data = *read32;
65+
66+ //snprintf(s, "size:%d offset:%d", sizeof(s), filesize, offset_to_data);
67+ //Drawing_Put_String(vram, xsize, x, y, 0x000000, s);
68+
69+ read32 = (uint *)(bmp + 0x0e);
70+
71+ if(*read32 == 12){
72+ Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "BMP Core Header.(not implemented.)");
73+ return 2;
74+ } else if(*read32 == 40){
75+ //Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "BMP INFO Header.");
76+ infoheader = (DATA_Format_BMP_InformationHeader *)(bmp + 0x0e);
77+ if(infoheader->ysize > 0){
78+ //Drawing_Put_String(vram, xsize, x, y + 16 * 2, 0x000000, "Bottom Up.");
79+ } else{
80+ Drawing_Put_String(vram, xsize, x, y + 16 * 2, 0x000000, "Top Down (not implemented).");
81+ return 5;
82+ }
83+
84+ if(infoheader->compression_type == 0){
85+ //Drawing_Put_String(vram, xsize, x, y + 16 * 3, 0x000000, "No compression.");
86+ } else{
87+ Drawing_Put_String(vram, xsize, x, y + 16 * 3, 0x000000, "Compressed (not implemented).");
88+ return 4;
89+ }
90+
91+ if(infoheader->bpp == 24){
92+ //Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, "24 bpp.");
93+ } else{
94+ snprintf(s, "%d bpp(not implemented).", sizeof(s), infoheader->bpp);
95+ Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, s);
96+ return 6;
97+ }
98+
99+ //snprintf(s, "xsize:%d ysize:%d", sizeof(s), infoheader->xsize, infoheader->ysize);
100+ //Drawing_Put_String(vram, xsize, x, y + 16 * 5, 0x000000, s);
101+
102+ rgb24 = (DATA_Format_BMP_RGB24 *)(bmp + offset_to_data);
103+
104+ for(iy = infoheader->ysize; iy > 0; iy--){
105+ for(ix = 0; ix < infoheader->xsize; ix++){
106+ Drawing_Draw_Point(vram, xsize, x + ix, y + iy - 1, rgb24->r << 16 | rgb24->g << 8 | rgb24->b);
107+ rgb24 = (DATA_Format_BMP_RGB24 *)((uint)rgb24 + 3);
108+ }
109+ rgb24 = (DATA_Format_BMP_RGB24 *)((uint)rgb24 + ((infoheader->xsize + 3) & ~3) - infoheader->xsize);
110+ }
111+ } else{
112+ Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "Unknown BMP Header.");
113+ return 3;
114+ }
115+
116+ return 0;
117+}
--- beta/tolset_chn_000/chnos_010/chnos/makeset.txt (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/makeset.txt (revision 309)
@@ -1,3 +1,3 @@
11
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
2+OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj chnlogo.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 fmt_bmp.obj intrpt.obj keyboard.obj memory.obj mtask.obj serial.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/drawing.c (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/drawing.c (revision 309)
@@ -1,8 +1,9 @@
11
22 #include "core.h"
33
4+void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
45 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);
6+void (*Drawing_Draw_Point)(void *vram, uint xsize, uint x, uint y, uint c);
67
78 void Initialise_Drawing(void)
89 {
@@ -11,17 +12,21 @@
1112 dispctrl = System_Display_Get_Controller();
1213
1314 if(dispctrl->bpp == 8){
15+ Drawing_Fill_Rectangle = Drawing08_Fill_Rectangle;
1416 Drawing_Put_String = Drawing08_Put_String;
15- Drawing_Fill_Rectangle = Drawing08_Fill_Rectangle;
17+ Drawing_Draw_Point = Drawing08_Draw_Point;
1618 } else if(dispctrl->bpp == 16){
19+ Drawing_Fill_Rectangle = Drawing16_Fill_Rectangle;
1720 Drawing_Put_String = Drawing16_Put_String;
18- Drawing_Fill_Rectangle = Drawing16_Fill_Rectangle;
21+ Drawing_Draw_Point = Drawing16_Draw_Point;
1922 } else if(dispctrl->bpp == 32){
23+ Drawing_Fill_Rectangle = Drawing32_Fill_Rectangle;
2024 Drawing_Put_String = Drawing32_Put_String;
21- Drawing_Fill_Rectangle = Drawing32_Fill_Rectangle;
25+ Drawing_Draw_Point = Drawing32_Draw_Point;
2226 } else{
27+ Drawing_Fill_Rectangle = Drawing_Invalid_Fill_Rectangle;
2328 Drawing_Put_String = Drawing_Invalid_Put_String;
24- Drawing_Fill_Rectangle = Drawing_Invalid_Fill_Rectangle;
29+ Drawing_Draw_Point = Drawing_Invalid_Draw_Point;
2530 #ifdef CHNOSPROJECT_DEBUG_DRAWING
2631 debug("Initalise_Drawing:Not implemented %d bpp.\n", dispctrl->bpp);
2732 #endif
@@ -29,6 +34,14 @@
2934 return;
3035 }
3136
37+void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
38+{
39+ #ifdef CHNOSPROJECT_DEBUG_DRAWING
40+ 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);
41+ #endif
42+ return;
43+}
44+
3245 void Drawing_Invalid_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s)
3346 {
3447 #ifdef CHNOSPROJECT_DEBUG_DRAWING
@@ -36,10 +49,11 @@
3649 #endif
3750 return;
3851 }
39-void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)
52+
53+void Drawing_Invalid_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)
4054 {
4155 #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);
56+ debug("Drawing_Invalid_Draw_Point:[0x%X] xsize:%d (%d, %d) color:0x%X\n", vram, xsize, x, y, c);
4357 #endif
4458 return;
4559 }
--- beta/tolset_chn_000/chnos_010/chnos/Makefile (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/Makefile (revision 309)
@@ -39,6 +39,9 @@
3939 hankaku.obj : hankaku.bin Makefile
4040 $(BIN2OBJ) hankaku.bin hankaku.obj _hankaku
4141
42+chnlogo.obj : chnlogo.bmp Makefile
43+ $(BIN2OBJ) chnlogo.bmp chnlogo.obj _chnlogo
44+
4245 asmhead.bin : asmhead.nas Makefile
4346 $(NASK) asmhead.nas asmhead.bin asmhead.lst
4447
--- beta/tolset_chn_000/chnos_010/chnos/core.h (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/core.h (revision 309)
@@ -45,22 +45,27 @@
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);
4747 void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
48+void Drawing08_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
4849
4950 /*draw16.c 16bit描画関連*/
5051 void Drawing16_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
5152 void Drawing16_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
5253 void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
54+void Drawing16_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
5355
5456 /*draw32.c 32bit描画関連*/
5557 void Drawing32_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
5658 void Drawing32_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);
5759 void Drawing32_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);
60+void Drawing32_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
5861
5962 /*drawing.c 描画関連*/
63+extern void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
6064 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);
65+extern void (*Drawing_Draw_Point)(void *vram, uint xsize, uint x, uint y, uint c);
6266 void Drawing_Invalid_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);
6367 void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);
68+void Drawing_Invalid_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);
6469 void Initialise_Drawing(void);
6570 uchar RGB_32_To_08(uint c32);
6671 uchar RGB_32_To_08_xy(uint c32, int x, int y);
@@ -153,6 +158,9 @@
153158 uint FIFO32_MyTaskFIFO_Status(void);
154159 uint FIFO32_MyTaskFIFO_Get(void);
155160
161+/*fmt_bmp.c ビットマップ描画関連*/
162+uint Format_BMP_DrawPicture(void *vram, uint xsize, uint x, uint y, uint pxsize, uint pysize, void *bmp);
163+
156164 /*intrpt.c 割り込み関連*/
157165 void Initialise_ProgrammableInterruptController(void);
158166 void ProgrammableInterruptController_InterruptMask_Clear(uint irq);
--- beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 309)
@@ -84,6 +84,8 @@
8484 Drawing_Fill_Rectangle(disp_ctrl->vram, disp_ctrl->xsize, 0xffffff, 0, 0, disp_ctrl->xsize - 1, disp_ctrl->ysize - 1);
8585 Drawing_Put_String(disp_ctrl->vram, disp_ctrl->xsize, 10, 10, 0x000000, "Welcome to CHNOSProject!");
8686
87+ Format_BMP_DrawPicture(disp_ctrl->vram, disp_ctrl->xsize, 10, 26, 0, 0, chnlogo);
88+
8789 for(;;){
8890
8991 }
--- beta/tolset_chn_000/chnos_010/chnos/draw32.c (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/draw32.c (revision 309)
@@ -43,3 +43,9 @@
4343 }
4444 return;
4545 }
46+
47+void Drawing32_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)
48+{
49+ ((uint *)vram)[y * xsize + x] = c;
50+ return;
51+}
--- beta/tolset_chn_000/chnos_010/chnos/draw16.c (revision 308)
+++ beta/tolset_chn_000/chnos_010/chnos/draw16.c (revision 309)
@@ -45,3 +45,9 @@
4545 }
4646 return;
4747 }
48+
49+void Drawing16_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)
50+{
51+ ((ushort *)vram)[y * xsize + x] = RGB_32_To_16(c);
52+ return;
53+}
旧リポジトリブラウザで表示