• R/O
  • SSH
  • HTTPS

chnosproject: Commit


Commit MetaInfo

Revisión74 (tree)
Tiempo2010-03-20 14:48:05
Autorhikarupsp

Log Message

重ね合わせ処理完了!!!!!!多分。
多色対応はとりあえず棚上げ。
32ビットモードのみ対応。

Cambiar Resumen

Diferencia incremental

--- beta/tolset_chn_000/chnos_006/bootpack.c (revision 73)
+++ beta/tolset_chn_000/chnos_006/bootpack.c (revision 74)
@@ -8,9 +8,11 @@
88 struct FIFO32 sysfifo;
99 struct MOUSE_DECODE mdec;
1010 struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
11+ struct SHEET32 *sht_back, *sht_mouse;
1112 int fifobuf[256], i = 0,time_tick,mx = binfo->scrnx / 2, my = binfo->scrny / 2;
1213 unsigned int all_mem_size = memtest(0x00400000, 0xbffffffff);
1314 unsigned int free_mem_size = 0;
15+ unsigned int *buf_back, buf_mouse[576];
1416
1517 init_gdtidt();
1618 init_pic();
@@ -17,9 +19,9 @@
1719 io_sti();
1820
1921 memman_init(memman);
20- memman_free(0x00001000,0x0009e000);
22+// memman_free(0x00001000,0x0009e000);
2123 memman_free(0x00400000,all_mem_size - 0x00400000);
22- init_scrn_i(vinfo->PhysBasePtr, binfo->scrnx, binfo->scrny, vinfo->BitsPerPixel);
24+
2325 fifo32_init(&sysfifo, 256, fifobuf);
2426 init_keyboard(&sysfifo, SYSFIFO_KEYB);
2527 init_mouse(&sysfifo, SYSFIFO_MOUSE, &mdec);
@@ -27,12 +29,28 @@
2729 init_sheets(vinfo->PhysBasePtr,binfo->scrnx,binfo->scrny);
2830 pit_beep_off();
2931
30- circle_i(vinfo->PhysBasePtr, binfo->scrnx/2, binfo->scrny/2, 0xff0000, binfo->scrnx, 100);
3132
33+ sht_back = sheet_alloc();
34+ sht_mouse = sheet_alloc();
35+ buf_back = (unsigned int *) memman_alloc_4k(vinfo->BankSize * 1024);
36+ sheet_setbuf(sht_back, buf_back, binfo->scrnx, binfo->scrny, VOID_INV_COL32);
37+ sheet_setbuf(sht_mouse, buf_mouse, 24, 24, INV_COL32);
38+ boxfill32(buf_back, binfo->scrnx, 0x000000, 0,0,binfo->scrnx, binfo->scrny);
39+ init_scrn_i(buf_back, binfo->scrnx, binfo->scrny, vinfo->BitsPerPixel,buf_mouse);
40+ sheet_slide(sht_back, 0,0);
41+ sheet_slide(sht_mouse, mx, my);
42+ sheet_updown(sht_back, 0);
43+ sheet_updown(sht_mouse, 1);
44+
45+
46+ circle_i(buf_back, binfo->scrnx/2, binfo->scrny/2, 0xff0000, binfo->scrnx, 100);
47+
3248 sprintf(s,"memory %d Byte(%d KB,%d MB)",all_mem_size,all_mem_size/1024, all_mem_size/(1024*1024));
33- boxfill_i(vinfo->PhysBasePtr, binfo->scrnx, 0x000000, 0,304,INT_MONITOR_LONG,320);
34- putfonts_asc_i(vinfo->PhysBasePtr, binfo->scrnx, 0,304,0xffffff,s);
49+ boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,304,INT_MONITOR_LONG,320);
50+ putfonts_asc_i(buf_back, binfo->scrnx, 0,304,0xffffff,s);
51+ sheet_refresh(sht_back, 0, 0, binfo->scrnx, binfo->scrny);
3552
53+
3654 for (;;){
3755 io_cli();
3856 if(fifo32_status(&sysfifo) == 0) {
@@ -39,9 +57,8 @@
3957
4058 free_mem_size = memman_free_total();
4159 sprintf(s,"free %d Byte(%d KB,%d MB)",free_mem_size,free_mem_size/1024, free_mem_size/(1024*1024));
42- boxfill_i(vinfo->PhysBasePtr, binfo->scrnx, 0x000000, 0,320,INT_MONITOR_LONG,336);
43- putfonts_asc_i(vinfo->PhysBasePtr, binfo->scrnx, 0,320,0xffffff,s);
44-
60+ boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,320,INT_MONITOR_LONG,336);
61+ putfonts_asc_i(buf_back, binfo->scrnx, 0,320,0xffffff,s);
4562 io_stihlt();
4663 } else {
4764 i = fifo32_get(&sysfifo);
@@ -49,26 +66,25 @@
4966 if( 256 <= i && i <=511) {
5067 i -= SYSFIFO_KEYB;
5168 io_sti();
52- boxfill_i(vinfo->PhysBasePtr, binfo->scrnx, 0x000000, 0,240,INT_MONITOR_LONG , 256);
69+ boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,240,INT_MONITOR_LONG , 256);
5370 sprintf(s,"INT 21(IRQ-1) : PS/2 キーボード%02X",i);
54- putfonts_asc_i(vinfo->PhysBasePtr, binfo->scrnx, 0,240,0xffffff,s);
55-
71+ putfonts_asc_i(buf_back, binfo->scrnx, 0,240,0xffffff,s);
72+ sheet_refresh(sht_back, 0,240,INT_MONITOR_LONG , 256);
73+
5674 } else if(512 <= i && i <= 767) {
5775 i -= SYSFIFO_MOUSE;
5876 io_sti();
5977 if (decode_mouse(i) == 1) {
60- boxfill_i(vinfo->PhysBasePtr, binfo->scrnx, 0x000000, 0,256,INT_MONITOR_LONG , 272);
78+ boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,256,INT_MONITOR_LONG , 272);
6179 sprintf(s,"INT 2C(IRQ-12) : PS/2 マウス(%02X,%02X,%02X)",mdec.buf[0], mdec.buf[1], mdec.buf[2]);
62- putfonts_asc_i(vinfo->PhysBasePtr, binfo->scrnx, 0,256,0xffffff,s);
80+ putfonts_asc_i(buf_back, binfo->scrnx, 0,256,0xffffff,s);
6381
64- boxfill_i(vinfo->PhysBasePtr, binfo->scrnx,DESKTOP_COL32,mx,my,mx + 32, my + 32);
65-
66- boxfill_i(vinfo->PhysBasePtr, binfo->scrnx, 0x000000, 0,272,INT_MONITOR_LONG , 288);
82+ boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,272,INT_MONITOR_LONG , 288);
6783 sprintf(s,"[lcr %4d %4d]",mdec.x, mdec.y);
6884 if((mdec.btn & 0x01) != 0) s[1] = 'L';
6985 if((mdec.btn & 0x02) != 0) s[3] = 'R';
7086 if((mdec.btn & 0x04) != 0) s[2] = 'C';
71- putfonts_asc_i(vinfo->PhysBasePtr, binfo->scrnx, 0,272,0xffffff,s);
87+ putfonts_asc_i(buf_back, binfo->scrnx, 0,272,0xffffff,s);
7288 mx += mdec.x;
7389 my += mdec.y;
7490 if(mx < 0) mx = 0;
@@ -76,10 +92,11 @@
7692 if(mx > binfo->scrnx - 24) mx = binfo->scrnx - 24;
7793 if(my > binfo->scrny - 24) my = binfo->scrny - 24;
7894
79- draw_mouse_i(vinfo->PhysBasePtr, mx, my, binfo->scrnx);
80- boxfill_i(vinfo->PhysBasePtr, binfo->scrnx, 0x000000, 0,288,INT_MONITOR_LONG,304);
95+ sheet_slide(sht_mouse, mx,my);
96+ boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,288,INT_MONITOR_LONG,304);
8197 sprintf(s,"(%4d,%4d)",mx,my);
82- putfonts_asc_i(vinfo->PhysBasePtr, binfo->scrnx, 0,288,0xffffff,s);
98+ putfonts_asc_i(buf_back, binfo->scrnx, 0,288,0xffffff,s);
99+ sheet_refresh(sht_back, 0, 256, INT_MONITOR_LONG, 336);
83100 }
84101 }
85102 }
--- beta/tolset_chn_000/chnos_006/sheet.c (revision 73)
+++ beta/tolset_chn_000/chnos_006/sheet.c (revision 74)
@@ -34,7 +34,7 @@
3434 return 0;
3535 }
3636
37-void sheet_setbuf(struct SHEET32 *sht,unsigned int *buf,int xsize, int ysize, int col_inv)
37+void sheet_setbuf(struct SHEET32 *sht,unsigned int *buf,int xsize, int ysize, unsigned int col_inv)
3838 {
3939 sht->buf = buf;
4040 sht->bxsize = xsize;
@@ -42,3 +42,103 @@
4242 sht->col_inv = col_inv;
4343 return;
4444 }
45+
46+void sheet_updown(struct SHEET32 *sht,int height)
47+{
48+ int h, old = sht->height;
49+ if(height > ctl->top + 1) height = ctl->top + 1;
50+ if (height < -1) height = -1;
51+ sht->height = height;
52+
53+ if (old > height){ /*以前よりも低くなる場合*/
54+ if (height >= 0){
55+ for (h = old; h > height; h--){
56+ ctl->sheets[h] = ctl->sheets[h - 1];
57+ ctl->sheets[h]->height = h;
58+ }
59+ ctl->sheets[height] = sht;
60+ } else { /*非表示になる場合*/
61+ if(ctl->top > old){
62+ for(h = old; h < ctl->top; h++){
63+ ctl->sheets[h] = ctl->sheets[h + 1];
64+ ctl->sheets[h]->height = h;
65+ }
66+ }
67+ ctl->top--;
68+ }
69+ sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize);
70+ } else if(old < height) { /*以前よりも高くなる場合*/
71+ if(old >= 0){
72+ for(h = old; h < height; h++){
73+ ctl->sheets[h] = ctl->sheets[h + 1];
74+ ctl->sheets[h]->height = h;
75+ }
76+ ctl->sheets[height]= sht;
77+ } else {
78+ for(h = ctl->top; h >= height; h--){
79+ ctl->sheets[h + 1] = ctl->sheets[h];
80+ ctl->sheets[h + 1]->height = h;
81+ }
82+ ctl->sheets[height] = sht;
83+ ctl->top++;
84+ }
85+ sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize);
86+ }
87+ return;
88+}
89+
90+void sheet_refresh(struct SHEET32 *sht, int bx0, int by0, int bx1, int by1)
91+{
92+ if(sht->height >= 0){
93+ sheet_refreshsub(sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1 );
94+ }
95+ return;
96+}
97+
98+void sheet_slide(struct SHEET32 *sht, int vx0, int vy0)
99+{
100+ int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
101+ sht->vx0 = vx0;
102+ sht->vy0 = vy0;
103+ if(sht->height >= 0) {
104+ sheet_refreshsub(old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize);
105+ sheet_refreshsub(vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize);
106+ }
107+ return;
108+}
109+
110+void sheet_free(struct SHEET32 *sht)
111+{
112+ if(sht->height >= 0) sheet_updown(sht, -1);
113+ sht->flags = 0;
114+ return;
115+}
116+
117+void sheet_refreshsub(int vx0, int vy0, int vx1, int vy1)
118+{
119+ int h, bx, by, vx, vy, bx0, by0, bx1, by1;
120+ unsigned int *buf, c, *vram = ctl->vram;
121+ struct SHEET32 *sht;
122+ for(h = 0; h <= ctl->top; h++){
123+ sht = ctl->sheets[h];
124+ buf = sht->buf;
125+ bx0 = vx0 - sht->vx0;
126+ by0 = vy0 - sht->vy0;
127+ bx1 = vx1 - sht->vx0;
128+ by1 = vy1 - sht->vy0;
129+ if(bx0 < 0) bx0 = 0;
130+ if(by0 < 0) by0 = 0;
131+ if(bx1 > sht->bxsize) bx1 = sht->bxsize;
132+ if(by1 > sht->bysize) by1 = sht->bysize;
133+ for(by = by0; by < by1; by++){
134+ vy = sht->vy0 + by;
135+ for(bx = bx0; bx < bx1; bx++){
136+ vx = sht->vx0 + bx;
137+ c = buf[by * sht->bxsize + bx];
138+ if(c != sht->col_inv) vram[vy * ctl->xsize + vx] = c;
139+ }
140+ }
141+ }
142+ return;
143+}
144+
--- beta/tolset_chn_000/chnos_006/graphic.c (revision 73)
+++ beta/tolset_chn_000/chnos_006/graphic.c (revision 74)
@@ -41,9 +41,8 @@
4141 };
4242
4343 /*拡張全モード対応版*/
44-void init_scrn_i(unsigned int *vrami, int xsize, int ysize, unsigned char bits)
44+void init_scrn_i(unsigned int *vrami, int xsize, int ysize, unsigned char bits, unsigned int *mousecur32)
4545 {
46- unsigned int mousecur32 [576];
4746 if(bits == 8){
4847 unsigned char *mousecur8 = (unsigned char *)mousecur32;
4948 unsigned char *vram8 = (unsigned char *)vrami;
@@ -93,26 +92,6 @@
9392 return;
9493 }
9594
96-void draw_mouse_i(unsigned int *vrami, int x, int y, int xsize)
97-{
98- struct VESAINFO *vinfo = (struct VESAINFO *) ADR_VESAINFO;
99- unsigned int mousecur32 [576];
100- if(vinfo->BitsPerPixel == 8){
101- unsigned char *mousecur8 = (unsigned char *)mousecur32;
102- unsigned char *vram8 = (unsigned char *)vrami;
103- init_mouse_cursor8(mousecur8, DESKTOP_COL8);
104- putblock8_8(vram8, xsize,24, 24, x, y, mousecur8, 24);
105- } else if(vinfo->BitsPerPixel == 16){
106- unsigned short *mousecur16 = (unsigned short *)mousecur32;
107- unsigned short *vram16 = (unsigned short *)vrami;
108- init_mouse_cursor16(mousecur16, DESKTOP_COL16);
109- putblock16_16(vram16, xsize,24, 24, x, y, mousecur16, 24);
110- } else if(vinfo->BitsPerPixel == 32){
111- init_mouse_cursor32(mousecur32, DESKTOP_COL32);
112- putblock32_32(vrami, xsize,24, 24, x, y, mousecur32, 24);
113- }
114- return;
115-}
11695 void boxfill_i(unsigned int *vrami, int xsize, unsigned int c, int x0, int y0, int x1, int y1)
11796 {
11897 struct VESAINFO *vinfo = (struct VESAINFO *) ADR_VESAINFO;
@@ -200,7 +179,7 @@
200179 x+=40;
201180 boxfill_i(vrami,xsize,0x00FFFF,x,y,x+40,y+40);
202181 x+=40;
203- boxfill_i(vrami,xsize,0xFFFFFF,x,y,x+40,y+40);
182+ boxfill_i(vrami,xsize,0xFFFFFe,x,y,x+40,y+40);
204183
205184 y+=40;
206185 x=0;
@@ -523,8 +502,8 @@
523502 putfonts32_asc(vram, xsize, 8, 8, 0xFFFFFF, "welcome to CHNOSProject! on 32bit video mode .");
524503 putfonts32_asc(vram, xsize, 8, 24, 0xFFFFFF, "ヨウコソ CHNOSプロジェクトヘ!");
525504 putfonts32_asc(vram, xsize, 8, 40, 0xFFFFFF, "カタコトデスガ ニホンゴガ カケルヨウニ ナリマシタ");
526- init_mouse_cursor32(mousecur, DESKTOP_COL32);
527- putblock32_32(vram, xsize, 24, 24, xsize/2, ysize/2, mousecur, 24);
505+ init_mouse_cursor32(mousecur);
506+
528507 return;
529508
530509 }
@@ -560,7 +539,7 @@
560539 return;
561540 }
562541
563-void init_mouse_cursor32(unsigned int *mouse, unsigned int bc)
542+void init_mouse_cursor32(unsigned int *mouse)
564543 {
565544 static char cursor[24][24] = {
566545 "***.....................",
@@ -599,7 +578,7 @@
599578 mouse[y * 24 + x] = 0xFFFFFF;
600579 }
601580 if (cursor[y][x] == '.') {
602- mouse[y * 24 + x] = bc;
581+ mouse[y * 24 + x] = INV_COL32;
603582 }
604583 }
605584 }
--- beta/tolset_chn_000/chnos_006/core.h (revision 73)
+++ beta/tolset_chn_000/chnos_006/core.h (revision 74)
@@ -67,6 +67,9 @@
6767 #define SYSFIFO_KEYB 0x100 /*256~511=keycode*/
6868 #define SYSFIFO_MOUSE 0x200 /*512~767=mouse*/
6969
70+#define INV_COL32 0xFFFFFFFF
71+#define VOID_INV_COL32 0xFEFFFFFF
72+
7073 #define DESKTOP_COL8 COL8_C6C6C6
7174 #define TASKBAR_COL8 COL8_0000FF
7275
@@ -113,8 +116,8 @@
113116 };
114117
115118 struct SHEET32 {
116- unsigned int *buf;
117- int bxsize,bysize,vx0,vy0,col_inv,height,flags;
119+ unsigned int *buf,col_inv;
120+ int bxsize,bysize,vx0,vy0,height,flags;
118121 };
119122
120123 struct FIFO32 {
@@ -217,7 +220,12 @@
217220
218221 void init_sheets(unsigned int *vram, int xsize, int ysize);
219222 struct SHEET32 *sheet_alloc(void);
220-void sheet_setbuf(struct SHEET32 *sht,unsigned int *buf,int xsize, int ysize, int col_inv );
223+void sheet_setbuf(struct SHEET32 *sht,unsigned int *buf,int xsize, int ysize, unsigned int col_inv );
224+void sheet_updown(struct SHEET32 *sht,int height);
225+void sheet_refresh(struct SHEET32 *sht, int bx0, int by0, int bx1, int by1);
226+void sheet_slide(struct SHEET32 *sht, int vx0, int vy0);
227+void sheet_free(struct SHEET32 *sht);
228+void sheet_refreshsub(int vx0, int vy0, int vx1, int vy1);
221229
222230 /*keyboard.c キーボード関係*/
223231 void init_keyboard(struct FIFO32 *fifo, int data0);
@@ -254,11 +262,10 @@
254262 void circle_i(unsigned int *vrami, int cx, int cy, unsigned int c, int xsize, int r);
255263 unsigned short rgb_int2short (unsigned int c32);
256264 unsigned char rgb_int2char(unsigned int c32);
257-void init_scrn_i(unsigned int *vram, int xsize, int ysize, unsigned char bits);
265+void init_scrn_i(unsigned int *vram, int xsize, int ysize, unsigned char bits, unsigned int *mousecur32);
258266 void boxfill_i(unsigned int *vrami, int xsize, unsigned int c, int x0, int y0, int x1, int y1);
259267 void col_pat_256safe(unsigned int *vrami, int xsize, int ysize);
260268 void putfonts_asc_i(unsigned int *vrami, int xsize, int x, int y, unsigned int ci, unsigned char *s);
261-void draw_mouse_i(unsigned int *vrami, int x, int y, int xsize);
262269 void point_i(unsigned int *vrami, int x, int y, unsigned int c32, int xsize);
263270
264271 /*8bits*/
@@ -285,7 +292,7 @@
285292 void init_scrn32(unsigned int *vram, int xsize, int ysize, unsigned int *mousecur);
286293 void putfont32(unsigned int *vram, int xsize, int x, int y, unsigned int c, unsigned char *font);
287294 void putfonts32_asc(unsigned int *vram, int xsize, int x, int y, unsigned int c, unsigned char *s);
288-void init_mouse_cursor32(unsigned int *mouse, unsigned int bc);
295+void init_mouse_cursor32(unsigned int *mouse);
289296 void putblock32_32(unsigned int *vram, int vxsize, int pxsize,int pysize, int px0, int py0, unsigned int *buf, int bxsize);
290297
291298
Show on old repository browser