• R/O
  • SSH
  • HTTPS

chnosproject: Commit


Commit MetaInfo

Revisión76 (tree)
Tiempo2010-03-21 19:03:11
Autorhikarupsp

Log Message

ウィンドウ表示関数追加。
多色対応はまたもや置き去り
window.cの追加。
前から残っていたメモリ確保の問題を修正。

Cambiar Resumen

Diferencia incremental

--- beta/tolset_chn_000/chnos_006/bootpack.c (revision 75)
+++ beta/tolset_chn_000/chnos_006/bootpack.c (revision 76)
@@ -12,7 +12,7 @@
1212 int fifobuf[256], i = 0,time_tick,mx = binfo->scrnx / 2, my = binfo->scrny / 2;
1313 unsigned int all_mem_size = memtest(0x00400000, 0xbffffffff);
1414 unsigned int free_mem_size = 0;
15- unsigned int *buf_back, buf_mouse[576];
15+ unsigned int *buf_back, buf_mouse[576], *buf_win;
1616
1717 init_gdtidt();
1818 init_pic();
@@ -19,20 +19,23 @@
1919 io_sti();
2020
2121 memman_init(memman);
22-// memman_free(0x00001000,0x0009e000);
22+// memman_free(0x00001000,0x0009e000);/*ここのメモリは誰かが使用中のようだ。*/
2323 memman_free(0x00400000,all_mem_size - 0x00400000);
2424
25+
2526 fifo32_init(&sysfifo, 256, fifobuf);
2627 init_keyboard(&sysfifo, SYSFIFO_KEYB);
2728 init_mouse(&sysfifo, SYSFIFO_MOUSE, &mdec);
2829 init_pit(&time_tick);
2930 init_sheets(vinfo->PhysBasePtr,binfo->scrnx,binfo->scrny);
31+ init_windows();
3032 pit_beep_off();
3133
3234
3335 sht_back = sheet_alloc();
3436 sht_mouse = sheet_alloc();
35- buf_back = (unsigned int *) memman_alloc_4k(vinfo->BankSize * 1024);
37+ buf_back = (unsigned int *) memman_alloc_4k(binfo->scrnx * binfo->scrny * 4);
38+ buf_win = (unsigned int *) memman_alloc_4k(200 * 150 * 4);
3639 sheet_setbuf(sht_back, buf_back, binfo->scrnx, binfo->scrny, VOID_INV_COL32);
3740 sheet_setbuf(sht_mouse, buf_mouse, 24, 24, INV_COL32);
3841 boxfill32(buf_back, binfo->scrnx, 0x000000, 0,0,binfo->scrnx, binfo->scrny);
@@ -40,10 +43,11 @@
4043 sheet_slide(sht_back, 0,0);
4144 sheet_slide(sht_mouse, mx, my);
4245 sheet_updown(sht_back, 0);
43- sheet_updown(sht_mouse, 1);
46+ make_window32(buf_win, "testwindow", 200, 150, 200, 50, 1);
47+ sheet_updown(sht_mouse, 6);
4448
4549
46- circle_i(buf_back, binfo->scrnx/2, binfo->scrny/2, 0xff0000, binfo->scrnx, 100);
50+ circle_i(buf_back, 100,100, 0xff0000, binfo->scrnx, 100);
4751
4852 sprintf(s,"memory %d Byte(%d KB,%d MB)",all_mem_size,all_mem_size/1024, all_mem_size/(1024*1024));
4953 boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,304,INT_MONITOR_LONG,320);
@@ -89,12 +93,12 @@
8993 my += mdec.y;
9094 if(mx < 0) mx = 0;
9195 if(my < 0) my = 0;
92- if(mx > binfo->scrnx - 24) mx = binfo->scrnx - 24;
93- if(my > binfo->scrny - 24) my = binfo->scrny - 24;
96+ if(mx > binfo->scrnx - 1) mx = binfo->scrnx - 1;
97+ if(my > binfo->scrny - 1) my = binfo->scrny - 1;
9498
9599 sheet_slide(sht_mouse, mx,my);
96100 boxfill_i(buf_back, binfo->scrnx, 0x000000, 0,288,INT_MONITOR_LONG,304);
97- sprintf(s,"(%4d,%4d)",mx,my);
101+ sprintf(s,"(%4d,%4d) %X",mx,my,vinfo->PhysBasePtr);
98102 putfonts_asc_i(buf_back, binfo->scrnx, 0,288,0xffffff,s);
99103 sheet_refresh(sht_back, 0, 256, INT_MONITOR_LONG, 336);
100104 }
--- beta/tolset_chn_000/chnos_006/window.c (nonexistent)
+++ beta/tolset_chn_000/chnos_006/window.c (revision 76)
@@ -0,0 +1,130 @@
1+#include "core.h"
2+
3+struct WINCTL *wctl;
4+
5+void init_windows(void)
6+{
7+ int i;
8+ wctl = (struct WINCTL *)memman_alloc_4k(sizeof(struct WINCTL));
9+ if(wctl == 0) goto err;
10+ for(i = 0;i < MAX_WINDOWS;i++){
11+ wctl->winfos[i].flags = WIN_FLAGS_VOID;
12+ }
13+err:
14+ return;
15+
16+
17+}
18+
19+struct WINDOWINFO *window_alloc(void)
20+{
21+ struct WINDOWINFO *win;
22+ int i;
23+ for(i = 0;i < MAX_WINDOWS;i++){
24+ if(wctl->winfos[i].flags == WIN_FLAGS_VOID){
25+ win = &wctl->winfos[i];
26+ win->flags = WIN_FLAGS_USE;
27+ return win;
28+ }
29+ }
30+ return 0;
31+}
32+
33+void make_window32(unsigned int *buf, unsigned char *title, int xsize, int ysize, int px, int py, int height)
34+{
35+ static char closebtn[16][40] = {
36+ "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO@",
37+ "OQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ$@",
38+ "OQQQQQQQQQQQQQJJQQQQQQQQJJQQQQQQQQQQQQ$@",
39+ "OQQQQQQQQQQQQQJJJQQQQQQJJJQQQQQQQQQQQQ$@",
40+ "OQQQQQQQQQQQQQQJJJQQQQJJJQQQQQQQQQQQQQ$@",
41+ "OQQQQQQQQQQQQQQQJJJQQJJJQQQQQQQQQQQQQQ$@",
42+ "OQQQQQQQQQQQQQQQQJJJJJJQQQQQQQQQQQQQQQ$@",
43+ "OQQQQQQQQQQQQQQQQQJJJJQQQQQQQQQQQQQQQQ$@",
44+ "OQQQQQQQQQQQQQQQQQJJJJQQQQQQQQQQQQQQQQ$@",
45+ "OQQQQQQQQQQQQQQQQJJJJJJQQQQQQQQQQQQQQQ$@",
46+ "OQQQQQQQQQQQQQQQJJJQQJJJQQQQQQQQQQQQQQ$@",
47+ "OQQQQQQQQQQQQQQJJJQQQQJJJQQQQQQQQQQQQQ$@",
48+ "OQQQQQQQQQQQQQJJJQQQQQQJJJQQQQQQQQQQQQ$@",
49+ "OQQQQQQQQQQQQQJJQQQQQQQQJJQQQQQQQQQQQQ$@",
50+ "OQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ$@",
51+ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
52+ };
53+ int x, y;
54+ char c;
55+ unsigned int col = 0;
56+ struct WINDOWINFO *winfo = window_alloc();
57+ if(winfo == 0) goto err;
58+ int i = 0;
59+ for (; *title != 0x00; title++) {
60+ winfo->title[i] = *title;
61+ i++;
62+ }
63+ winfo->xsize = xsize + 8;
64+ winfo->ysize = ysize + 28;
65+ winfo->bxsize = xsize;
66+ winfo->bysize = ysize;
67+ winfo->px = px;
68+ winfo->py = py;
69+
70+ winfo->center = sheet_alloc();
71+ winfo->sideL = sheet_alloc();
72+ winfo->sideR = sheet_alloc();
73+ winfo->bottom = sheet_alloc();
74+ winfo->head = sheet_alloc();
75+
76+ winfo->buf_c = buf;
77+ winfo->buf_L = (unsigned int *)memman_alloc_4k(ysize * 4 * 4);
78+ winfo->buf_R = (unsigned int *)memman_alloc_4k(ysize * 4 * 4);
79+ winfo->buf_bottom = (unsigned int *)memman_alloc_4k(4 * winfo->xsize * 4);
80+ winfo->buf_head = (unsigned int *)memman_alloc_4k(24 * winfo->xsize * 4);
81+
82+ sheet_setbuf(winfo->center, winfo->buf_c, xsize, ysize,INV_COL32);
83+ sheet_setbuf(winfo->sideL, winfo->buf_L, 4, ysize,INV_COL32);
84+ sheet_setbuf(winfo->sideR, winfo->buf_R, 4, ysize,INV_COL32);
85+ sheet_setbuf(winfo->bottom, winfo->buf_bottom, winfo->xsize, 4,INV_COL32);
86+ sheet_setbuf(winfo->head, winfo->buf_head, winfo->xsize, 24,INV_COL32);
87+
88+ boxfill_i(winfo->buf_c, xsize, 0xFFFFFF, 0,0,xsize,ysize);
89+ boxfill_i(winfo->buf_L, 4, 0x00FF00, 0,0,4,ysize);
90+ boxfill_i(winfo->buf_R, 4, 0x00FF00, 0,0,4,ysize);
91+ boxfill_i(winfo->buf_bottom, winfo->xsize, 0x00FF00, 0,0,winfo->xsize,4);
92+ boxfill_i(winfo->buf_head, winfo->xsize, 0x00FF00, 0,0,winfo->xsize,24);
93+ putfonts_asc_i(winfo->buf_head, winfo->xsize, 4,4,0xffffff,winfo->title);
94+ for(y = 0; y < 16; y++){
95+ for(x = 0; x < 40; x++){
96+ c = closebtn[y][x];
97+ if(c == '@') col = 0xCA0000;
98+ else if(c == '$') col = 0xFB0000;
99+ else if(c == 'Q') col = 0xFF1A1A;
100+ else if(c == 'J') col = 0xFFFFFF;
101+ else if(c == 'O') col = 0xFFFFFF;
102+ winfo->buf_head[winfo->xsize * y + (winfo->xsize - 44 + x)] = col;
103+ }
104+ }
105+
106+ sheet_slide(winfo->center, px + 4,py + 24);
107+ sheet_slide(winfo->sideL, px,py + 24);
108+ sheet_slide(winfo->sideR, px + winfo->xsize - 4,py + 24);
109+ sheet_slide(winfo->bottom, px,py + winfo->ysize - 4);
110+ sheet_slide(winfo->head, px,py);
111+
112+
113+ sheet_updown(winfo->center, height);
114+ sheet_updown(winfo->sideL, height);
115+ sheet_updown(winfo->sideR, height);
116+ sheet_updown(winfo->bottom, height);
117+ sheet_updown(winfo->head, height);
118+
119+err:
120+ return;
121+
122+}
123+
124+
125+
126+
127+
128+
129+
130+
--- beta/tolset_chn_000/chnos_006/sheet.c (revision 75)
+++ beta/tolset_chn_000/chnos_006/sheet.c (revision 76)
@@ -119,6 +119,10 @@
119119 int h, bx, by, vx, vy, bx0, by0, bx1, by1;
120120 unsigned int *buf, c, *vram = ctl->vram;
121121 struct SHEET32 *sht;
122+ if(vx0 < 0) vx0 = 0;
123+ if(vy0 < 0) vy0 = 0;
124+ if(vx1 > ctl->xsize) vx1 = ctl->xsize;
125+ if(vy1 > ctl->ysize) vy1 = ctl->ysize;
122126 for(h = 0; h <= ctl->top; h++){
123127 sht = ctl->sheets[h];
124128 buf = sht->buf;
--- beta/tolset_chn_000/chnos_006/graphic.c (revision 75)
+++ beta/tolset_chn_000/chnos_006/graphic.c (revision 76)
@@ -597,3 +597,9 @@
597597 }
598598
599599
600+
601+
602+
603+
604+
605+
--- beta/tolset_chn_000/chnos_006/Makefile (revision 75)
+++ beta/tolset_chn_000/chnos_006/Makefile (revision 76)
@@ -1,4 +1,4 @@
1-OBJS_BOOTPACK = naskfunc.obj hankaku.obj graphic.obj gdtidt.obj int.obj io.obj fifo.obj keyboard.obj timer.obj mouse.obj memory.obj sheet.obj bootpack.obj
1+OBJS_BOOTPACK = naskfunc.obj hankaku.obj graphic.obj gdtidt.obj int.obj io.obj fifo.obj keyboard.obj timer.obj mouse.obj memory.obj sheet.obj window.obj bootpack.obj
22
33 TOOLPATH = ../z_tools/
44 INCPATH = ../z_tools/CHNOSProject/
--- beta/tolset_chn_000/chnos_006/core.h (revision 75)
+++ beta/tolset_chn_000/chnos_006/core.h (revision 76)
@@ -59,11 +59,16 @@
5959 #define MEMMAN_FREES 4090
6060 #define MEMMAN_ADDR 0x003c0000
6161
62-#define MAX_SHEETS 256
62+#define MAX_SHEETS 1024
6363
64+#define MAX_WINDOWS 256
65+
6466 #define SHT_FLAGS_VOID 0
6567 #define SHT_FLAGS_USE 1
6668
69+#define WIN_FLAGS_VOID 0
70+#define WIN_FLAGS_USE 1
71+
6772 #define SYSFIFO_KEYB 0x100 /*256~511=keycode*/
6873 #define SYSFIFO_MOUSE 0x200 /*512~767=mouse*/
6974
@@ -105,7 +110,19 @@
105110
106111
107112 /*構造体宣言*/
113+struct WINDOWINFO {
114+ unsigned char title[32];
115+ unsigned int *buf_c;
116+ struct SHEET32 *head, *center, *sideL, *sideR, *bottom;
117+ unsigned int *buf_head, *buf_L, *buf_R, *buf_bottom;
118+ int xsize,ysize,bxsize,bysize,px,py;
119+ unsigned int flags;
120+};
108121
122+struct WINCTL {
123+ struct WINDOWINFO winfos[MAX_WINDOWS];
124+};
125+
109126 struct MEM_FREEINFO {
110127 unsigned int addr, size;
111128 };
@@ -216,6 +233,12 @@
216233 unsigned int memman_alloc_4k(unsigned int size);
217234 int memman_free_4k(unsigned int addr, unsigned int size);
218235
236+/*window.c ウィンドウ関係*/
237+void init_windows(void);
238+struct WINDOWINFO *window_alloc(void);
239+void make_window32(unsigned int *buf, unsigned char *title, int xsize, int ysize, int px, int py, int height);
240+
241+
219242 /*sheet.c 画面管理関係*/
220243
221244 void init_sheets(unsigned int *vram, int xsize, int ysize);
Show on old repository browser