1
0
Fork 0
forked from len0rd/rockbox

do not update border when we don't see it. some more cleanup.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11055 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Anton Romanov 2006-09-26 08:36:54 +00:00
parent b2111b9a91
commit 25ffd2e146
7 changed files with 71 additions and 91 deletions

View file

@ -1,3 +1,5 @@
26.09.2006 do not update border when we don't see it. some more cleanup.
25.09.2006 yet more code cleanup, quick snapshot feature,sound should no longer crash,light optimizations 25.09.2006 yet more code cleanup, quick snapshot feature,sound should no longer crash,light optimizations
04.09.2006 code cleanup; now using IRAM correctly (i hope) 04.09.2006 code cleanup; now using IRAM correctly (i hope)

View file

@ -60,11 +60,15 @@ int SPNM(halfframe)(int firsttick, int numlines)
/* Check if updating screen */ /* Check if updating screen */
if(SPNM(updating)) { if(SPNM(updating)) {
#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
border = SPNM(lastborder); border = SPNM(lastborder);
if((feport & 0x07) != border) { if((feport & 0x07) != border) {
SPNM(border_update) = 2; SPNM(border_update) = 2;
SPNM(lastborder) = feport & 0x07; SPNM(lastborder) = feport & 0x07;
} }
#else
SPNM(border_update) = 0;
#endif
scrptr = update_screen_line(scrptr, SPNM(coli)[scline], DANM(next_scri), scrptr = update_screen_line(scrptr, SPNM(coli)[scline], DANM(next_scri),
border, &cmark); border, &cmark);

View file

@ -84,7 +84,7 @@ static struct configdata config[] =
}; };
int spcf_read_conf_file(const char *filename) int spcf_read_conf_file(const char *filename)
{ {
settings.volume = 10; settings.volume = 10;
settings.showfps=1; settings.showfps=1;
settings.keymap[0]='2'; settings.keymap[0]='2';
settings.keymap[1]='w'; settings.keymap[1]='w';
@ -93,8 +93,8 @@ int spcf_read_conf_file(const char *filename)
settings.keymap[4]='z'; settings.keymap[4]='z';
settings.kempston = 1 ; settings.kempston = 1 ;
settings.invert_colors=0; settings.invert_colors=0;
settings.sound = 0; settings.sound = 0;
settings.frameskip = 0; settings.frameskip = 0;
configfile_init(rb); configfile_init(rb);
@ -112,17 +112,17 @@ int spcf_read_conf_file(const char *filename)
/* Keep a copy of the saved version of the settings - so we can check if /* Keep a copy of the saved version of the settings - so we can check if
the settings have changed when we quit */ the settings have changed when we quit */
old_settings = settings; old_settings = settings;
sound_on = settings.sound; sound_on = settings.sound;
showframe = settings.frameskip+1; showframe = settings.frameskip+1;
int i; int i;
for ( i=0 ; i<5 ; i++){ for ( i=0 ; i<5 ; i++){
if (settings.keymap[i] == 'E') if (settings.keymap[i] == 'E')
intkeys[i]=SK_KP_Enter; intkeys[i]=SK_KP_Enter;
else if ( settings.keymap[i] == 'S' ) else if ( settings.keymap[i] == 'S' )
intkeys[i]=SK_KP_Space; intkeys[i]=SK_KP_Space;
else else
intkeys[i] = (unsigned) settings.keymap[i]; intkeys[i] = (unsigned) settings.keymap[i];
} }
return 1; return 1;
} }
@ -131,7 +131,7 @@ int spcf_read_conf_file(const char *filename)
/* set keys */ /* set keys */
static void set_keys(void){ static void set_keys(void){
int m; int m;
char c; char c;
int result; int result;
int menu_quit=0; int menu_quit=0;
static const struct menu_item items[] = { static const struct menu_item items[] = {
@ -198,8 +198,8 @@ static void select_keymap(void){
int menu_quit=0; int menu_quit=0;
static const struct menu_item items[] = { static const struct menu_item items[] = {
{ "2w90z", NULL }, { "2w90z", NULL },
{ "qaopS", NULL }, { "qaopS", NULL },
{ "7658S", NULL }, { "7658S", NULL },
}; };
m = rb->menu_init(items, sizeof(items) / sizeof(*items), m = rb->menu_init(items, sizeof(items) / sizeof(*items),
@ -213,15 +213,15 @@ static void select_keymap(void){
switch(result) switch(result)
{ {
case 0: case 0:
rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[0].desc , sizeof(items[0].desc)); rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[0].desc , sizeof(items[0].desc));
menu_quit=1; menu_quit=1;
break; break;
case 1: case 1:
rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[1].desc , sizeof(items[1].desc)); rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[1].desc , sizeof(items[1].desc));
menu_quit=1; menu_quit=1;
break; break;
case 2: case 2:
rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[2].desc , sizeof(items[2].desc)); rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[2].desc , sizeof(items[2].desc));
menu_quit=1; menu_quit=1;
break; break;
default: default:
@ -247,9 +247,9 @@ static void options_menu(void){
{ "Map Keys to kempston", NULL }, { "Map Keys to kempston", NULL },
{ "Display Speed", NULL }, { "Display Speed", NULL },
{ "Invert Colors", NULL }, { "Invert Colors", NULL },
{ "Frameskip", NULL }, { "Frameskip", NULL },
{ "Sound", NULL }, { "Sound", NULL },
{ "Volume", NULL }, { "Volume", NULL },
{ "Predefined keymap", NULL }, { "Predefined keymap", NULL },
{ "Custom keymap", NULL }, { "Custom keymap", NULL },
}; };
@ -257,15 +257,15 @@ static void options_menu(void){
{ "0", NULL }, { "0", NULL },
{ "1", NULL }, { "1", NULL },
{ "2", NULL }, { "2", NULL },
{ "3", NULL }, { "3", NULL },
{ "4", NULL }, { "4", NULL },
{ "5", NULL }, { "5", NULL },
{ "6", NULL }, { "6", NULL },
{ "7", NULL }, { "7", NULL },
{ "8", NULL }, { "8", NULL },
{ "9", NULL }, { "9", NULL },
}; };
m = rb->menu_init(items, sizeof(items) / sizeof(*items), m = rb->menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
@ -299,34 +299,34 @@ static void options_menu(void){
settings.invert_colors=new_setting; settings.invert_colors=new_setting;
rb->splash(HZ, true , "Restart to see effect"); rb->splash(HZ, true , "Restart to see effect");
break; break;
case 3: case 3:
new_setting = settings.frameskip; new_setting = settings.frameskip;
rb->set_option("Frameskip",&new_setting,INT, rb->set_option("Frameskip",&new_setting,INT,
frameskip_items, 10, NULL); frameskip_items, 10, NULL);
if (new_setting != settings.frameskip ) if (new_setting != settings.frameskip )
settings.frameskip=new_setting; settings.frameskip=new_setting;
break; break;
case 4: case 4:
new_setting = settings.sound; new_setting = settings.sound;
rb->set_option("Sound",&new_setting,INT, rb->set_option("Sound",&new_setting,INT,
no_yes, 2, NULL); no_yes, 2, NULL);
if (new_setting != settings.sound ) if (new_setting != settings.sound )
settings.sound=new_setting; settings.sound=new_setting;
#if CODEC == SWCODEC && !defined SIMULATOR #if CODEC == SWCODEC && !defined SIMULATOR
rb->pcm_play_stop(); rb->pcm_play_stop();
#endif #endif
break; break;
case 5: case 5:
new_setting = 9 - settings.volume; new_setting = 9 - settings.volume;
rb->set_option("Volume",&new_setting,INT, rb->set_option("Volume",&new_setting,INT,
frameskip_items, 10, NULL); frameskip_items, 10, NULL);
new_setting = 9 - new_setting; new_setting = 9 - new_setting;
if (new_setting != settings.volume ) if (new_setting != settings.volume )
settings.volume=new_setting; settings.volume=new_setting;
break; break;
case 6: case 6:
select_keymap(); select_keymap();
break; break;
case 7: case 7:
set_keys(); set_keys();
break; break;
@ -353,8 +353,8 @@ static bool zxbox_menu(void)
static const struct menu_item items[] = { static const struct menu_item items[] = {
{ "VKeyboard", NULL }, { "VKeyboard", NULL },
{ "Play/Pause Tape", NULL }, { "Play/Pause Tape", NULL },
{ "Save quick snapshot", NULL }, { "Save quick snapshot", NULL },
{ "Load quick snapshot", NULL }, { "Load quick snapshot", NULL },
{ "Save Snapshot", NULL }, { "Save Snapshot", NULL },
{ "Toggle \"fast\" mode", NULL }, { "Toggle \"fast\" mode", NULL },
{ "Options", NULL }, { "Options", NULL },
@ -383,14 +383,14 @@ static bool zxbox_menu(void)
pause_play(); pause_play();
menu_quit=1; menu_quit=1;
break; break;
case 2: case 2:
save_quick_snapshot(); save_quick_snapshot();
menu_quit = 1; menu_quit = 1;
break; break;
case 3: case 3:
load_quick_snapshot(); load_quick_snapshot();
menu_quit = 1; menu_quit = 1;
break; break;
case 4: case 4:
save_snapshot(); save_snapshot();
break; break;
@ -416,15 +416,15 @@ static bool zxbox_menu(void)
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
int i; int i;
for ( i=0 ; i<5 ; i++){ for ( i=0 ; i<5 ; i++){
if (settings.keymap[i] == 'E') if (settings.keymap[i] == 'E')
intkeys[i]=SK_KP_Enter; intkeys[i]=SK_KP_Enter;
else if ( settings.keymap[i] == 'S' ) else if ( settings.keymap[i] == 'S' )
intkeys[i]=SK_KP_Space; intkeys[i]=SK_KP_Space;
else else
intkeys[i] = (unsigned) settings.keymap[i]; intkeys[i] = (unsigned) settings.keymap[i];
} }
#ifdef USE_GRAY #ifdef USE_GRAY
gray_show(true); gray_show(true);
#endif #endif
@ -476,20 +476,10 @@ static void run_singlemode(void)
exit_requested = 0; exit_requested = 0;
video_frames=-1; video_frames=-1;
start_time = *rb->current_tick; start_time = *rb->current_tick;
sound_on = settings.sound; sound_on = settings.sound;
showframe = settings.frameskip+1; showframe = settings.frameskip+1;
spti_reset(); spti_reset();
} }
if(sp_paused) {
autoclose_sound();
while(sp_paused) {
spkb_process_events(1);
spti_sleep(SKIPTICKS);
translate_screen();
update();
}
spti_reset();
}
halfsec = !(sp_int_ctr % 25); halfsec = !(sp_int_ctr % 25);
evenframe = !(sp_int_ctr & 1); evenframe = !(sp_int_ctr & 1);

View file

@ -48,7 +48,6 @@ int SPNM(scri)[PORT_TIME_NUM];
int SPNM(coli)[PORT_TIME_NUM]; int SPNM(coli)[PORT_TIME_NUM];
int SPNM(playing_tape) = 0; int SPNM(playing_tape) = 0;
int SPNM(paused) = 0;
char *SPNM(image); char *SPNM(image);
int SPNM(updating); int SPNM(updating);

View file

@ -55,7 +55,6 @@ extern int SPNM(load_trapped);
extern qbyte SPNM(scr_mark)[]; extern qbyte SPNM(scr_mark)[];
extern byte SPNM(fe_inport_high)[]; extern byte SPNM(fe_inport_high)[];
extern int SPNM(playing_tape); extern int SPNM(playing_tape);
extern int SPNM(paused);
extern int SPNM(scline); extern int SPNM(scline);

View file

@ -82,6 +82,7 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border,
cmark = *cmarkp; cmark = *cmarkp;
scrptr = (qbyte *) scrp; scrptr = (qbyte *) scrp;
if(scri >= 0) { /* normal line */ if(scri >= 0) { /* normal line */
#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
if(SPNM(border_update)) { if(SPNM(border_update)) {
brd_color = SPNM(colors)[border]; brd_color = SPNM(colors)[border];
brd_color |= brd_color << 8; brd_color |= brd_color << 8;
@ -91,7 +92,10 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border,
for(i = 8; i; i--) *scrptr++ = brd_color; for(i = 8; i; i--) *scrptr++ = brd_color;
scrptr -= 0x48; scrptr -= 0x48;
} }
else scrptr += 0x08; else
#endif
scrptr += 0x08;
tmptr = SPNM(scr_mark) + 0x2C0 + (coli >> 3); tmptr = SPNM(scr_mark) + 0x2C0 + (coli >> 3);
mark = *tmptr; mark = *tmptr;
if(!(coli & 0x07)) { if(!(coli & 0x07)) {
@ -129,40 +133,23 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border,
else scrptr += 0x48; else scrptr += 0x48;
} }
else if(scri == -1) { /* only border */ else if(scri == -1) { /* only border */
#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
if(SPNM(border_update)) { if(SPNM(border_update)) {
brd_color = SPNM(colors)[border]; brd_color = SPNM(colors)[border];
brd_color |= brd_color << 8; brd_color |= brd_color << 8;
brd_color |= brd_color << 16; brd_color |= brd_color << 16;
for(i = 0x50; i; i--) *scrptr++ = brd_color; for(i = 0x50; i; i--) *scrptr++ = brd_color;
} }
else scrptr += 0x50; else
#endif
scrptr += 0x50;
} }
*cmarkp = cmark; *cmarkp = cmark;
return (byte *) scrptr; return (byte *) scrptr;
} }
void translate_screen(void)
{
int border, scline;
byte *scrptr;
qbyte cmark = 0;
scrptr = (byte *) SPNM(image);
border = DANM(ula_outport) & 0x07;
if(border != SPNM(lastborder)) {
SPNM(border_update) = 2;
SPNM(lastborder) = border;
}
for(scline = 0; scline < (TMNUM / 2); scline++)
scrptr = update_screen_line(scrptr, SPNM(coli)[scline], SPNM(scri)[scline],
border, &cmark);
}
void spscr_init_mask_color(void) void spscr_init_mask_color(void)
{ {
int clb; int clb;

View file

@ -30,7 +30,6 @@ extern void init_spect_scr(void);
extern void destroy_spect_scr(void); extern void destroy_spect_scr(void);
extern void update_screen(void); extern void update_screen(void);
extern void flash_change(void); extern void flash_change(void);
extern void translate_screen(void);
extern byte *update_screen_line(byte *scrp, int coli, int scri, int border, extern byte *update_screen_line(byte *scrp, int coli, int scri, int border,
qbyte *cmarkp); qbyte *cmarkp);