notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed deadlock
[picodrive.git]
/
Pico
/
Pico.c
diff --git
a/Pico/Pico.c
b/Pico/Pico.c
index
e6a3b29
..
91d9331
100644
(file)
--- a/
Pico/Pico.c
+++ b/
Pico/Pico.c
@@
-8,10
+8,9
@@
\r
\r
#include "PicoInt.h"
\r
\r
\r
#include "PicoInt.h"
\r
-#include "sound/sound.h"
\r
#include "sound/ym2612.h"
\r
\r
#include "sound/ym2612.h"
\r
\r
-int PicoVer=0x01
10
;
\r
+int PicoVer=0x01
33
;
\r
struct Pico Pico;
\r
int PicoOpt=0; // disable everything by default
\r
int PicoSkipFrame=0; // skip rendering frame?
\r
struct Pico Pico;
\r
int PicoOpt=0; // disable everything by default
\r
int PicoSkipFrame=0; // skip rendering frame?
\r
@@
-39,7
+38,6
@@
int PicoInit(void)
\r
PicoInitMCD();
\r
\r
\r
PicoInitMCD();
\r
\r
- // notaz: sram
\r
SRam.data=0;
\r
SRam.resize=1;
\r
\r
SRam.data=0;
\r
SRam.resize=1;
\r
\r
@@
-53,7
+51,6
@@
void PicoExit(void)
PicoExitMCD();
\r
z80_exit();
\r
\r
PicoExitMCD();
\r
z80_exit();
\r
\r
- // notaz: sram
\r
if(SRam.data) free(SRam.data); SRam.data=0;
\r
}
\r
\r
if(SRam.data) free(SRam.data); SRam.data=0;
\r
}
\r
\r
@@
-152,8
+149,6
@@
int PicoReset(int hard)
return 0;
\r
}
\r
\r
return 0;
\r
}
\r
\r
-
\r
- // notaz: sram
\r
if(SRam.resize) {
\r
int sram_size = 0;
\r
if(SRam.data) free(SRam.data); SRam.data=0;
\r
if(SRam.resize) {
\r
int sram_size = 0;
\r
if(SRam.data) free(SRam.data); SRam.data=0;
\r
@@
-161,7
+156,7
@@
int PicoReset(int hard)
\r
if(*(Pico.rom+0x1B1) == 'R' && *(Pico.rom+0x1B0) == 'A') {
\r
if(*(Pico.rom+0x1B2) & 0x40) {
\r
\r
if(*(Pico.rom+0x1B1) == 'R' && *(Pico.rom+0x1B0) == 'A') {
\r
if(*(Pico.rom+0x1B2) & 0x40) {
\r
- // EEPROM
SRAM
\r
+ // EEPROM
\r
// what kind of EEPROMs are actually used? X24C02? X24C04? (X24C01 has only 128), but we will support up to 8K
\r
SRam.start = PicoRead32(0x1B4) & ~1; // zero address is used for clock by some games
\r
SRam.end = PicoRead32(0x1B8);
\r
// what kind of EEPROMs are actually used? X24C02? X24C04? (X24C01 has only 128), but we will support up to 8K
\r
SRam.start = PicoRead32(0x1B4) & ~1; // zero address is used for clock by some games
\r
SRam.end = PicoRead32(0x1B8);
\r
@@
-194,7
+189,7
@@
int PicoReset(int hard)
// Dino Dini's Soccer malfunctions if SRAM is not filled with 0xff
\r
if (strncmp((char *)Pico.rom+0x150, "IDOND NI'I", 10) == 0)
\r
memset(SRam.data, 0xff, sram_size);
\r
// Dino Dini's Soccer malfunctions if SRAM is not filled with 0xff
\r
if (strncmp((char *)Pico.rom+0x150, "IDOND NI'I", 10) == 0)
\r
memset(SRam.data, 0xff, sram_size);
\r
-
dprintf("sram: det: %i; eeprom: %i; start: %06x; end: %06x\n
",
\r
+
elprintf(EL_STATUS, "sram: det: %i; eeprom: %i; start: %06x; end: %06x
",
\r
(Pico.m.sram_reg>>4)&1, (Pico.m.sram_reg>>2)&1, SRam.start, SRam.end);
\r
}
\r
\r
(Pico.m.sram_reg>>4)&1, (Pico.m.sram_reg>>2)&1, SRam.start, SRam.end);
\r
}
\r
\r
@@
-204,48
+199,45
@@
int PicoReset(int hard)
return 0;
\r
}
\r
\r
return 0;
\r
}
\r
\r
-static int dma_timings[] = {
\r
+// dma2vram settings are just hacks to unglitch Legend of Galahad (needs <= 104 to work)
\r
+// same for Outrunners (92-121, when active is set to 24)
\r
+static const int dma_timings[] = {
\r
83, 167, 166, 83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy
\r
102, 205, 204, 102, // vblank: 40cell:
\r
83, 167, 166, 83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy
\r
102, 205, 204, 102, // vblank: 40cell:
\r
-
8,
16, 15, 8, // active: 32cell:
\r
-
9,
18, 17, 9 // ...
\r
+
16,
16, 15, 8, // active: 32cell:
\r
+
24,
18, 17, 9 // ...
\r
};
\r
\r
};
\r
\r
-static int dma_bsycles[] = {
\r
-(488<<8)/8
3
, (488<<8)/167, (488<<8)/166, (488<<8)/83,
\r
+static
const
int dma_bsycles[] = {
\r
+(488<<8)/8
2
, (488<<8)/167, (488<<8)/166, (488<<8)/83,
\r
(488<<8)/102, (488<<8)/205, (488<<8)/204, (488<<8)/102,
\r
(488<<8)/102, (488<<8)/205, (488<<8)/204, (488<<8)/102,
\r
-(488<<8)/
8,
(488<<8)/16, (488<<8)/15, (488<<8)/8,
\r
-(488<<8)/
9,
(488<<8)/18, (488<<8)/17, (488<<8)/9
\r
+(488<<8)/
16,
(488<<8)/16, (488<<8)/15, (488<<8)/8,
\r
+(488<<8)/
24,
(488<<8)/18, (488<<8)/17, (488<<8)/9
\r
};
\r
\r
};
\r
\r
-//static
\r
-int CheckDMA(void)
\r
+PICO_INTERNAL int CheckDMA(void)
\r
{
\r
{
\r
- int burn = 0,
bytes_can = 0
, dma_op = Pico.video.reg[0x17]>>6; // see gens for 00 and 01 modes
\r
- int
bytes = Pico.m.dma_byte
s;
\r
+ int burn = 0,
xfers_can
, dma_op = Pico.video.reg[0x17]>>6; // see gens for 00 and 01 modes
\r
+ int
xfers = Pico.m.dma_xfer
s;
\r
int dma_op1;
\r
\r
if(!(dma_op&2)) dma_op = (Pico.video.type==1) ? 0 : 1; // setting dma_timings offset here according to Gens
\r
dma_op1 = dma_op;
\r
if(Pico.video.reg[12] & 1) dma_op |= 4; // 40 cell mode?
\r
if(!(Pico.video.status&8)&&(Pico.video.reg[1]&0x40)) dma_op|=8; // active display?
\r
int dma_op1;
\r
\r
if(!(dma_op&2)) dma_op = (Pico.video.type==1) ? 0 : 1; // setting dma_timings offset here according to Gens
\r
dma_op1 = dma_op;
\r
if(Pico.video.reg[12] & 1) dma_op |= 4; // 40 cell mode?
\r
if(!(Pico.video.status&8)&&(Pico.video.reg[1]&0x40)) dma_op|=8; // active display?
\r
- bytes_can = dma_timings[dma_op];
\r
-
\r
- if(bytes <= bytes_can) {
\r
+ xfers_can = dma_timings[dma_op];
\r
+ if(xfers <= xfers_can) {
\r
if(dma_op&2) Pico.video.status&=~2; // dma no longer busy
\r
else {
\r
if(dma_op&2) Pico.video.status&=~2; // dma no longer busy
\r
else {
\r
- burn = bytes * dma_bsycles[dma_op] >> 8; // have to be approximate because can't afford division..
\r
- //SekCycleCnt-=Pico.m.dma_endcycles;
\r
- //Pico.m.dma_endcycles = 0;
\r
+ burn = xfers * dma_bsycles[dma_op] >> 8; // have to be approximate because can't afford division..
\r
}
\r
}
\r
- Pico.m.dma_
byte
s = 0;
\r
+ Pico.m.dma_
xfer
s = 0;
\r
} else {
\r
if(!(dma_op&2)) burn = 488;
\r
} else {
\r
if(!(dma_op&2)) burn = 488;
\r
- Pico.m.dma_
bytes -= byte
s_can;
\r
+ Pico.m.dma_
xfers -= xfer
s_can;
\r
}
\r
\r
}
\r
\r
- //SekCycleCnt+=burn;
\r
- dprintf("~Dma %i op=%i can=%i burn=%i [%i|%i]", Pico.m.dma_bytes, dma_op1, bytes_can, burn, Pico.m.scanline, SekCyclesDone());
\r
+ elprintf(EL_VDPDMA, "~Dma %i op=%i can=%i burn=%i [%i]", Pico.m.dma_xfers, dma_op1, xfers_can, burn, SekCyclesDone());
\r
//dprintf("~aim: %i, cnt: %i", SekCycleAim, SekCycleCnt);
\r
return burn;
\r
}
\r
//dprintf("~aim: %i, cnt: %i", SekCycleAim, SekCycleCnt);
\r
return burn;
\r
}
\r
@@
-254,9
+246,9
@@
static __inline void SekRun(int cyc)
{
\r
int cyc_do;
\r
SekCycleAim+=cyc;
\r
{
\r
int cyc_do;
\r
SekCycleAim+=cyc;
\r
- //
dprintf("aim: %i, cnt: %i
", SekCycleAim, SekCycleCnt);
\r
+ //
printf("aim: %i, cnt: %i\n
", SekCycleAim, SekCycleCnt);
\r
if((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return;
\r
if((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return;
\r
- //
dprintf("cyc_do: %i
", cyc_do);
\r
+ //
printf("cyc_do: %i\n
", cyc_do);
\r
#if defined(EMU_C68K) && defined(EMU_M68K)
\r
// this means we do run-compare Cyclone vs Musashi
\r
SekCycleCnt+=CM_compareRun(cyc_do);
\r
#if defined(EMU_C68K) && defined(EMU_M68K)
\r
// this means we do run-compare Cyclone vs Musashi
\r
SekCycleCnt+=CM_compareRun(cyc_do);
\r
@@
-322,7
+314,6
@@
static __inline void getSamples(int y)
static int curr_pos = 0;
\r
\r
if(y == 224) {
\r
static int curr_pos = 0;
\r
\r
if(y == 224) {
\r
- //dprintf("sta%i: %i [%i]", (emustatus & 2), emustatus, y);
\r
if(emustatus & 2)
\r
curr_pos += sound_render(curr_pos, PsndLen-PsndLen/2);
\r
else curr_pos = sound_render(0, PsndLen);
\r
if(emustatus & 2)
\r
curr_pos += sound_render(curr_pos, PsndLen-PsndLen/2);
\r
else curr_pos = sound_render(0, PsndLen);
\r
@@
-338,7
+329,9
@@
static __inline void getSamples(int y)
}
\r
}
\r
\r
}
\r
}
\r
\r
-//extern UINT32 mz80GetRegisterValue(void *, UINT32);
\r
+
\r
+#if 1*0
\r
+int vint_delay = 205/*68*/, as_delay = 18/*148*/;
\r
\r
// Accurate but slower frame which does hints
\r
static int PicoFrameHints(void)
\r
\r
// Accurate but slower frame which does hints
\r
static int PicoFrameHints(void)
\r
@@
-374,10
+367,19
@@
static int PicoFrameHints(void)
hint=pv->reg[10]; // Load H-Int counter
\r
//dprintf("-hint: %i", hint);
\r
\r
hint=pv->reg[10]; // Load H-Int counter
\r
//dprintf("-hint: %i", hint);
\r
\r
+ //SekRun(as_delay);
\r
+ SekRun(148);
\r
+
\r
for (y=0;y<lines;y++)
\r
{
\r
Pico.m.scanline=(short)y;
\r
\r
for (y=0;y<lines;y++)
\r
{
\r
Pico.m.scanline=(short)y;
\r
\r
+ // VDP FIFO
\r
+ pv->lwrite_cnt -= 12;
\r
+ if (pv->lwrite_cnt < 0) pv->lwrite_cnt=0;
\r
+ if (pv->lwrite_cnt == 0)
\r
+ Pico.video.status|=0x200;
\r
+
\r
// pad delay (for 6 button pads)
\r
if(PicoOpt&0x20) {
\r
if(Pico.m.padDelay[0]++ > 25) Pico.m.padTHPhase[0]=0;
\r
// pad delay (for 6 button pads)
\r
if(PicoOpt&0x20) {
\r
if(Pico.m.padDelay[0]++ > 25) Pico.m.padTHPhase[0]=0;
\r
@@
-390,24
+392,30
@@
static int PicoFrameHints(void)
//dprintf("rhint:old @ %06x", SekPc);
\r
hint=pv->reg[10]; // Reload H-Int counter
\r
pv->pending_ints|=0x10;
\r
//dprintf("rhint:old @ %06x", SekPc);
\r
hint=pv->reg[10]; // Reload H-Int counter
\r
pv->pending_ints|=0x10;
\r
- if (pv->reg[0]&0x10) SekInterrupt(4);
\r
- //dprintf("rhint: %i @ %06x [%i|%i]", hint, SekPc, y, SekCycleCnt);
\r
+ if (pv->reg[0]&0x10) {
\r
+ elprintf(EL_INTS, "hint: @ %06x [%i]", SekPc, SekCycleCnt);
\r
+ SekInterrupt(4);
\r
+ }
\r
//dprintf("hint_routine: %x", (*(unsigned short*)(Pico.ram+0x0B84)<<16)|*(unsigned short*)(Pico.ram+0x0B86));
\r
}
\r
\r
// V-Interrupt:
\r
if (y == lines_vis)
\r
{
\r
//dprintf("hint_routine: %x", (*(unsigned short*)(Pico.ram+0x0B84)<<16)|*(unsigned short*)(Pico.ram+0x0B86));
\r
}
\r
\r
// V-Interrupt:
\r
if (y == lines_vis)
\r
{
\r
- dprintf("vint: @ %06x [%i|%i], aim=%i cnt=%i", SekPc, y, SekCycleCnt, SekCycleAim, SekCycleCnt);
\r
pv->status|=0x08; // go into vblank
\r
pv->status|=0x08; // go into vblank
\r
- if(!Pico.m.dma_bytes||(Pico.video.reg[0x17]&0x80)) {
\r
+ //pv->status|=0x80; // V-Int happened
\r
+ //if(!Pico.m.dma_bytes||(Pico.video.reg[0x17]&0x80)) {
\r
// there must be a gap between H and V ints, also after vblank bit set (Mazin Saga, Bram Stoker's Dracula)
\r
// there must be a gap between H and V ints, also after vblank bit set (Mazin Saga, Bram Stoker's Dracula)
\r
- SekRun(128); SekCycleAim-=128; // 128; ?
\r
- }
\r
- dprintf("[%i|%i], aim=%i cnt=%i @ %x", y, SekCycleCnt, SekCycleAim, SekCycleCnt, SekPc);
\r
- pv->status|=0x80; // V-Int happened
\r
+ SekRun(68); SekCycleAim-=68; // 128; ?
\r
+ SekCycleAim-=148;
\r
+// SekRun(vint_delay); SekCycleAim-=vint_delay; // 128; ?
\r
+// SekCycleAim-=as_delay;
\r
+ //}
\r
pv->pending_ints|=0x20;
\r
pv->pending_ints|=0x20;
\r
- if(pv->reg[1]&0x20) SekInterrupt(6);
\r
+ if(pv->reg[1]&0x20) {
\r
+ elprintf(EL_INTS, "vint: @ %06x [%i]", SekPc, SekCycleCnt);
\r
+ SekInterrupt(6);
\r
+ }
\r
if(Pico.m.z80Run && (PicoOpt&4)) // ?
\r
z80_int();
\r
//dprintf("zint: [%i|%i] zPC=%04x", Pico.m.scanline, SekCyclesDone(), mz80GetRegisterValue(NULL, 0));
\r
if(Pico.m.z80Run && (PicoOpt&4)) // ?
\r
z80_int();
\r
//dprintf("zint: [%i|%i] zPC=%04x", Pico.m.scanline, SekCyclesDone(), mz80GetRegisterValue(NULL, 0));
\r
@@
-431,7
+439,7
@@
static int PicoFrameHints(void)
getSamples(y);
\r
\r
// Run scanline:
\r
getSamples(y);
\r
\r
// Run scanline:
\r
- if (Pico.m.dma_
byte
s) SekCyclesBurn(CheckDMA());
\r
+ if (Pico.m.dma_
xfer
s) SekCyclesBurn(CheckDMA());
\r
SekRun(cycles_68k);
\r
if ((PicoOpt&4) && Pico.m.z80Run) {
\r
if (Pico.m.z80Run & 2) z80CycleAim+=cycles_z80;
\r
SekRun(cycles_68k);
\r
if ((PicoOpt&4) && Pico.m.z80Run) {
\r
if (Pico.m.z80Run & 2) z80CycleAim+=cycles_z80;
\r
@@
-453,25
+461,18
@@
static int PicoFrameHints(void)
\r
return 0;
\r
}
\r
\r
return 0;
\r
}
\r
+#else
\r
+#include "PicoFrameHints.c"
\r
+#endif
\r
\r
// helper z80 runner
\r
static void PicoRunZ80Simple(int line_from, int line_to)
\r
{
\r
int line_from_r=line_from, line_to_r=line_to, line = line_from;
\r
int line_sample = Pico.m.pal ? 68 : 93;
\r
\r
// helper z80 runner
\r
static void PicoRunZ80Simple(int line_from, int line_to)
\r
{
\r
int line_from_r=line_from, line_to_r=line_to, line = line_from;
\r
int line_sample = Pico.m.pal ? 68 : 93;
\r
- extern const unsigned short vcounts[];
\r
\r
if(!(PicoOpt&4) || Pico.m.z80Run == 0) { line_from_r = line_to_r; line_to_r = 0; }
\r
\r
\r
if(!(PicoOpt&4) || Pico.m.z80Run == 0) { line_from_r = line_to_r; line_to_r = 0; }
\r
\r
- if(z80startCycle != 0x01000000) {
\r
- line_from_r = vcounts[z80startCycle>>8]+1;
\r
- z80startCycle = 0x01000000;
\r
- }
\r
- if(z80stopCycle != 0x01000000) {
\r
- line_to_r = vcounts[z80stopCycle>>8]+1;
\r
- z80stopCycle = 0x01000000;
\r
- }
\r
-
\r
if(PicoOpt&1) {
\r
// we have ym2612 enabled, so we have to run Z80 in lines, so we could update DAC and timers
\r
for(; line < line_to; line++) {
\r
if(PicoOpt&1) {
\r
// we have ym2612 enabled, so we have to run Z80 in lines, so we could update DAC and timers
\r
for(; line < line_to; line++) {
\r
@@
-494,42
+495,43
@@
static int PicoFrameSimple(void)
int y=0,line=0,lines=0,lines_step=0,sects;
\r
int cycles_68k_vblock,cycles_68k_block;
\r
\r
int y=0,line=0,lines=0,lines_step=0,sects;
\r
int cycles_68k_vblock,cycles_68k_block;
\r
\r
- // we don't emulate DMA timing in this mode
\r
- if (Pico.m.dma_bytes) {
\r
- Pico.m.dma_bytes=0;
\r
- Pico.video.status&=~2;
\r
- }
\r
-
\r
- if (Pico.m.pal) {
\r
- // M68k cycles/frame: 152009.78
\r
+ // split to 16 run calls for active scan, for vblank split to 2 (ntsc), 3 (pal 240), 4 (pal 224)
\r
+ if (Pico.m.pal && (pv->reg[1]&8)) { // 240 lines
\r
if(pv->reg[1]&8) { // 240 lines
\r
if(pv->reg[1]&8) { // 240 lines
\r
- cycles_68k_block =
(int) ((double) OSC_PAL / 7 / 50 / 312 * 15 + 0.4); // 16 sects, 16*15=240, 7308
\r
- cycles_68k_vblock =
(int) ((double) OSC_PAL / 7 / 50 / 312 * 24 + 0.4); // 3 sects, 3*24=72, 35163?
\r
+ cycles_68k_block =
7329; // (488*240+148)/16.0, -4
\r
+ cycles_68k_vblock =
11640; // (72*488-148-68)/3.0, 0
\r
lines_step = 15;
\r
} else {
\r
lines_step = 15;
\r
} else {
\r
- cycles_68k_block =
(int) ((double) OSC_PAL / 7 / 50 / 312 * 14 + 0.4); // 16*14=22
4
\r
- cycles_68k_vblock =
(int) ((double) OSC_PAL / 7 / 50 / 312 * 22 + 0.4); // 4 sects, 4*22=88
\r
+ cycles_68k_block =
6841; // (488*224+148)/16.0, -
4
\r
+ cycles_68k_vblock =
10682; // (88*488-148-68)/4.0, 0
\r
lines_step = 14;
\r
}
\r
} else {
\r
// M68k cycles/frame: 127840.71
\r
lines_step = 14;
\r
}
\r
} else {
\r
// M68k cycles/frame: 127840.71
\r
- cycles_68k_block =
(int) ((double) OSC_NTSC / 7 / 60 / 262 * 14 + 0.4); // 16*14=224, 6831
\r
- cycles_68k_vblock =
(int) ((double) OSC_NTSC / 7 / 60 / 262 * 19 + 0.4); // 2 sects, 2*19=38, 18544
\r
+ cycles_68k_block =
6841; // (488*224+148)/16.0, -4
\r
+ cycles_68k_vblock =
9164; // (38*488-148-68)/2.0, 0
\r
lines_step = 14;
\r
}
\r
\r
lines_step = 14;
\r
}
\r
\r
+ // we don't emulate DMA timing in this mode
\r
+ if (Pico.m.dma_xfers) {
\r
+ Pico.m.dma_xfers=0;
\r
+ Pico.video.status&=~2;
\r
+ }
\r
+
\r
+ // VDP FIFO too
\r
+ pv->lwrite_cnt = 0;
\r
+ Pico.video.status|=0x200;
\r
+
\r
Pico.m.scanline=-1;
\r
\r
SekCyclesReset();
\r
\r
Pico.m.scanline=-1;
\r
\r
SekCyclesReset();
\r
\r
- if(PicoOpt&4)
\r
- z80_resetCycles();
\r
-
\r
// 6 button pad: let's just say it timed out now
\r
Pico.m.padTHPhase[0]=Pico.m.padTHPhase[1]=0;
\r
\r
// ---- Active Scan ----
\r
// 6 button pad: let's just say it timed out now
\r
Pico.m.padTHPhase[0]=Pico.m.padTHPhase[1]=0;
\r
\r
// ---- Active Scan ----
\r
- pv->status&=~88; // clear V-Int, come out of vblank
\r
+ pv->status&=~
0x
88; // clear V-Int, come out of vblank
\r
\r
// Run in sections:
\r
for(sects=16; sects; sects--)
\r
\r
// Run in sections:
\r
for(sects=16; sects; sects--)
\r
@@
-555,19
+557,20
@@
static int PicoFrameSimple(void)
}
\r
\r
// here we render sound if ym2612 is disabled
\r
}
\r
\r
// here we render sound if ym2612 is disabled
\r
- if(!(PicoOpt&1) && PsndOut) {
\r
+ if
(!(PicoOpt&1) && PsndOut) {
\r
int len = sound_render(0, PsndLen);
\r
int len = sound_render(0, PsndLen);
\r
- if(PicoWriteSound) PicoWriteSound(len);
\r
+ if
(PicoWriteSound) PicoWriteSound(len);
\r
// clear sound buffer
\r
sound_clear();
\r
}
\r
\r
// render screen
\r
// clear sound buffer
\r
sound_clear();
\r
}
\r
\r
// render screen
\r
- if(!PicoSkipFrame) {
\r
- if(!(PicoOpt&0x10))
\r
+ if (!PicoSkipFrame)
\r
+ {
\r
+ if (!(PicoOpt&0x10))
\r
// Draw the screen
\r
#if CAN_HANDLE_240_LINES
\r
// Draw the screen
\r
#if CAN_HANDLE_240_LINES
\r
- if(pv->reg[1]&8) {
\r
+ if
(pv->reg[1]&8) {
\r
for (y=0;y<240;y++) PicoLine(y);
\r
} else {
\r
for (y=0;y<224;y++) PicoLine(y);
\r
for (y=0;y<240;y++) PicoLine(y);
\r
} else {
\r
for (y=0;y<224;y++) PicoLine(y);
\r
@@
-578,6
+581,11
@@
static int PicoFrameSimple(void)
else PicoFrameFull();
\r
}
\r
\r
else PicoFrameFull();
\r
}
\r
\r
+ // a gap between flags set and vint
\r
+ pv->pending_ints|=0x20;
\r
+ pv->status|=8; // go into vblank
\r
+ SekRun(68+4);
\r
+
\r
// ---- V-Blanking period ----
\r
// fix line counts
\r
if(Pico.m.pal) {
\r
// ---- V-Blanking period ----
\r
// fix line counts
\r
if(Pico.m.pal) {
\r
@@
-596,14
+604,11
@@
static int PicoFrameSimple(void)
lines_step = 19;
\r
}
\r
\r
lines_step = 19;
\r
}
\r
\r
- //dprintf("vint: @ %06x [%i]", SekPc, SekCycleCnt);
\r
- pv->pending_ints|=0x20;
\r
if (pv->reg[1]&0x20) SekInterrupt(6); // Set IRQ
\r
if (pv->reg[1]&0x20) SekInterrupt(6); // Set IRQ
\r
- pv->status|=0x88; // V-Int happened / go into vblank
\r
- if(Pico.m.z80Run && (PicoOpt&4)) // ?
\r
+ if (Pico.m.z80Run && (PicoOpt&4))
\r
z80_int();
\r
\r
z80_int();
\r
\r
- while(sects) {
\r
+ while
(sects) {
\r
lines += lines_step;
\r
\r
SekRun(cycles_68k_vblock);
\r
lines += lines_step;
\r
\r
SekRun(cycles_68k_vblock);
\r
@@
-612,11
+617,11
@@
static int PicoFrameSimple(void)
line=lines;
\r
\r
sects--;
\r
line=lines;
\r
\r
sects--;
\r
- if(sects && CheckIdle()) break;
\r
+ if
(sects && CheckIdle()) break;
\r
}
\r
\r
// run Z80 for remaining sections
\r
}
\r
\r
// run Z80 for remaining sections
\r
- if(sects) {
\r
+ if
(sects) {
\r
lines += sects*lines_step;
\r
PicoRunZ80Simple(line, lines);
\r
}
\r
lines += sects*lines_step;
\r
PicoRunZ80Simple(line, lines);
\r
}
\r
@@
-689,6
+694,7
@@
char *debugString(void)
dstrp+=strlen(dstrp);
\r
sprintf(dstrp, "scroll size: w: %i, h: %i SRAM: %i; eeprom: %i\n", reg[0x10]&3, (reg[0x10]&0x30)>>4,
\r
bit(Pico.m.sram_reg, 4), bit(Pico.m.sram_reg, 2)); dstrp+=strlen(dstrp);
\r
dstrp+=strlen(dstrp);
\r
sprintf(dstrp, "scroll size: w: %i, h: %i SRAM: %i; eeprom: %i\n", reg[0x10]&3, (reg[0x10]&0x30)>>4,
\r
bit(Pico.m.sram_reg, 4), bit(Pico.m.sram_reg, 2)); dstrp+=strlen(dstrp);
\r
+ sprintf(dstrp, "sram range: %06x-%06x, reg: %02x\n", SRam.start, SRam.end, Pico.m.sram_reg); dstrp+=strlen(dstrp);
\r
sprintf(dstrp, "pend int: v:%i, h:%i, vdp status: %04x\n", bit(pv->pending_ints,5), bit(pv->pending_ints,4), pv->status);
\r
dstrp+=strlen(dstrp);
\r
#ifdef EMU_C68K
\r
sprintf(dstrp, "pend int: v:%i, h:%i, vdp status: %04x\n", bit(pv->pending_ints,5), bit(pv->pending_ints,4), pv->status);
\r
dstrp+=strlen(dstrp);
\r
#ifdef EMU_C68K
\r
@@
-734,7
+740,7
@@
char *debugString(void)
code2 = sprite[1];
\r
sx = (code2>>16)&0x1ff;
\r
\r
code2 = sprite[1];
\r
sx = (code2>>16)&0x1ff;
\r
\r
-
dprintf("#%02i x: %03i y: %03i %ix%i
", u, sx, sy, ((code>>26)&3)+1, height);
\r
+
printf("#%02i x: %03i y: %03i %ix%i\n
", u, sx, sy, ((code>>26)&3)+1, height);
\r
\r
link=(code>>16)&0x7f;
\r
if(!link) break; // End of sprites
\r
\r
link=(code>>16)&0x7f;
\r
if(!link) break; // End of sprites
\r