summaryrefslogtreecommitdiff
path: root/apps/plugins/zxbox
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/zxbox')
-rw-r--r--apps/plugins/zxbox/ChangeLog2
-rw-r--r--apps/plugins/zxbox/spect.c4
-rw-r--r--apps/plugins/zxbox/spmain.c120
-rw-r--r--apps/plugins/zxbox/spperif.c1
-rw-r--r--apps/plugins/zxbox/spperif.h1
-rw-r--r--apps/plugins/zxbox/spscr.c33
-rw-r--r--apps/plugins/zxbox/spscr.h1
7 files changed, 71 insertions, 91 deletions
diff --git a/apps/plugins/zxbox/ChangeLog b/apps/plugins/zxbox/ChangeLog
index 2986d97eda..ce31728f36 100644
--- a/apps/plugins/zxbox/ChangeLog
+++ b/apps/plugins/zxbox/ChangeLog
@@ -1,3 +1,5 @@
126.09.2006 do not update border when we don't see it. some more cleanup.
2
125.09.2006 yet more code cleanup, quick snapshot feature,sound should no longer crash,light optimizations 325.09.2006 yet more code cleanup, quick snapshot feature,sound should no longer crash,light optimizations
2 4
304.09.2006 code cleanup; now using IRAM correctly (i hope) 504.09.2006 code cleanup; now using IRAM correctly (i hope)
diff --git a/apps/plugins/zxbox/spect.c b/apps/plugins/zxbox/spect.c
index 8e9291f704..47715fa9fd 100644
--- a/apps/plugins/zxbox/spect.c
+++ b/apps/plugins/zxbox/spect.c
@@ -60,11 +60,15 @@ int SPNM(halfframe)(int firsttick, int numlines)
60 /* Check if updating screen */ 60 /* Check if updating screen */
61 61
62 if(SPNM(updating)) { 62 if(SPNM(updating)) {
63#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
63 border = SPNM(lastborder); 64 border = SPNM(lastborder);
64 if((feport & 0x07) != border) { 65 if((feport & 0x07) != border) {
65 SPNM(border_update) = 2; 66 SPNM(border_update) = 2;
66 SPNM(lastborder) = feport & 0x07; 67 SPNM(lastborder) = feport & 0x07;
67 } 68 }
69#else
70 SPNM(border_update) = 0;
71#endif
68 scrptr = update_screen_line(scrptr, SPNM(coli)[scline], DANM(next_scri), 72 scrptr = update_screen_line(scrptr, SPNM(coli)[scline], DANM(next_scri),
69 border, &cmark); 73 border, &cmark);
70 74
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c
index 030047cc94..3a702abb71 100644
--- a/apps/plugins/zxbox/spmain.c
+++ b/apps/plugins/zxbox/spmain.c
@@ -84,7 +84,7 @@ static struct configdata config[] =
84}; 84};
85int spcf_read_conf_file(const char *filename) 85int spcf_read_conf_file(const char *filename)
86{ 86{
87 settings.volume = 10; 87 settings.volume = 10;
88 settings.showfps=1; 88 settings.showfps=1;
89 settings.keymap[0]='2'; 89 settings.keymap[0]='2';
90 settings.keymap[1]='w'; 90 settings.keymap[1]='w';
@@ -93,8 +93,8 @@ int spcf_read_conf_file(const char *filename)
93 settings.keymap[4]='z'; 93 settings.keymap[4]='z';
94 settings.kempston = 1 ; 94 settings.kempston = 1 ;
95 settings.invert_colors=0; 95 settings.invert_colors=0;
96 settings.sound = 0; 96 settings.sound = 0;
97 settings.frameskip = 0; 97 settings.frameskip = 0;
98 98
99 99
100 configfile_init(rb); 100 configfile_init(rb);
@@ -112,17 +112,17 @@ int spcf_read_conf_file(const char *filename)
112 /* Keep a copy of the saved version of the settings - so we can check if 112 /* Keep a copy of the saved version of the settings - so we can check if
113 the settings have changed when we quit */ 113 the settings have changed when we quit */
114 old_settings = settings; 114 old_settings = settings;
115 sound_on = settings.sound; 115 sound_on = settings.sound;
116 showframe = settings.frameskip+1; 116 showframe = settings.frameskip+1;
117 int i; 117 int i;
118 for ( i=0 ; i<5 ; i++){ 118 for ( i=0 ; i<5 ; i++){
119 if (settings.keymap[i] == 'E') 119 if (settings.keymap[i] == 'E')
120 intkeys[i]=SK_KP_Enter; 120 intkeys[i]=SK_KP_Enter;
121 else if ( settings.keymap[i] == 'S' ) 121 else if ( settings.keymap[i] == 'S' )
122 intkeys[i]=SK_KP_Space; 122 intkeys[i]=SK_KP_Space;
123 else 123 else
124 intkeys[i] = (unsigned) settings.keymap[i]; 124 intkeys[i] = (unsigned) settings.keymap[i];
125 } 125 }
126 return 1; 126 return 1;
127} 127}
128 128
@@ -131,7 +131,7 @@ int spcf_read_conf_file(const char *filename)
131/* set keys */ 131/* set keys */
132static void set_keys(void){ 132static void set_keys(void){
133 int m; 133 int m;
134 char c; 134 char c;
135 int result; 135 int result;
136 int menu_quit=0; 136 int menu_quit=0;
137 static const struct menu_item items[] = { 137 static const struct menu_item items[] = {
@@ -198,8 +198,8 @@ static void select_keymap(void){
198 int menu_quit=0; 198 int menu_quit=0;
199 static const struct menu_item items[] = { 199 static const struct menu_item items[] = {
200 { "2w90z", NULL }, 200 { "2w90z", NULL },
201 { "qaopS", NULL }, 201 { "qaopS", NULL },
202 { "7658S", NULL }, 202 { "7658S", NULL },
203 }; 203 };
204 204
205 m = rb->menu_init(items, sizeof(items) / sizeof(*items), 205 m = rb->menu_init(items, sizeof(items) / sizeof(*items),
@@ -213,15 +213,15 @@ static void select_keymap(void){
213 switch(result) 213 switch(result)
214 { 214 {
215 case 0: 215 case 0:
216 rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[0].desc , sizeof(items[0].desc)); 216 rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[0].desc , sizeof(items[0].desc));
217 menu_quit=1; 217 menu_quit=1;
218 break; 218 break;
219 case 1: 219 case 1:
220 rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[1].desc , sizeof(items[1].desc)); 220 rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[1].desc , sizeof(items[1].desc));
221 menu_quit=1; 221 menu_quit=1;
222 break; 222 break;
223 case 2: 223 case 2:
224 rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[2].desc , sizeof(items[2].desc)); 224 rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[2].desc , sizeof(items[2].desc));
225 menu_quit=1; 225 menu_quit=1;
226 break; 226 break;
227 default: 227 default:
@@ -247,9 +247,9 @@ static void options_menu(void){
247 { "Map Keys to kempston", NULL }, 247 { "Map Keys to kempston", NULL },
248 { "Display Speed", NULL }, 248 { "Display Speed", NULL },
249 { "Invert Colors", NULL }, 249 { "Invert Colors", NULL },
250 { "Frameskip", NULL }, 250 { "Frameskip", NULL },
251 { "Sound", NULL }, 251 { "Sound", NULL },
252 { "Volume", NULL }, 252 { "Volume", NULL },
253 { "Predefined keymap", NULL }, 253 { "Predefined keymap", NULL },
254 { "Custom keymap", NULL }, 254 { "Custom keymap", NULL },
255 }; 255 };
@@ -257,15 +257,15 @@ static void options_menu(void){
257 { "0", NULL }, 257 { "0", NULL },
258 { "1", NULL }, 258 { "1", NULL },
259 { "2", NULL }, 259 { "2", NULL },
260 { "3", NULL }, 260 { "3", NULL },
261 { "4", NULL }, 261 { "4", NULL },
262 { "5", NULL }, 262 { "5", NULL },
263 { "6", NULL }, 263 { "6", NULL },
264 { "7", NULL }, 264 { "7", NULL },
265 { "8", NULL }, 265 { "8", NULL },
266 { "9", NULL }, 266 { "9", NULL },
267 }; 267 };
268 268
269 269
270 m = rb->menu_init(items, sizeof(items) / sizeof(*items), 270 m = rb->menu_init(items, sizeof(items) / sizeof(*items),
271 NULL, NULL, NULL, NULL); 271 NULL, NULL, NULL, NULL);
@@ -299,34 +299,34 @@ static void options_menu(void){
299 settings.invert_colors=new_setting; 299 settings.invert_colors=new_setting;
300 rb->splash(HZ, true , "Restart to see effect"); 300 rb->splash(HZ, true , "Restart to see effect");
301 break; 301 break;
302 case 3: 302 case 3:
303 new_setting = settings.frameskip; 303 new_setting = settings.frameskip;
304 rb->set_option("Frameskip",&new_setting,INT, 304 rb->set_option("Frameskip",&new_setting,INT,
305 frameskip_items, 10, NULL); 305 frameskip_items, 10, NULL);
306 if (new_setting != settings.frameskip ) 306 if (new_setting != settings.frameskip )
307 settings.frameskip=new_setting; 307 settings.frameskip=new_setting;
308 break; 308 break;
309 case 4: 309 case 4:
310 new_setting = settings.sound; 310 new_setting = settings.sound;
311 rb->set_option("Sound",&new_setting,INT, 311 rb->set_option("Sound",&new_setting,INT,
312 no_yes, 2, NULL); 312 no_yes, 2, NULL);
313 if (new_setting != settings.sound ) 313 if (new_setting != settings.sound )
314 settings.sound=new_setting; 314 settings.sound=new_setting;
315#if CODEC == SWCODEC && !defined SIMULATOR 315#if CODEC == SWCODEC && !defined SIMULATOR
316 rb->pcm_play_stop(); 316 rb->pcm_play_stop();
317#endif 317#endif
318 break; 318 break;
319 case 5: 319 case 5:
320 new_setting = 9 - settings.volume; 320 new_setting = 9 - settings.volume;
321 rb->set_option("Volume",&new_setting,INT, 321 rb->set_option("Volume",&new_setting,INT,
322 frameskip_items, 10, NULL); 322 frameskip_items, 10, NULL);
323 new_setting = 9 - new_setting; 323 new_setting = 9 - new_setting;
324 if (new_setting != settings.volume ) 324 if (new_setting != settings.volume )
325 settings.volume=new_setting; 325 settings.volume=new_setting;
326 break; 326 break;
327 case 6: 327 case 6:
328 select_keymap(); 328 select_keymap();
329 break; 329 break;
330 case 7: 330 case 7:
331 set_keys(); 331 set_keys();
332 break; 332 break;
@@ -353,8 +353,8 @@ static bool zxbox_menu(void)
353 static const struct menu_item items[] = { 353 static const struct menu_item items[] = {
354 { "VKeyboard", NULL }, 354 { "VKeyboard", NULL },
355 { "Play/Pause Tape", NULL }, 355 { "Play/Pause Tape", NULL },
356 { "Save quick snapshot", NULL }, 356 { "Save quick snapshot", NULL },
357 { "Load quick snapshot", NULL }, 357 { "Load quick snapshot", NULL },
358 { "Save Snapshot", NULL }, 358 { "Save Snapshot", NULL },
359 { "Toggle \"fast\" mode", NULL }, 359 { "Toggle \"fast\" mode", NULL },
360 { "Options", NULL }, 360 { "Options", NULL },
@@ -383,14 +383,14 @@ static bool zxbox_menu(void)
383 pause_play(); 383 pause_play();
384 menu_quit=1; 384 menu_quit=1;
385 break; 385 break;
386 case 2: 386 case 2:
387 save_quick_snapshot(); 387 save_quick_snapshot();
388 menu_quit = 1; 388 menu_quit = 1;
389 break; 389 break;
390 case 3: 390 case 3:
391 load_quick_snapshot(); 391 load_quick_snapshot();
392 menu_quit = 1; 392 menu_quit = 1;
393 break; 393 break;
394 case 4: 394 case 4:
395 save_snapshot(); 395 save_snapshot();
396 break; 396 break;
@@ -416,15 +416,15 @@ static bool zxbox_menu(void)
416 rb->cpu_boost(true); 416 rb->cpu_boost(true);
417#endif 417#endif
418 418
419 int i; 419 int i;
420 for ( i=0 ; i<5 ; i++){ 420 for ( i=0 ; i<5 ; i++){
421 if (settings.keymap[i] == 'E') 421 if (settings.keymap[i] == 'E')
422 intkeys[i]=SK_KP_Enter; 422 intkeys[i]=SK_KP_Enter;
423 else if ( settings.keymap[i] == 'S' ) 423 else if ( settings.keymap[i] == 'S' )
424 intkeys[i]=SK_KP_Space; 424 intkeys[i]=SK_KP_Space;
425 else 425 else
426 intkeys[i] = (unsigned) settings.keymap[i]; 426 intkeys[i] = (unsigned) settings.keymap[i];
427 } 427 }
428#ifdef USE_GRAY 428#ifdef USE_GRAY
429 gray_show(true); 429 gray_show(true);
430#endif 430#endif
@@ -476,20 +476,10 @@ static void run_singlemode(void)
476 exit_requested = 0; 476 exit_requested = 0;
477 video_frames=-1; 477 video_frames=-1;
478 start_time = *rb->current_tick; 478 start_time = *rb->current_tick;
479 sound_on = settings.sound; 479 sound_on = settings.sound;
480 showframe = settings.frameskip+1; 480 showframe = settings.frameskip+1;
481 spti_reset(); 481 spti_reset();
482 } 482 }
483 if(sp_paused) {
484 autoclose_sound();
485 while(sp_paused) {
486 spkb_process_events(1);
487 spti_sleep(SKIPTICKS);
488 translate_screen();
489 update();
490 }
491 spti_reset();
492 }
493 halfsec = !(sp_int_ctr % 25); 483 halfsec = !(sp_int_ctr % 25);
494 evenframe = !(sp_int_ctr & 1); 484 evenframe = !(sp_int_ctr & 1);
495 485
diff --git a/apps/plugins/zxbox/spperif.c b/apps/plugins/zxbox/spperif.c
index 6255ba689a..33f43608b4 100644
--- a/apps/plugins/zxbox/spperif.c
+++ b/apps/plugins/zxbox/spperif.c
@@ -48,7 +48,6 @@ int SPNM(scri)[PORT_TIME_NUM];
48int SPNM(coli)[PORT_TIME_NUM]; 48int SPNM(coli)[PORT_TIME_NUM];
49 49
50int SPNM(playing_tape) = 0; 50int SPNM(playing_tape) = 0;
51int SPNM(paused) = 0;
52 51
53char *SPNM(image); 52char *SPNM(image);
54int SPNM(updating); 53int SPNM(updating);
diff --git a/apps/plugins/zxbox/spperif.h b/apps/plugins/zxbox/spperif.h
index cb0d550072..f2ccb57be4 100644
--- a/apps/plugins/zxbox/spperif.h
+++ b/apps/plugins/zxbox/spperif.h
@@ -55,7 +55,6 @@ extern int SPNM(load_trapped);
55extern qbyte SPNM(scr_mark)[]; 55extern qbyte SPNM(scr_mark)[];
56extern byte SPNM(fe_inport_high)[]; 56extern byte SPNM(fe_inport_high)[];
57extern int SPNM(playing_tape); 57extern int SPNM(playing_tape);
58extern int SPNM(paused);
59 58
60extern int SPNM(scline); 59extern int SPNM(scline);
61 60
diff --git a/apps/plugins/zxbox/spscr.c b/apps/plugins/zxbox/spscr.c
index 4cae8654ae..6b85904d11 100644
--- a/apps/plugins/zxbox/spscr.c
+++ b/apps/plugins/zxbox/spscr.c
@@ -82,6 +82,7 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border,
82 cmark = *cmarkp; 82 cmark = *cmarkp;
83 scrptr = (qbyte *) scrp; 83 scrptr = (qbyte *) scrp;
84 if(scri >= 0) { /* normal line */ 84 if(scri >= 0) { /* normal line */
85#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
85 if(SPNM(border_update)) { 86 if(SPNM(border_update)) {
86 brd_color = SPNM(colors)[border]; 87 brd_color = SPNM(colors)[border];
87 brd_color |= brd_color << 8; 88 brd_color |= brd_color << 8;
@@ -91,7 +92,10 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border,
91 for(i = 8; i; i--) *scrptr++ = brd_color; 92 for(i = 8; i; i--) *scrptr++ = brd_color;
92 scrptr -= 0x48; 93 scrptr -= 0x48;
93 } 94 }
94 else scrptr += 0x08; 95 else
96#endif
97 scrptr += 0x08;
98
95 tmptr = SPNM(scr_mark) + 0x2C0 + (coli >> 3); 99 tmptr = SPNM(scr_mark) + 0x2C0 + (coli >> 3);
96 mark = *tmptr; 100 mark = *tmptr;
97 if(!(coli & 0x07)) { 101 if(!(coli & 0x07)) {
@@ -129,40 +133,23 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border,
129 else scrptr += 0x48; 133 else scrptr += 0x48;
130 } 134 }
131 else if(scri == -1) { /* only border */ 135 else if(scri == -1) { /* only border */
136#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
132 if(SPNM(border_update)) { 137 if(SPNM(border_update)) {
133 brd_color = SPNM(colors)[border]; 138 brd_color = SPNM(colors)[border];
134 brd_color |= brd_color << 8; 139 brd_color |= brd_color << 8;
135 brd_color |= brd_color << 16; 140 brd_color |= brd_color << 16;
136 for(i = 0x50; i; i--) *scrptr++ = brd_color; 141 for(i = 0x50; i; i--) *scrptr++ = brd_color;
137 } 142 }
138 else scrptr += 0x50; 143 else
144#endif
145 scrptr += 0x50;
146
139 } 147 }
140 148
141 *cmarkp = cmark; 149 *cmarkp = cmark;
142 return (byte *) scrptr; 150 return (byte *) scrptr;
143} 151}
144 152
145void translate_screen(void)
146{
147 int border, scline;
148 byte *scrptr;
149 qbyte cmark = 0;
150
151 scrptr = (byte *) SPNM(image);
152
153 border = DANM(ula_outport) & 0x07;
154 if(border != SPNM(lastborder)) {
155 SPNM(border_update) = 2;
156 SPNM(lastborder) = border;
157 }
158
159 for(scline = 0; scline < (TMNUM / 2); scline++)
160 scrptr = update_screen_line(scrptr, SPNM(coli)[scline], SPNM(scri)[scline],
161 border, &cmark);
162
163}
164
165
166void spscr_init_mask_color(void) 153void spscr_init_mask_color(void)
167{ 154{
168 int clb; 155 int clb;
diff --git a/apps/plugins/zxbox/spscr.h b/apps/plugins/zxbox/spscr.h
index 82161dea15..b90dabd7f4 100644
--- a/apps/plugins/zxbox/spscr.h
+++ b/apps/plugins/zxbox/spscr.h
@@ -30,7 +30,6 @@ extern void init_spect_scr(void);
30extern void destroy_spect_scr(void); 30extern void destroy_spect_scr(void);
31extern void update_screen(void); 31extern void update_screen(void);
32extern void flash_change(void); 32extern void flash_change(void);
33extern void translate_screen(void);
34 33
35extern byte *update_screen_line(byte *scrp, int coli, int scri, int border, 34extern byte *update_screen_line(byte *scrp, int coli, int scri, int border,
36 qbyte *cmarkp); 35 qbyte *cmarkp);