{ \
unsigned short t; \
int i; \
{ \
unsigned short t; \
int i; \
- for (i = 320/2; i > 0; i--, p32x++) { \
- t = pal[*p32x >> 8]; \
- if (*pmd == mdbg || (t & 0x20)) \
- *pd = t; \
- else \
- pmd_draw_code; \
- pd++; pmd++; \
- t = pal[*p32x & 0xff]; \
+ for (i = 320; i > 0; i--, pd++, p32x++, pmd++) { \
+ t = pal[*(unsigned char *)((long)p32x ^ 1)]; \
if (*pmd == mdbg || (t & 0x20)) \
*pd = t; \
else \
pmd_draw_code; \
if (*pmd == mdbg || (t & 0x20)) \
*pd = t; \
else \
pmd_draw_code; \
convert_pal555(Pico32x.vdp_regs[0] & P32XV_PRI);
if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 1) { // Packed Pixel Mode
convert_pal555(Pico32x.vdp_regs[0] & P32XV_PRI);
if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 1) { // Packed Pixel Mode
- do_line_pp(pd, p32x, pmd,);
+ unsigned char *p32xb = (void *)p32x;
+ if (Pico32x.vdp_regs[2 / 2] & P32XV_SFT)
+ p32xb++;
+ do_line_pp(pd, p32xb, pmd,);
}
else { // Run Length Mode
do_line_rl(pd, p32x, pmd,);
}
else { // Run Length Mode
do_line_rl(pd, p32x, pmd,);
*dst = palmd[*pmd]
#define PICOSCAN_PRE \
*dst = palmd[*pmd]
#define PICOSCAN_PRE \
- PicoScan32xBegin(l + (lines_offs & 0xff)); \
+ PicoScan32xBegin(l + (lines_sft_offs & 0xff)); \
dst = DrawLineDest; \
#define PICOSCAN_POST \
dst = DrawLineDest; \
#define PICOSCAN_POST \
- PicoScan32xEnd(l + (lines_offs & 0xff)); \
+ PicoScan32xEnd(l + (lines_sft_offs & 0xff)); \
#define make_do_loop(name, pre_code, post_code, md_code) \
/* Direct Color Mode */ \
static void do_loop_dc##name(unsigned short *dst, \
#define make_do_loop(name, pre_code, post_code, md_code) \
/* Direct Color Mode */ \
static void do_loop_dc##name(unsigned short *dst, \
- unsigned short *dram, int lines_offs, int mdbg) \
+ unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
int inv_bit = (Pico32x.vdp_regs[0] & P32XV_PRI) ? 0x8000 : 0; \
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
unsigned short *palmd = HighPal; \
unsigned short *p32x; \
{ \
int inv_bit = (Pico32x.vdp_regs[0] & P32XV_PRI) ? 0x8000 : 0; \
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
unsigned short *palmd = HighPal; \
unsigned short *p32x; \
- int lines = lines_offs >> 16; \
+ int lines = lines_sft_offs >> 16; \
int l; \
(void)palmd; \
for (l = 0; l < lines; l++, pmd += 8) { \
int l; \
(void)palmd; \
for (l = 0; l < lines; l++, pmd += 8) { \
\
/* Packed Pixel Mode */ \
static void do_loop_pp##name(unsigned short *dst, \
\
/* Packed Pixel Mode */ \
static void do_loop_pp##name(unsigned short *dst, \
- unsigned short *dram, int lines_offs, int mdbg) \
+ unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
unsigned short *palmd = HighPal; \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
unsigned short *palmd = HighPal; \
- unsigned short *p32x; \
- int lines = lines_offs >> 16; \
+ unsigned char *p32x; \
+ int lines = lines_sft_offs >> 16; \
int l; \
(void)palmd; \
for (l = 0; l < lines; l++, pmd += 8) { \
pre_code; \
int l; \
(void)palmd; \
for (l = 0; l < lines; l++, pmd += 8) { \
pre_code; \
- p32x = dram + dram[l]; \
+ p32x = (void *)(dram + dram[l]); \
+ p32x += (lines_sft_offs >> 8) & 1; \
do_line_pp(dst, p32x, pmd, md_code); \
post_code; \
} \
do_line_pp(dst, p32x, pmd, md_code); \
post_code; \
} \
\
/* Run Length Mode */ \
static void do_loop_rl##name(unsigned short *dst, \
\
/* Run Length Mode */ \
static void do_loop_rl##name(unsigned short *dst, \
- unsigned short *dram, int lines_offs, int mdbg) \
+ unsigned short *dram, int lines_sft_offs, int mdbg) \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
unsigned short *palmd = HighPal; \
unsigned short *p32x; \
{ \
unsigned short *pal = Pico32xMem->pal_native; \
unsigned char *pmd = PicoDraw2FB + 328 * 8 + 8; \
unsigned short *palmd = HighPal; \
unsigned short *p32x; \
- int lines = lines_offs >> 16; \
+ int lines = lines_sft_offs >> 16; \
int l; \
(void)palmd; \
for (l = 0; l < lines; l++, pmd += 8) { \
int l; \
(void)palmd; \
for (l = 0; l < lines; l++, pmd += 8) { \
int have_scan = PicoScan32xBegin != NULL && PicoScan32xEnd != NULL;
const do_loop_func *do_loop;
unsigned short *dram;
int have_scan = PicoScan32xBegin != NULL && PicoScan32xEnd != NULL;
const do_loop_func *do_loop;
unsigned short *dram;
int which_func;
DrawLineDest = DrawLineDestBase + offs * DrawLineDestIncrement;
int which_func;
DrawLineDest = DrawLineDestBase + offs * DrawLineDestIncrement;
which_func = have_scan ? DO_LOOP_MD_SCAN : DO_LOOP_MD;
else
which_func = have_scan ? DO_LOOP_SCAN : DO_LOOP;
which_func = have_scan ? DO_LOOP_MD_SCAN : DO_LOOP_MD;
else
which_func = have_scan ? DO_LOOP_SCAN : DO_LOOP;
+ lines_sft_offs = (lines << 16) | offs;
+ if (Pico32x.vdp_regs[2 / 2] & P32XV_SFT)
+ lines_sft_offs |= 1 << 8;
- do_loop[which_func](DrawLineDest, dram, (lines << 16) | offs, md_bg);
+ do_loop[which_func](DrawLineDest, dram, lines_sft_offs, md_bg);
}
void PicoDraw32xSetFrameMode(int is_on, int only_32x)
}
void PicoDraw32xSetFrameMode(int is_on, int only_32x)
-@ unsigned short *dst, unsigned short *dram, int lines_offs, int mdbg
+@ unsigned short *dst, unsigned short *dram, int lines_sft_offs, int mdbg
.macro make_do_loop_dc name call_scan do_md
.global \name
\name:
.macro make_do_loop_dc name call_scan do_md
.global \name
\name:
-@ unsigned short *dst, unsigned short *dram, int lines_offs, int mdbg
+@ unsigned short *dst, unsigned short *dram, int lines_sft_offs, int mdbg
.macro make_do_loop_pp name call_scan do_md
.global \name
\name:
.macro make_do_loop_pp name call_scan do_md
.global \name
\name:
add r11,r11,#8
mov r6, #320
add r5, r1, r12, lsl #1 @ p32x = dram + dram[l]
add r11,r11,#8
mov r6, #320
add r5, r1, r12, lsl #1 @ p32x = dram + dram[l]
+ and r12,r2, #0x100 @ shift
+ add r5, r5, r12,lsr #8
2: @ loop_inner:
do_pixel_pp \do_md
2: @ loop_inner:
do_pixel_pp \do_md
-@ unsigned short *dst, unsigned short *dram, int lines_offs, int mdbg
+@ unsigned short *dst, unsigned short *dram, int lines_sft_offs, int mdbg
.macro make_do_loop_rl name call_scan do_md
.global \name
\name:
.macro make_do_loop_rl name call_scan do_md
.global \name
\name:
Pico32x.dirty_pal = 1;
r[0] = (r[0] & P32XV_nPAL) | (d & 0xff);
break;
Pico32x.dirty_pal = 1;
r[0] = (r[0] & P32XV_nPAL) | (d & 0xff);
break;
+ case 0x03: // shift (for pp mode)
+ r[2 / 2] = d & 1;
+ break;
case 0x05: // fill len
r[4 / 2] = d & 0xff;
break;
case 0x05: // fill len
r[4 / 2] = d & 0xff;
break;
return sh2_write8_unmapped(a, d, id);
}
return sh2_write8_unmapped(a, d, id);
}
+/* quirk: in both normal and overwrite areas only nonzero values go through */
#define sh2_write8_dramN(n) \
#define sh2_write8_dramN(n) \
- if (!(a & 0x20000) || d) { \
+ if ((d & 0xff) != 0) { \
u8 *dram = (u8 *)Pico32xMem->dram[n]; \
dram[(a & 0x1ffff) ^ 1] = d; \
} \
u8 *dram = (u8 *)Pico32xMem->dram[n]; \
dram[(a & 0x1ffff) ^ 1] = d; \
} \
rendstatus_old = -1;\r
}\r
\r
rendstatus_old = -1;\r
}\r
\r
+// note: may be called on the middle of frame\r
void PicoDrawSetOutBuf(void *dest, int increment)\r
{\r
DrawLineDestBase = dest;\r
DrawLineDestIncrement = increment;\r
void PicoDrawSetOutBuf(void *dest, int increment)\r
{\r
DrawLineDestBase = dest;\r
DrawLineDestIncrement = increment;\r
+ DrawLineDest = DrawLineDestBase + DrawScanline * increment;\r
}\r
\r
void PicoDrawSetInternalBuf(void *dest, int increment)\r
}\r
\r
void PicoDrawSetInternalBuf(void *dest, int increment)\r
if (dest != NULL) {\r
HighColBase = dest;\r
HighColIncrement = increment;\r
if (dest != NULL) {\r
HighColBase = dest;\r
HighColIncrement = increment;\r
+ HighCol = HighColBase + DrawScanline * increment;\r
}\r
else {\r
HighColBase = DefHighCol;\r
}\r
else {\r
HighColBase = DefHighCol;\r
#define P32XV_PRI (1<< 7)\r
#define P32XV_Mx (3<< 0) // display mode mask\r
\r
#define P32XV_PRI (1<< 7)\r
#define P32XV_Mx (3<< 0) // display mode mask\r
\r
+#define P32XV_SFT (1<< 0)\r
+\r
#define P32XV_VBLK (1<<15)\r
#define P32XV_HBLK (1<<14)\r
#define P32XV_PEN (1<<13)\r
#define P32XV_VBLK (1<<15)\r
#define P32XV_HBLK (1<<14)\r
#define P32XV_PEN (1<<13)\r
PicoDraw32xSetFrameMode(1, only_32x);\r
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);\r
}\r
PicoDraw32xSetFrameMode(1, only_32x);\r
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);\r
}\r
+ //PicoDraw32xSetFrameMode(0, 0);\r
+ //PicoDrawSetOutFormat(PDF_RGB555, 1);\r
}\r
\r
void plat_video_toggle_renderer(int change, int is_menu)\r
}\r
\r
void plat_video_toggle_renderer(int change, int is_menu)\r
PicoOpt &= ~POPT_ALT_RENDERER;\r
PicoOpt |= opts|POPT_ACC_SPRITES; // acc_sprites\r
\r
PicoOpt &= ~POPT_ALT_RENDERER;\r
PicoOpt |= opts|POPT_ACC_SPRITES; // acc_sprites\r
\r
- PicoDrawSetOutFormat(PDF_RGB555, 0);\r
+ PicoDrawSetOutFormat(PDF_RGB555, 1);\r
+ PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);\r
+ PicoDraw32xSetFrameMode(0, 0);\r
\r
Pico.m.dirtyPal = 1;\r
PicoFrameDrawOnly();\r
\r
Pico.m.dirtyPal = 1;\r
PicoFrameDrawOnly();\r
PicoOpt &= ~POPT_ALT_RENDERER;\r
PicoOpt |= POPT_EN_SOFTSCALE|POPT_ACC_SPRITES;\r
\r
PicoOpt &= ~POPT_ALT_RENDERER;\r
PicoOpt |= POPT_EN_SOFTSCALE|POPT_ACC_SPRITES;\r
\r
- PicoDrawSetOutFormat(PDF_RGB555, 0);\r
+ PicoDrawSetOutFormat(PDF_RGB555, 1);\r
+ PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);\r
+ PicoDraw32xSetFrameMode(0, 0);\r
Pico.m.dirtyPal = 1;\r
PicoFrame();\r
\r
Pico.m.dirtyPal = 1;\r
PicoFrame();\r
\r