diff --git a/uisimulator/Makefile b/uisimulator/Makefile index 16ace5db6b..5d16cdecfe 100644 --- a/uisimulator/Makefile +++ b/uisimulator/Makefile @@ -22,7 +22,7 @@ TARGET = rockboxui CC = gcc RM = rm -CFLAGS = -g -O2 +CFLAGS = -g CPPFLAGS = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS LDFLAGS = -lX11 -lm -lXt -lXmu -lsocket -lnsl @@ -42,7 +42,7 @@ distclean: clean $(RM) config.cache .c.o: - $(CC) $(CPPFLAGS) $(CCFLAGS) -c $< + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< $(DEPEND): $(CC) -MM $(CFLAGS) $(SRCS) > $(DEPEND) diff --git a/uisimulator/lcd-x11.c b/uisimulator/lcd-x11.c index ccde5935cd..d61955d0cd 100644 --- a/uisimulator/lcd-x11.c +++ b/uisimulator/lcd-x11.c @@ -39,7 +39,7 @@ #include "lcd.h" #include "lcd-x11.h" -extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT]; +extern unsigned char display[LCD_HEIGHT/8][LCD_WIDTH]; void lcd_update (void) { @@ -56,6 +56,9 @@ void lcd_update (void) if(display[y/8][x]&(1< + +#define PRINT(x) printf x +#else +#define PRINT(x) #endif + #define DISP_X LCD_WIDTH /* Display width in pixels */ #define DISP_Y LCD_HEIGHT /* Display height in pixels */ @@ -168,14 +173,11 @@ 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 + PRINT(("lcd_position: set to %d, %d\n", x, y)); } -#ifdef LCD_DEBUG else - fprintf(stderr, "lcd_position: not set\n"); -#endif + PRINT(("lcd_position: not set\n")); + } @@ -198,8 +200,12 @@ void lcd_clear(void) */ void lcd_char (int ch, char invert) { - unsigned char (*dp)[DISP_X] = (void *) &display[lcd_y/8][lcd_x]; - unsigned long shift, mask, col; + unsigned char yrow = lcd_y/8; + unsigned char (*dp)[LCD_WIDTH] = &display[yrow][lcd_x]; + unsigned char shift, mask, col; + + PRINT(("lcd_char: output %c (%02x) at %d, %d (yrow %d)\n", + ch, ch, lcd_x, lcd_y, yrow)); /* Limit to char generation table */ if (ch < ASCII_MIN || ch > ASCII_MAX) @@ -214,9 +220,14 @@ void lcd_char (int ch, char invert) /* Write each char column */ for (col = 0; col < CHAR_X-1; col++) { unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert; + + PRINT(("OR[0]: %02x on x %d y %d \n", data&0xff, col+lcd_x, yrow)); + dp[0][col] = (dp[0][col] & mask) | data; - if (lcd_y < DISP_Y-8) + if (lcd_y < DISP_Y-8) { + PRINT(("OR[1]: %02x on x %d y %d\n", (data>>8), col+lcd_x, yrow+1)); dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8); + } } /* Column after char */ @@ -232,10 +243,8 @@ 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 + PRINT(("lcd_string: output %s at %d, %d\n", text, lcd_x, lcd_y)); + while ((ch = *text++) != '\0') { if (lcd_y > DISP_Y-CHAR_Y) { /* Scroll (8 pixels) */ @@ -248,16 +257,13 @@ void lcd_string(const char *text, char invert) else { lcd_char (ch, invert); lcd_x += CHAR_X; - } - if (lcd_x > DISP_X-CHAR_X) { - /* Wrap to next line */ - lcd_x = 0; - lcd_y += CHAR_Y; + if (lcd_x > DISP_X-CHAR_X) { + /* Wrap to next line */ + lcd_x = 0; + lcd_y += CHAR_Y; + } } } -#ifdef LCD_DEBUG - fprintf(stderr, "lcd_string: position after write: %d, %d\n", - lcd_x, lcd_y); -#endif + PRINT(("lcd_string: position after write: %d, %d\n", lcd_x, lcd_y)); } diff --git a/uisimulator/uibasic.c b/uisimulator/uibasic.c index 9af52f4839..979491e731 100644 --- a/uisimulator/uibasic.c +++ b/uisimulator/uibasic.c @@ -224,16 +224,13 @@ screenhack (Display *the_dpy, Window the_window) Logf("Rockbox will kill ya!"); - lcd_position(1, 1); - lcd_string( "R", 0); + lcd_position(0, 6); + lcd_string( "Rock the box", 0); - lcd_position(0, 16); - lcd_string( "R", 0); - -#if 0 lcd_position(8, 24); - lcd_string( "2", 0); -#endif + lcd_string( "Roolz", 0); + + lcd_update(); while (1) { /* deal with input here */