mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
32x: packed pixel mode (works over 68k)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@773 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
be2c420828
commit
974fdb5bfd
15 changed files with 330 additions and 91 deletions
58
pico/32x/draw.c
Normal file
58
pico/32x/draw.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
#include "../pico_int.h"
|
||||
|
||||
static void convert_pal555(void)
|
||||
{
|
||||
unsigned int *ps = (void *)Pico32xMem->pal;
|
||||
unsigned int *pd = (void *)Pico32xMem->pal_native;
|
||||
unsigned int m1 = 0x001f001f;
|
||||
unsigned int m2 = 0x03e003e0;
|
||||
unsigned int m3 = 0xfc00fc00;
|
||||
int i;
|
||||
|
||||
// place prio to LS green bit
|
||||
for (i = 0x100/2; i > 0; i--, ps++, pd++) {
|
||||
unsigned int t = *ps;
|
||||
*pd = ((t & m1) << 11) | ((t & m2) << 1) | ((t & m3) >> 10);
|
||||
}
|
||||
|
||||
Pico32x.dirty_pal = 0;
|
||||
}
|
||||
|
||||
void FinalizeLine32xRGB555(int sh, int line)
|
||||
{
|
||||
unsigned short *pd = DrawLineDest;
|
||||
unsigned short *pal = Pico32xMem->pal_native;
|
||||
unsigned char *pb = HighCol + 8;
|
||||
unsigned short cram0;
|
||||
|
||||
// this is a bit hackish:
|
||||
// we swap cram color 0 with color that is used for background,
|
||||
// as bg is forced to 0 when we do 32X
|
||||
cram0 = Pico.cram[0];
|
||||
Pico.cram[0] = Pico.cram[Pico.video.reg[7] & 0x3f];
|
||||
|
||||
FinalizeLineRGB555(sh, line);
|
||||
Pico.cram[0] = cram0;
|
||||
|
||||
if ((Pico32x.vdp_regs[0] & 3) == 0)
|
||||
return; // blanking
|
||||
|
||||
if (Pico32x.dirty_pal)
|
||||
convert_pal555();
|
||||
|
||||
if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 1) {
|
||||
unsigned short *dram = (void *)Pico32xMem->dram[Pico32x.vdp_regs[0x0a/2] & P32XV_FS];
|
||||
unsigned short *ps = dram + dram[line];
|
||||
unsigned short t;
|
||||
int i;
|
||||
for (i = 320/2; i > 0; i--, ps++, pd += 2, pb += 2) {
|
||||
t = pal[*ps >> 8];
|
||||
if (pb[0] == 0 || (t & 0x20))
|
||||
pd[0] = t;
|
||||
t = pal[*ps & 0xff];
|
||||
if (pb[1] == 0 || (t & 0x20))
|
||||
pd[1] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue