mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
fast mode timing changed (again...)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@271 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
c77ca79e89
commit
9a8ffeeeea
4 changed files with 29 additions and 19 deletions
|
@ -72,17 +72,17 @@ static
|
|||
void z80WriteBusReq(u32 d)
|
||||
{
|
||||
d&=1; d^=1;
|
||||
if (Pico.m.scanline != -1)
|
||||
//if (Pico.m.scanline != -1)
|
||||
{
|
||||
if(!d) {
|
||||
// this is for a nasty situation where Z80 was enabled and disabled in the same 68k timeslice (Golden Axe III)
|
||||
if (Pico.m.z80Run) {
|
||||
int lineCycles;
|
||||
z80stopCycle = SekCyclesDone();
|
||||
if (Pico.m.z80Run&2)
|
||||
if ((Pico.m.z80Run&2) && Pico.m.scanline != -1)
|
||||
lineCycles=(488-SekCyclesLeft)&0x1ff;
|
||||
else lineCycles=z80stopCycle-z80startCycle; // z80 was started at current line
|
||||
if (lineCycles > 0 && lineCycles <= 488) {
|
||||
if (lineCycles > 0) { // && lineCycles <= 488) {
|
||||
//dprintf("zrun: %i/%i cycles", lineCycles, (lineCycles>>1)-(lineCycles>>5));
|
||||
lineCycles=(lineCycles>>1)-(lineCycles>>5);
|
||||
z80_run(lineCycles);
|
||||
|
|
36
Pico/Pico.c
36
Pico/Pico.c
|
@ -423,24 +423,34 @@ static int PicoFrameHints(void)
|
|||
#include "PicoFrameHints.c"
|
||||
#endif
|
||||
|
||||
// helper z80 runner
|
||||
// helper z80 runner. Runs only if z80 is enabled at this point
|
||||
// (z80WriteBusReq will handle the rest)
|
||||
static void PicoRunZ80Simple(int line_from, int line_to)
|
||||
{
|
||||
int line_from_r=line_from, line_to_r=line_to, line = line_from;
|
||||
int line_from_r=line_from, line_to_r=line_to, line=0;
|
||||
int line_sample = Pico.m.pal ? 68 : 93;
|
||||
|
||||
if(!(PicoOpt&4) || Pico.m.z80Run == 0) { line_from_r = line_to_r; line_to_r = 0; }
|
||||
if (!(PicoOpt&4) || Pico.m.z80Run == 0) line_to_r = 0;
|
||||
else {
|
||||
extern const unsigned short vcounts[];
|
||||
if (z80startCycle) {
|
||||
line = vcounts[z80startCycle>>8];
|
||||
if (line > line_from)
|
||||
line_from_r = line;
|
||||
}
|
||||
z80startCycle = SekCyclesDone();
|
||||
}
|
||||
|
||||
if(PicoOpt&1) {
|
||||
if (PicoOpt&1) {
|
||||
// we have ym2612 enabled, so we have to run Z80 in lines, so we could update DAC and timers
|
||||
for(; line < line_to; line++) {
|
||||
for (line = line_from; line < line_to; line++) {
|
||||
sound_timers_and_dac(line);
|
||||
if((line == 224 || line == line_sample) && PsndOut) getSamples(line);
|
||||
if(line == 32 && PsndOut) emustatus &= ~1;
|
||||
if(line >= line_from_r && line < line_to_r)
|
||||
if ((line == 224 || line == line_sample) && PsndOut) getSamples(line);
|
||||
if (line == 32 && PsndOut) emustatus &= ~1;
|
||||
if (line >= line_from_r && line < line_to_r)
|
||||
z80_run(228);
|
||||
}
|
||||
} else if(line_to_r-line_from_r > 0) {
|
||||
} else if (line_to_r-line_from_r > 0) {
|
||||
z80_run(228*(line_to_r-line_from_r));
|
||||
// samples will be taken by caller
|
||||
}
|
||||
|
@ -482,6 +492,7 @@ static int PicoFrameSimple(void)
|
|||
Pico.video.status|=0x200;
|
||||
|
||||
Pico.m.scanline=-1;
|
||||
z80startCycle=0;
|
||||
|
||||
SekCyclesReset();
|
||||
|
||||
|
@ -507,11 +518,12 @@ static int PicoFrameSimple(void)
|
|||
if(sects) {
|
||||
int c = sects*cycles_68k_block;
|
||||
|
||||
lines += sects*lines_step;
|
||||
PicoRunZ80Simple(line, lines);
|
||||
// this is for approriate line counter, etc
|
||||
// this "run" is for approriate line counter, etc
|
||||
SekCycleCnt += c;
|
||||
SekCycleAim += c;
|
||||
|
||||
lines += sects*lines_step;
|
||||
PicoRunZ80Simple(line, lines);
|
||||
}
|
||||
|
||||
// here we render sound if ym2612 is disabled
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
else { \
|
||||
cnt = SekCyclesDone() - z80startCycle; \
|
||||
cnt = (cnt>>1)-(cnt>>5); \
|
||||
if (cnt > (z80_cycles)) cnt = z80_cycles; \
|
||||
if (cnt < 0 || cnt > (z80_cycles)) cnt = z80_cycles; \
|
||||
Pico.m.z80Run |= 2; \
|
||||
z80CycleAim+=cnt; \
|
||||
} \
|
||||
|
|
|
@ -106,9 +106,7 @@ PICO_INTERNAL void sound_reset(void)
|
|||
// also clear the internal registers+addr line
|
||||
ym2612_regs = YM2612GetRegs();
|
||||
memset(ym2612_regs, 0, 0x200+4);
|
||||
// setting these to 0 might confuse timing code,
|
||||
// so better set to something like this instead
|
||||
z80startCycle = z80stopCycle = 0x01000000;
|
||||
z80startCycle = z80stopCycle = 0;
|
||||
|
||||
sound_rerate(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue