Rev 4201 | Rev 4678 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4201 | Rev 4296 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | #include <panic.h> |
45 | #include <panic.h> |
46 | #include <memstr.h> |
46 | #include <memstr.h> |
47 | #include <config.h> |
47 | #include <config.h> |
48 | #include <bitops.h> |
48 | #include <bitops.h> |
49 | #include <print.h> |
49 | #include <print.h> |
- | 50 | #include <string.h> |
|
50 | #include <ddi/ddi.h> |
51 | #include <ddi/ddi.h> |
51 | #include <arch/types.h> |
52 | #include <arch/types.h> |
52 | 53 | ||
53 | SPINLOCK_INITIALIZE(fb_lock); |
54 | SPINLOCK_INITIALIZE(fb_lock); |
54 | 55 | ||
Line 77... | Line 78... | ||
77 | 78 | ||
78 | #define BG_COLOR 0x000080 |
79 | #define BG_COLOR 0x000080 |
79 | #define FG_COLOR 0xffff00 |
80 | #define FG_COLOR 0xffff00 |
80 | #define INV_COLOR 0xaaaaaa |
81 | #define INV_COLOR 0xaaaaaa |
81 | 82 | ||
82 | #define CURSOR 0x2588 |
- | |
83 | - | ||
84 | #define RED(x, bits) ((x >> (8 + 8 + 8 - bits)) & ((1 << bits) - 1)) |
83 | #define RED(x, bits) ((x >> (8 + 8 + 8 - bits)) & ((1 << bits) - 1)) |
85 | #define GREEN(x, bits) ((x >> (8 + 8 - bits)) & ((1 << bits) - 1)) |
84 | #define GREEN(x, bits) ((x >> (8 + 8 - bits)) & ((1 << bits) - 1)) |
86 | #define BLUE(x, bits) ((x >> (8 - bits)) & ((1 << bits) - 1)) |
85 | #define BLUE(x, bits) ((x >> (8 - bits)) & ((1 << bits) - 1)) |
87 | 86 | ||
88 | #define COL2X(col) ((col) * FONT_WIDTH) |
87 | #define COL2X(col) ((col) * FONT_WIDTH) |
Line 198... | Line 197... | ||
198 | 197 | ||
199 | 198 | ||
200 | /** Draw character at given position |
199 | /** Draw character at given position |
201 | * |
200 | * |
202 | */ |
201 | */ |
203 | static void glyph_draw(uint16_t glyph, unsigned int col, unsigned int row, bool silent) |
202 | static void glyph_draw(uint16_t glyph, unsigned int col, unsigned int row, bool silent, bool overlay) |
204 | { |
203 | { |
205 | unsigned int x = COL2X(col); |
204 | unsigned int x = COL2X(col); |
206 | unsigned int y = ROW2Y(row); |
205 | unsigned int y = ROW2Y(row); |
207 | unsigned int yd; |
206 | unsigned int yd; |
208 | 207 | ||
209 | if (y >= ytrim) |
208 | if (y >= ytrim) |
210 | logo_hide(silent); |
209 | logo_hide(silent); |
211 | 210 | ||
- | 211 | if (!overlay) |
|
212 | backbuf[BB_POS(col, row)] = glyph; |
212 | backbuf[BB_POS(col, row)] = glyph; |
213 | 213 | ||
214 | if (!silent) { |
214 | if (!silent) { |
215 | for (yd = 0; yd < FONT_SCANLINES; yd++) |
215 | for (yd = 0; yd < FONT_SCANLINES; yd++) |
216 | memcpy(&fb_addr[FB_POS(x, y + yd + ylogo)], |
216 | memcpy(&fb_addr[FB_POS(x, y + yd + ylogo)], |
217 | &glyphs[GLYPH_POS(glyph, yd)], glyphscanline); |
217 | &glyphs[GLYPH_POS(glyph, yd)], glyphscanline); |
Line 267... | Line 267... | ||
267 | } |
267 | } |
268 | 268 | ||
269 | 269 | ||
270 | static void cursor_put(bool silent) |
270 | static void cursor_put(bool silent) |
271 | { |
271 | { |
- | 272 | unsigned int col = position % cols; |
|
- | 273 | unsigned int row = position / cols; |
|
- | 274 | ||
272 | glyph_draw(fb_font_glyph(CURSOR), position % cols, position / cols, silent); |
275 | glyph_draw(fb_font_glyph(U_CURSOR), col, row, silent, true); |
273 | } |
276 | } |
274 | 277 | ||
275 | 278 | ||
276 | static void cursor_remove(bool silent) |
279 | static void cursor_remove(bool silent) |
277 | { |
280 | { |
- | 281 | unsigned int col = position % cols; |
|
- | 282 | unsigned int row = position / cols; |
|
- | 283 | ||
278 | glyph_draw(fb_font_glyph(0), position % cols, position / cols, silent); |
284 | glyph_draw(backbuf[BB_POS(col, row)], col, row, silent, true); |
279 | } |
285 | } |
280 | 286 | ||
281 | 287 | ||
282 | /** Print character to screen |
288 | /** Print character to screen |
283 | * |
289 | * |
Line 305... | Line 311... | ||
305 | break; |
311 | break; |
306 | case '\t': |
312 | case '\t': |
307 | cursor_remove(silent); |
313 | cursor_remove(silent); |
308 | do { |
314 | do { |
309 | glyph_draw(fb_font_glyph(' '), position % cols, |
315 | glyph_draw(fb_font_glyph(' '), position % cols, |
310 | position / cols, silent); |
316 | position / cols, silent, false); |
311 | position++; |
317 | position++; |
312 | } while ((position % 8) && (position < cols * rows)); |
318 | } while ((position % 8) && (position < cols * rows)); |
313 | break; |
319 | break; |
314 | default: |
320 | default: |
315 | glyph_draw(fb_font_glyph(ch), position % cols, |
321 | glyph_draw(fb_font_glyph(ch), position % cols, |
316 | position / cols, silent); |
322 | position / cols, silent, false); |
317 | position++; |
323 | position++; |
318 | } |
324 | } |
319 | 325 | ||
320 | if (position >= cols * rows) { |
326 | if (position >= cols * rows) { |
321 | position -= cols; |
327 | position -= cols; |