重ね合わせ処理完了!!!!!!多分。
多色対応はとりあえず棚上げ。
32ビットモードのみ対応。
@@ -8,9 +8,11 @@ | ||
8 | 8 | struct FIFO32 sysfifo; |
9 | 9 | struct MOUSE_DECODE mdec; |
10 | 10 | struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; |
11 | + struct SHEET32 *sht_back, *sht_mouse; | |
11 | 12 | int fifobuf[256], i = 0,time_tick,mx = binfo->scrnx / 2, my = binfo->scrny / 2; |
12 | 13 | unsigned int all_mem_size = memtest(0x00400000, 0xbffffffff); |
13 | 14 | unsigned int free_mem_size = 0; |
15 | + unsigned int *buf_back, buf_mouse[576]; | |
14 | 16 | |
15 | 17 | init_gdtidt(); |
16 | 18 | init_pic(); |
@@ -17,9 +19,9 @@ | ||
17 | 19 | io_sti(); |
18 | 20 | |
19 | 21 | memman_init(memman); |
20 | - memman_free(0x00001000,0x0009e000); | |
22 | +// memman_free(0x00001000,0x0009e000); | |
21 | 23 | memman_free(0x00400000,all_mem_size - 0x00400000); |
22 | - init_scrn_i(vinfo->PhysBasePtr, binfo->scrnx, binfo->scrny, vinfo->BitsPerPixel); | |
24 | + | |
23 | 25 | fifo32_init(&sysfifo, 256, fifobuf); |
24 | 26 | init_keyboard(&sysfifo, SYSFIFO_KEYB); |
25 | 27 | init_mouse(&sysfifo, SYSFIFO_MOUSE, &mdec); |
@@ -27,12 +29,28 @@ | ||
27 | 29 | init_sheets(vinfo->PhysBasePtr,binfo->scrnx,binfo->scrny); |
28 | 30 | pit_beep_off(); |
29 | 31 | |
30 | - circle_i(vinfo->PhysBasePtr, binfo->scrnx/2, binfo->scrny/2, 0xff0000, binfo->scrnx, 100); | |
31 | 32 | |
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 | + | |
32 | 48 | 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); | |
35 | 52 | |
53 | + | |
36 | 54 | for (;;){ |
37 | 55 | io_cli(); |
38 | 56 | if(fifo32_status(&sysfifo) == 0) { |
@@ -39,9 +57,8 @@ | ||
39 | 57 | |
40 | 58 | free_mem_size = memman_free_total(); |
41 | 59 | 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); | |
45 | 62 | io_stihlt(); |
46 | 63 | } else { |
47 | 64 | i = fifo32_get(&sysfifo); |
@@ -49,26 +66,25 @@ | ||
49 | 66 | if( 256 <= i && i <=511) { |
50 | 67 | i -= SYSFIFO_KEYB; |
51 | 68 | 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); | |
53 | 70 | 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 | + | |
56 | 74 | } else if(512 <= i && i <= 767) { |
57 | 75 | i -= SYSFIFO_MOUSE; |
58 | 76 | io_sti(); |
59 | 77 | 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); | |
61 | 79 | 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); | |
63 | 81 | |
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); | |
67 | 83 | sprintf(s,"[lcr %4d %4d]",mdec.x, mdec.y); |
68 | 84 | if((mdec.btn & 0x01) != 0) s[1] = 'L'; |
69 | 85 | if((mdec.btn & 0x02) != 0) s[3] = 'R'; |
70 | 86 | 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); | |
72 | 88 | mx += mdec.x; |
73 | 89 | my += mdec.y; |
74 | 90 | if(mx < 0) mx = 0; |
@@ -76,10 +92,11 @@ | ||
76 | 92 | if(mx > binfo->scrnx - 24) mx = binfo->scrnx - 24; |
77 | 93 | if(my > binfo->scrny - 24) my = binfo->scrny - 24; |
78 | 94 | |
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); | |
81 | 97 | 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); | |
83 | 100 | } |
84 | 101 | } |
85 | 102 | } |
@@ -34,7 +34,7 @@ | ||
34 | 34 | return 0; |
35 | 35 | } |
36 | 36 | |
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) | |
38 | 38 | { |
39 | 39 | sht->buf = buf; |
40 | 40 | sht->bxsize = xsize; |
@@ -42,3 +42,103 @@ | ||
42 | 42 | sht->col_inv = col_inv; |
43 | 43 | return; |
44 | 44 | } |
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 | + |
@@ -41,9 +41,8 @@ | ||
41 | 41 | }; |
42 | 42 | |
43 | 43 | /*拡張全モード対応版*/ |
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) | |
45 | 45 | { |
46 | - unsigned int mousecur32 [576]; | |
47 | 46 | if(bits == 8){ |
48 | 47 | unsigned char *mousecur8 = (unsigned char *)mousecur32; |
49 | 48 | unsigned char *vram8 = (unsigned char *)vrami; |
@@ -93,26 +92,6 @@ | ||
93 | 92 | return; |
94 | 93 | } |
95 | 94 | |
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 | -} | |
116 | 95 | void boxfill_i(unsigned int *vrami, int xsize, unsigned int c, int x0, int y0, int x1, int y1) |
117 | 96 | { |
118 | 97 | struct VESAINFO *vinfo = (struct VESAINFO *) ADR_VESAINFO; |
@@ -200,7 +179,7 @@ | ||
200 | 179 | x+=40; |
201 | 180 | boxfill_i(vrami,xsize,0x00FFFF,x,y,x+40,y+40); |
202 | 181 | 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); | |
204 | 183 | |
205 | 184 | y+=40; |
206 | 185 | x=0; |
@@ -523,8 +502,8 @@ | ||
523 | 502 | putfonts32_asc(vram, xsize, 8, 8, 0xFFFFFF, "welcome to CHNOSProject! on 32bit video mode ."); |
524 | 503 | putfonts32_asc(vram, xsize, 8, 24, 0xFFFFFF, "ヨウコソ CHNOSプロジェクトヘ!"); |
525 | 504 | 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 | + | |
528 | 507 | return; |
529 | 508 | |
530 | 509 | } |
@@ -560,7 +539,7 @@ | ||
560 | 539 | return; |
561 | 540 | } |
562 | 541 | |
563 | -void init_mouse_cursor32(unsigned int *mouse, unsigned int bc) | |
542 | +void init_mouse_cursor32(unsigned int *mouse) | |
564 | 543 | { |
565 | 544 | static char cursor[24][24] = { |
566 | 545 | "***.....................", |
@@ -599,7 +578,7 @@ | ||
599 | 578 | mouse[y * 24 + x] = 0xFFFFFF; |
600 | 579 | } |
601 | 580 | if (cursor[y][x] == '.') { |
602 | - mouse[y * 24 + x] = bc; | |
581 | + mouse[y * 24 + x] = INV_COL32; | |
603 | 582 | } |
604 | 583 | } |
605 | 584 | } |
@@ -67,6 +67,9 @@ | ||
67 | 67 | #define SYSFIFO_KEYB 0x100 /*256~511=keycode*/ |
68 | 68 | #define SYSFIFO_MOUSE 0x200 /*512~767=mouse*/ |
69 | 69 | |
70 | +#define INV_COL32 0xFFFFFFFF | |
71 | +#define VOID_INV_COL32 0xFEFFFFFF | |
72 | + | |
70 | 73 | #define DESKTOP_COL8 COL8_C6C6C6 |
71 | 74 | #define TASKBAR_COL8 COL8_0000FF |
72 | 75 |
@@ -113,8 +116,8 @@ | ||
113 | 116 | }; |
114 | 117 | |
115 | 118 | 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; | |
118 | 121 | }; |
119 | 122 | |
120 | 123 | struct FIFO32 { |
@@ -217,7 +220,12 @@ | ||
217 | 220 | |
218 | 221 | void init_sheets(unsigned int *vram, int xsize, int ysize); |
219 | 222 | 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); | |
221 | 229 | |
222 | 230 | /*keyboard.c キーボード関係*/ |
223 | 231 | void init_keyboard(struct FIFO32 *fifo, int data0); |
@@ -254,11 +262,10 @@ | ||
254 | 262 | void circle_i(unsigned int *vrami, int cx, int cy, unsigned int c, int xsize, int r); |
255 | 263 | unsigned short rgb_int2short (unsigned int c32); |
256 | 264 | 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); | |
258 | 266 | void boxfill_i(unsigned int *vrami, int xsize, unsigned int c, int x0, int y0, int x1, int y1); |
259 | 267 | void col_pat_256safe(unsigned int *vrami, int xsize, int ysize); |
260 | 268 | 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); | |
262 | 269 | void point_i(unsigned int *vrami, int x, int y, unsigned int c32, int xsize); |
263 | 270 | |
264 | 271 | /*8bits*/ |
@@ -285,7 +292,7 @@ | ||
285 | 292 | void init_scrn32(unsigned int *vram, int xsize, int ysize, unsigned int *mousecur); |
286 | 293 | void putfont32(unsigned int *vram, int xsize, int x, int y, unsigned int c, unsigned char *font); |
287 | 294 | 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); | |
289 | 296 | void putblock32_32(unsigned int *vram, int vxsize, int pxsize,int pysize, int px0, int py0, unsigned int *buf, int bxsize); |
290 | 297 | |
291 | 298 |