とりあえず描画系はそろえた。
タスクバーの描写と、boxfillの動作を変更した。
メモリの使用可能領域も、頭のほうにページディレクトリ、テーブルが、後ろにはsystem構造体が置いてあるので、そのあたりも変更した。
タイマーなどはまだない。
とりあえず、前回と同じく多色対応はできている。
@@ -5,6 +5,9 @@ | ||
5 | 5 | { |
6 | 6 | int x, y; |
7 | 7 | |
8 | + y1 -= 1; | |
9 | + x1 -= 1; | |
10 | + | |
8 | 11 | for (y = y0;y <= y1;y++) { |
9 | 12 | for (x = x0; x <= x1; x++) |
10 | 13 | vram[y * xsize + x] = c; |
@@ -15,9 +18,6 @@ | ||
15 | 18 | void init_desktop16(ushort *vram, uint xsize, uint ysize) |
16 | 19 | { |
17 | 20 | boxfill16(vram, xsize, DESKTOP_COL16, 0, 0, xsize, ysize); |
18 | - putfonts16_asc(vram, xsize, 168, 8, RGB16(31,62,31), "welcome to CHNOSProject! on 16bit video mode ."); | |
19 | - putfonts16_asc(vram, xsize, 168, 24, RGB16(31,62,31), "ヨウコソ CHNOSプロジェクトヘ!"); | |
20 | - putfonts16_asc(vram, xsize, 168, 40, RGB16(31,62,31), "カタコトデスガ ニホンゴガ カケルヨウニ ナリマシタ"); | |
21 | 21 | |
22 | 22 | return; |
23 | 23 | } |
@@ -24,9 +24,9 @@ | ||
24 | 24 | |
25 | 25 | void init_taskbar16(ushort *vram, uint xsize) |
26 | 26 | { |
27 | - boxfill16(vram, xsize, TASKBAR_COL16, 0, 0, xsize, TASKBAR_HEIGHT); | |
28 | - boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize, 1); | |
29 | - boxfill16(vram, xsize, RGB16(31,62,31), xsize-2, 0, xsize, TASKBAR_HEIGHT); | |
27 | + boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize, TASKBAR_HEIGHT); | |
28 | + boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize - 2, TASKBAR_HEIGHT - 2); | |
29 | + boxfill16(vram, xsize, TASKBAR_COL16, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2); | |
30 | 30 | |
31 | 31 | return; |
32 | 32 | } |
@@ -5,6 +5,9 @@ | ||
5 | 5 | { |
6 | 6 | int x, y; |
7 | 7 | |
8 | + y1 -= 1; | |
9 | + x1 -= 1; | |
10 | + | |
8 | 11 | for (y = y0; y <= y1; y++) { |
9 | 12 | for (x = x0; x <= x1; x++) |
10 | 13 | vram[y * xsize + x] = c; |
@@ -16,9 +19,6 @@ | ||
16 | 19 | void init_desktop8(uchar *vram, uint xsize, uint ysize) |
17 | 20 | { |
18 | 21 | boxfill8(vram, xsize, DESKTOP_COL8, 0, 0, xsize, ysize); |
19 | - putfonts8_asc(vram, xsize, 168, 8, COL8_FFFFFF, "welcome to CHNOSProject! on 8bit video mode ."); | |
20 | - putfonts8_asc(vram, xsize, 168, 24, COL8_FFFFFF, "ヨウコソ CHNOSプロジェクトヘ!"); | |
21 | - putfonts8_asc(vram, xsize, 168, 40, COL8_FFFFFF, "カタコトデスガ ニホンゴガ カケルヨウニ ナリマシタ"); | |
22 | 22 | |
23 | 23 | return; |
24 | 24 | } |
@@ -25,9 +25,9 @@ | ||
25 | 25 | |
26 | 26 | void init_taskbar8(uchar *vram, uint xsize) |
27 | 27 | { |
28 | - boxfill8(vram, xsize, TASKBAR_COL8, 0, 0, xsize, TASKBAR_HEIGHT); | |
29 | - boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize, 1); | |
30 | - boxfill8(vram, xsize, COL8_FFFFFF, xsize-2, 0, xsize, TASKBAR_HEIGHT); | |
28 | + boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize, TASKBAR_HEIGHT); | |
29 | + boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize - 2, TASKBAR_HEIGHT - 2); | |
30 | + boxfill8(vram, xsize, TASKBAR_COL8, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2); | |
31 | 31 | |
32 | 32 | return; |
33 | 33 | } |
@@ -9,14 +9,16 @@ | ||
9 | 9 | |
10 | 10 | init_system(); |
11 | 11 | |
12 | - col_pat(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, system.data.info.boot.scrny); | |
13 | - draw_chnos_logo(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, system.data.info.boot.scrnx >> 4, system.data.info.boot.scrnx >> 1, (system.data.info.boot.scrny >> 1) - (system.data.info.boot.scrny / 10)); | |
12 | + init_screen_i(system.draw.sht.desktop_buf, system.draw.sht.taskbar_buf, system.draw.sht.mouse_buf); | |
14 | 13 | |
15 | - sprintf(s, "Welcome to CHNOS Project Paging-Test-Version."); | |
16 | - putfonts_asc_i(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 0, 0xFFFFFF, s); | |
14 | + boxfill_i(system.draw.sht.core_buf, system.data.info.boot.scrnx, 0x000000, 0, 0, system.data.info.boot.scrnx, system.data.info.boot.scrny); | |
15 | + draw_chnos_logo(system.draw.sht.core_buf, system.data.info.boot.scrnx, system.data.info.boot.scrnx >> 4, system.data.info.boot.scrnx >> 1, (system.data.info.boot.scrny >> 1) - (system.data.info.boot.scrny / 10)); | |
16 | + sheet_updown(system.draw.sht.core, 0); | |
17 | 17 | |
18 | - sprintf(s, "Physical-Memory:%dMB(%dKB) Free_Total:%dMB(%dKB)", system.io.mem.total >> 20, system.io.mem.total >> 10, sys_memman_free_total() >> 20, sys_memman_free_total() >> 10); | |
19 | - putfonts_asc_i(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 16, 0xFFFFFF, s); | |
18 | + sheet_updown(system.draw.sht.core, -1); | |
19 | + sheet_updown(system.draw.sht.desktop, 0); | |
20 | + sheet_updown(system.draw.sht.taskbar, 1); | |
21 | + sheet_updown(system.draw.sht.mouse, 2); | |
20 | 22 | |
21 | 23 | for(;;){ |
22 | 24 | io_hlt(); |
@@ -20,11 +20,38 @@ | ||
20 | 20 | system.data.info.vesa = *vesa; |
21 | 21 | system.data.info.boot = *boot; |
22 | 22 | |
23 | + init_serial(); | |
23 | 24 | init_gdtidt(); |
24 | 25 | init_paging(); |
25 | 26 | sys_memman_init(); |
26 | - sys_memman_free((void *)0x00400000, system.io.mem.total - sizeof(struct SYSTEM) - 0x00400000); | |
27 | - init_serial(); | |
27 | + sys_memman_free((void *)(0x00400000 + (1024 * 4) + (1024 * 1024 * 4)), system.io.mem.total - sizeof(struct SYSTEM) - 0x00400000) - (1024 * 4) - (1024 * 1024 * 4); | |
28 | + init_sheets(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, system.data.info.boot.scrny, system.data.info.vesa.BitsPerPixel); | |
28 | 29 | |
30 | + | |
31 | + system.draw.sht.core = sheet_alloc(); | |
32 | + system.draw.sht.desktop = sheet_alloc(); | |
33 | + system.draw.sht.taskbar = sheet_alloc(); | |
34 | + system.draw.sht.mouse = sheet_alloc(); | |
35 | + | |
36 | + system.draw.sht.core_buf = sys_memman_alloc(system.data.info.boot.scrnx * system.data.info.boot.scrny * (system.data.info.vesa.BitsPerPixel >> 3)); | |
37 | + system.draw.sht.desktop_buf = sys_memman_alloc(system.data.info.boot.scrnx * system.data.info.boot.scrny * (system.data.info.vesa.BitsPerPixel >> 3)); | |
38 | + system.draw.sht.taskbar_buf = sys_memman_alloc(system.data.info.boot.scrnx * TASKBAR_HEIGHT * (system.data.info.vesa.BitsPerPixel >> 3)); | |
39 | + system.draw.sht.mouse_buf = sys_memman_alloc(24 * 24 * (system.data.info.vesa.BitsPerPixel >> 3)); | |
40 | + | |
41 | + | |
42 | + sheet_setbuf(system.draw.sht.desktop, system.draw.sht.desktop_buf, system.data.info.boot.scrnx, system.data.info.boot.scrny, INV_COL32); | |
43 | + sheet_setbuf(system.draw.sht.mouse, system.draw.sht.mouse_buf, 24, 24, INV_COL32); | |
44 | + sheet_setbuf(system.draw.sht.taskbar, system.draw.sht.taskbar_buf, system.data.info.boot.scrnx, TASKBAR_HEIGHT, INV_COL32); | |
45 | + sheet_setbuf(system.draw.sht.core, system.draw.sht.core_buf, system.data.info.boot.scrnx, system.data.info.boot.scrny, INV_COL32); | |
46 | + | |
47 | + sheet_slide(system.draw.sht.desktop, 0, 0); | |
48 | + sheet_updown(system.draw.sht.desktop, -1); | |
49 | + sheet_slide(system.draw.sht.taskbar, 0, system.data.info.boot.scrny - TASKBAR_HEIGHT); | |
50 | + sheet_updown(system.draw.sht.taskbar, -1); | |
51 | + sheet_slide(system.draw.sht.mouse, system.data.info.boot.scrnx >> 1, system.data.info.boot.scrny >> 1); | |
52 | + sheet_updown(system.draw.sht.mouse, -1); | |
53 | + sheet_slide(system.draw.sht.core, 0, 0); | |
54 | + sheet_updown(system.draw.sht.core, -1); | |
55 | + | |
29 | 56 | return; |
30 | 57 | } |
@@ -0,0 +1,376 @@ | ||
1 | + | |
2 | +#include "core.h" | |
3 | + | |
4 | +UI_SheetControl *ctl; | |
5 | +void (*sheet_refreshsub)(int vx0, int vy0, int vx1, int vy1, int h0, int h1); | |
6 | +void (*sheet_refreshmap)(int vx0, int vy0, int vx1, int vy1, int h0); | |
7 | + | |
8 | +void init_sheets(void *vram, int xsize, int ysize, uchar bits) | |
9 | +{ | |
10 | + int i; | |
11 | + | |
12 | + switch(bits){ | |
13 | + case 8: | |
14 | + sheet_refreshsub = sheet_refreshsub8; | |
15 | + sheet_refreshmap = sheet_refreshmap8; | |
16 | + break; | |
17 | + case 16: | |
18 | + sheet_refreshsub = sheet_refreshsub16; | |
19 | + sheet_refreshmap = sheet_refreshmap16; | |
20 | + break; | |
21 | + case 32: | |
22 | + sheet_refreshsub = sheet_refreshsub32; | |
23 | + sheet_refreshmap = sheet_refreshmap32; | |
24 | + break; | |
25 | + } | |
26 | + | |
27 | + ctl = (UI_SheetControl *)sys_memman_alloc(sizeof(UI_SheetControl)); | |
28 | + if(ctl == 0) goto err; | |
29 | + ctl->map = (uint *)sys_memman_alloc(xsize * ysize * 4); | |
30 | + if(ctl->map == 0){ | |
31 | + sys_memman_free(ctl, sizeof(UI_SheetControl)); | |
32 | + goto err; | |
33 | + } | |
34 | + ctl->vram = vram; | |
35 | + ctl->xsize = xsize; | |
36 | + ctl->ysize = ysize; | |
37 | + ctl->top = -1; | |
38 | + for(i = 0;i < MAX_SHEETS;i++){ | |
39 | + ctl->sheets0[i].flags = initialized; | |
40 | + } | |
41 | +err: | |
42 | + return; | |
43 | +} | |
44 | + | |
45 | +UI_Sheet *sheet_alloc(void) | |
46 | +{ | |
47 | + UI_Sheet *sht; | |
48 | + int i; | |
49 | + | |
50 | + for(i = 0;i < MAX_SHEETS;i++){ | |
51 | + if(ctl->sheets0[i].flags == initialized){ | |
52 | + sht = &ctl->sheets0[i]; | |
53 | + sht->flags = allocated; | |
54 | + sht->height = -1; | |
55 | + return sht; | |
56 | + } | |
57 | + } | |
58 | + return 0; | |
59 | +} | |
60 | + | |
61 | +void sheet_setbuf(UI_Sheet *sht, void *buf,int xsize, int ysize, uint col_inv) | |
62 | +{ | |
63 | + sht->buf = buf; | |
64 | + sht->bxsize = xsize; | |
65 | + sht->bysize = ysize; | |
66 | + sht->col_inv = col_inv; | |
67 | + return; | |
68 | +} | |
69 | + | |
70 | +void sheet_updown(UI_Sheet *sht, int height) | |
71 | +{ | |
72 | + int h, old = sht->height; | |
73 | + | |
74 | + if(height > ctl->top + 1) height = ctl->top + 1; | |
75 | + if (height < -1) height = -1; | |
76 | + sht->height = height; | |
77 | + | |
78 | + if (old > height){ /*以前よりも低くなる場合*/ | |
79 | + if (height >= 0){ | |
80 | + for (h = old; h > height; h--){ | |
81 | + ctl->sheets[h] = ctl->sheets[h - 1]; | |
82 | + ctl->sheets[h]->height = h; | |
83 | + } | |
84 | + ctl->sheets[height] = sht; | |
85 | + sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1); | |
86 | + sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old); | |
87 | + } else { /*非表示になる場合*/ | |
88 | + if(ctl->top > old){ | |
89 | + for(h = old; h < ctl->top; h++){ | |
90 | + ctl->sheets[h] = ctl->sheets[h + 1]; | |
91 | + ctl->sheets[h]->height = h; | |
92 | + } | |
93 | + } | |
94 | + ctl->top--; | |
95 | + sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0); | |
96 | + sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1); | |
97 | + } | |
98 | + } else if(old < height) { /*以前よりも高くなる場合*/ | |
99 | + if(old >= 0){ | |
100 | + for(h = old; h < height; h++){ | |
101 | + ctl->sheets[h] = ctl->sheets[h + 1]; | |
102 | + ctl->sheets[h]->height = h; | |
103 | + } | |
104 | + ctl->sheets[height]= sht; | |
105 | + } else { | |
106 | + for(h = ctl->top; h >= height; h--){ | |
107 | + ctl->sheets[h + 1] = ctl->sheets[h]; | |
108 | + ctl->sheets[h + 1]->height = h; | |
109 | + } | |
110 | + ctl->sheets[height] = sht; | |
111 | + ctl->top++; | |
112 | + } | |
113 | + sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height); | |
114 | + sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height); | |
115 | + } | |
116 | + | |
117 | + return; | |
118 | +} | |
119 | + | |
120 | +void sheet_refresh(UI_Sheet *sht, int bx0, int by0, int bx1, int by1) | |
121 | +{ | |
122 | + if(sht->height >= 0){ | |
123 | + sheet_refreshsub(sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1 , sht->height, sht->height); | |
124 | + } | |
125 | + | |
126 | + return; | |
127 | +} | |
128 | + | |
129 | +void sheet_refresh_full_alpha(UI_Sheet *sht) | |
130 | +{ | |
131 | + sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, sht->height); | |
132 | + sheet_refresh_full(sht); | |
133 | + | |
134 | + return; | |
135 | +} | |
136 | + | |
137 | +void sheet_refresh_full(UI_Sheet *sht) | |
138 | +{ | |
139 | + sheet_refresh(sht, 0, 0, sht->bxsize, sht->bysize); | |
140 | + | |
141 | + return; | |
142 | +} | |
143 | + | |
144 | +void sheet_slide(UI_Sheet *sht, int vx0, int vy0) | |
145 | +{ | |
146 | + int old_vx0 = sht->vx0, old_vy0 = sht->vy0; | |
147 | + | |
148 | + sht->vx0 = vx0; | |
149 | + sht->vy0 = vy0; | |
150 | + if(sht->height >= 0) { | |
151 | + sheet_refreshmap(old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize,0); | |
152 | + sheet_refreshmap(vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize,sht->height); | |
153 | + sheet_refreshsub(old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize,0,sht->height - 1); | |
154 | + sheet_refreshsub(vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize,sht->height, sht->height); | |
155 | + } | |
156 | + | |
157 | + return; | |
158 | +} | |
159 | + | |
160 | +void sheet_free(UI_Sheet *sht) | |
161 | +{ | |
162 | + if(sht->height >= 0) sheet_updown(sht, -1); | |
163 | + sht->flags = initialized; | |
164 | + | |
165 | + return; | |
166 | +} | |
167 | + | |
168 | +void sheet_refreshsub32(int vx0, int vy0, int vx1, int vy1, int h0, int h1) | |
169 | +{ | |
170 | + int h, bx, by, vx, vy, bx0, by0, bx1, by1; | |
171 | + uint *map = ctl->map,sid; | |
172 | + uint *buf, *vram = (uint *)ctl->vram; | |
173 | + UI_Sheet *sht; | |
174 | + | |
175 | + if(vx0 < 0) vx0 = 0; | |
176 | + if(vy0 < 0) vy0 = 0; | |
177 | + if(vx1 > ctl->xsize) vx1 = ctl->xsize; | |
178 | + if(vy1 > ctl->ysize) vy1 = ctl->ysize; | |
179 | + for(h = 0; h <= ctl->top; h++){ | |
180 | + sht = ctl->sheets[h]; | |
181 | + buf = sht->buf; | |
182 | + sid = sht - ctl->sheets0; | |
183 | + bx0 = vx0 - sht->vx0; | |
184 | + by0 = vy0 - sht->vy0; | |
185 | + bx1 = vx1 - sht->vx0; | |
186 | + by1 = vy1 - sht->vy0; | |
187 | + if(bx0 < 0) bx0 = 0; | |
188 | + if(by0 < 0) by0 = 0; | |
189 | + if(bx1 > sht->bxsize) bx1 = sht->bxsize; | |
190 | + if(by1 > sht->bysize) by1 = sht->bysize; | |
191 | + for(by = by0; by < by1; by++){ | |
192 | + vy = sht->vy0 + by; | |
193 | + for(bx = bx0; bx < bx1; bx++){ | |
194 | + vx = sht->vx0 + bx; | |
195 | + if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx]; | |
196 | + } | |
197 | + } | |
198 | + } | |
199 | + | |
200 | + return; | |
201 | +} | |
202 | + | |
203 | +void sheet_refreshsub16(int vx0, int vy0, int vx1, int vy1, int h0, int h1) | |
204 | +{ | |
205 | + int h, bx, by, vx, vy, bx0, by0, bx1, by1; | |
206 | + uint *map = ctl->map,sid; | |
207 | + ushort *buf, *vram = (ushort *)ctl->vram; | |
208 | + UI_Sheet *sht; | |
209 | + | |
210 | + if(vx0 < 0) vx0 = 0; | |
211 | + if(vy0 < 0) vy0 = 0; | |
212 | + if(vx1 > ctl->xsize) vx1 = ctl->xsize; | |
213 | + if(vy1 > ctl->ysize) vy1 = ctl->ysize; | |
214 | + for(h = 0; h <= ctl->top; h++){ | |
215 | + sht = ctl->sheets[h]; | |
216 | + buf = sht->buf; | |
217 | + sid = sht - ctl->sheets0; | |
218 | + bx0 = vx0 - sht->vx0; | |
219 | + by0 = vy0 - sht->vy0; | |
220 | + bx1 = vx1 - sht->vx0; | |
221 | + by1 = vy1 - sht->vy0; | |
222 | + if(bx0 < 0) bx0 = 0; | |
223 | + if(by0 < 0) by0 = 0; | |
224 | + if(bx1 > sht->bxsize) bx1 = sht->bxsize; | |
225 | + if(by1 > sht->bysize) by1 = sht->bysize; | |
226 | + for(by = by0; by < by1; by++){ | |
227 | + vy = sht->vy0 + by; | |
228 | + for(bx = bx0; bx < bx1; bx++){ | |
229 | + vx = sht->vx0 + bx; | |
230 | + if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx]; | |
231 | + } | |
232 | + } | |
233 | + } | |
234 | + | |
235 | + return; | |
236 | +} | |
237 | + | |
238 | +void sheet_refreshsub8(int vx0, int vy0, int vx1, int vy1, int h0, int h1) | |
239 | +{ | |
240 | + int h, bx, by, vx, vy, bx0, by0, bx1, by1; | |
241 | + uint *map = ctl->map,sid; | |
242 | + uchar *buf, *vram = (uchar *)ctl->vram; | |
243 | + UI_Sheet *sht; | |
244 | + | |
245 | + if(vx0 < 0) vx0 = 0; | |
246 | + if(vy0 < 0) vy0 = 0; | |
247 | + if(vx1 > ctl->xsize) vx1 = ctl->xsize; | |
248 | + if(vy1 > ctl->ysize) vy1 = ctl->ysize; | |
249 | + for(h = 0; h <= ctl->top; h++){ | |
250 | + sht = ctl->sheets[h]; | |
251 | + buf = sht->buf; | |
252 | + sid = sht - ctl->sheets0; | |
253 | + bx0 = vx0 - sht->vx0; | |
254 | + by0 = vy0 - sht->vy0; | |
255 | + bx1 = vx1 - sht->vx0; | |
256 | + by1 = vy1 - sht->vy0; | |
257 | + if(bx0 < 0) bx0 = 0; | |
258 | + if(by0 < 0) by0 = 0; | |
259 | + if(bx1 > sht->bxsize) bx1 = sht->bxsize; | |
260 | + if(by1 > sht->bysize) by1 = sht->bysize; | |
261 | + for(by = by0; by < by1; by++){ | |
262 | + vy = sht->vy0 + by; | |
263 | + for(bx = bx0; bx < bx1; bx++){ | |
264 | + vx = sht->vx0 + bx; | |
265 | + if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx]; | |
266 | + } | |
267 | + } | |
268 | + } | |
269 | + | |
270 | + return; | |
271 | +} | |
272 | + | |
273 | +void sheet_refreshmap32(int vx0, int vy0, int vx1, int vy1, int h0) | |
274 | +{ | |
275 | + int h, bx, by, vx, vy, bx0, by0, bx1, by1; | |
276 | + uint sid, *map = ctl->map; | |
277 | + uint *buf; | |
278 | + UI_Sheet *sht; | |
279 | + | |
280 | + if(vx0 < 0) vx0 = 0; | |
281 | + if(vy0 < 0) vy0 = 0; | |
282 | + if(vx1 > ctl->xsize) vx1 = ctl->xsize; | |
283 | + if(vy1 > ctl->ysize) vy1 = ctl->ysize; | |
284 | + for(h = 0; h <= ctl->top; h++){ | |
285 | + sht = ctl->sheets[h]; | |
286 | + sid = sht - ctl->sheets0; | |
287 | + buf = sht->buf; | |
288 | + bx0 = vx0 - sht->vx0; | |
289 | + by0 = vy0 - sht->vy0; | |
290 | + bx1 = vx1 - sht->vx0; | |
291 | + by1 = vy1 - sht->vy0; | |
292 | + if(bx0 < 0) bx0 = 0; | |
293 | + if(by0 < 0) by0 = 0; | |
294 | + if(bx1 > sht->bxsize) bx1 = sht->bxsize; | |
295 | + if(by1 > sht->bysize) by1 = sht->bysize; | |
296 | + for(by = by0; by < by1; by++){ | |
297 | + vy = sht->vy0 + by; | |
298 | + for(bx = bx0; bx < bx1; bx++){ | |
299 | + vx = sht->vx0 + bx; | |
300 | + if(buf[by * sht->bxsize + bx] != INV_COL32) map[vy * ctl->xsize + vx] = sid; | |
301 | + } | |
302 | + } | |
303 | + } | |
304 | + | |
305 | + return; | |
306 | +} | |
307 | + | |
308 | +void sheet_refreshmap16(int vx0, int vy0, int vx1, int vy1, int h0) | |
309 | +{ | |
310 | + int h, bx, by, vx, vy, bx0, by0, bx1, by1; | |
311 | + uint sid, *map = ctl->map; | |
312 | + ushort *buf; | |
313 | + UI_Sheet *sht; | |
314 | + | |
315 | + if(vx0 < 0) vx0 = 0; | |
316 | + if(vy0 < 0) vy0 = 0; | |
317 | + if(vx1 > ctl->xsize) vx1 = ctl->xsize; | |
318 | + if(vy1 > ctl->ysize) vy1 = ctl->ysize; | |
319 | + for(h = 0; h <= ctl->top; h++){ | |
320 | + sht = ctl->sheets[h]; | |
321 | + sid = sht - ctl->sheets0; | |
322 | + buf = sht->buf; | |
323 | + bx0 = vx0 - sht->vx0; | |
324 | + by0 = vy0 - sht->vy0; | |
325 | + bx1 = vx1 - sht->vx0; | |
326 | + by1 = vy1 - sht->vy0; | |
327 | + if(bx0 < 0) bx0 = 0; | |
328 | + if(by0 < 0) by0 = 0; | |
329 | + if(bx1 > sht->bxsize) bx1 = sht->bxsize; | |
330 | + if(by1 > sht->bysize) by1 = sht->bysize; | |
331 | + for(by = by0; by < by1; by++){ | |
332 | + vy = sht->vy0 + by; | |
333 | + for(bx = bx0; bx < bx1; bx++){ | |
334 | + vx = sht->vx0 + bx; | |
335 | + if(buf[by * sht->bxsize + bx] != INV_COL16) map[vy * ctl->xsize + vx] = sid; | |
336 | + } | |
337 | + } | |
338 | + } | |
339 | + | |
340 | + return; | |
341 | +} | |
342 | + | |
343 | +void sheet_refreshmap8(int vx0, int vy0, int vx1, int vy1, int h0) | |
344 | +{ | |
345 | + int h, bx, by, vx, vy, bx0, by0, bx1, by1; | |
346 | + uint sid, *map = ctl->map; | |
347 | + uchar *buf; | |
348 | + UI_Sheet *sht; | |
349 | + | |
350 | + if(vx0 < 0) vx0 = 0; | |
351 | + if(vy0 < 0) vy0 = 0; | |
352 | + if(vx1 > ctl->xsize) vx1 = ctl->xsize; | |
353 | + if(vy1 > ctl->ysize) vy1 = ctl->ysize; | |
354 | + for(h = 0; h <= ctl->top; h++){ | |
355 | + sht = ctl->sheets[h]; | |
356 | + sid = sht - ctl->sheets0; | |
357 | + buf = sht->buf; | |
358 | + bx0 = vx0 - sht->vx0; | |
359 | + by0 = vy0 - sht->vy0; | |
360 | + bx1 = vx1 - sht->vx0; | |
361 | + by1 = vy1 - sht->vy0; | |
362 | + if(bx0 < 0) bx0 = 0; | |
363 | + if(by0 < 0) by0 = 0; | |
364 | + if(bx1 > sht->bxsize) bx1 = sht->bxsize; | |
365 | + if(by1 > sht->bysize) by1 = sht->bysize; | |
366 | + for(by = by0; by < by1; by++){ | |
367 | + vy = sht->vy0 + by; | |
368 | + for(bx = bx0; bx < bx1; bx++){ | |
369 | + vx = sht->vx0 + bx; | |
370 | + if(buf[by * sht->bxsize + bx] != INV_COL8) map[vy * ctl->xsize + vx] = sid; | |
371 | + } | |
372 | + } | |
373 | + } | |
374 | + | |
375 | + return; | |
376 | +} |
@@ -47,7 +47,6 @@ | ||
47 | 47 | "***.....................", |
48 | 48 | }; |
49 | 49 | |
50 | -/* | |
51 | 50 | void putfonts_asc_sht_i(UI_Sheet *sht, int x, int y, uint c, uint bc, const uchar *s) |
52 | 51 | { |
53 | 52 | int l; |
@@ -66,7 +65,6 @@ | ||
66 | 65 | sheet_refresh(sht, x, y, x + l * 8, y + 16); |
67 | 66 | return; |
68 | 67 | } |
69 | -*/ | |
70 | 68 | |
71 | 69 | void init_screen_i(void *desktop, void *taskbar, void *mousecursor) |
72 | 70 | { |
@@ -107,15 +105,17 @@ | ||
107 | 105 | void init_taskbar_i(void *vrami) |
108 | 106 | { |
109 | 107 | uchar bpp; |
108 | + uint xsize; | |
110 | 109 | |
111 | 110 | bpp = system.data.info.vesa.BitsPerPixel; |
111 | + xsize = system.data.info.boot.scrnx; | |
112 | 112 | |
113 | 113 | if(bpp == 8){ |
114 | - init_taskbar8(vrami, bpp); | |
114 | + init_taskbar8(vrami, xsize); | |
115 | 115 | } else if(bpp == 16){ |
116 | - init_taskbar16(vrami, bpp); | |
116 | + init_taskbar16(vrami, xsize); | |
117 | 117 | } else if(bpp == 32){ |
118 | - init_taskbar32(vrami, bpp); | |
118 | + init_taskbar32(vrami, xsize); | |
119 | 119 | } |
120 | 120 | return; |
121 | 121 | } |
@@ -191,9 +191,6 @@ | ||
191 | 191 | |
192 | 192 | void boxfill_i(void *vrami, int xsize, uint c, int x0, int y0, int x1, int y1) |
193 | 193 | { |
194 | - y1 -= 1; | |
195 | - x1 -= 1; | |
196 | - | |
197 | 194 | if(system.data.info.vesa.BitsPerPixel == 8){ |
198 | 195 | uchar c8 = rgb_int2char(c); |
199 | 196 | boxfill8(vrami, xsize, c8, x0, y0, x1, y1); |
@@ -1,6 +1,6 @@ | ||
1 | 1 | |
2 | 2 | #OBJS_BOOTPACK = naskfunc.obj hankaku.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj gdtidt.obj int.obj io.obj fifo.obj keyboard.obj timer.obj mouse.obj memory.obj sheet.obj window.obj system.obj bootpack.obj |
3 | -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 bootpack.obj | |
3 | +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 bootpack.obj | |
4 | 4 | TOOLPATH = ../../z_tools/ |
5 | 5 | INCPATH = ../../z_tools/CHNOSProject/ |
6 | 6 |
@@ -5,6 +5,9 @@ | ||
5 | 5 | { |
6 | 6 | int x, y; |
7 | 7 | |
8 | + y1 -= 1; | |
9 | + x1 -= 1; | |
10 | + | |
8 | 11 | for (y = y0;y <= y1;y++) { |
9 | 12 | for (x = x0; x <= x1; x++) |
10 | 13 | vram[y * xsize + x] = c; |
@@ -16,9 +19,6 @@ | ||
16 | 19 | void init_desktop32(uint *vram, uint xsize, uint ysize) |
17 | 20 | { |
18 | 21 | boxfill32(vram, xsize, DESKTOP_COL32, 0, 0, xsize, ysize); |
19 | - putfonts32_asc(vram, xsize, 168, 8, 0xFFFFFF, "welcome to CHNOSProject! on 32bit video mode ."); | |
20 | - putfonts32_asc(vram, xsize, 168, 24, 0xFFFFFF, "ヨウコソ CHNOSプロジェクトヘ!"); | |
21 | - putfonts32_asc(vram, xsize, 168, 40, 0xFFFFFF, "カタコトデスガ ニホンゴガ カケルヨウニ ナリマシタ"); | |
22 | 22 | |
23 | 23 | return; |
24 | 24 | } |
@@ -25,9 +25,9 @@ | ||
25 | 25 | |
26 | 26 | void init_taskbar32(uint *vram, uint xsize) |
27 | 27 | { |
28 | - boxfill32(vram, xsize, TASKBAR_COL32, 0, 0, xsize, TASKBAR_HEIGHT); | |
29 | - boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize, 1); | |
30 | - boxfill32(vram, xsize, 0xFFFFFF, xsize-2, 0, xsize, TASKBAR_HEIGHT); | |
28 | + boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize, TASKBAR_HEIGHT); | |
29 | + boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize - 2, TASKBAR_HEIGHT - 2); | |
30 | + boxfill32(vram, xsize, TASKBAR_COL32, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2); | |
31 | 31 | |
32 | 32 | return; |
33 | 33 | } |
@@ -96,6 +96,13 @@ | ||
96 | 96 | |
97 | 97 | #define MEMMAN_FREES 4000 |
98 | 98 | |
99 | +#define INV_COL32 0xFFFFFFFF | |
100 | +#define INV_COL16 0x1192 | |
101 | +#define INV_COL8 0xFF | |
102 | + | |
103 | +#define MAX_SHEETS 1024 | |
104 | + | |
105 | + | |
99 | 106 | /*new object types*/ |
100 | 107 | typedef enum _bool { false, true} bool; |
101 | 108 | typedef enum _state_alloc { none, initialized, allocated, configured, inuse} state_alloc; |
@@ -166,6 +173,21 @@ | ||
166 | 173 | } free[MEMMAN_FREES]; |
167 | 174 | }; |
168 | 175 | |
176 | +struct SHEET { | |
177 | + void *buf; | |
178 | + uint col_inv; | |
179 | + int bxsize, bysize, vx0, vy0, height; | |
180 | + state_alloc flags; | |
181 | +}; | |
182 | + | |
183 | +struct SHTCTL { | |
184 | + uint *map; | |
185 | + void *vram; | |
186 | + int xsize,ysize,top; | |
187 | + struct SHEET *sheets[MAX_SHEETS]; | |
188 | + struct SHEET sheets0[MAX_SHEETS]; | |
189 | +}; | |
190 | + | |
169 | 191 | /*typedef structures*/ |
170 | 192 | typedef struct BOOTINFO DATA_BootInfo; |
171 | 193 | typedef struct VESAINFO DATA_VESAInfo; |
@@ -172,6 +194,8 @@ | ||
172 | 194 | typedef struct SEGMENT_DESCRIPTOR IO_SegmentDescriptor; |
173 | 195 | typedef struct GATE_DESCRIPTOR IO_GateDescriptor; |
174 | 196 | typedef struct MEMMAN IO_MemoryControl; |
197 | +typedef struct SHEET UI_Sheet; | |
198 | +typedef struct SHTCTL UI_SheetControl; | |
175 | 199 | |
176 | 200 | /*virtual classes*/ |
177 | 201 | struct SYSTEM { |
@@ -191,6 +215,18 @@ | ||
191 | 215 | IO_GateDescriptor *idt; |
192 | 216 | } interrupt; |
193 | 217 | } io; |
218 | + struct SYS_DRAW { | |
219 | + struct SYS_DRAW_SHT { | |
220 | + UI_Sheet *core; | |
221 | + UI_Sheet *desktop; | |
222 | + UI_Sheet *taskbar; | |
223 | + UI_Sheet *mouse; | |
224 | + void *core_buf; | |
225 | + void *desktop_buf; | |
226 | + void *taskbar_buf; | |
227 | + void *mouse_buf; | |
228 | + } sht; | |
229 | + } draw; | |
194 | 230 | struct SYS_DATA { |
195 | 231 | struct SYS_DATA_INFO { |
196 | 232 | DATA_BootInfo boot; |
@@ -229,6 +265,10 @@ | ||
229 | 265 | uchar rgb_int2char (uint c32); |
230 | 266 | ushort rgb_int2short (uint c32); |
231 | 267 | void col_pat(void *vrami, int xsize, int ysize); |
268 | + | |
269 | +void putfonts_asc_sht_i(UI_Sheet *sht, int x, int y, uint c, uint bc, const uchar *s); | |
270 | +void putfonts_asc_sht_i_no_bc(UI_Sheet *sht, int x, int y, uint c, const uchar *s); | |
271 | + | |
232 | 272 | /*08Bits*/ |
233 | 273 | void boxfill8(uchar *vram, int xsize, uchar c, int x0, int y0, int x1, int y1); |
234 | 274 | void init_desktop8(uchar *vram, uint xsize, uint ysize); |
@@ -315,6 +355,22 @@ | ||
315 | 355 | void paging_set_dir(uint *dir_entry, uint *table_base, uint attribute, uint available); |
316 | 356 | void paging_set_table(uint *table_entry, uint *page_base, uint attribute, uint available); |
317 | 357 | |
358 | +/*sheet.c*/ | |
359 | +void init_sheets(void *vram, int xsize, int ysize, uchar bits); | |
360 | +UI_Sheet *sheet_alloc(void); | |
361 | +void sheet_setbuf(UI_Sheet *sht, void *buf,int xsize, int ysize, uint col_inv); | |
362 | +void sheet_updown(UI_Sheet *sht, int height); | |
363 | +void sheet_refresh(UI_Sheet *sht, int bx0, int by0, int bx1, int by1); | |
364 | +void sheet_refresh_full_alpha(UI_Sheet *sht); | |
365 | +void sheet_refresh_full(UI_Sheet *sht); | |
366 | +void sheet_slide(UI_Sheet *sht, int vx0, int vy0); | |
367 | +void sheet_free(UI_Sheet *sht); | |
368 | +void sheet_refreshsub32(int vx0, int vy0, int vx1, int vy1, int h0, int h1); | |
369 | +void sheet_refreshsub16(int vx0, int vy0, int vx1, int vy1, int h0, int h1); | |
370 | +void sheet_refreshsub8(int vx0, int vy0, int vx1, int vy1, int h0, int h1); | |
371 | +void sheet_refreshmap32(int vx0, int vy0, int vx1, int vy1, int h0); | |
372 | +void sheet_refreshmap16(int vx0, int vy0, int vx1, int vy1, int h0); | |
373 | +void sheet_refreshmap8(int vx0, int vy0, int vx1, int vy1, int h0); | |
318 | 374 | |
319 | 375 | /* naskfunc.nas */ |
320 | 376 | void pipelineflush(void); |