Commit ff5fb0bb authored by Sergio Costas's avatar Sergio Costas

Correccion de la prueba que hice para forzar 8 bits

Mas depuracion

Mejor emulacion de contienda
parent 6964beb3
......@@ -16,3 +16,4 @@ WHAT EMULATES RIGHT IN FBZX?
-Emulates Spanish 128K from Investronica/Sinclair
-Allows to insert POKE values in memory (inmunity, infinite lives...)
-Can load and save SCR snapshots
-ULAPlus support
2.6.0
*ULAPlus support
*Fixed a little bug in the ROM loading
2.5.0
*Allows to set POKEs
......
......@@ -1274,11 +1274,18 @@ void do_contention() {
if (!ordenador.contended_zone)
return;
if ((ordenador.cicles_counter%4)==3)
if (ordenador.cicles_counter<14335) {
return;
}
int ccicles=(ordenador.cicles_counter-14335)%8;
if (ccicles>5) {
return;
}
emulate(3-(ordenador.cicles_counter%4));
emulate(6-ccicles);
printf ("Contencion %d\n",6-ccicles);
}
void Z80free_Wr (register word Addr, register byte Value) {
......
......@@ -174,7 +174,7 @@ struct computer {
// OSD global variables
unsigned char osd_text[81];
unsigned char osd_text[200];
unsigned int osd_time;
// pagination global variables
......
......@@ -225,7 +225,7 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
}
// screen initialization
valores=SDL_HWPALETTE;//|SDL_ANYFORMAT;
valores=SDL_HWPALETTE|SDL_ANYFORMAT;
if (fullscreen==1)
valores|=SDL_FULLSCREEN;
......@@ -236,7 +236,6 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
else
valores|=SDL_SWSURFACE;
depth=8;
screen=SDL_SetVideoMode(resx,resy,depth,valores);
if(screen==NULL) {
printf("Can't assign SDL Surface. Exiting\n");
......@@ -252,6 +251,8 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
} else
ordenador.mustlock=0;
printf("Locking screen\n");
// sound initialization
if (sound_type==SOUND_AUTOMATIC) {
......@@ -266,7 +267,7 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
sound_init(0);
sound_aborted=1;
}
printf("Init sound\n");
if(ordenador.format)
ordenador.increment=2*ordenador.channels;
else
......@@ -274,14 +275,17 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
value=0;
for(bucle2=0;bucle2<NUM_SNDBUF;bucle2++) {
sound[bucle2]=(unsigned char *)malloc(ordenador.buffer_len*ordenador.increment+4);
sound[bucle2]=(unsigned char *)malloc(ordenador.buffer_len*ordenador.increment+8);
for(bucle=0;bucle<ordenador.buffer_len*ordenador.increment+4;bucle++)
sound[bucle2][bucle]=value;
value+=4;
}
printf("Init sound 2\n");
ordenador.tst_sample=3500000/ordenador.freq;
printf("Set volume\n");
set_volume(70);
printf("Return init\n");
}
void end_system() {
......@@ -594,7 +598,9 @@ int main(int argc,char *argv[]) {
}
computer_init();
printf("Computer init\n");
register_screen(screen);
printf("Screen registered\n");
if(fullscreen) {
SDL_Fullscreen_Switch();
}
......@@ -616,9 +622,11 @@ int main(int argc,char *argv[]) {
// assign random values to the memory before start execution
printf("Reset memory\n");
for(bucle=0;bucle<196608;bucle++)
ordenador.memoria[bucle]=(unsigned char) rand();
printf("Memory resetted\n");
ordenador.tap_file=NULL;
// we filter all the events, except keyboard events
......@@ -640,12 +648,15 @@ int main(int argc,char *argv[]) {
SDL_ShowCursor(SDL_DISABLE);
salir=1;
printf("Init microdrive\n");
microdrive_init();
printf("Reset computer\n");
ResetComputer();
sleep(1);
printf("Reset screen\n");
clean_screen();
if (sound_aborted==1) {
......@@ -653,6 +664,7 @@ int main(int argc,char *argv[]) {
ordenador.osd_time=100;
}
printf("load main game\n");
load_main_game(gamefile);
sprintf(ordenador.osd_text,"Press F1 for help");
......
......@@ -272,7 +272,7 @@ void help_menu() {
clean_screen();
print_string(fbuffer,"FBZX (2.5.0)",-1,10,15,0,ancho);
print_string(fbuffer,"FBZX (2.6.0)",-1,10,15,0,ancho);
print_string(fbuffer,"Available keys",-1,40,14,0,ancho);
print_string(fbuffer,"Shift:Caps Shift Ctrl:Symbol Shift",-1,95,11,0,ancho);
......@@ -651,8 +651,9 @@ void select_tapfile() {
return;
}
if(ordenador.tap_file!=NULL)
if(ordenador.tap_file!=NULL) {
fclose(ordenador.tap_file);
}
ordenador.tap_file=fopen(filename,"r+"); // read and write
ordenador.tape_write = 0; // by default, can't record
......@@ -848,10 +849,10 @@ void select_mdrfile() {
retorno=-1;
else {
retorno=0;
retval=fread(ordenador.mdr_cartridge,137923,1,ordenador.mdr_file); // read the cartridge in memory
ordenador.mdr_modified=0; // not modified
fclose(ordenador.mdr_file);
ordenador.mdr_tapehead=0;
retval=fread(ordenador.mdr_cartridge,137923,1,ordenador.mdr_file); // read the cartridge in memory
ordenador.mdr_modified=0; // not modified
fclose(ordenador.mdr_file);
ordenador.mdr_tapehead=0;
}
clean_screen();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment