X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FPicoInt.h;h=4ac115f38f1f6e6b2b79f15debde4ee6ec403482;hb=45a1ef7153910f005c01cba63d12f312071efef0;hp=bf5c46d9dc19bdda37a9eac4ae1fdd38c1f3d9ae;hpb=43e6eaad0b73b37907be3342e0fd4cf65919e9f6;p=picodrive.git diff --git a/Pico/PicoInt.h b/Pico/PicoInt.h index bf5c46d..4ac115f 100644 --- a/Pico/PicoInt.h +++ b/Pico/PicoInt.h @@ -1,7 +1,7 @@ // Pico Library - Internal Header File // (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006,2007 Grazvydas "notaz" Ignotas, all rights reserved. +// (c) Copyright 2006-2008 Grazvydas "notaz" Ignotas, all rights reserved. // Free for non-commercial use. // For commercial use, separate licencing terms must be obtained. @@ -185,10 +185,7 @@ extern struct DrZ80 drZ80; #define z80_run(cycles) ((cycles) - DrZ80Run(&drZ80, cycles)) #define z80_run_nr(cycles) DrZ80Run(&drZ80, cycles) -#define z80_int() { \ - drZ80.z80irqvector = 0xFF; /* default IRQ vector RST opcode */ \ - drZ80.Z80_IRQ = 1; \ -} +#define z80_int() drZ80.Z80_IRQ = 1 #define z80_cyclesLeft drZ80.cycles @@ -479,18 +476,26 @@ extern int timer_a_next_oflow, timer_a_step, timer_a_offset; // in z80 cycles extern int timer_b_next_oflow, timer_b_step, timer_b_offset; void ym2612_sync_timers(int z80_cycles, int mode_old, int mode_new); +void ym2612_pack_state(void); +void ym2612_unpack_state(void); + +#define TIMER_NO_OFLOW 0x70000000 +// tA = 72 * (1024 - NA) / M +#define TIMER_A_TICK_ZCYCLES 17203 +// tB = 1152 * (256 - NA) / M +#define TIMER_B_TICK_ZCYCLES 262800 // 275251 broken, see Dai Makaimura #define timers_cycle() \ - if (timer_a_next_oflow > 0 && timer_a_next_oflow < 0x70000000) \ + if (timer_a_next_oflow > 0 && timer_a_next_oflow < TIMER_NO_OFLOW) \ timer_a_next_oflow -= Pico.m.pal ? 70938*256 : 59659*256; \ - if (timer_b_next_oflow > 0 && timer_b_next_oflow < 0x70000000) \ + if (timer_b_next_oflow > 0 && timer_b_next_oflow < TIMER_NO_OFLOW) \ timer_b_next_oflow -= Pico.m.pal ? 70938*256 : 59659*256; \ ym2612_sync_timers(0, ym2612.OPN.ST.mode, ym2612.OPN.ST.mode); #define timers_reset() \ - timer_a_next_oflow = timer_b_next_oflow = 0x70000000; \ - timer_a_step = timer_a_offset = 16495 * 1024; \ - timer_b_step = timer_b_offset = 263912 * 256; + timer_a_next_oflow = timer_b_next_oflow = TIMER_NO_OFLOW; \ + timer_a_step = timer_a_offset = TIMER_A_TICK_ZCYCLES * 1024; \ + timer_b_step = timer_b_offset = TIMER_B_TICK_ZCYCLES * 256; // VideoPort.c