- // decide if we draw this line
-#if CAN_HANDLE_240_LINES
- if(!skip && ((!(pv->reg[1]&8) && y<224) || ((pv->reg[1]&8) && y<240)) )
-#else
- if(!skip && y<224)
-#endif
- PicoLine(y);
-
- if(PicoOpt&1)
- sound_timers_and_dac(y);
-
- // get samples from sound chips
- if(y == 32 && PsndOut)
- emustatus &= ~1;
- else if((y == 224 || y == line_sample) && PsndOut)
- ;//getSamples(y);
-
- // Run scanline:
- //dprintf("m68k starting exec @ %06x", SekPc);
- SekRun(cycles_68k);
- if ((Pico_mcd->m68k_regs[1]&3) == 1) { // no busreq/no reset
-#if 0
- int i;
- FILE *f = fopen("prg_ram.bin", "wb");
- for (i = 0; i < 0x80000; i+=2)
- {
- int tmp = Pico_mcd->prg_ram[i];
- Pico_mcd->prg_ram[i] = Pico_mcd->prg_ram[i+1];
- Pico_mcd->prg_ram[i+1] = tmp;
- }
- fwrite(Pico_mcd->prg_ram, 1, 0x80000, f);
- fclose(f);
- exit(1);
+static __inline void update_chips(void)
+{
+ int counter_timer, int3_set;
+ int counter75hz_lim = Pico.m.pal ? 2080 : 2096;
+
+ // 75Hz CDC update
+ if ((Pico_mcd->m.counter75hz+=10) >= counter75hz_lim) {
+ Pico_mcd->m.counter75hz -= counter75hz_lim;
+ Check_CD_Command();
+ }
+
+ // update timers
+ counter_timer = Pico.m.pal ? 0x21630 : 0x2121c; // 136752 : 135708;
+ Pico_mcd->m.timer_stopwatch += counter_timer;
+ if ((int3_set = Pico_mcd->s68k_regs[0x31])) {
+ Pico_mcd->m.timer_int3 -= counter_timer;
+ if (Pico_mcd->m.timer_int3 < 0) {
+ if (Pico_mcd->s68k_regs[0x33] & (1<<3)) {
+ elprintf(EL_INTS, "s68k: timer irq 3");
+ SekInterruptS68k(3);
+ Pico_mcd->m.timer_int3 += int3_set << 16;
+ }
+ // is this really what happens if irq3 is masked out?
+ Pico_mcd->m.timer_int3 &= 0xffffff;
+ }
+ }
+
+ // update gfx chip
+ if (Pico_mcd->rot_comp.Reg_58 & 0x8000)
+ gfx_cd_update();
+
+ // delayed setting of DMNA bit (needed for Silpheed)
+ if (Pico_mcd->m.state_flags & 2) {
+ Pico_mcd->m.state_flags &= ~2;
+ if (!(Pico_mcd->s68k_regs[3] & 4)) {
+ Pico_mcd->s68k_regs[3] |= 2;
+ Pico_mcd->s68k_regs[3] &= ~1;
+#ifdef USE_POLL_DETECT
+ if ((s68k_poll_adclk&0xfe) == 2) {
+ SekSetStopS68k(0); s68k_poll_adclk = 0;
+ }