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