diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/Makefile | 4 | ||||
-rw-r--r-- | uisimulator/lcd-x11.c | 5 | ||||
-rw-r--r-- | uisimulator/lcd.c | 50 | ||||
-rw-r--r-- | uisimulator/uibasic.c | 13 |
4 files changed, 39 insertions, 33 deletions
diff --git a/uisimulator/Makefile b/uisimulator/Makefile index 16ace5db6b..5d16cdecfe 100644 --- a/uisimulator/Makefile +++ b/uisimulator/Makefile | |||
@@ -22,7 +22,7 @@ TARGET = rockboxui | |||
22 | CC = gcc | 22 | CC = gcc |
23 | RM = rm | 23 | RM = rm |
24 | 24 | ||
25 | CFLAGS = -g -O2 | 25 | CFLAGS = -g |
26 | CPPFLAGS = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS | 26 | CPPFLAGS = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS |
27 | LDFLAGS = -lX11 -lm -lXt -lXmu -lsocket -lnsl | 27 | LDFLAGS = -lX11 -lm -lXt -lXmu -lsocket -lnsl |
28 | 28 | ||
@@ -42,7 +42,7 @@ distclean: clean | |||
42 | $(RM) config.cache | 42 | $(RM) config.cache |
43 | 43 | ||
44 | .c.o: | 44 | .c.o: |
45 | $(CC) $(CPPFLAGS) $(CCFLAGS) -c $< | 45 | $(CC) $(CPPFLAGS) $(CFLAGS) -c $< |
46 | 46 | ||
47 | $(DEPEND): | 47 | $(DEPEND): |
48 | $(CC) -MM $(CFLAGS) $(SRCS) > $(DEPEND) | 48 | $(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 @@ | |||
39 | #include "lcd.h" | 39 | #include "lcd.h" |
40 | #include "lcd-x11.h" | 40 | #include "lcd-x11.h" |
41 | 41 | ||
42 | extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT]; | 42 | extern unsigned char display[LCD_HEIGHT/8][LCD_WIDTH]; |
43 | 43 | ||
44 | void lcd_update (void) | 44 | void lcd_update (void) |
45 | { | 45 | { |
@@ -56,6 +56,9 @@ void lcd_update (void) | |||
56 | if(display[y/8][x]&(1<<bit)) { | 56 | if(display[y/8][x]&(1<<bit)) { |
57 | points[p].x = x + MARGIN_X; | 57 | points[p].x = x + MARGIN_X; |
58 | points[p].y = y+bit + MARGIN_Y; | 58 | points[p].y = y+bit + MARGIN_Y; |
59 | #ifdef LCD_DEBUG | ||
60 | printf("Set pixel at %d,%d\n", x, y+bit); | ||
61 | #endif | ||
59 | p++; /* increase the point counter */ | 62 | p++; /* increase the point counter */ |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/uisimulator/lcd.c b/uisimulator/lcd.c index 052330c115..294302c9ac 100644 --- a/uisimulator/lcd.c +++ b/uisimulator/lcd.c | |||
@@ -24,8 +24,13 @@ | |||
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #ifdef LCD_DEBUG | 25 | #ifdef LCD_DEBUG |
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | |||
28 | #define PRINT(x) printf x | ||
29 | #else | ||
30 | #define PRINT(x) | ||
27 | #endif | 31 | #endif |
28 | 32 | ||
33 | |||
29 | #define DISP_X LCD_WIDTH /* Display width in pixels */ | 34 | #define DISP_X LCD_WIDTH /* Display width in pixels */ |
30 | #define DISP_Y LCD_HEIGHT /* Display height in pixels */ | 35 | #define DISP_Y LCD_HEIGHT /* Display height in pixels */ |
31 | 36 | ||
@@ -168,14 +173,11 @@ void lcd_position(int x, int y) | |||
168 | if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) { | 173 | if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) { |
169 | lcd_x = x; | 174 | lcd_x = x; |
170 | lcd_y = y; | 175 | lcd_y = y; |
171 | #ifdef LCD_DEBUG | 176 | PRINT(("lcd_position: set to %d, %d\n", x, y)); |
172 | fprintf(stderr, "lcd_position: set to %d, %d\n", x, y); | ||
173 | #endif | ||
174 | } | 177 | } |
175 | #ifdef LCD_DEBUG | ||
176 | else | 178 | else |
177 | fprintf(stderr, "lcd_position: not set\n"); | 179 | PRINT(("lcd_position: not set\n")); |
178 | #endif | 180 | |
179 | 181 | ||
180 | } | 182 | } |
181 | 183 | ||
@@ -198,8 +200,12 @@ void lcd_clear(void) | |||
198 | */ | 200 | */ |
199 | void lcd_char (int ch, char invert) | 201 | void lcd_char (int ch, char invert) |
200 | { | 202 | { |
201 | unsigned char (*dp)[DISP_X] = (void *) &display[lcd_y/8][lcd_x]; | 203 | unsigned char yrow = lcd_y/8; |
202 | unsigned long shift, mask, col; | 204 | unsigned char (*dp)[LCD_WIDTH] = &display[yrow][lcd_x]; |
205 | unsigned char shift, mask, col; | ||
206 | |||
207 | PRINT(("lcd_char: output %c (%02x) at %d, %d (yrow %d)\n", | ||
208 | ch, ch, lcd_x, lcd_y, yrow)); | ||
203 | 209 | ||
204 | /* Limit to char generation table */ | 210 | /* Limit to char generation table */ |
205 | if (ch < ASCII_MIN || ch > ASCII_MAX) | 211 | if (ch < ASCII_MIN || ch > ASCII_MAX) |
@@ -214,9 +220,14 @@ void lcd_char (int ch, char invert) | |||
214 | /* Write each char column */ | 220 | /* Write each char column */ |
215 | for (col = 0; col < CHAR_X-1; col++) { | 221 | for (col = 0; col < CHAR_X-1; col++) { |
216 | unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert; | 222 | unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert; |
223 | |||
224 | PRINT(("OR[0]: %02x on x %d y %d \n", data&0xff, col+lcd_x, yrow)); | ||
225 | |||
217 | dp[0][col] = (dp[0][col] & mask) | data; | 226 | dp[0][col] = (dp[0][col] & mask) | data; |
218 | if (lcd_y < DISP_Y-8) | 227 | if (lcd_y < DISP_Y-8) { |
228 | PRINT(("OR[1]: %02x on x %d y %d\n", (data>>8), col+lcd_x, yrow+1)); | ||
219 | dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8); | 229 | dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8); |
230 | } | ||
220 | } | 231 | } |
221 | 232 | ||
222 | /* Column after char */ | 233 | /* Column after char */ |
@@ -232,10 +243,8 @@ void lcd_string(const char *text, char invert) | |||
232 | { | 243 | { |
233 | int ch; | 244 | int ch; |
234 | 245 | ||
235 | #ifdef LCD_DEBUG | 246 | PRINT(("lcd_string: output %s at %d, %d\n", text, lcd_x, lcd_y)); |
236 | fprintf(stderr, "lcd_string: output %s at %d, %d\n", | 247 | |
237 | text, lcd_x, lcd_y); | ||
238 | #endif | ||
239 | while ((ch = *text++) != '\0') { | 248 | while ((ch = *text++) != '\0') { |
240 | if (lcd_y > DISP_Y-CHAR_Y) { | 249 | if (lcd_y > DISP_Y-CHAR_Y) { |
241 | /* Scroll (8 pixels) */ | 250 | /* Scroll (8 pixels) */ |
@@ -248,16 +257,13 @@ void lcd_string(const char *text, char invert) | |||
248 | else { | 257 | else { |
249 | lcd_char (ch, invert); | 258 | lcd_char (ch, invert); |
250 | lcd_x += CHAR_X; | 259 | lcd_x += CHAR_X; |
251 | } | ||
252 | 260 | ||
253 | if (lcd_x > DISP_X-CHAR_X) { | 261 | if (lcd_x > DISP_X-CHAR_X) { |
254 | /* Wrap to next line */ | 262 | /* Wrap to next line */ |
255 | lcd_x = 0; | 263 | lcd_x = 0; |
256 | lcd_y += CHAR_Y; | 264 | lcd_y += CHAR_Y; |
265 | } | ||
257 | } | 266 | } |
258 | } | 267 | } |
259 | #ifdef LCD_DEBUG | 268 | PRINT(("lcd_string: position after write: %d, %d\n", lcd_x, lcd_y)); |
260 | fprintf(stderr, "lcd_string: position after write: %d, %d\n", | ||
261 | lcd_x, lcd_y); | ||
262 | #endif | ||
263 | } | 269 | } |
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) | |||
224 | 224 | ||
225 | Logf("Rockbox will kill ya!"); | 225 | Logf("Rockbox will kill ya!"); |
226 | 226 | ||
227 | lcd_position(1, 1); | 227 | lcd_position(0, 6); |
228 | lcd_string( "R", 0); | 228 | lcd_string( "Rock the box", 0); |
229 | 229 | ||
230 | lcd_position(0, 16); | ||
231 | lcd_string( "R", 0); | ||
232 | |||
233 | #if 0 | ||
234 | lcd_position(8, 24); | 230 | lcd_position(8, 24); |
235 | lcd_string( "2", 0); | 231 | lcd_string( "Roolz", 0); |
236 | #endif | 232 | |
233 | lcd_update(); | ||
237 | 234 | ||
238 | while (1) { | 235 | while (1) { |
239 | /* deal with input here */ | 236 | /* deal with input here */ |