mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 23:58:04 -04:00
psp readme, some adjustments
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@296 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
b542be4686
commit
81fda4e8d8
7 changed files with 265 additions and 87 deletions
153
Pico/Draw.c
153
Pico/Draw.c
|
@ -535,22 +535,49 @@ static void DrawWindow(int tstart, int tend, int prio, int sh) // int *hcache
|
|||
}
|
||||
|
||||
// Draw tiles across screen:
|
||||
for (; tilex < tend; tilex++)
|
||||
if (!sh)
|
||||
{
|
||||
int addr=0,zero=0;
|
||||
int pal;
|
||||
for (; tilex < tend; tilex++)
|
||||
{
|
||||
int addr=0,zero=0;
|
||||
int pal;
|
||||
|
||||
code=Pico.vram[nametab+tilex];
|
||||
if(code==blank) continue;
|
||||
if((code>>15) != prio) {
|
||||
rendstatus|=2;
|
||||
continue;
|
||||
code=Pico.vram[nametab+tilex];
|
||||
if(code==blank) continue;
|
||||
if((code>>15) != prio) {
|
||||
rendstatus|=2;
|
||||
continue;
|
||||
}
|
||||
|
||||
pal=((code>>9)&0x30);
|
||||
|
||||
// Get tile address/2:
|
||||
addr=(code&0x7ff)<<4;
|
||||
if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip
|
||||
|
||||
if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);
|
||||
else zero=TileNorm(8+(tilex<<3),addr,pal);
|
||||
|
||||
if (zero) blank=code; // We know this tile is blank now
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; tilex < tend; tilex++)
|
||||
{
|
||||
int addr=0,zero=0;
|
||||
int pal, tmp, *zb;
|
||||
|
||||
pal=((code>>9)&0x30);
|
||||
code=Pico.vram[nametab+tilex];
|
||||
if(code==blank) continue;
|
||||
if((code>>15) != prio) {
|
||||
rendstatus|=2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(sh) {
|
||||
int tmp, *zb = (int *)(HighCol+8+(tilex<<3));
|
||||
pal=((code>>9)&0x30);
|
||||
|
||||
zb = (int *)(HighCol+8+(tilex<<3));
|
||||
if(prio) {
|
||||
tmp = *zb;
|
||||
if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;
|
||||
|
@ -562,24 +589,43 @@ static void DrawWindow(int tstart, int tend, int prio, int sh) // int *hcache
|
|||
} else {
|
||||
pal |= 0x40;
|
||||
}
|
||||
|
||||
// Get tile address/2:
|
||||
addr=(code&0x7ff)<<4;
|
||||
if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip
|
||||
|
||||
if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);
|
||||
else zero=TileNorm(8+(tilex<<3),addr,pal);
|
||||
|
||||
if (zero) blank=code; // We know this tile is blank now
|
||||
}
|
||||
|
||||
// Get tile address/2:
|
||||
addr=(code&0x7ff)<<4;
|
||||
if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip
|
||||
|
||||
if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);
|
||||
else zero=TileNorm(8+(tilex<<3),addr,pal);
|
||||
|
||||
if (zero) blank=code; // We know this tile is blank now
|
||||
}
|
||||
|
||||
// terminate the cache list
|
||||
//*hcache = 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
|
||||
static void DrawTilesFromCacheShPrep(void)
|
||||
{
|
||||
if (!(rendstatus&0x80))
|
||||
{
|
||||
// as some layer has covered whole line with hi priority tiles,
|
||||
// we can process whole line and then act as if sh/hi mode was off.
|
||||
rendstatus|=0x80;
|
||||
int c = 320/4, *zb = (int *)(HighCol+8);
|
||||
while (c--)
|
||||
{
|
||||
int tmp = *zb;
|
||||
if (!(tmp & 0x80808080)) *zb=tmp&0x3f3f3f3f;
|
||||
else {
|
||||
if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;
|
||||
if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000;
|
||||
*zb=tmp;
|
||||
}
|
||||
zb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawTilesFromCache(int *hc, int sh, int rlim)
|
||||
{
|
||||
int code, addr, dx;
|
||||
|
@ -589,28 +635,31 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim)
|
|||
|
||||
if (sh && (rendstatus&0xc0))
|
||||
{
|
||||
if (!(rendstatus&0x80))
|
||||
{
|
||||
// as some layer has covered whole line with hi priority tiles,
|
||||
// we can process whole line and then act as if sh/hi mode was off.
|
||||
rendstatus|=0x80;
|
||||
int c = 320/4, *zb = (int *)(HighCol+8);
|
||||
while (c--)
|
||||
{
|
||||
int tmp = *zb;
|
||||
if (!(tmp & 0x80808080)) *zb=tmp&0x3f3f3f3f;
|
||||
else {
|
||||
if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;
|
||||
if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000;
|
||||
*zb=tmp;
|
||||
}
|
||||
zb++;
|
||||
}
|
||||
}
|
||||
DrawTilesFromCacheShPrep();
|
||||
sh = 0;
|
||||
}
|
||||
|
||||
if (sh)
|
||||
if (!sh)
|
||||
{
|
||||
short blank=-1; // The tile we know is blank
|
||||
while ((code=*hc++)) {
|
||||
int zero;
|
||||
if((short)code == blank) continue;
|
||||
// Get tile address/2:
|
||||
addr=(code&0x7ff)<<4;
|
||||
addr+=(unsigned int)code>>25; // y offset into tile
|
||||
dx=(code>>16)&0x1ff;
|
||||
|
||||
pal=((code>>9)&0x30);
|
||||
if (rlim-dx < 0) goto last_cut_tile;
|
||||
|
||||
if (code&0x0800) zero=TileFlip(dx,addr,pal);
|
||||
else zero=TileNorm(dx,addr,pal);
|
||||
|
||||
if (zero) blank=(short)code;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((code=*hc++)) {
|
||||
unsigned char *zb;
|
||||
|
@ -631,26 +680,6 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim)
|
|||
else TileNorm(dx,addr,pal);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
short blank=-1; // The tile we know is blank
|
||||
while ((code=*hc++)) {
|
||||
int zero;
|
||||
if((short)code == blank) continue;
|
||||
// Get tile address/2:
|
||||
addr=(code&0x7ff)<<4;
|
||||
addr+=(unsigned int)code>>25; // y offset into tile
|
||||
dx=(code>>16)&0x1ff;
|
||||
|
||||
pal=((code>>9)&0x30);
|
||||
if (rlim-dx < 0) goto last_cut_tile;
|
||||
|
||||
if (code&0x0800) zero=TileFlip(dx,addr,pal);
|
||||
else zero=TileNorm(dx,addr,pal);
|
||||
|
||||
if (zero) blank=(short)code;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
last_cut_tile:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# vim:filetype=mips
|
||||
|
||||
# only CLUT for now..
|
||||
|
||||
.set noreorder # don't reorder any instructions
|
||||
.set noat # don't use $at
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
# void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count)
|
||||
|
||||
|
@ -1671,6 +1672,9 @@ tile00000001:
|
|||
jr $ra
|
||||
sb $t0, 0($a0)
|
||||
|
||||
.data
|
||||
.align 4
|
||||
|
||||
TileTable:
|
||||
.long 000000000000, tile00000001, tile00000010, tile00000011, tile00000100, tile00000101, tile00000110, tile00000111
|
||||
.long tile00001000, tile00001001, tile00001010, tile00001011, tile00001100, tile00001101, tile00001110, tile00001111
|
||||
|
|
|
@ -339,7 +339,7 @@ PICO_INTERNAL_ASM u32 PicoRead8(u32 a)
|
|||
else d=OtherRead16(a&~1, 8);
|
||||
if ((a&1)==0) d>>=8;
|
||||
|
||||
|
||||
end:
|
||||
#ifdef __debug_io
|
||||
dprintf("r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc);
|
||||
#endif
|
||||
|
@ -684,11 +684,14 @@ PICO_INTERNAL unsigned char z80_read(unsigned short a)
|
|||
|
||||
if (a>=0x8000)
|
||||
{
|
||||
extern u32 PicoReadM68k8(u32 a);
|
||||
u32 addr68k;
|
||||
addr68k=Pico.m.z80_bank68k<<15;
|
||||
addr68k+=a&0x7fff;
|
||||
|
||||
ret = (u8) PicoRead8(addr68k);
|
||||
if (PicoMCD & 1)
|
||||
ret = PicoReadM68k8(addr68k);
|
||||
else ret = PicoRead8(addr68k);
|
||||
elprintf(EL_Z80BNK, "z80->68k r8 [%06x] %02x", addr68k, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -728,11 +731,14 @@ PICO_INTERNAL_ASM void z80_write(unsigned int a, unsigned char data)
|
|||
|
||||
if (a>=0x8000)
|
||||
{
|
||||
extern void PicoWriteM68k8(u32 a,u8 d);
|
||||
u32 addr68k;
|
||||
addr68k=Pico.m.z80_bank68k<<15;
|
||||
addr68k+=a&0x7fff;
|
||||
elprintf(EL_Z80BNK, "z80->68k w8 [%06x] %02x", addr68k, data);
|
||||
PicoWrite8(addr68k, data);
|
||||
if (PicoMCD & 1)
|
||||
PicoWriteM68k8(addr68k, data);
|
||||
else PicoWrite8(addr68k, data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
|
|||
#ifdef _ASM_CD_MEMORY_C
|
||||
u32 PicoReadM68k8(u32 a);
|
||||
#else
|
||||
static u32 PicoReadM68k8(u32 a)
|
||||
u32 PicoReadM68k8(u32 a)
|
||||
{
|
||||
u32 d=0;
|
||||
|
||||
|
@ -723,7 +723,7 @@ static u32 PicoReadM68k32(u32 a)
|
|||
#ifdef _ASM_CD_MEMORY_C
|
||||
void PicoWriteM68k8(u32 a,u8 d);
|
||||
#else
|
||||
static void PicoWriteM68k8(u32 a,u8 d)
|
||||
void PicoWriteM68k8(u32 a,u8 d)
|
||||
{
|
||||
#ifdef __debug_io
|
||||
dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue