Subversion Repositories HelenOS-historic

Rev

Rev 1363 | Rev 1366 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1363 Rev 1365
1
/*
1
/*
2
 * Copyright (C) 2006 Jakub Vana
2
 * Copyright (C) 2006 Jakub Vana
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
#include <stdio.h>
29
#include <stdio.h>
30
#include <ddi.h>
30
#include <ddi.h>
31
#include <task.h>
31
#include <task.h>
32
#include <stdlib.h>
32
#include <stdlib.h>
33
#include <ddi.h>
33
#include <ddi.h>
34
#include <sysinfo.h>
34
#include <sysinfo.h>
35
#include <align.h>
35
#include <align.h>
36
#include <as.h>
36
#include <as.h>
37
#include <ipc/fb.h>
37
#include <ipc/fb.h>
38
 
38
 
39
 
39
 
40
#include <ipc/ipc.h>
40
#include <ipc/ipc.h>
41
#include <ipc/services.h>
41
#include <ipc/services.h>
42
#include <unistd.h>
42
#include <unistd.h>
43
#include <stdlib.h>
43
#include <stdlib.h>
44
#include <ipc/ns.h>
44
#include <ipc/ns.h>
45
 
45
 
46
#include <kernel/errno.h>
46
#include <kernel/errno.h>
47
 
47
 
48
 
48
 
49
#include "fb.h"
49
#include "fb.h"
50
 
50
 
51
 
51
 
52
 
52
 
53
#define pl /*printf("FB:L:%d\n",(int)__LINE__);*/
53
#define pl /*printf("FB:L:%d\n",(int)__LINE__);*/
54
 
54
 
55
#define EFB (-1)
55
#define EFB (-1)
56
 
56
 
57
extern int __DONT_OPEN_STDIO__=1;
57
extern int __DONT_OPEN_STDIO__=1;
58
 
58
 
59
#define DEFAULT_BGCOLOR     0x000080
59
#define DEFAULT_BGCOLOR     0x000080
60
#define DEFAULT_FGCOLOR     0xffff00
60
#define DEFAULT_FGCOLOR     0xffff00
61
#define DEFAULT_LOGOCOLOR   0x0000ff
61
#define DEFAULT_LOGOCOLOR   0x0000ff
62
 
62
 
63
#define MAIN_BGCOLOR        0x404000
63
#define MAIN_BGCOLOR        0x404000
64
#define MAIN_FGCOLOR        0x000000
64
#define MAIN_FGCOLOR        0x000000
65
#define MAIN_LOGOCOLOR  0x404000
65
#define MAIN_LOGOCOLOR  0x404000
66
 
66
 
67
#define SPACING (2)
67
#define SPACING (2)
68
 
68
 
69
#define H_NO_VFBS 3
69
#define H_NO_VFBS 3
70
#define V_NO_VFBS 3
70
#define V_NO_VFBS 3
71
 
71
 
72
 
72
 
73
static void fb_putchar(int item,char ch);
73
static void fb_putchar(int item,char ch);
74
int create_window(int item,unsigned int x, unsigned int y,unsigned int x_size, unsigned int y_size,
74
int create_window(int item,unsigned int x, unsigned int y,unsigned int x_size, unsigned int y_size,
75
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR);
75
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR);
76
void fb_init(int item,__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan,
76
void fb_init(int item,__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan,
77
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR);
77
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR);
78
 
78
 
79
 
79
 
80
unsigned int mod_col(unsigned int col,int mod);
80
unsigned int mod_col(unsigned int col,int mod);
81
 
81
 
82
 
82
 
83
 
83
 
84
 
84
 
85
 
85
 
86
int main(int argc, char *argv[])
86
int main(int argc, char *argv[])
87
{
87
{
88
   
88
   
89
    __address fb_ph_addr;
89
    __address fb_ph_addr;
90
    unsigned int fb_width;
90
    unsigned int fb_width;
91
    unsigned int fb_height;
91
    unsigned int fb_height;
92
    unsigned int fb_bpp;
92
    unsigned int fb_bpp;
93
    unsigned int fb_scanline;
93
    unsigned int fb_scanline;
94
    __address fb_addr;
94
    __address fb_addr;
95
    int a=0;
95
    int a=0;
96
 
96
 
97
 
97
 
98
    if(!sysinfo_value("fb")) return -1;
98
    if(!sysinfo_value("fb")) return -1;
99
   
99
   
100
    fb_ph_addr=sysinfo_value("fb.address.physical");
100
    fb_ph_addr=sysinfo_value("fb.address.physical");
101
    fb_width=sysinfo_value("fb.width");
101
    fb_width=sysinfo_value("fb.width");
102
    fb_height=sysinfo_value("fb.height");
102
    fb_height=sysinfo_value("fb.height");
103
    fb_bpp=sysinfo_value("fb.bpp");
103
    fb_bpp=sysinfo_value("fb.bpp");
104
    fb_scanline=sysinfo_value("fb.scanline");
104
    fb_scanline=sysinfo_value("fb.scanline");
105
 
105
 
106
    fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE);
106
    fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE);
107
 
107
 
108
 
108
 
109
 
109
 
110
    map_physmem(task_get_id(),(void *)((__address)fb_ph_addr),(void *)fb_addr,
110
    map_physmem(task_get_id(),(void *)((__address)fb_ph_addr),(void *)fb_addr,
111
        (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH,1);
111
        (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH,1);
112
   
112
   
113
    fb_init(0,fb_addr, fb_width, fb_height, fb_bpp, fb_scanline,
113
    fb_init(0,fb_addr, fb_width, fb_height, fb_bpp, fb_scanline,
114
        MAIN_BGCOLOR,MAIN_FGCOLOR,MAIN_LOGOCOLOR);
114
        MAIN_BGCOLOR,MAIN_FGCOLOR,MAIN_LOGOCOLOR);
115
 
115
 
116
    fb_putchar(0,'\n');
116
    fb_putchar(0,'\n');
117
    fb_putchar(0,' ');
117
    fb_putchar(0,' ');
118
 
118
 
119
 
119
 
120
    {
120
    {
121
        int i,j;
121
        int i,j;
122
 
122
 
123
        for(i=0;i<H_NO_VFBS;i++)
123
        for(i=0;i<H_NO_VFBS;i++)
124
            for(j=0;j<V_NO_VFBS;j++)
124
            for(j=0;j<V_NO_VFBS;j++)
125
            {
125
            {
126
   
126
   
127
                int w=create_window(0,(fb_width/H_NO_VFBS)*i+SPACING,
127
                int w=create_window(0,(fb_width/H_NO_VFBS)*i+SPACING,
128
                    (fb_height/V_NO_VFBS)*j+SPACING,(fb_width/H_NO_VFBS)-2*SPACING ,
128
                    (fb_height/V_NO_VFBS)*j+SPACING,(fb_width/H_NO_VFBS)-2*SPACING ,
129
                        (fb_height/V_NO_VFBS)-2*SPACING,mod_col(DEFAULT_BGCOLOR,/*i+j*H_NO_VFBS*/0),
129
                        (fb_height/V_NO_VFBS)-2*SPACING,mod_col(DEFAULT_BGCOLOR,/*i+j*H_NO_VFBS*/0),
130
                            mod_col(DEFAULT_FGCOLOR,/*i+j*H_NO_VFBS*/0),
130
                            mod_col(DEFAULT_FGCOLOR,/*i+j*H_NO_VFBS*/0),
131
                                mod_col(DEFAULT_LOGOCOLOR,/*i+j*H_NO_VFBS)*/0));
131
                                mod_col(DEFAULT_LOGOCOLOR,/*i+j*H_NO_VFBS)*/0));
132
 
132
 
133
                if(w==EFB) return -1;
133
                if(w==EFB) return -1;
134
 
134
 
135
                {
135
                {
136
                    char text[]="Hello, World from\nHelenOS Framebuffer driver\non Virtual Framebuffer\nVFB ";
136
                    char text[]="Hello, World from\nHelenOS Framebuffer driver\non Virtual Framebuffer\nVFB ";
137
                    int i;
137
                    int i;
138
                    for(i=0;text[i];i++) fb_putchar(w,text[i]);
138
                    for(i=0;text[i];i++) fb_putchar(w,text[i]);
139
                    fb_putchar(w,w+'0');
139
                    fb_putchar(w,w+'0');
140
                    fb_putchar(w,'\n');
140
                    fb_putchar(w,'\n');
141
                }
141
                }
142
            }
142
            }
143
    }
143
    }
144
 
144
 
145
 
145
 
146
    ipc_call_t call;
146
    ipc_call_t call;
147
    ipc_callid_t callid;
147
    ipc_callid_t callid;
148
    char connected = 0;
148
    char connected = 0;
149
    int res;
149
    int res;
150
    int c;
150
    int c;
151
    ipcarg_t phonead;
151
    ipcarg_t phonead;
152
   
152
   
153
    ipcarg_t retval, arg1, arg2;
153
    ipcarg_t retval, arg1, arg2;
154
 
154
 
155
 
155
 
156
 
156
 
157
    if ((res = ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, &phonead)) != 0)
157
    if ((res = ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, &phonead)) != 0)
158
    {
158
    {
159
        return -1;
159
        return -1;
160
    };
160
    };
161
 
161
 
162
       
162
       
163
    while (1) {
163
    while (1) {
164
        static int vfb_no=1;
164
        static int vfb_no=1;
165
 
165
 
166
        callid = ipc_wait_for_call(&call, 0);
166
        callid = ipc_wait_for_call(&call);
167
    //  printf("%s:Call phone=%lX..", NAME, call.in_phone_hash);
167
    //  printf("%s:Call phone=%lX..", NAME, call.in_phone_hash);
168
        switch (IPC_GET_METHOD(call)&((1<<METHOD_WIDTH)-1)) {
168
        switch (IPC_GET_METHOD(call)&((1<<METHOD_WIDTH)-1)) {
169
            case IPC_M_PHONE_HUNGUP:
169
            case IPC_M_PHONE_HUNGUP:
170
//              fb_putchar(4,((a++)&15)+'A');
170
//              fb_putchar(4,((a++)&15)+'A');
171
               
171
               
172
                retval = 0;
172
                retval = 0;
173
                break;
173
                break;
174
            case IPC_M_CONNECT_ME_TO:
174
            case IPC_M_CONNECT_ME_TO:
175
                    retval = 0;
175
                    retval = 0;
176
//              fb_putchar(1,((a++)&15)+'A');
176
//              fb_putchar(1,((a++)&15)+'A');
177
                break;
177
                break;
178
            case FB_GET_VFB:
178
            case FB_GET_VFB:
179
                retval = 0;
179
                retval = 0;
180
                arg1 = vfb_no++;   
180
                arg1 = vfb_no++;   
181
//              fb_putchar(2,((a++)&15)+'A');
181
//              fb_putchar(2,((a++)&15)+'A');
182
               
182
               
183
                break;
183
                break;
184
 
184
 
185
            case FB_PUTCHAR:
185
            case FB_PUTCHAR:
186
                retval = 0;
186
                retval = 0;
187
                fb_putchar(IPC_GET_ARG1(call),IPC_GET_ARG2(call));
187
                fb_putchar(IPC_GET_ARG1(call),IPC_GET_ARG2(call));
188
//              fb_putchar(2,((a++)&15)+'A');
188
//              fb_putchar(2,((a++)&15)+'A');
189
                break;
189
                break;
190
 
190
 
191
            default:
191
            default:
192
                retval = ENOENT;
192
                retval = ENOENT;
193
//              fb_putchar(3,((a++)&15)+'A');
193
//              fb_putchar(3,((a++)&15)+'A');
194
                break;
194
                break;
195
        }
195
        }
196
 
196
 
197
        if (! (callid & IPC_CALLID_NOTIFICATION)) {
197
        if (! (callid & IPC_CALLID_NOTIFICATION)) {
198
            ipc_answer_fast(callid, retval, arg1, arg2);
198
            ipc_answer_fast(callid, retval, arg1, arg2);
199
        }
199
        }
200
    }
200
    }
201
 
201
 
202
    return 0;
202
    return 0;
203
}
203
}
204
/*
204
/*
205
 * Copyright (C) 2006 Ondrej Palkovsky
205
 * Copyright (C) 2006 Ondrej Palkovsky
206
 * All rights reserved.
206
 * All rights reserved.
207
 *
207
 *
208
 * Redistribution and use in source and binary forms, with or without
208
 * Redistribution and use in source and binary forms, with or without
209
 * modification, are permitted provided that the following conditions
209
 * modification, are permitted provided that the following conditions
210
 * are met:
210
 * are met:
211
 *
211
 *
212
 * - Redistributions of source code must retain the above copyright
212
 * - Redistributions of source code must retain the above copyright
213
 *   notice, this list of conditions and the following disclaimer.
213
 *   notice, this list of conditions and the following disclaimer.
214
 * - Redistributions in binary form must reproduce the above copyright
214
 * - Redistributions in binary form must reproduce the above copyright
215
 *   notice, this list of conditions and the following disclaimer in the
215
 *   notice, this list of conditions and the following disclaimer in the
216
 *   documentation and/or other materials provided with the distribution.
216
 *   documentation and/or other materials provided with the distribution.
217
 * - The name of the author may not be used to endorse or promote products
217
 * - The name of the author may not be used to endorse or promote products
218
 *   derived from this software without specific prior written permission.
218
 *   derived from this software without specific prior written permission.
219
 *
219
 *
220
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
220
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
221
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
222
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
222
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
223
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
223
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
224
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
224
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
225
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
225
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
226
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
226
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
227
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
227
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
228
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
228
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
229
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
229
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
230
 */
230
 */
231
 
231
 
232
#include "font-8x16.h"
232
#include "font-8x16.h"
233
#include <string.h>
233
#include <string.h>
234
 
234
 
235
#include "helenos.xbm"
235
#include "helenos.xbm"
236
 
236
 
237
 
237
 
238
 
238
 
239
 
239
 
240
 
240
 
241
 
241
 
242
#define GRAPHICS_ITEMS 1024
242
#define GRAPHICS_ITEMS 1024
243
 
243
 
244
 
244
 
245
/***************************************************************/
245
/***************************************************************/
246
/* Pixel specific fuctions */
246
/* Pixel specific fuctions */
247
 
247
 
248
typedef void (*putpixel_fn_t)(int item,unsigned int x, unsigned int y, int color);
248
typedef void (*putpixel_fn_t)(int item,unsigned int x, unsigned int y, int color);
249
typedef int (*getpixel_fn_t)(int item,unsigned int x, unsigned int y);
249
typedef int (*getpixel_fn_t)(int item,unsigned int x, unsigned int y);
250
 
250
 
251
typedef struct framebuffer_descriptor
251
typedef struct framebuffer_descriptor
252
{
252
{
253
    __u8 *fbaddress ;
253
    __u8 *fbaddress ;
254
 
254
 
255
    unsigned int xres ;
255
    unsigned int xres ;
256
    unsigned int yres ;
256
    unsigned int yres ;
257
    unsigned int scanline ;
257
    unsigned int scanline ;
258
    unsigned int pixelbytes ;
258
    unsigned int pixelbytes ;
259
 
259
 
260
    unsigned int position ;
260
    unsigned int position ;
261
    unsigned int columns ;
261
    unsigned int columns ;
262
    unsigned int rows ;
262
    unsigned int rows ;
263
   
263
   
264
    unsigned int BGCOLOR;
264
    unsigned int BGCOLOR;
265
    unsigned int FGCOLOR;
265
    unsigned int FGCOLOR;
266
    unsigned int LOGOCOLOR;
266
    unsigned int LOGOCOLOR;
267
   
267
   
268
    putpixel_fn_t putpixel;
268
    putpixel_fn_t putpixel;
269
    getpixel_fn_t getpixel;
269
    getpixel_fn_t getpixel;
270
   
270
   
271
}framebuffer_descriptor_t;
271
}framebuffer_descriptor_t;
272
 
272
 
273
void * graphics_items[GRAPHICS_ITEMS+1]={NULL};
273
void * graphics_items[GRAPHICS_ITEMS+1]={NULL};
274
 
274
 
275
#define FB(__a__,__b__) (((framebuffer_descriptor_t*)(graphics_items[__a__]))->__b__)
275
#define FB(__a__,__b__) (((framebuffer_descriptor_t*)(graphics_items[__a__]))->__b__)
276
 
276
 
277
#define COL_WIDTH   8
277
#define COL_WIDTH   8
278
#define ROW_BYTES   (FB(item,scanline) * FONT_SCANLINES)
278
#define ROW_BYTES   (FB(item,scanline) * FONT_SCANLINES)
279
#define RED(x, bits)    ((x >> (16 + 8 - bits)) & ((1 << bits) - 1))
279
#define RED(x, bits)    ((x >> (16 + 8 - bits)) & ((1 << bits) - 1))
280
#define GREEN(x, bits)  ((x >> (8 + 8 - bits)) & ((1 << bits) - 1))
280
#define GREEN(x, bits)  ((x >> (8 + 8 - bits)) & ((1 << bits) - 1))
281
#define BLUE(x, bits)   ((x >> (8 - bits)) & ((1 << bits) - 1))
281
#define BLUE(x, bits)   ((x >> (8 - bits)) & ((1 << bits) - 1))
282
 
282
 
283
#define POINTPOS(x, y)  (y * FB(item,scanline) + x * FB(item,pixelbytes))
283
#define POINTPOS(x, y)  (y * FB(item,scanline) + x * FB(item,pixelbytes))
284
 
284
 
285
 
285
 
286
 
286
 
287
 
287
 
288
/** Put pixel - 24-bit depth, 1 free byte */
288
/** Put pixel - 24-bit depth, 1 free byte */
289
static void putpixel_4byte(int item,unsigned int x, unsigned int y, int color)
289
static void putpixel_4byte(int item,unsigned int x, unsigned int y, int color)
290
{
290
{
291
    *((__u32 *)(FB(item,fbaddress) + POINTPOS(x, y))) = color;
291
    *((__u32 *)(FB(item,fbaddress) + POINTPOS(x, y))) = color;
292
}
292
}
293
 
293
 
294
/** Return pixel color - 24-bit depth, 1 free byte */
294
/** Return pixel color - 24-bit depth, 1 free byte */
295
static int getpixel_4byte(int item,unsigned int x, unsigned int y)
295
static int getpixel_4byte(int item,unsigned int x, unsigned int y)
296
{
296
{
297
    return *((__u32 *)(FB(item,fbaddress) + POINTPOS(x, y))) & 0xffffff;
297
    return *((__u32 *)(FB(item,fbaddress) + POINTPOS(x, y))) & 0xffffff;
298
}
298
}
299
 
299
 
300
/** Put pixel - 24-bit depth */
300
/** Put pixel - 24-bit depth */
301
static void putpixel_3byte(int item,unsigned int x, unsigned int y, int color)
301
static void putpixel_3byte(int item,unsigned int x, unsigned int y, int color)
302
{
302
{
303
    unsigned int startbyte = POINTPOS(x, y);
303
    unsigned int startbyte = POINTPOS(x, y);
304
 
304
 
305
#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
305
#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
306
    FB(item,fbaddress)[startbyte] = RED(color, 8);
306
    FB(item,fbaddress)[startbyte] = RED(color, 8);
307
    FB(item,fbaddress)[startbyte + 1] = GREEN(color, 8);
307
    FB(item,fbaddress)[startbyte + 1] = GREEN(color, 8);
308
    FB(item,fbaddress)[startbyte + 2] = BLUE(color, 8);
308
    FB(item,fbaddress)[startbyte + 2] = BLUE(color, 8);
309
#else
309
#else
310
    FB(item,fbaddress)[startbyte + 2] = RED(color, 8);
310
    FB(item,fbaddress)[startbyte + 2] = RED(color, 8);
311
    FB(item,fbaddress)[startbyte + 1] = GREEN(color, 8);
311
    FB(item,fbaddress)[startbyte + 1] = GREEN(color, 8);
312
    FB(item,fbaddress)[startbyte + 0] = BLUE(color, 8);
312
    FB(item,fbaddress)[startbyte + 0] = BLUE(color, 8);
313
#endif
313
#endif
314
                                                                                               
314
                                                                                               
315
 
315
 
316
}
316
}
317
 
317
 
318
/** Return pixel color - 24-bit depth */
318
/** Return pixel color - 24-bit depth */
319
static int getpixel_3byte(int item,unsigned int x, unsigned int y)
319
static int getpixel_3byte(int item,unsigned int x, unsigned int y)
320
{
320
{
321
    unsigned int startbyte = POINTPOS(x, y);
321
    unsigned int startbyte = POINTPOS(x, y);
322
 
322
 
323
 
323
 
324
 
324
 
325
#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
325
#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
326
    return FB(item,fbaddress)[startbyte] << 16 | FB(item,fbaddress)[startbyte + 1] << 8 | FB(item,fbaddress)[startbyte + 2];
326
    return FB(item,fbaddress)[startbyte] << 16 | FB(item,fbaddress)[startbyte + 1] << 8 | FB(item,fbaddress)[startbyte + 2];
327
#else
327
#else
328
    return FB(item,fbaddress)[startbyte + 2] << 16 | FB(item,fbaddress)[startbyte + 1] << 8 | FB(item,fbaddress)[startbyte + 0];
328
    return FB(item,fbaddress)[startbyte + 2] << 16 | FB(item,fbaddress)[startbyte + 1] << 8 | FB(item,fbaddress)[startbyte + 0];
329
#endif
329
#endif
330
                               
330
                               
331
 
331
 
332
}
332
}
333
 
333
 
334
/** Put pixel - 16-bit depth (5:6:5) */
334
/** Put pixel - 16-bit depth (5:6:5) */
335
static void putpixel_2byte(int item,unsigned int x, unsigned int y, int color)
335
static void putpixel_2byte(int item,unsigned int x, unsigned int y, int color)
336
{
336
{
337
    /* 5-bit, 6-bits, 5-bits */
337
    /* 5-bit, 6-bits, 5-bits */
338
    *((__u16 *)(FB(item,fbaddress) + POINTPOS(x, y))) = RED(color, 5) << 11 | GREEN(color, 6) << 5 | BLUE(color, 5);
338
    *((__u16 *)(FB(item,fbaddress) + POINTPOS(x, y))) = RED(color, 5) << 11 | GREEN(color, 6) << 5 | BLUE(color, 5);
339
}
339
}
340
 
340
 
341
/** Return pixel color - 16-bit depth (5:6:5) */
341
/** Return pixel color - 16-bit depth (5:6:5) */
342
static int getpixel_2byte(int item,unsigned int x, unsigned int y)
342
static int getpixel_2byte(int item,unsigned int x, unsigned int y)
343
{
343
{
344
    int color = *((__u16 *)(FB(item,fbaddress) + POINTPOS(x, y)));
344
    int color = *((__u16 *)(FB(item,fbaddress) + POINTPOS(x, y)));
345
    return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
345
    return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
346
}
346
}
347
 
347
 
348
/** Put pixel - 8-bit depth (3:2:3) */
348
/** Put pixel - 8-bit depth (3:2:3) */
349
static void putpixel_1byte(int item,unsigned int x, unsigned int y, int color)
349
static void putpixel_1byte(int item,unsigned int x, unsigned int y, int color)
350
{
350
{
351
    FB(item,fbaddress)[POINTPOS(x, y)] = RED(color, 3) << 5 | GREEN(color, 2) << 3 | BLUE(color, 3);
351
    FB(item,fbaddress)[POINTPOS(x, y)] = RED(color, 3) << 5 | GREEN(color, 2) << 3 | BLUE(color, 3);
352
}
352
}
353
 
353
 
354
/** Return pixel color - 8-bit depth (3:2:3) */
354
/** Return pixel color - 8-bit depth (3:2:3) */
355
static int getpixel_1byte(int item,unsigned int x, unsigned int y)
355
static int getpixel_1byte(int item,unsigned int x, unsigned int y)
356
{
356
{
357
    int color = FB(item,fbaddress)[POINTPOS(x, y)];
357
    int color = FB(item,fbaddress)[POINTPOS(x, y)];
358
    return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
358
    return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
359
}
359
}
360
 
360
 
361
/** Fill line with color BGCOLOR */
361
/** Fill line with color BGCOLOR */
362
static void clear_line(int item,unsigned int y)
362
static void clear_line(int item,unsigned int y)
363
{
363
{
364
    unsigned int x;
364
    unsigned int x;
365
    for (x = 0; x < FB(item,xres); x++)
365
    for (x = 0; x < FB(item,xres); x++)
366
        FB(item,putpixel)(item,x, y, FB(item,BGCOLOR));
366
        FB(item,putpixel)(item,x, y, FB(item,BGCOLOR));
367
}
367
}
368
 
368
 
369
 
369
 
370
/** Fill screen with background color */
370
/** Fill screen with background color */
371
static void clear_screen(int item)
371
static void clear_screen(int item)
372
{
372
{
373
    unsigned int y;
373
    unsigned int y;
374
    for (y = 0; y < FB(item,yres); y++)
374
    for (y = 0; y < FB(item,yres); y++)
375
    {
375
    {
376
        clear_line(item,y); pl
376
        clear_line(item,y); pl
377
    }  
377
    }  
378
}
378
}
379
 
379
 
380
 
380
 
381
/** Scroll screen one row up */
381
/** Scroll screen one row up */
382
static void scroll_screen(int item)
382
static void scroll_screen(int item)
383
{
383
{
384
    unsigned int i;
384
    unsigned int i;
385
    unsigned int j;
385
    unsigned int j;
386
 
386
 
387
    for(j=0;j<FB(item,yres)-FONT_SCANLINES;j++)
387
    for(j=0;j<FB(item,yres)-FONT_SCANLINES;j++)
388
        memcpy((void *) FB(item,fbaddress)+j*FB(item,scanline),
388
        memcpy((void *) FB(item,fbaddress)+j*FB(item,scanline),
389
            (void *) &FB(item,fbaddress)[ROW_BYTES+j*FB(item,scanline)], FB(item,pixelbytes)*FB(item,xres));
389
            (void *) &FB(item,fbaddress)[ROW_BYTES+j*FB(item,scanline)], FB(item,pixelbytes)*FB(item,xres));
390
 
390
 
391
    //memcpy((void *) FB(item,fbaddress), (void *) &FB(item,fbaddress)[ROW_BYTES], FB(item,scanline) * FB(item,yres) - ROW_BYTES);
391
    //memcpy((void *) FB(item,fbaddress), (void *) &FB(item,fbaddress)[ROW_BYTES], FB(item,scanline) * FB(item,yres) - ROW_BYTES);
392
 
392
 
393
    /* Clear last row */
393
    /* Clear last row */
394
    for (i = 0; i < FONT_SCANLINES; i++)
394
    for (i = 0; i < FONT_SCANLINES; i++)
395
        clear_line(item,(FB(item,rows) - 1) * FONT_SCANLINES + i);
395
        clear_line(item,(FB(item,rows) - 1) * FONT_SCANLINES + i);
396
}
396
}
397
 
397
 
398
 
398
 
399
static void invert_pixel(int item,unsigned int x, unsigned int y)
399
static void invert_pixel(int item,unsigned int x, unsigned int y)
400
{
400
{
401
    FB(item,putpixel)(item, x, y, ~FB(item,getpixel)(item, x, y));
401
    FB(item,putpixel)(item, x, y, ~FB(item,getpixel)(item, x, y));
402
}
402
}
403
 
403
 
404
 
404
 
405
/** Draw one line of glyph at a given position */
405
/** Draw one line of glyph at a given position */
406
static void draw_glyph_line(int item,unsigned int glline, unsigned int x, unsigned int y)
406
static void draw_glyph_line(int item,unsigned int glline, unsigned int x, unsigned int y)
407
{
407
{
408
    unsigned int i;
408
    unsigned int i;
409
 
409
 
410
    for (i = 0; i < 8; i++)
410
    for (i = 0; i < 8; i++)
411
        if (glline & (1 << (7 - i))) {
411
        if (glline & (1 << (7 - i))) {
412
            FB(item,putpixel)(item,x + i, y, FB(item,FGCOLOR));
412
            FB(item,putpixel)(item,x + i, y, FB(item,FGCOLOR));
413
        } else
413
        } else
414
            FB(item,putpixel)(item,x + i, y, FB(item,BGCOLOR));
414
            FB(item,putpixel)(item,x + i, y, FB(item,BGCOLOR));
415
}
415
}
416
 
416
 
417
/***************************************************************/
417
/***************************************************************/
418
/* Character-console functions */
418
/* Character-console functions */
419
 
419
 
420
/** Draw character at given position */
420
/** Draw character at given position */
421
static void draw_glyph(int item,__u8 glyph, unsigned int col, unsigned int row)
421
static void draw_glyph(int item,__u8 glyph, unsigned int col, unsigned int row)
422
{
422
{
423
    unsigned int y;
423
    unsigned int y;
424
 
424
 
425
    for (y = 0; y < FONT_SCANLINES; y++)
425
    for (y = 0; y < FONT_SCANLINES; y++)
426
        draw_glyph_line(item ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
426
        draw_glyph_line(item ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
427
}
427
}
428
 
428
 
429
/** Invert character at given position */
429
/** Invert character at given position */
430
static void invert_char(int item,unsigned int col, unsigned int row)
430
static void invert_char(int item,unsigned int col, unsigned int row)
431
{
431
{
432
    unsigned int x;
432
    unsigned int x;
433
    unsigned int y;
433
    unsigned int y;
434
 
434
 
435
    for (x = 0; x < COL_WIDTH; x++)
435
    for (x = 0; x < COL_WIDTH; x++)
436
        for (y = 0; y < FONT_SCANLINES; y++)
436
        for (y = 0; y < FONT_SCANLINES; y++)
437
            invert_pixel(item,col * COL_WIDTH + x, row * FONT_SCANLINES + y);
437
            invert_pixel(item,col * COL_WIDTH + x, row * FONT_SCANLINES + y);
438
}
438
}
439
 
439
 
440
/** Draw character at default position */
440
/** Draw character at default position */
441
static void draw_char(int item,char chr)
441
static void draw_char(int item,char chr)
442
{
442
{
443
    draw_glyph(item ,chr, FB(item,position) % FB(item,columns), FB(item,position) / FB(item,columns));
443
    draw_glyph(item ,chr, FB(item,position) % FB(item,columns), FB(item,position) / FB(item,columns));
444
}
444
}
445
 
445
 
446
static void draw_logo(int item,unsigned int startx, unsigned int starty)
446
static void draw_logo(int item,unsigned int startx, unsigned int starty)
447
{
447
{
448
    unsigned int x;
448
    unsigned int x;
449
    unsigned int y;
449
    unsigned int y;
450
    unsigned int byte;
450
    unsigned int byte;
451
    unsigned int rowbytes;
451
    unsigned int rowbytes;
452
 
452
 
453
    rowbytes = (helenos_width - 1) / 8 + 1;
453
    rowbytes = (helenos_width - 1) / 8 + 1;
454
 
454
 
455
    for (y = 0; y < helenos_height; y++)
455
    for (y = 0; y < helenos_height; y++)
456
        for (x = 0; x < helenos_width; x++) {
456
        for (x = 0; x < helenos_width; x++) {
457
            byte = helenos_bits[rowbytes * y + x / 8];
457
            byte = helenos_bits[rowbytes * y + x / 8];
458
            byte >>= x % 8;
458
            byte >>= x % 8;
459
            if (byte & 1)
459
            if (byte & 1)
460
                FB(item,putpixel)(item,startx + x, starty + y, FB(item,LOGOCOLOR));
460
                FB(item,putpixel)(item,startx + x, starty + y, FB(item,LOGOCOLOR));
461
        }
461
        }
462
}
462
}
463
 
463
 
464
/***************************************************************/
464
/***************************************************************/
465
/* Stdout specific functions */
465
/* Stdout specific functions */
466
 
466
 
467
static void invert_cursor(int item)
467
static void invert_cursor(int item)
468
{
468
{
469
    invert_char(item,FB(item,position) % FB(item,columns), FB(item,position) / FB(item,columns));
469
    invert_char(item,FB(item,position) % FB(item,columns), FB(item,position) / FB(item,columns));
470
}
470
}
471
 
471
 
472
/** Print character to screen
472
/** Print character to screen
473
 *
473
 *
474
 *  Emulate basic terminal commands
474
 *  Emulate basic terminal commands
475
 */
475
 */
476
static void fb_putchar(int item,char ch)
476
static void fb_putchar(int item,char ch)
477
{
477
{
478
   
478
   
479
    switch (ch) {
479
    switch (ch) {
480
        case '\n':
480
        case '\n':
481
            invert_cursor(item);
481
            invert_cursor(item);
482
            FB(item,position) += FB(item,columns);
482
            FB(item,position) += FB(item,columns);
483
            FB(item,position) -= FB(item,position) % FB(item,columns);
483
            FB(item,position) -= FB(item,position) % FB(item,columns);
484
            break;
484
            break;
485
        case '\r':
485
        case '\r':
486
            invert_cursor(item);
486
            invert_cursor(item);
487
            FB(item,position) -= FB(item,position) % FB(item,columns);
487
            FB(item,position) -= FB(item,position) % FB(item,columns);
488
            break;
488
            break;
489
        case '\b':
489
        case '\b':
490
            invert_cursor(item);
490
            invert_cursor(item);
491
            if (FB(item,position) % FB(item,columns))
491
            if (FB(item,position) % FB(item,columns))
492
                FB(item,position)--;
492
                FB(item,position)--;
493
            break;
493
            break;
494
        case '\t':
494
        case '\t':
495
            invert_cursor(item);
495
            invert_cursor(item);
496
            do {
496
            do {
497
                draw_char(item,' ');
497
                draw_char(item,' ');
498
                FB(item,position)++;
498
                FB(item,position)++;
499
            } while (FB(item,position) % 8);
499
            } while (FB(item,position) % 8);
500
            break;
500
            break;
501
        default:
501
        default:
502
            draw_char(item,ch);
502
            draw_char(item,ch);
503
            FB(item,position)++;
503
            FB(item,position)++;
504
    }
504
    }
505
   
505
   
506
    if (FB(item,position) >= FB(item,columns) * FB(item,rows)) {
506
    if (FB(item,position) >= FB(item,columns) * FB(item,rows)) {
507
        FB(item,position) -= FB(item,columns);
507
        FB(item,position) -= FB(item,columns);
508
        scroll_screen(item);
508
        scroll_screen(item);
509
    }
509
    }
510
   
510
   
511
    invert_cursor(item);
511
    invert_cursor(item);
512
   
512
   
513
}
513
}
514
 
514
 
515
 
515
 
516
/** Initialize framebuffer as a chardev output device
516
/** Initialize framebuffer as a chardev output device
517
 *
517
 *
518
 * @param addr Address of theframebuffer
518
 * @param addr Address of theframebuffer
519
 * @param x    Screen width in pixels
519
 * @param x    Screen width in pixels
520
 * @param y    Screen height in pixels
520
 * @param y    Screen height in pixels
521
 * @param bpp  Bits per pixel (8, 16, 24, 32)
521
 * @param bpp  Bits per pixel (8, 16, 24, 32)
522
 * @param scan Bytes per one scanline
522
 * @param scan Bytes per one scanline
523
 *
523
 *
524
 */
524
 */
525
void fb_init(int item,__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan,
525
void fb_init(int item,__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan,
526
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR)
526
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR)
527
{
527
{
528
   
528
   
529
    if( (graphics_items[item]=malloc(sizeof(framebuffer_descriptor_t))) ==NULL)
529
    if( (graphics_items[item]=malloc(sizeof(framebuffer_descriptor_t))) ==NULL)
530
    {
530
    {
531
        return;
531
        return;
532
    }
532
    }
533
 
533
 
534
    switch (bpp) {
534
    switch (bpp) {
535
        case 8:
535
        case 8:
536
            FB(item,putpixel) = putpixel_1byte;
536
            FB(item,putpixel) = putpixel_1byte;
537
            FB(item,getpixel) = getpixel_1byte;
537
            FB(item,getpixel) = getpixel_1byte;
538
            FB(item,pixelbytes) = 1;
538
            FB(item,pixelbytes) = 1;
539
            break;
539
            break;
540
        case 16:
540
        case 16:
541
            FB(item,putpixel) = putpixel_2byte;
541
            FB(item,putpixel) = putpixel_2byte;
542
            FB(item,getpixel) = getpixel_2byte;
542
            FB(item,getpixel) = getpixel_2byte;
543
            FB(item,pixelbytes) = 2;
543
            FB(item,pixelbytes) = 2;
544
            break;
544
            break;
545
        case 24:
545
        case 24:
546
            FB(item,putpixel) = putpixel_3byte;
546
            FB(item,putpixel) = putpixel_3byte;
547
            FB(item,getpixel) = getpixel_3byte;
547
            FB(item,getpixel) = getpixel_3byte;
548
            FB(item,pixelbytes) = 3;
548
            FB(item,pixelbytes) = 3;
549
            break;
549
            break;
550
        case 32:
550
        case 32:
551
            FB(item,putpixel) = putpixel_4byte;
551
            FB(item,putpixel) = putpixel_4byte;
552
            FB(item,getpixel) = getpixel_4byte;
552
            FB(item,getpixel) = getpixel_4byte;
553
            FB(item,pixelbytes) = 4;
553
            FB(item,pixelbytes) = 4;
554
            break;
554
            break;
555
    }
555
    }
556
 
556
 
557
       
557
       
558
    FB(item,fbaddress) = (unsigned char *) addr; pl
558
    FB(item,fbaddress) = (unsigned char *) addr; pl
559
    FB(item,xres) = x; pl
559
    FB(item,xres) = x; pl
560
    FB(item,yres) = y; pl
560
    FB(item,yres) = y; pl
561
    FB(item,scanline) = scan; pl
561
    FB(item,scanline) = scan; pl
562
   
562
   
563
   
563
   
564
    FB(item,rows) = y / FONT_SCANLINES; pl
564
    FB(item,rows) = y / FONT_SCANLINES; pl
565
    FB(item,columns) = x / COL_WIDTH; pl
565
    FB(item,columns) = x / COL_WIDTH; pl
566
 
566
 
567
    FB(item,BGCOLOR)=BGCOLOR;
567
    FB(item,BGCOLOR)=BGCOLOR;
568
    FB(item,FGCOLOR)=FGCOLOR;
568
    FB(item,FGCOLOR)=FGCOLOR;
569
    FB(item,LOGOCOLOR)=LOGOCOLOR;
569
    FB(item,LOGOCOLOR)=LOGOCOLOR;
570
 
570
 
571
 
571
 
572
    clear_screen(item); pl
572
    clear_screen(item); pl
573
    draw_logo(item,FB(item,xres) - helenos_width, 0); pl
573
    draw_logo(item,FB(item,xres) - helenos_width, 0); pl
574
    invert_cursor(item); pl
574
    invert_cursor(item); pl
575
 
575
 
576
}
576
}
577
 
577
 
578
 
578
 
579
static int get_free_item()
579
static int get_free_item()
580
{
580
{
581
    int item;
581
    int item;
582
    for(item=0;graphics_items[item]!=NULL;item++);
582
    for(item=0;graphics_items[item]!=NULL;item++);
583
    return (item==GRAPHICS_ITEMS)?EFB:item;
583
    return (item==GRAPHICS_ITEMS)?EFB:item;
584
}
584
}
585
 
585
 
586
unsigned int mod_col(unsigned int col,int mod)
586
unsigned int mod_col(unsigned int col,int mod)
587
{
587
{
588
    if(mod & 1) col^=0xff;
588
    if(mod & 1) col^=0xff;
589
    if(mod & 2) col^=0xff00;
589
    if(mod & 2) col^=0xff00;
590
    if(mod & 4) col^=0xff0000;
590
    if(mod & 4) col^=0xff0000;
591
    return col;
591
    return col;
592
}
592
}
593
 
593
 
594
 
594
 
595
int create_window(int item,unsigned int x, unsigned int y,unsigned int x_size, unsigned int y_size,
595
int create_window(int item,unsigned int x, unsigned int y,unsigned int x_size, unsigned int y_size,
596
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR)
596
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR)
597
{
597
{
598
    int item_new;
598
    int item_new;
599
   
599
   
600
    if(EFB==(item_new=get_free_item()))return EFB;
600
    if(EFB==(item_new=get_free_item()))return EFB;
601
   
601
   
602
   
602
   
603
    if( (graphics_items[item_new]=malloc(sizeof(framebuffer_descriptor_t))) ==NULL)
603
    if( (graphics_items[item_new]=malloc(sizeof(framebuffer_descriptor_t))) ==NULL)
604
    {
604
    {
605
        return EFB;
605
        return EFB;
606
    }
606
    }
607
   
607
   
608
   
608
   
609
   
609
   
610
    FB(item_new,putpixel) = FB(item,putpixel);
610
    FB(item_new,putpixel) = FB(item,putpixel);
611
    FB(item_new,getpixel) = FB(item,getpixel);
611
    FB(item_new,getpixel) = FB(item,getpixel);
612
    FB(item_new,pixelbytes) = FB(item,pixelbytes);
612
    FB(item_new,pixelbytes) = FB(item,pixelbytes);
613
 
613
 
614
    FB(item_new,fbaddress) = FB(item,fbaddress) + POINTPOS(x, y) ;
614
    FB(item_new,fbaddress) = FB(item,fbaddress) + POINTPOS(x, y) ;
615
    FB(item_new,xres) = x_size;
615
    FB(item_new,xres) = x_size;
616
    FB(item_new,yres) = y_size;
616
    FB(item_new,yres) = y_size;
617
    FB(item_new,scanline) =  FB(item,scanline);
617
    FB(item_new,scanline) =  FB(item,scanline);
618
   
618
   
619
 
619
 
620
    FB(item_new,rows) = y_size / FONT_SCANLINES;
620
    FB(item_new,rows) = y_size / FONT_SCANLINES;
621
    FB(item_new,columns) = x_size / COL_WIDTH;
621
    FB(item_new,columns) = x_size / COL_WIDTH;
622
 
622
 
623
    FB(item_new,BGCOLOR)=BGCOLOR;
623
    FB(item_new,BGCOLOR)=BGCOLOR;
624
    FB(item_new,FGCOLOR)=FGCOLOR;
624
    FB(item_new,FGCOLOR)=FGCOLOR;
625
    FB(item_new,LOGOCOLOR)=LOGOCOLOR;
625
    FB(item_new,LOGOCOLOR)=LOGOCOLOR;
626
 
626
 
627
 
627
 
628
    clear_screen(item_new);
628
    clear_screen(item_new);
629
    draw_logo(item_new,FB(item_new,xres) - helenos_width, 0);
629
    draw_logo(item_new,FB(item_new,xres) - helenos_width, 0);
630
    invert_cursor(item_new);
630
    invert_cursor(item_new);
631
 
631
 
632
    return item_new;
632
    return item_new;
633
}
633
}
634
 
634
 
635
 
635
 
636
 
636
 
637
 
637