diff --git a/src/emulator.c b/src/emulator.c index 2e0d131..ef063c3 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -1833,7 +1833,11 @@ int main(int argc,char *argv[]) if(ordenador.interr==1) { Z80free_INT(&procesador,bus_empty()); if ((ordenador.precision==0)||(jump_frames>0)) ordenador.interr=0; - if (ordenador.recording_rzx) {if (ordenador.icount != 0xFFFF) rzx_update(&ordenador.icount);ordenador.icount=0;} + if (ordenador.recording_rzx) + { + if (ordenador.icount == 0xFFFF) ordenador.icount=0; + else if (test_IFF1(&procesador)||(ordenador.icount>10)) {rzx_update(&ordenador.icount);ordenador.icount=0;} + } } } diff --git a/src/gui_sdl.c b/src/gui_sdl.c index 932f535..327b2a1 100644 --- a/src/gui_sdl.c +++ b/src/gui_sdl.c @@ -1952,7 +1952,7 @@ static int do_rzx(int which) ordenador.frames_count_rzx=1; retorno2 = load_rzx(); if (retorno2) break; //Error or no file - retorno2 = rzx_update(&ordenador.maxicount); + retorno2 = rzx_update(&ordenador.maxicount); //The first frame does not generate interrupt if (retorno2 == RZX_FINISHED) {printf("RZX: Playing finished at fisrt frame\n"); break;} //ordenador.cicles_counter=32; //to avoid the interrupt at first frame ordenador.playing_rzx = 1; diff --git a/src/rzx_lib/rzx.c b/src/rzx_lib/rzx.c index f60a530..659f6a9 100644 --- a/src/rzx_lib/rzx.c +++ b/src/rzx_lib/rzx.c @@ -293,6 +293,8 @@ void rzx_close_irb() block.start=pos; /* signal that we have exited the IRB */ rzx_status&=~RZX_IRB; + INcount=0; + INold=0xFFFF; } @@ -678,7 +680,6 @@ int rzx_update(rzx_u16 *icount) rzx_popen(fpos,"wb"); } #endif - INcount=0; INold=0xFFFF; } diff --git a/src/z80free/Z80free.c b/src/z80free/Z80free.c index 7838f92..9bb309b 100644 --- a/src/z80free/Z80free.c +++ b/src/z80free/Z80free.c @@ -67,6 +67,11 @@ int Z80free_step(Z80FREE *processor) { return (retval); } +byte test_IFF1 (Z80FREE *processor) +{ + return processor->IFF1; +} + int Z80free_ustep(Z80FREE *processor) { static byte opcode,d1; diff --git a/src/z80free/Z80free.h b/src/z80free/Z80free.h index b95de1e..a2787c0 100644 --- a/src/z80free/Z80free.h +++ b/src/z80free/Z80free.h @@ -147,6 +147,7 @@ void Z80free_Wr_fake (register word Addr, register byte Value); byte Z80free_In (register word Port); void Z80free_Out (register word Port, register byte Value); void Z80free_Out_fake (register word Port, register byte Value); +byte test_IFF1 (Z80FREE *); /* Opcode functions */