diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/win32/button.c | 23 | ||||
-rw-r--r-- | uisimulator/win32/kernel.c | 2 | ||||
-rw-r--r-- | uisimulator/win32/lcd-win32.c | 66 | ||||
-rw-r--r-- | uisimulator/win32/lcd-win32.h | 23 | ||||
-rw-r--r-- | uisimulator/win32/lcd.c | 440 | ||||
-rw-r--r-- | uisimulator/win32/uisw32.cpp | 5 | ||||
-rw-r--r-- | uisimulator/win32/uisw32.h | 3 | ||||
-rw-r--r-- | uisimulator/win32/uisw32.suo | bin | 7680 -> 10752 bytes | |||
-rw-r--r-- | uisimulator/win32/uisw32.vcproj | 17 |
9 files changed, 131 insertions, 448 deletions
diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c index ebcf973faa..6c4ec9962a 100644 --- a/uisimulator/win32/button.c +++ b/uisimulator/win32/button.c | |||
@@ -1,3 +1,22 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
1 | #include <windows.h> | 20 | #include <windows.h> |
2 | #include "config.h" | 21 | #include "config.h" |
3 | #include "sh7034.h" | 22 | #include "sh7034.h" |
@@ -5,7 +24,9 @@ | |||
5 | 24 | ||
6 | #define KEY(k) HIBYTE(GetKeyState (k)) | 25 | #define KEY(k) HIBYTE(GetKeyState (k)) |
7 | 26 | ||
8 | void button_init(void) {}int button_get(void) | 27 | void button_init(void) {} |
28 | |||
29 | int button_get(void) | ||
9 | { | 30 | { |
10 | int btn = 0; | 31 | int btn = 0; |
11 | if (KEY (VK_NUMPAD4) || | 32 | if (KEY (VK_NUMPAD4) || |
diff --git a/uisimulator/win32/kernel.c b/uisimulator/win32/kernel.c index 4277190dab..b6d36e3fa8 100644 --- a/uisimulator/win32/kernel.c +++ b/uisimulator/win32/kernel.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Björn Stenberg, Felix Arends | 10 | * Copyright (C) 2002 by Felix Arends |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c new file mode 100644 index 0000000000..4539696cef --- /dev/null +++ b/uisimulator/win32/lcd-win32.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <windows.h> | ||
21 | #include <process.h> | ||
22 | #include "uisw32.h" | ||
23 | #include "lcd.h" | ||
24 | |||
25 | // | ||
26 | // simulator specific code | ||
27 | // | ||
28 | |||
29 | // varaibles | ||
30 | unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; // the display | ||
31 | char bitmap[LCD_WIDTH][LCD_HEIGHT]; // the ui display | ||
32 | |||
33 | BITMAPINFO2 bmi = | ||
34 | { | ||
35 | sizeof (BITMAPINFOHEADER), | ||
36 | LCD_WIDTH, -LCD_HEIGHT, 1, 8, | ||
37 | BI_RGB, 0, 0, 0, 2, 2, | ||
38 | UI_LCD_COLOR, 0, // green background color | ||
39 | UI_LCD_BLACK, 0 // black color | ||
40 | }; // bitmap information | ||
41 | |||
42 | |||
43 | // lcd_init | ||
44 | // init lcd controler | ||
45 | void lcd_init() | ||
46 | { | ||
47 | lcd_clear_display (); | ||
48 | } | ||
49 | |||
50 | // lcd_update | ||
51 | // update lcd | ||
52 | void lcd_update() | ||
53 | { | ||
54 | int x, y; | ||
55 | if (hGUIWnd == NULL) | ||
56 | _endthread (); | ||
57 | |||
58 | for (x = 0; x < LCD_WIDTH; x++) | ||
59 | for (y = 0; y < LCD_HEIGHT; y++) | ||
60 | bitmap[y][x] = ((display[x][y/8] >> (y & 7)) & 1); | ||
61 | |||
62 | InvalidateRect (hGUIWnd, NULL, FALSE); | ||
63 | |||
64 | // natural sleep :) | ||
65 | Sleep (50); | ||
66 | } \ No newline at end of file | ||
diff --git a/uisimulator/win32/lcd-win32.h b/uisimulator/win32/lcd-win32.h index 5049c2d70c..e4b1e3bd8e 100644 --- a/uisimulator/win32/lcd-win32.h +++ b/uisimulator/win32/lcd-win32.h | |||
@@ -1,3 +1,22 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
1 | #ifndef __LCDWIN32_H__ | 20 | #ifndef __LCDWIN32_H__ |
2 | #define __LCDWIN32_H__ | 21 | #define __LCDWIN32_H__ |
3 | 22 | ||
@@ -13,14 +32,14 @@ typedef struct | |||
13 | 32 | ||
14 | #ifdef HAVE_LCD_BITMAP | 33 | #ifdef HAVE_LCD_BITMAP |
15 | 34 | ||
16 | extern unsigned char display[DISP_X][DISP_Y/8]; // the display | 35 | extern unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; // the display |
17 | #else | 36 | #else |
18 | #define DISP_X 112 | 37 | #define DISP_X 112 |
19 | #define DISP_Y 64 | 38 | #define DISP_Y 64 |
20 | #endif | 39 | #endif |
21 | 40 | ||
22 | 41 | ||
23 | extern char bitmap[DISP_Y][DISP_X]; // the ui display | 42 | extern char bitmap[LCD_WIDTH][LCD_HEIGHT]; // the ui display |
24 | extern BITMAPINFO2 bmi; // bitmap information | 43 | extern BITMAPINFO2 bmi; // bitmap information |
25 | 44 | ||
26 | 45 | ||
diff --git a/uisimulator/win32/lcd.c b/uisimulator/win32/lcd.c deleted file mode 100644 index 21c79bd620..0000000000 --- a/uisimulator/win32/lcd.c +++ /dev/null | |||
@@ -1,440 +0,0 @@ | |||
1 | #include <windows.h> | ||
2 | #include <process.h> | ||
3 | #include "uisw32.h" | ||
4 | #include "lcd.h" | ||
5 | |||
6 | #ifdef HAVE_LCD_CHARCELLS | ||
7 | # ifndef JBP_OLD | ||
8 | |||
9 | static char const lcd_ascii[] = | ||
10 | { | ||
11 | /*****************************************************************************************/ | ||
12 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ | ||
13 | /* ************************************************************************************/ | ||
14 | /* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x04,0x05,0x00,0x00,0x00,0x00,0x00,0x00, | ||
15 | /* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
16 | /* 2x */ 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, | ||
17 | /* 3x */ 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, | ||
18 | /* 4x */ 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, | ||
19 | /* 5x */ 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, | ||
20 | /* 6x */ 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, | ||
21 | /* 7x */ 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x20,0x20,0x20,0x20,0x20, | ||
22 | /* 8x */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||
23 | /* 9x */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||
24 | /* Ax */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||
25 | /* Bx */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||
26 | /* Cx */ 0x41,0x41,0x41,0x41,0x41,0x41,0x20,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49, | ||
27 | /* Dx */ 0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x4F,0x20,0x20,0x55,0x55,0x55,0x55,0x59,0x20,0x20, | ||
28 | /* Ex */ 0x61,0x61,0x61,0x61,0x61,0x61,0x20,0x63,0x65,0x65,0x65,0x65,0x69,0x69,0x69,0x69, | ||
29 | /* Fx */ 0x64,0x6E,0x6F,0x6F,0x6F,0x6F,0x6F,0x20,0x20,0x75,0x75,0x75,0x75,0x79,0x79,0x79 | ||
30 | /******/ | ||
31 | }; | ||
32 | |||
33 | # else | ||
34 | |||
35 | static char const lcd_ascii[] = | ||
36 | { | ||
37 | /*****************************************************************************************/ | ||
38 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ | ||
39 | /* ************************************************************************************/ | ||
40 | /* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x85,0x89,0x00,0x00,0x00,0x00,0x00,0x00, | ||
41 | /* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
42 | /* 2x */ 0x24,0x25,0x26,0x37,0x06,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33, | ||
43 | /* 3x */ 0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43, | ||
44 | /* 4x */ 0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53, | ||
45 | /* 5x */ 0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0xA9,0x33,0xCE,0x00,0x15, | ||
46 | /* 6x */ 0x00,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73, | ||
47 | /* 7x */ 0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x24,0x24,0x24,0x24,0x24, | ||
48 | /* 8x */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, | ||
49 | /* 9x */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, | ||
50 | /* Ax */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, | ||
51 | /* Bx */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, | ||
52 | /* Cx */ 0x45,0x45,0x45,0x45,0x45,0x45,0x24,0x47,0x49,0x49,0x49,0x49,0x4D,0x4D,0x4D,0x4D, | ||
53 | /* Dx */ 0x48,0x52,0x53,0x53,0x53,0x53,0x53,0x24,0x24,0x59,0x59,0x59,0x59,0x5D,0x24,0x24, | ||
54 | /* Ex */ 0x65,0x65,0x65,0x65,0x65,0x65,0x24,0x67,0x69,0x69,0x69,0x69,0x6D,0x6D,0x6D,0x6D, | ||
55 | /* Fx */ 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24,0x24,0x79,0x79,0x79,0x79,0x7D,0x24,0x7D | ||
56 | /******/ | ||
57 | }; | ||
58 | |||
59 | # endif | ||
60 | |||
61 | void lcd_puts (char const *string) | ||
62 | { | ||
63 | while (*string) | ||
64 | lcd_data (LCD_ASCII(*string++)); | ||
65 | } | ||
66 | |||
67 | void lcd_putns (char const *string,int n) | ||
68 | { | ||
69 | while (n--) | ||
70 | lcd_data (LCD_ASCII(*string++)); | ||
71 | } | ||
72 | |||
73 | void lcd_putc (int character) | ||
74 | { | ||
75 | lcd_data (LCD_ASCII(character)); | ||
76 | } | ||
77 | |||
78 | void lcd_pattern (int which,char const *pattern,int count) | ||
79 | { | ||
80 | lcd_instruction (LCD_PRAM|which); | ||
81 | lcd_copy ((void *)pattern,count); | ||
82 | } | ||
83 | |||
84 | void lcd_puthex (unsigned int value,int digits) | ||
85 | { | ||
86 | switch (digits) { | ||
87 | case 8: | ||
88 | lcd_puthex (value >> 16,4); | ||
89 | case 4: | ||
90 | lcd_puthex (value >> 8,2); | ||
91 | case 2: | ||
92 | lcd_puthex (value >> 4,1); | ||
93 | case 1: | ||
94 | value &= 15; | ||
95 | lcd_putc (value+((value < 10) ? '0' : ('A'-10))); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | |||
100 | /* HAVE_LCD_CHARCELLS */ | ||
101 | #elif defined(HAVE_LCD_BITMAP) | ||
102 | |||
103 | /* | ||
104 | * All bitmaps have this format: | ||
105 | * Bits within a byte are arranged veritcally, LSB at top. | ||
106 | * Bytes are stored in column-major format, with byte 0 at top left, | ||
107 | * byte 1 is 2nd from top, etc. Bytes following left-most column | ||
108 | * starts 2nd left column, etc. | ||
109 | * | ||
110 | * Note: The HW takes bitmap bytes in row-major order. | ||
111 | * | ||
112 | * Memory copy of display bitmap | ||
113 | */ | ||
114 | unsigned char display[DISP_X][DISP_Y/8]; | ||
115 | |||
116 | /* | ||
117 | * ASCII character generation tables | ||
118 | * | ||
119 | * This contains only the printable characters (0x20-0x7f). | ||
120 | * Each element in this table is a character pattern bitmap. | ||
121 | */ | ||
122 | #define ASCII_MIN 0x20 /* First char in table */ | ||
123 | #define ASCII_MAX 0x7f /* Last char in table */ | ||
124 | |||
125 | extern const unsigned char char_gen_6x8[][5][1]; | ||
126 | extern const unsigned char char_gen_8x12[][7][2]; | ||
127 | extern const unsigned char char_gen_12x16[][11][2]; | ||
128 | |||
129 | |||
130 | /* All zeros and ones bitmaps for area filling */ | ||
131 | static const unsigned char zeros[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
132 | 0x00, 0x00 }; | ||
133 | static const unsigned char ones[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
134 | 0xff, 0xff }; | ||
135 | |||
136 | static int lcd_y; /* Current pixel row */ | ||
137 | static int lcd_x; /* Current pixel column */ | ||
138 | static int lcd_size; /* Current font width */ | ||
139 | |||
140 | /* | ||
141 | * Clear the display | ||
142 | */ | ||
143 | void lcd_clear_display (void) | ||
144 | { | ||
145 | lcd_position (0, 0, 8); | ||
146 | memset (display, 0, sizeof display); | ||
147 | } | ||
148 | |||
149 | /* | ||
150 | * Set current x,y position and font size | ||
151 | */ | ||
152 | void lcd_position (int x, int y, int size) | ||
153 | { | ||
154 | if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) | ||
155 | { | ||
156 | lcd_x = x; | ||
157 | lcd_y = y; | ||
158 | } | ||
159 | |||
160 | lcd_size = size; | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | * Display a string at current position and size | ||
165 | */ | ||
166 | void lcd_string (const char *str) | ||
167 | { | ||
168 | int x = lcd_x; | ||
169 | int nx = lcd_size; | ||
170 | int ny, ch; | ||
171 | const unsigned char *src; | ||
172 | |||
173 | if (nx == 12) | ||
174 | ny = 16; | ||
175 | else if (nx == 8) | ||
176 | ny = 12; | ||
177 | else | ||
178 | { | ||
179 | nx = 6; | ||
180 | ny = 8; | ||
181 | } | ||
182 | |||
183 | while ((ch = *str++) != '\0') | ||
184 | { | ||
185 | if (ch == '\n' || lcd_x + nx > DISP_X) | ||
186 | { | ||
187 | /* Wrap to next line */ | ||
188 | lcd_x = x; | ||
189 | lcd_y += ny; | ||
190 | } | ||
191 | |||
192 | if (lcd_y + ny > DISP_Y) | ||
193 | return; | ||
194 | |||
195 | /* Limit to char generation table */ | ||
196 | if (ch >= ASCII_MIN && ch <= ASCII_MAX) | ||
197 | { | ||
198 | if (nx == 12) | ||
199 | src = char_gen_12x16[ch-ASCII_MIN][0]; | ||
200 | else if (nx == 8) | ||
201 | src = char_gen_8x12[ch-ASCII_MIN][0]; | ||
202 | else | ||
203 | src = char_gen_6x8[ch-ASCII_MIN][0]; | ||
204 | |||
205 | lcd_bitmap (src, lcd_x, lcd_y, nx-1, ny, TRUE); | ||
206 | lcd_bitmap (zeros, lcd_x+nx-1, lcd_y, 1, ny, TRUE); | ||
207 | |||
208 | lcd_x += nx; | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | * Display a bitmap at (x, y), size (nx, ny) | ||
215 | * clear is TRUE to clear destination area first | ||
216 | */ | ||
217 | void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny, | ||
218 | bool clear) | ||
219 | { | ||
220 | unsigned char *dst; | ||
221 | unsigned char *dst2 = &display[x][y/8]; | ||
222 | unsigned int data, mask, mask2, mask3, mask4; | ||
223 | int shift = y & 7; | ||
224 | |||
225 | ny += shift; | ||
226 | |||
227 | /* Calculate bit masks */ | ||
228 | mask4 = ~(0xfe << ((ny-1) & 7)); | ||
229 | if (clear) | ||
230 | { | ||
231 | mask = ~(0xff << shift); | ||
232 | mask2 = 0; | ||
233 | mask3 = ~mask4; | ||
234 | if (ny <= 8) | ||
235 | mask3 |= mask; | ||
236 | } | ||
237 | else | ||
238 | mask = mask2 = mask3 = 0xff; | ||
239 | |||
240 | /* Loop for each column */ | ||
241 | for (x = 0; x < nx; x++) | ||
242 | { | ||
243 | dst = dst2; | ||
244 | dst2 += DISP_Y/8; | ||
245 | data = 0; | ||
246 | y = 0; | ||
247 | |||
248 | if (ny > 8) | ||
249 | { | ||
250 | /* First partial row */ | ||
251 | data = *src++ << shift; | ||
252 | *dst = (*dst & mask) ^ data; | ||
253 | data >>= 8; | ||
254 | dst++; | ||
255 | |||
256 | /* Intermediate rows */ | ||
257 | for (y = 8; y < ny-8; y += 8) | ||
258 | { | ||
259 | data |= *src++ << shift; | ||
260 | *dst = (*dst & mask2) ^ data; | ||
261 | data >>= 8; | ||
262 | dst++; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | /* Last partial row */ | ||
267 | if (y + shift < ny) | ||
268 | data |= *src++ << shift; | ||
269 | *dst = (*dst & mask3) ^ (data & mask4); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | /* | ||
274 | * Clear a rectangular area at (x, y), size (nx, ny) | ||
275 | */ | ||
276 | void lcd_clearrect (int x, int y, int nx, int ny) | ||
277 | { | ||
278 | int i; | ||
279 | for (i = 0; i < nx; i++) | ||
280 | lcd_bitmap (zeros, x+i, y, 1, ny, TRUE); | ||
281 | } | ||
282 | |||
283 | /* | ||
284 | * Fill a rectangular area at (x, y), size (nx, ny) | ||
285 | */ | ||
286 | void lcd_fillrect (int x, int y, int nx, int ny) | ||
287 | { | ||
288 | int i; | ||
289 | for (i = 0; i < nx; i++) | ||
290 | lcd_bitmap (ones, x+i, y, 1, ny, TRUE); | ||
291 | } | ||
292 | |||
293 | /* Invert a rectangular area at (x, y), size (nx, ny) */ | ||
294 | void lcd_invertrect (int x, int y, int nx, int ny) | ||
295 | { | ||
296 | int i; | ||
297 | for (i = 0; i < nx; i++) | ||
298 | lcd_bitmap (ones, x+i, y, 1, ny, FALSE); | ||
299 | } | ||
300 | |||
301 | #define DRAW_PIXEL(x,y) display[x][y/8] |= (1<<(y&7)) | ||
302 | #define CLEAR_PIXEL(x,y) display[x][y/8] &= ~(1<<(y&7)) | ||
303 | |||
304 | void lcd_drawline( int x1, int y1, int x2, int y2 ) | ||
305 | { | ||
306 | int numpixels; | ||
307 | int i; | ||
308 | int deltax, deltay; | ||
309 | int d, dinc1, dinc2; | ||
310 | int x, xinc1, xinc2; | ||
311 | int y, yinc1, yinc2; | ||
312 | |||
313 | deltax = abs(x2 - x1); | ||
314 | deltay = abs(y2 - y1); | ||
315 | |||
316 | if(deltax >= deltay) | ||
317 | { | ||
318 | numpixels = deltax; | ||
319 | d = 2 * deltay - deltax; | ||
320 | dinc1 = deltay * 2; | ||
321 | dinc2 = (deltay - deltax) * 2; | ||
322 | xinc1 = 1; | ||
323 | xinc2 = 1; | ||
324 | yinc1 = 0; | ||
325 | yinc2 = 1; | ||
326 | } | ||
327 | else | ||
328 | { | ||
329 | numpixels = deltay; | ||
330 | d = 2 * deltax - deltay; | ||
331 | dinc1 = deltax * 2; | ||
332 | dinc2 = (deltax - deltay) * 2; | ||
333 | xinc1 = 0; | ||
334 | xinc2 = 1; | ||
335 | yinc1 = 1; | ||
336 | yinc2 = 1; | ||
337 | } | ||
338 | numpixels++; /* include endpoints */ | ||
339 | |||
340 | if(x1 > x2) | ||
341 | { | ||
342 | xinc1 = -xinc1; | ||
343 | xinc2 = -xinc2; | ||
344 | } | ||
345 | |||
346 | if(y1 > y2) | ||
347 | { | ||
348 | yinc1 = -yinc1; | ||
349 | yinc2 = -yinc2; | ||
350 | } | ||
351 | |||
352 | x = x1; | ||
353 | y = y1; | ||
354 | |||
355 | for(i=0; i<numpixels; i++) | ||
356 | { | ||
357 | DRAW_PIXEL(x,y); | ||
358 | |||
359 | if(d < 0) | ||
360 | { | ||
361 | d += dinc1; | ||
362 | x += xinc1; | ||
363 | y += yinc1; | ||
364 | } | ||
365 | else | ||
366 | { | ||
367 | d += dinc2; | ||
368 | x += xinc2; | ||
369 | y += yinc2; | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | |||
374 | /* | ||
375 | * Set a single pixel | ||
376 | */ | ||
377 | void lcd_drawpixel(int x, int y) | ||
378 | { | ||
379 | DRAW_PIXEL(x,y); | ||
380 | } | ||
381 | |||
382 | /* | ||
383 | * Clear a single pixel | ||
384 | */ | ||
385 | void lcd_clearpixel(int x, int y) | ||
386 | { | ||
387 | CLEAR_PIXEL(x,y); | ||
388 | } | ||
389 | |||
390 | |||
391 | #else | ||
392 | /* no LCD defined, no code to use */ | ||
393 | #endif | ||
394 | |||
395 | // | ||
396 | // | ||
397 | // | ||
398 | // simulator specific code | ||
399 | // | ||
400 | // | ||
401 | // | ||
402 | |||
403 | // varaibles | ||
404 | unsigned char display[DISP_X][DISP_Y/8]; // the display | ||
405 | char bitmap[DISP_Y][DISP_X]; // the ui display | ||
406 | |||
407 | BITMAPINFO2 bmi = | ||
408 | { | ||
409 | sizeof (BITMAPINFOHEADER), | ||
410 | DISP_X, -DISP_Y, 1, 8, | ||
411 | BI_RGB, 0, 0, 0, 2, 2, | ||
412 | UI_LCD_COLOR, 0, // green background color | ||
413 | UI_LCD_BLACK, 0 // black color | ||
414 | }; // bitmap information | ||
415 | |||
416 | |||
417 | // lcd_init | ||
418 | // init lcd controler | ||
419 | void lcd_init() | ||
420 | { | ||
421 | lcd_clear_display (); | ||
422 | } | ||
423 | |||
424 | // lcd_update | ||
425 | // update lcd | ||
426 | void lcd_update() | ||
427 | { | ||
428 | int x, y; | ||
429 | if (hGUIWnd == NULL) | ||
430 | _endthread (); | ||
431 | |||
432 | for (x = 0; x < DISP_X; x++) | ||
433 | for (y = 0; y < DISP_Y; y++) | ||
434 | bitmap[y][x] = ((display[x][y/8] >> (y & 7)) & 1); | ||
435 | |||
436 | InvalidateRect (hGUIWnd, NULL, FALSE); | ||
437 | |||
438 | // natural sleep :) | ||
439 | Sleep (50); | ||
440 | } \ No newline at end of file | ||
diff --git a/uisimulator/win32/uisw32.cpp b/uisimulator/win32/uisw32.cpp index 6bc1bedb00..529ecbfb4e 100644 --- a/uisimulator/win32/uisw32.cpp +++ b/uisimulator/win32/uisw32.cpp | |||
@@ -5,6 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | ||
8 | * | 9 | * |
9 | * Copyright (C) 2002 by Felix Arends | 10 | * Copyright (C) 2002 by Felix Arends |
10 | * | 11 | * |
@@ -164,8 +165,8 @@ LRESULT GUIWndProc ( | |||
164 | // draw lcd screen | 165 | // draw lcd screen |
165 | StretchDIBits (hDc, | 166 | StretchDIBits (hDc, |
166 | UI_LCD_POSX * r.right / UI_WIDTH, UI_LCD_POSY * r.bottom / UI_HEIGHT, | 167 | UI_LCD_POSX * r.right / UI_WIDTH, UI_LCD_POSY * r.bottom / UI_HEIGHT, |
167 | DISP_X * r.right / UI_WIDTH, DISP_Y * r.bottom / UI_HEIGHT, | 168 | LCD_WIDTH * r.right / UI_WIDTH, LCD_HEIGHT * r.bottom / UI_HEIGHT, |
168 | 0, 0, DISP_X, DISP_Y, | 169 | 0, 0, LCD_WIDTH, LCD_HEIGHT, |
169 | bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, SRCCOPY); | 170 | bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, SRCCOPY); |
170 | 171 | ||
171 | EndPaint (hWnd, &ps); | 172 | EndPaint (hWnd, &ps); |
diff --git a/uisimulator/win32/uisw32.h b/uisimulator/win32/uisw32.h index 37edb0c4b8..d168c8955e 100644 --- a/uisimulator/win32/uisw32.h +++ b/uisimulator/win32/uisw32.h | |||
@@ -5,6 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | ||
8 | * | 9 | * |
9 | * Copyright (C) 2002 by Felix Arends | 10 | * Copyright (C) 2002 by Felix Arends |
10 | * | 11 | * |
@@ -24,7 +25,7 @@ | |||
24 | 25 | ||
25 | #define UI_WIDTH 240 // width of GUI window | 26 | #define UI_WIDTH 240 // width of GUI window |
26 | #define UI_HEIGHT 360 // height of GUI window | 27 | #define UI_HEIGHT 360 // height of GUI window |
27 | #define UI_LCD_COLOR 46, 57, 49 // bkgnd color of LCD | 28 | #define UI_LCD_COLOR 46, 67, 49 // bkgnd color of LCD |
28 | #define UI_LCD_BLACK 0, 0, 0 // black | 29 | #define UI_LCD_BLACK 0, 0, 0 // black |
29 | #define UI_LCD_POSX 59 // x position of lcd | 30 | #define UI_LCD_POSX 59 // x position of lcd |
30 | #define UI_LCD_POSY 95 // y position of lcd | 31 | #define UI_LCD_POSY 95 // y position of lcd |
diff --git a/uisimulator/win32/uisw32.suo b/uisimulator/win32/uisw32.suo index 63fcd66d0d..070ca781b2 100644 --- a/uisimulator/win32/uisw32.suo +++ b/uisimulator/win32/uisw32.suo | |||
Binary files differ | |||
diff --git a/uisimulator/win32/uisw32.vcproj b/uisimulator/win32/uisw32.vcproj index 39e7b82464..afc181d417 100644 --- a/uisimulator/win32/uisw32.vcproj +++ b/uisimulator/win32/uisw32.vcproj | |||
@@ -116,7 +116,22 @@ | |||
116 | RelativePath="kernel.c"> | 116 | RelativePath="kernel.c"> |
117 | </File> | 117 | </File> |
118 | <File | 118 | <File |
119 | RelativePath="lcd.c"> | 119 | RelativePath="lcd-win32.c"> |
120 | </File> | ||
121 | <File | ||
122 | RelativePath="..\..\firmware\drivers\lcd.c"> | ||
123 | <FileConfiguration | ||
124 | Name="Debug|Win32"> | ||
125 | <Tool | ||
126 | Name="VCCLCompilerTool" | ||
127 | ObjectFile="$(IntDir)/$(InputName)1.obj"/> | ||
128 | </FileConfiguration> | ||
129 | <FileConfiguration | ||
130 | Name="Release|Win32"> | ||
131 | <Tool | ||
132 | Name="VCCLCompilerTool" | ||
133 | ObjectFile="$(IntDir)/$(InputName)1.obj"/> | ||
134 | </FileConfiguration> | ||
120 | </File> | 135 | </File> |
121 | <File | 136 | <File |
122 | RelativePath="tetris.c"> | 137 | RelativePath="tetris.c"> |