mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
eliminate texrels (wip2)
This commit is contained in:
parent
ea38612fad
commit
99bdfd31b8
13 changed files with 102 additions and 147 deletions
|
@ -85,9 +85,9 @@ static void convert_pal555(int invert_prio)
|
|||
// this is almost never used (Wiz and menu bg gen only)
|
||||
void FinalizeLine32xRGB555(int sh, int line, struct PicoEState *est)
|
||||
{
|
||||
unsigned short *pd = DrawLineDest;
|
||||
unsigned short *pd = est->DrawLineDest;
|
||||
unsigned short *pal = Pico32xMem->pal_native;
|
||||
unsigned char *pmd = HighCol + 8;
|
||||
unsigned char *pmd = est->HighCol + 8;
|
||||
unsigned short *dram, *p32x;
|
||||
unsigned char mdbg;
|
||||
|
||||
|
@ -130,7 +130,7 @@ void FinalizeLine32xRGB555(int sh, int line, struct PicoEState *est)
|
|||
|
||||
#define PICOSCAN_PRE \
|
||||
PicoScan32xBegin(l + (lines_sft_offs & 0xff)); \
|
||||
dst = DrawLineDest; \
|
||||
dst = Pico.est.DrawLineDest; \
|
||||
|
||||
#define PICOSCAN_POST \
|
||||
PicoScan32xEnd(l + (lines_sft_offs & 0xff)); \
|
||||
|
@ -228,7 +228,7 @@ void PicoDraw32xLayer(int offs, int lines, int md_bg)
|
|||
int lines_sft_offs;
|
||||
int which_func;
|
||||
|
||||
DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
||||
dram = Pico32xMem->dram[Pico32x.vdp_regs[0x0a/2] & P32XV_FS];
|
||||
|
||||
if (Pico32xDrawMode == PDM32X_BOTH) {
|
||||
|
@ -266,7 +266,7 @@ do_it:
|
|||
if (Pico32x.vdp_regs[2 / 2] & P32XV_SFT)
|
||||
lines_sft_offs |= 1 << 8;
|
||||
|
||||
do_loop[which_func](DrawLineDest, dram, lines_sft_offs, md_bg);
|
||||
do_loop[which_func](Pico.est.DrawLineDest, dram, lines_sft_offs, md_bg);
|
||||
}
|
||||
|
||||
// mostly unused, games tend to keep 32X layer on
|
||||
|
@ -292,7 +292,7 @@ void PicoDraw32xLayerMdOnly(int offs, int lines)
|
|||
for (l = 0; l < lines; l++) {
|
||||
if (have_scan) {
|
||||
PicoScan32xBegin(l + offs);
|
||||
dst = DrawLineDest + poffs;
|
||||
dst = Pico.est.DrawLineDest + poffs;
|
||||
}
|
||||
for (p = 0; p < plen; p += 4) {
|
||||
dst[p + 0] = pal[*pmd++];
|
||||
|
|
|
@ -20,13 +20,12 @@ char *PDebugMain(void)
|
|||
{
|
||||
struct PicoVideo *pv=&Pico.video;
|
||||
unsigned char *reg=pv->reg, r;
|
||||
extern int HighPreSpr[];
|
||||
int i, sprites_lo, sprites_hi;
|
||||
char *dstrp;
|
||||
|
||||
sprites_lo = sprites_hi = 0;
|
||||
for (i = 0; HighPreSpr[i] != 0; i+=2)
|
||||
if (HighPreSpr[i+1] & 0x8000)
|
||||
for (i = 0; Pico.est.HighPreSpr[i] != 0; i+=2)
|
||||
if (Pico.est.HighPreSpr[i+1] & 0x8000)
|
||||
sprites_hi++;
|
||||
else sprites_lo++;
|
||||
|
||||
|
|
68
pico/draw.c
68
pico/draw.c
|
@ -35,18 +35,16 @@ int (*PicoScanBegin)(unsigned int num) = NULL;
|
|||
int (*PicoScanEnd) (unsigned int num) = NULL;
|
||||
|
||||
static unsigned char DefHighCol[8+320+8];
|
||||
unsigned char *HighCol = DefHighCol;
|
||||
static unsigned char *HighColBase = DefHighCol;
|
||||
static int HighColIncrement;
|
||||
|
||||
static unsigned int DefOutBuff[320*2/2];
|
||||
void *DrawLineDest = DefOutBuff; // pointer to dest buffer where to draw this line to
|
||||
void *DrawLineDestBase = DefOutBuff;
|
||||
int DrawLineDestIncrement;
|
||||
|
||||
static int HighCacheA[41+1]; // caches for high layers
|
||||
static int HighCacheB[41+1];
|
||||
int HighPreSpr[80*2+1]; // slightly preprocessed sprites
|
||||
static int HighPreSpr[80*2+1]; // slightly preprocessed sprites
|
||||
|
||||
#define SPRL_HAVE_HI 0x80 // have hi priority sprites
|
||||
#define SPRL_HAVE_LO 0x40 // *lo*
|
||||
|
@ -100,7 +98,7 @@ void blockcpy_or(void *dst, void *src, size_t n, int pat)
|
|||
#define TileNormMaker(funcname,pix_func) \
|
||||
static int funcname(int sx,int addr,int pal) \
|
||||
{ \
|
||||
unsigned char *pd = HighCol+sx; \
|
||||
unsigned char *pd = Pico.est.HighCol+sx; \
|
||||
unsigned int pack=0; unsigned int t=0; \
|
||||
\
|
||||
pack=*(unsigned int *)(Pico.vram+addr); /* Get 8 pixels */ \
|
||||
|
@ -124,7 +122,7 @@ static int funcname(int sx,int addr,int pal) \
|
|||
#define TileFlipMaker(funcname,pix_func) \
|
||||
static int funcname(int sx,int addr,int pal) \
|
||||
{ \
|
||||
unsigned char *pd = HighCol+sx; \
|
||||
unsigned char *pd = Pico.est.HighCol+sx; \
|
||||
unsigned int pack=0; unsigned int t=0; \
|
||||
\
|
||||
pack=*(unsigned int *)(Pico.vram+addr); /* Get 8 pixels */ \
|
||||
|
@ -515,7 +513,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
|
|||
pal=((code>>9)&0x30);
|
||||
|
||||
if (prio) {
|
||||
int *zb = (int *)(HighCol+8+(tilex<<3));
|
||||
int *zb = (int *)(est->HighCol+8+(tilex<<3));
|
||||
*zb++ &= 0xbfbfbfbf;
|
||||
*zb &= 0xbfbfbfbf;
|
||||
} else {
|
||||
|
@ -541,7 +539,7 @@ static void DrawTilesFromCacheShPrep(void)
|
|||
// 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,
|
||||
// but leave lo pri op sprite markers alone
|
||||
int c = 320/4, *zb = (int *)(HighCol+8);
|
||||
int c = 320/4, *zb = (int *)(Pico.est.HighCol+8);
|
||||
Pico.est.rendstatus |= PDRAW_SHHI_DONE;
|
||||
while (c--)
|
||||
{
|
||||
|
@ -591,7 +589,7 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est
|
|||
addr=(code&0x7ff)<<4;
|
||||
addr+=(unsigned int)code>>25; // y offset into tile
|
||||
dx=(code>>16)&0x1ff;
|
||||
zb = HighCol+dx;
|
||||
zb = est->HighCol+dx;
|
||||
*zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf;
|
||||
*zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf;
|
||||
|
||||
|
@ -607,7 +605,7 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est
|
|||
last_cut_tile:
|
||||
{
|
||||
unsigned int t, pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels
|
||||
unsigned char *pd = HighCol+dx;
|
||||
unsigned char *pd = est->HighCol+dx;
|
||||
if (!pack) return;
|
||||
if (code&0x0800)
|
||||
{
|
||||
|
@ -812,7 +810,7 @@ static void DrawSpritesSHi(unsigned char *sprited, const struct PicoEState *est)
|
|||
int offs, delta, width, height, row;
|
||||
|
||||
offs = (p[cnt] & 0x7f) * 2;
|
||||
sprite = HighPreSpr + offs;
|
||||
sprite = est->HighPreSpr + offs;
|
||||
code = sprite[1];
|
||||
pal = (code>>9)&0x30;
|
||||
|
||||
|
@ -936,7 +934,7 @@ static void DrawSpritesHiAS(unsigned char *sprited, int sh)
|
|||
|
||||
/* nasty 1: remove 'sprite' flags */
|
||||
{
|
||||
int c = 320/4/4, *zb = (int *)(HighCol+8);
|
||||
int c = 320/4/4, *zb = (int *)(Pico.est.HighCol+8);
|
||||
while (c--)
|
||||
{
|
||||
*zb++ &= 0x7f7f7f7f; *zb++ &= 0x7f7f7f7f;
|
||||
|
@ -1147,7 +1145,7 @@ static void DrawAllSprites(unsigned char *sprited, int prio, int sh,
|
|||
|
||||
// --------------------------------------------
|
||||
|
||||
void BackFill(int reg7, int sh)
|
||||
void BackFill(int reg7, int sh, struct PicoEState *est)
|
||||
{
|
||||
unsigned int back;
|
||||
|
||||
|
@ -1157,7 +1155,7 @@ void BackFill(int reg7, int sh)
|
|||
back|=back<<8;
|
||||
back|=back<<16;
|
||||
|
||||
memset32((int *)(HighCol+8), back, 320/4);
|
||||
memset32((int *)(est->HighCol+8), back, 320/4);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1204,10 +1202,10 @@ void PicoDoHighPal555(int sh, int line, struct PicoEState *est)
|
|||
}
|
||||
}
|
||||
|
||||
void FinalizeLine555(int sh, int line)
|
||||
void FinalizeLine555(int sh, int line, struct PicoEState *est)
|
||||
{
|
||||
unsigned short *pd=DrawLineDest;
|
||||
unsigned char *ps=HighCol+8;
|
||||
unsigned short *pd=est->DrawLineDest;
|
||||
unsigned char *ps=est->HighCol+8;
|
||||
unsigned short *pal=HighPal;
|
||||
int len;
|
||||
|
||||
|
@ -1242,7 +1240,7 @@ void FinalizeLine555(int sh, int line)
|
|||
|
||||
static void FinalizeLine8bit(int sh, int line, struct PicoEState *est)
|
||||
{
|
||||
unsigned char *pd = DrawLineDest;
|
||||
unsigned char *pd = est->DrawLineDest;
|
||||
int len, rs = est->rendstatus;
|
||||
static int dirty_count;
|
||||
|
||||
|
@ -1271,12 +1269,12 @@ static void FinalizeLine8bit(int sh, int line, struct PicoEState *est)
|
|||
|
||||
if (!sh && (rs & PDRAW_SONIC_MODE)) {
|
||||
if (dirty_count >= 11) {
|
||||
blockcpy_or(pd, HighCol+8, len, 0x80);
|
||||
blockcpy_or(pd, est->HighCol+8, len, 0x80);
|
||||
} else {
|
||||
blockcpy_or(pd, HighCol+8, len, 0x40);
|
||||
blockcpy_or(pd, est->HighCol+8, len, 0x40);
|
||||
}
|
||||
} else {
|
||||
blockcpy(pd, HighCol+8, len);
|
||||
blockcpy(pd, est->HighCol+8, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1403,8 +1401,8 @@ PICO_INTERNAL void PicoFrameStart(void)
|
|||
rendstatus_old = Pico.est.rendstatus;
|
||||
}
|
||||
|
||||
HighCol = HighColBase + offs * HighColIncrement;
|
||||
DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
||||
Pico.est.HighCol = HighColBase + offs * HighColIncrement;
|
||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + offs * DrawLineDestIncrement;
|
||||
Pico.est.DrawScanline = 0;
|
||||
skip_next_line = 0;
|
||||
|
||||
|
@ -1421,7 +1419,7 @@ static void DrawBlankedLine(int line, int offs, int sh, int bgc)
|
|||
if (PicoScanBegin != NULL)
|
||||
PicoScanBegin(line + offs);
|
||||
|
||||
BackFill(bgc, sh);
|
||||
BackFill(bgc, sh, &Pico.est);
|
||||
|
||||
if (FinalizeLine != NULL)
|
||||
FinalizeLine(sh, line, &Pico.est);
|
||||
|
@ -1429,8 +1427,8 @@ static void DrawBlankedLine(int line, int offs, int sh, int bgc)
|
|||
if (PicoScanEnd != NULL)
|
||||
PicoScanEnd(line + offs);
|
||||
|
||||
HighCol += HighColIncrement;
|
||||
DrawLineDest = (char *)DrawLineDest + DrawLineDestIncrement;
|
||||
Pico.est.HighCol += HighColIncrement;
|
||||
Pico.est.DrawLineDest = (char *)Pico.est.DrawLineDest + DrawLineDestIncrement;
|
||||
}
|
||||
|
||||
static void PicoLine(int line, int offs, int sh, int bgc)
|
||||
|
@ -1452,7 +1450,7 @@ static void PicoLine(int line, int offs, int sh, int bgc)
|
|||
}
|
||||
|
||||
// Draw screen:
|
||||
BackFill(bgc, sh);
|
||||
BackFill(bgc, sh, &Pico.est);
|
||||
if (Pico.video.reg[1]&0x40)
|
||||
DrawDisplay(sh);
|
||||
|
||||
|
@ -1462,8 +1460,8 @@ static void PicoLine(int line, int offs, int sh, int bgc)
|
|||
if (PicoScanEnd != NULL)
|
||||
skip_next_line = PicoScanEnd(line + offs);
|
||||
|
||||
HighCol += HighColIncrement;
|
||||
DrawLineDest = (char *)DrawLineDest + DrawLineDestIncrement;
|
||||
Pico.est.HighCol += HighColIncrement;
|
||||
Pico.est.DrawLineDest = (char *)Pico.est.DrawLineDest + DrawLineDestIncrement;
|
||||
}
|
||||
|
||||
void PicoDrawSync(int to, int blank_last_line)
|
||||
|
@ -1539,7 +1537,7 @@ void PicoDrawSetOutBuf(void *dest, int increment)
|
|||
{
|
||||
DrawLineDestBase = dest;
|
||||
DrawLineDestIncrement = increment;
|
||||
DrawLineDest = DrawLineDestBase + Pico.est.DrawScanline * increment;
|
||||
Pico.est.DrawLineDest = DrawLineDestBase + Pico.est.DrawScanline * increment;
|
||||
}
|
||||
|
||||
void PicoDrawSetInternalBuf(void *dest, int increment)
|
||||
|
@ -1547,7 +1545,7 @@ void PicoDrawSetInternalBuf(void *dest, int increment)
|
|||
if (dest != NULL) {
|
||||
HighColBase = dest;
|
||||
HighColIncrement = increment;
|
||||
HighCol = HighColBase + Pico.est.DrawScanline * increment;
|
||||
Pico.est.HighCol = HighColBase + Pico.est.DrawScanline * increment;
|
||||
}
|
||||
else {
|
||||
HighColBase = DefHighCol;
|
||||
|
@ -1572,4 +1570,12 @@ void PicoDrawSetCallbacks(int (*begin)(unsigned int num), int (*end)(unsigned in
|
|||
}
|
||||
}
|
||||
|
||||
// vim:ts=4:sw=4:expandtab
|
||||
void PicoDrawInit(void)
|
||||
{
|
||||
Pico.est.DrawLineDest = DefOutBuff;
|
||||
Pico.est.HighCol = HighColBase;
|
||||
Pico.est.HighPreSpr = HighPreSpr;
|
||||
rendstatus_old = -1;
|
||||
}
|
||||
|
||||
// vim:ts=2:sw=2:expandtab
|
||||
|
|
|
@ -10,15 +10,7 @@
|
|||
|
||||
#include "pico_int_o32.h"
|
||||
|
||||
.extern PicoOpt
|
||||
.extern HighCol
|
||||
.extern HighSprZ
|
||||
.extern HighPreSpr
|
||||
.extern DrawLineDest
|
||||
.extern DrawStripInterlace
|
||||
.extern HighCacheS_ptr
|
||||
|
||||
.equiv OVERRIDE_HIGHCOL, 1
|
||||
|
||||
.equ PDRAW_SPRITES_MOVED, (1<<0)
|
||||
.equ PDRAW_WND_DIFF_PRIO, (1<<1)
|
||||
|
@ -395,17 +387,12 @@ DrawLayer:
|
|||
sub r10,r10,r9, lsl #16 @ cells-=cellskip
|
||||
|
||||
@ cache some stuff to avoid mem access
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr r11,=HighCol
|
||||
ldr r11,[sp, #9*4] @ est
|
||||
mov r0, #0xf
|
||||
ldr r11,[r11]
|
||||
.else
|
||||
ldr r11,=HighCol
|
||||
mov r0, #0xf
|
||||
.endif
|
||||
ldr r11,[r11, #OFS_HighCol]
|
||||
|
||||
mvn r9, #0 @ r9=prevcode=-1
|
||||
add r1, r11, r7 @ r1=pdest
|
||||
add r1, r11, r7 @ r1=pdest
|
||||
|
||||
|
||||
@ r4 & r7 are scratch in this loop
|
||||
|
@ -548,14 +535,9 @@ DrawLayer:
|
|||
add r10,r10,r9, lsl #16 @ cell+=cellskip
|
||||
|
||||
@ cache some stuff to avoid mem access
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr r11,=HighCol
|
||||
ldr r11,[sp, #9*4] @ est
|
||||
mov r0, #0xf
|
||||
ldr r11,[r11]
|
||||
.else
|
||||
ldr r11,=HighCol
|
||||
mov r0, #0xf
|
||||
.endif
|
||||
ldr r11,[r11, #OFS_HighCol]
|
||||
|
||||
mvn r9, #0 @ r9=prevcode=-1
|
||||
add r1, r11, r7 @ r1=pdest
|
||||
|
@ -722,23 +704,17 @@ DrawLayer:
|
|||
|
||||
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
@ void BackFill(int reg7, int sh, struct PicoEState *est)
|
||||
|
||||
.global BackFill @ int reg7, int sh
|
||||
.global BackFill
|
||||
|
||||
BackFill:
|
||||
stmfd sp!, {r4-r9,lr}
|
||||
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr lr, =HighCol
|
||||
mov r0, r0, lsl #26
|
||||
ldr lr, [lr]
|
||||
ldr lr, [r2, #OFS_HighCol]
|
||||
mov r0, r0, lsr #26
|
||||
add lr, lr, #8
|
||||
.else
|
||||
ldr lr, =(HighCol+8)
|
||||
mov r0, r0, lsl #26
|
||||
mov r0, r0, lsr #26
|
||||
.endif
|
||||
|
||||
orr r0, r0, r1, lsl #6
|
||||
orr r0, r0, r0, lsl #8
|
||||
|
@ -764,8 +740,8 @@ BackFill:
|
|||
stmia lr!, {r0-r7}
|
||||
stmia lr!, {r0-r7}
|
||||
|
||||
ldmfd sp!, {r4-r9,r12}
|
||||
bx r12
|
||||
ldmfd sp!, {r4-r9,lr}
|
||||
bx lr
|
||||
|
||||
|
||||
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
@ -778,14 +754,8 @@ DrawTilesFromCache:
|
|||
stmfd sp!, {r4-r9,r11,lr}
|
||||
|
||||
@ cache some stuff to avoid mem access
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr r11,=HighCol
|
||||
ldr r11,[r3, #OFS_HighCol]
|
||||
mov r12,#0xf
|
||||
ldr r11,[r11]
|
||||
.else
|
||||
ldr r11,=HighCol
|
||||
mov r12,#0xf
|
||||
.endif
|
||||
ldr lr, [r3, #OFS_Pico_vram]
|
||||
mov r9, r3 @ est
|
||||
|
||||
|
@ -964,14 +934,8 @@ DrawSpritesSHi:
|
|||
add r10,r0, #3 @ r10=HighLnSpr end
|
||||
add r10,r10,r3 @ r10=HighLnSpr end
|
||||
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr r11,=HighCol
|
||||
ldr r11,[r1, #OFS_HighCol]
|
||||
mov r12,#0xf
|
||||
ldr r11,[r11]
|
||||
.else
|
||||
ldr r11,=HighCol
|
||||
mov r12,#0xf
|
||||
.endif
|
||||
ldr lr, [r1, #OFS_Pico_vram]
|
||||
|
||||
|
||||
|
@ -979,7 +943,7 @@ DrawSpriteSHi:
|
|||
@ draw next sprite
|
||||
ldrb r0, [r10,#-1]!
|
||||
ldr r7, [sp] @ est
|
||||
ldr r1, =HighPreSpr
|
||||
ldr r1, [r7, #OFS_HighPreSpr]
|
||||
cmp r0, #0xff
|
||||
ldmeqfd sp!, {r1,r4-r11,pc} @ end of list
|
||||
and r0, r0, #0x7f
|
||||
|
@ -1159,14 +1123,8 @@ das_no_prep:
|
|||
add r10,r0, #3
|
||||
add r10,r10,r2 @ r10=HighLnSpr end
|
||||
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr r11,=HighCol
|
||||
ldr r11,[r3, #OFS_HighCol]
|
||||
mov r12,#0xf
|
||||
ldr r11,[r11]
|
||||
.else
|
||||
ldr r11,=HighCol
|
||||
mov r12,#0xf
|
||||
.endif
|
||||
ldr lr, [r3, #OFS_Pico_vram]
|
||||
|
||||
@ + 0 : hhhhvvvv ----hhvv yyyyyyyy yyyyyyyy // v, h: horiz. size
|
||||
|
@ -1182,7 +1140,7 @@ DrawSprite:
|
|||
ldmeqfd sp!, {r1,r3-r11,pc} @ end of list
|
||||
cmp r2, r8, lsr #1
|
||||
bne DrawSprite @ wrong priority
|
||||
ldr r1, =HighPreSpr
|
||||
ldr r1, [r7, #OFS_HighPreSpr]
|
||||
and r0, r0, #0x7f
|
||||
add r0, r1, r0, lsl #3
|
||||
|
||||
|
@ -1352,17 +1310,10 @@ DrawWindow:
|
|||
sub r8, r1, r0
|
||||
|
||||
@ cache some stuff to avoid mem access
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr r11,=HighCol
|
||||
ldr r11, [r11, #OFS_HighCol]
|
||||
mov r8, r8, lsl #1 @ cells
|
||||
ldr r11,[r11]
|
||||
mvn r9, #0 @ r9=prevcode=-1
|
||||
add r11,r11,#8
|
||||
.else
|
||||
ldr r11,=(HighCol+8)
|
||||
mov r8, r8, lsl #1 @ cells
|
||||
mvn r9, #0 @ r9=prevcode=-1
|
||||
.endif
|
||||
add r1, r11, r0, lsl #4 @ r1=pdest
|
||||
mov r0, #0xf
|
||||
b .dwloop_enter
|
||||
|
@ -1632,17 +1583,9 @@ FinalizeLineRGB555_pal_done:
|
|||
tstne r12,#PDRAW_ACC_SPRITES
|
||||
movne lr, #0x3f
|
||||
|
||||
.if OVERRIDE_HIGHCOL
|
||||
ldr r1, =HighCol
|
||||
ldr r0, =DrawLineDest
|
||||
ldr r1, [r1]
|
||||
ldr r0, [r0]
|
||||
ldr r1, [r10, #OFS_HighCol]
|
||||
ldr r0, [r10, #OFS_DrawLineDest]
|
||||
add r1, r1, #8
|
||||
.else
|
||||
ldr r0, =DrawLineDest
|
||||
ldr r1, =(HighCol+8)
|
||||
ldr r0, [r0]
|
||||
.endif
|
||||
|
||||
ldrb r12, [r8, #12]
|
||||
mov lr, lr, lsl #1
|
||||
|
@ -1650,7 +1593,7 @@ FinalizeLineRGB555_pal_done:
|
|||
tst r12, #1
|
||||
movne r2, #320/8 @ len
|
||||
bne .fl_no32colRGB555
|
||||
ldr r4, =PicoOpt
|
||||
ldr r4, [r10, #OFS_PicoOpt]
|
||||
mov r2, #256/8
|
||||
ldr r4, [r4]
|
||||
tst r4, #0x4000
|
||||
|
|
16
pico/mode4.c
16
pico/mode4.c
|
@ -28,7 +28,7 @@ static int screen_offset;
|
|||
|
||||
static int TileNormM4(int sx, int addr, int pal)
|
||||
{
|
||||
unsigned char *pd = HighCol + sx;
|
||||
unsigned char *pd = Pico.est.HighCol + sx;
|
||||
unsigned int pack, t;
|
||||
|
||||
pack = *(unsigned int *)(Pico.vram + addr); /* Get 4 bitplanes / 8 pixels */
|
||||
|
@ -50,7 +50,7 @@ static int TileNormM4(int sx, int addr, int pal)
|
|||
|
||||
static int TileFlipM4(int sx,int addr,int pal)
|
||||
{
|
||||
unsigned char *pd = HighCol + sx;
|
||||
unsigned char *pd = Pico.est.HighCol + sx;
|
||||
unsigned int pack, t;
|
||||
|
||||
pack = *(unsigned int *)(Pico.vram + addr); /* Get 4 bitplanes / 8 pixels */
|
||||
|
@ -192,7 +192,7 @@ static void DrawDisplayM4(int scanline)
|
|||
|
||||
if (pv->reg[0] & 0x20)
|
||||
// first column masked
|
||||
((int *)HighCol)[2] = ((int *)HighCol)[3] = 0xe0e0e0e0;
|
||||
((int *)Pico.est.HighCol)[2] = ((int *)Pico.est.HighCol)[3] = 0xe0e0e0e0;
|
||||
}
|
||||
|
||||
void PicoFrameStartMode4(void)
|
||||
|
@ -219,7 +219,7 @@ void PicoFrameStartMode4(void)
|
|||
rendlines = lines;
|
||||
}
|
||||
|
||||
DrawLineDest = (char *)DrawLineDestBase + screen_offset * DrawLineDestIncrement;
|
||||
Pico.est.DrawLineDest = (char *)DrawLineDestBase + screen_offset * DrawLineDestIncrement;
|
||||
}
|
||||
|
||||
void PicoLineMode4(int line)
|
||||
|
@ -233,7 +233,7 @@ void PicoLineMode4(int line)
|
|||
skip_next_line = PicoScanBegin(line + screen_offset);
|
||||
|
||||
// Draw screen:
|
||||
BackFill(Pico.video.reg[7] & 0x0f, 0);
|
||||
BackFill(Pico.video.reg[7] & 0x0f, 0, &Pico.est);
|
||||
if (Pico.video.reg[1] & 0x40)
|
||||
DrawDisplayM4(line);
|
||||
|
||||
|
@ -243,7 +243,7 @@ void PicoLineMode4(int line)
|
|||
if (PicoScanEnd != NULL)
|
||||
skip_next_line = PicoScanEnd(line + screen_offset);
|
||||
|
||||
DrawLineDest = (char *)DrawLineDest + DrawLineDestIncrement;
|
||||
Pico.est.DrawLineDest = (char *)Pico.est.DrawLineDest + DrawLineDestIncrement;
|
||||
}
|
||||
|
||||
void PicoDoHighPal555M4(void)
|
||||
|
@ -282,12 +282,12 @@ static void FinalizeLineRGB555M4(int line)
|
|||
|
||||
static void FinalizeLine8bitM4(int line)
|
||||
{
|
||||
unsigned char *pd = DrawLineDest;
|
||||
unsigned char *pd = Pico.est.DrawLineDest;
|
||||
|
||||
if (!(PicoOpt & POPT_DIS_32C_BORDER))
|
||||
pd += 32;
|
||||
|
||||
memcpy32((int *)pd, (int *)(HighCol+8), 256/4);
|
||||
memcpy32((int *)pd, (int *)(Pico.est.HighCol+8), 256/4);
|
||||
}
|
||||
|
||||
void PicoDrawSetOutputMode4(pdso_t which)
|
||||
|
|
|
@ -38,6 +38,7 @@ void PicoInit(void)
|
|||
|
||||
Pico.est.Pico_video = &Pico.video;
|
||||
Pico.est.Pico_vram = Pico.vram;
|
||||
Pico.est.PicoOpt = &PicoOpt;
|
||||
|
||||
// Init CPUs:
|
||||
SekInit();
|
||||
|
@ -46,6 +47,8 @@ void PicoInit(void)
|
|||
PicoInitMCD();
|
||||
PicoSVPInit();
|
||||
Pico32xInit();
|
||||
|
||||
PicoDrawInit();
|
||||
}
|
||||
|
||||
// to be called once on emu exit
|
||||
|
|
|
@ -171,8 +171,6 @@ typedef enum
|
|||
void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode);
|
||||
void PicoDrawSetOutBuf(void *dest, int increment);
|
||||
void PicoDrawSetCallbacks(int (*begin)(unsigned int num), int (*end)(unsigned int num));
|
||||
extern void *DrawLineDest;
|
||||
extern unsigned char *HighCol;
|
||||
// utility
|
||||
#ifdef _ASM_DRAW_C
|
||||
void vidConvCpyRGB565(void *to, void *from, int pixels);
|
||||
|
|
|
@ -333,8 +333,12 @@ struct PicoEState
|
|||
{
|
||||
int DrawScanline;
|
||||
int rendstatus;
|
||||
void *DrawLineDest; // draw estination
|
||||
unsigned char *HighCol;
|
||||
int *HighPreSpr;
|
||||
void *Pico_video;
|
||||
void *Pico_vram;
|
||||
int *PicoOpt;
|
||||
};
|
||||
|
||||
// some assembly stuff depend on these, do not touch!
|
||||
|
@ -584,9 +588,10 @@ extern void (*PicoCartUnloadHook)(void);
|
|||
int CM_compareRun(int cyc, int is_sub);
|
||||
|
||||
// draw.c
|
||||
void PicoDrawInit(void);
|
||||
PICO_INTERNAL void PicoFrameStart(void);
|
||||
void PicoDrawSync(int to, int blank_last_line);
|
||||
void BackFill(int reg7, int sh);
|
||||
void BackFill(int reg7, int sh, struct PicoEState *est);
|
||||
void FinalizeLine555(int sh, int line, struct PicoEState *est);
|
||||
extern int (*PicoScanBegin)(unsigned int num);
|
||||
extern int (*PicoScanEnd)(unsigned int num);
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
/* autogenerated by ./tools/mkoffsets, do not edit */
|
||||
#define OFS_DrawScanline 0x00
|
||||
#define OFS_rendstatus 0x04
|
||||
#define OFS_Pico_video 0x08
|
||||
#define OFS_Pico_vram 0x0c
|
||||
#define OFS_DrawLineDest 0x08
|
||||
#define OFS_HighCol 0x0c
|
||||
#define OFS_HighPreSpr 0x10
|
||||
#define OFS_Pico_video 0x14
|
||||
#define OFS_Pico_vram 0x18
|
||||
#define OFS_PicoOpt 0x1c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue