From a1fd255d04e1835b2c8cc77ea414ecddea55d8e6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 26 Mar 2002 14:27:03 +0000 Subject: [PATCH] updates git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/lcd-x11.c | 6 ++++-- uisimulator/lcd-x11.h | 22 ++++++++++++++++++++++ uisimulator/lcd.c | 23 +++++++++++++++++++---- uisimulator/lcd.h | 2 ++ uisimulator/screenhack.c | 2 +- uisimulator/uibasic.c | 26 +++++++++++++++++++++++--- 6 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 uisimulator/lcd-x11.h diff --git a/uisimulator/lcd-x11.c b/uisimulator/lcd-x11.c index 7655765137..ccde5935cd 100644 --- a/uisimulator/lcd-x11.c +++ b/uisimulator/lcd-x11.c @@ -37,6 +37,7 @@ */ #include "lcd.h" +#include "lcd-x11.h" extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT]; @@ -53,8 +54,8 @@ void lcd_update (void) /* one or more bits/pixels are set */ for(bit=0; bit<8; bit++) { if(display[y/8][x]&(1< ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Daniel Stenberg + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#define MARGIN_X 3 +#define MARGIN_Y 3 + diff --git a/uisimulator/lcd.c b/uisimulator/lcd.c index 8607477d82..4909b5cc49 100644 --- a/uisimulator/lcd.c +++ b/uisimulator/lcd.c @@ -22,6 +22,9 @@ */ #include "lcd.h" +#ifdef LCD_DEBUG +#include +#endif #define DISP_X LCD_WIDTH /* Display width in pixels */ #define DISP_Y LCD_HEIGHT /* Display height in pixels */ @@ -40,7 +43,7 @@ #define ASCII_MIN 0x20 /* First char in table */ #define ASCII_MAX 0x7f /* Last char in table */ -static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = +static const unsigned char lcd_font_data[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = { 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x2f */ 0x00, 0x00, 0x4f, 0x00, 0x00, @@ -154,8 +157,8 @@ static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = */ unsigned char display[LCD_HEIGHT/8][LCD_WIDTH]; -static unsigned char lcd_y; /* Current pixel row */ -static unsigned char lcd_x; /* Current pixel column */ +static int lcd_y; /* Current pixel row */ +static int lcd_x; /* Current pixel column */ /* * Set current x,y position @@ -165,7 +168,15 @@ void lcd_position(int x, int y) if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) { lcd_x = x; lcd_y = y; +#ifdef LCD_DEBUG + fprintf(stderr, "lcd_position: set to %d, %d\n", x, y); +#endif } +#ifdef LCD_DEBUG + else + fprintf(stderr, "lcd_position: not set\n"); +#endif + } /* @@ -202,7 +213,7 @@ void lcd_char (int ch, char invert) /* Write each char column */ for (col = 0; col < CHAR_X-1; col++) { - unsigned long data = (char_gen[ch-ASCII_MIN][col] << shift) ^ invert; + unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert; dp[0][col] = (dp[0][col] & mask) | data; if (lcd_y < DISP_Y-8) dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8); @@ -221,6 +232,10 @@ void lcd_string(const char *text, char invert) { int ch; +#ifdef LCD_DEBUG + fprintf(stderr, "lcd_string: output %s at %d, %d\n", + text, lcd_x, lcd_y); +#endif while ((ch = *text++) != '\0') { if (lcd_y > DISP_Y-CHAR_Y) { /* Scroll (8 pixels) */ diff --git a/uisimulator/lcd.h b/uisimulator/lcd.h index 0a099cb8c7..963e70c341 100644 --- a/uisimulator/lcd.h +++ b/uisimulator/lcd.h @@ -24,3 +24,5 @@ #define LCD_WIDTH 112 /* Display width in pixels */ #define LCD_HEIGHT 64 /* Display height in pixels */ +#define LCD_DEBUG 1 + diff --git a/uisimulator/screenhack.c b/uisimulator/screenhack.c index 4e3c9c9146..f234a9711b 100644 --- a/uisimulator/screenhack.c +++ b/uisimulator/screenhack.c @@ -83,7 +83,7 @@ static XrmOptionDescRec default_options [] = { static char *default_defaults[] = { ".root: false", - "*geometry: 100x200", /* this should be .geometry, but nooooo... */ + "*geometry: 200x100", /* this should be .geometry, but nooooo... */ "*mono: false", "*installColormap: false", "*visualID: default", diff --git a/uisimulator/uibasic.c b/uisimulator/uibasic.c index 2d9f33fb7d..c6c9c7d236 100644 --- a/uisimulator/uibasic.c +++ b/uisimulator/uibasic.c @@ -33,6 +33,9 @@ #include "version.h" +#include "lcd.h" +#include "lcd-x11.h" + #define MAX(x,y) ((x)>(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y)) @@ -78,7 +81,7 @@ void Logf(char *fmt, ...) t = localtime(&now); log = fopen(LOGFILE, "a"); if(log) { - fprintf(log, "%02d.%02d.%02d ", + fprintf(log, "%02d:%02d:%02d ", t->tm_hour, t->tm_min, t->tm_sec); vfprintf(log, fmt, args); fprintf(log, "\n"); @@ -86,7 +89,7 @@ void Logf(char *fmt, ...) fclose(log); } - fprintf(stderr, "%02d.%02d.%02d ", + fprintf(stderr, "%02d:%02d:%02d ", t->tm_hour, t->tm_min, t->tm_sec); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); @@ -221,7 +224,14 @@ screenhack (Display *the_dpy, Window the_window) Logf("Rockbox will kill ya!"); - lcd_string( PROGNAME, 0); + lcd_position(1, 1); + lcd_string( "RockBoxx", 0); + + lcd_position(8, 16); + lcd_string( "R", 0); + + lcd_position(8, 24); + lcd_string( "2", 0); while (1) { /* deal with input here */ @@ -237,6 +247,16 @@ void screen_redraw() lcd_update(); +#define X1 0 +#define Y1 0 +#define X2 (LCD_WIDTH + MARGIN_X*2) +#define Y2 (LCD_HEIGHT + MARGIN_Y*2) + + drawline(1, X1, Y1, X2, Y1); + drawline(1, X2, Y1, X2, Y2); + drawline(1, X1, Y2, X2, Y2); + drawline(1, X1, Y1, X1, Y2); + #if 0 /* does nothing "real" yet */ /* drawtext(1, 20, 20, PROGNAME);*/