mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
vdp, kludge for z80 access
This commit is contained in:
parent
a20300bf1e
commit
1613ec6c30
3 changed files with 28 additions and 27 deletions
|
@ -696,14 +696,14 @@ u32 PicoRead8_vdp(u32 a)
|
||||||
if ((a & 0x00f0) == 0x0000) {
|
if ((a & 0x00f0) == 0x0000) {
|
||||||
switch (a & 0x0d)
|
switch (a & 0x0d)
|
||||||
{
|
{
|
||||||
case 0x00: return PicoVideoRead8DataH();
|
case 0x00: return PicoVideoRead8DataH(0);
|
||||||
case 0x01: return PicoVideoRead8DataL();
|
case 0x01: return PicoVideoRead8DataL(0);
|
||||||
case 0x04: return PicoVideoRead8CtlH();
|
case 0x04: return PicoVideoRead8CtlH(0);
|
||||||
case 0x05: return PicoVideoRead8CtlL();
|
case 0x05: return PicoVideoRead8CtlL(0);
|
||||||
case 0x08:
|
case 0x08:
|
||||||
case 0x0c: return PicoVideoRead8HV_H();
|
case 0x0c: return PicoVideoRead8HV_H(0);
|
||||||
case 0x09:
|
case 0x09:
|
||||||
case 0x0d: return PicoVideoRead8HV_L();
|
case 0x0d: return PicoVideoRead8HV_L(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1195,10 +1195,10 @@ static unsigned char z80_md_vdp_read(unsigned short a)
|
||||||
if ((a & 0x00f0) == 0x0000) {
|
if ((a & 0x00f0) == 0x0000) {
|
||||||
switch (a & 0x0d)
|
switch (a & 0x0d)
|
||||||
{
|
{
|
||||||
case 0x00: return PicoVideoRead8DataH();
|
case 0x00: return PicoVideoRead8DataH(1);
|
||||||
case 0x01: return PicoVideoRead8DataL();
|
case 0x01: return PicoVideoRead8DataL(1);
|
||||||
case 0x04: return PicoVideoRead8CtlH();
|
case 0x04: return PicoVideoRead8CtlH(1);
|
||||||
case 0x05: return PicoVideoRead8CtlL();
|
case 0x05: return PicoVideoRead8CtlL(1);
|
||||||
case 0x08:
|
case 0x08:
|
||||||
case 0x0c: return get_scanline(1); // FIXME: make it proper
|
case 0x0c: return get_scanline(1); // FIXME: make it proper
|
||||||
case 0x09:
|
case 0x09:
|
||||||
|
|
|
@ -864,12 +864,12 @@ static __inline void VideoWriteVRAM(u32 a, u16 d)
|
||||||
|
|
||||||
PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d);
|
PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d);
|
||||||
PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a);
|
PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a);
|
||||||
unsigned char PicoVideoRead8DataH(void);
|
unsigned char PicoVideoRead8DataH(int is_from_z80);
|
||||||
unsigned char PicoVideoRead8DataL(void);
|
unsigned char PicoVideoRead8DataL(int is_from_z80);
|
||||||
unsigned char PicoVideoRead8CtlH(void);
|
unsigned char PicoVideoRead8CtlH(int is_from_z80);
|
||||||
unsigned char PicoVideoRead8CtlL(void);
|
unsigned char PicoVideoRead8CtlL(int is_from_z80);
|
||||||
unsigned char PicoVideoRead8HV_H(void);
|
unsigned char PicoVideoRead8HV_H(int is_from_z80);
|
||||||
unsigned char PicoVideoRead8HV_L(void);
|
unsigned char PicoVideoRead8HV_L(int is_from_z80);
|
||||||
extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **base, unsigned int *mask);
|
extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **base, unsigned int *mask);
|
||||||
void PicoVideoFIFOSync(int cycles);
|
void PicoVideoFIFOSync(int cycles);
|
||||||
int PicoVideoFIFOHint(void);
|
int PicoVideoFIFOHint(void);
|
||||||
|
|
|
@ -362,12 +362,13 @@ static void VideoWrite(u16 d)
|
||||||
AutoIncrement();
|
AutoIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int VideoRead(void)
|
static unsigned int VideoRead(int is_from_z80)
|
||||||
{
|
{
|
||||||
unsigned int a, d = VdpFIFO.fifo_data[(VdpFIFO.fifo_dx+1)&3];
|
unsigned int a, d = VdpFIFO.fifo_data[(VdpFIFO.fifo_dx+1)&3];
|
||||||
|
|
||||||
a=Pico.video.addr; a>>=1;
|
a=Pico.video.addr; a>>=1;
|
||||||
|
|
||||||
|
if (!is_from_z80)
|
||||||
SekCyclesBurnRun(PicoVideoFIFORead());
|
SekCyclesBurnRun(PicoVideoFIFORead());
|
||||||
switch (Pico.video.type)
|
switch (Pico.video.type)
|
||||||
{
|
{
|
||||||
|
@ -940,23 +941,23 @@ PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a)
|
||||||
|
|
||||||
if (a==0x00) // data port
|
if (a==0x00) // data port
|
||||||
{
|
{
|
||||||
return VideoRead();
|
return VideoRead(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char PicoVideoRead8DataH(void)
|
unsigned char PicoVideoRead8DataH(int is_from_z80)
|
||||||
{
|
{
|
||||||
return VideoRead() >> 8;
|
return VideoRead(is_from_z80) >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char PicoVideoRead8DataL(void)
|
unsigned char PicoVideoRead8DataL(int is_from_z80)
|
||||||
{
|
{
|
||||||
return VideoRead();
|
return VideoRead(is_from_z80);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char PicoVideoRead8CtlH(void)
|
unsigned char PicoVideoRead8CtlH(int is_from_z80)
|
||||||
{
|
{
|
||||||
struct PicoVideo *pv = &Pico.video;
|
struct PicoVideo *pv = &Pico.video;
|
||||||
u8 d = VideoSr(pv) >> 8;
|
u8 d = VideoSr(pv) >> 8;
|
||||||
|
@ -968,7 +969,7 @@ unsigned char PicoVideoRead8CtlH(void)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char PicoVideoRead8CtlL(void)
|
unsigned char PicoVideoRead8CtlL(int is_from_z80)
|
||||||
{
|
{
|
||||||
struct PicoVideo *pv = &Pico.video;
|
struct PicoVideo *pv = &Pico.video;
|
||||||
u8 d = VideoSr(pv);
|
u8 d = VideoSr(pv);
|
||||||
|
@ -980,14 +981,14 @@ unsigned char PicoVideoRead8CtlL(void)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char PicoVideoRead8HV_H(void)
|
unsigned char PicoVideoRead8HV_H(int is_from_z80)
|
||||||
{
|
{
|
||||||
elprintf(EL_HVCNT, "vcounter: %02x [%u] @ %06x", Pico.video.v_counter, SekCyclesDone(), SekPc);
|
elprintf(EL_HVCNT, "vcounter: %02x [%u] @ %06x", Pico.video.v_counter, SekCyclesDone(), SekPc);
|
||||||
return Pico.video.v_counter;
|
return Pico.video.v_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: broken
|
// FIXME: broken
|
||||||
unsigned char PicoVideoRead8HV_L(void)
|
unsigned char PicoVideoRead8HV_L(int is_from_z80)
|
||||||
{
|
{
|
||||||
u32 d = (SekCyclesDone() - Pico.t.m68c_line_start) & 0x1ff; // FIXME
|
u32 d = (SekCyclesDone() - Pico.t.m68c_line_start) & 0x1ff; // FIXME
|
||||||
if (Pico.video.reg[0]&2)
|
if (Pico.video.reg[0]&2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue