Skip to content

Commit 6376653

Browse files
DerThoreWDrijver
andauthored
LoadRGB4 Kick 1.3/3.1 compatibility Update (ApolloTeam-dev#127)
* Fixed Typo in copper.h * Add Interlace modes, prepare SuperHires * Implement setwritemask * Implement minterms * Implement minterms * Implement minterms * Implement minterms * Implement minterms * Implement minterms * Implement minterms * WritePixel rewrite * dragging and swapping screens * Show screens while dragging needs an "anti flicker" in future. * Repair requesters Show requesters with raster background correctly * Temp workaround for SysInfo * Temp workaround for SysInfo * Better detection of matching screenmode * Better detection of matching screenmode * Mouse Pointer visible in flipped screen * Better detection for CGX screens * Aktualisieren von bestmodeida.c * Aktualisieren von bestmodeida.c * Aktualisieren von bestmodeida.c * Update bestmodeida.c * Correcting parameter order * Update amigavideo_hiddclass.c Activate prepared SuperHires * Update videocontrol.c Correct some, added missing ones. * Update videocontrol.c added missing define * Remove RT from AllocMem * Remove RT from AllocMem * Enhance GELS with HWSprites * Update drawglist.c * Update start.c for new core * added missing pointer added missing pointer and BORDER collision preset * DA/DD bus * DA/DD IDE Bus * DA/DD IDE Bus * DA/DD IDE Bus * DD/DA IDE Bus * DA/DD IDE Bus * DA/DD IDE Bus * DA/DD Gayle * DA/DD Gayle * DA/DD Gayle * DA/DD Gayle * DA/DD Gayle * Add GadGImage * Make LoadRGB4 more 1.3 and 3.1 compatible * Aktualisieren von loadrgb4.c * Add CL Poke Funcs * Add CL Poke Funcs * Update setrgb4.c * Aktualisieren von setrgb4.c * Aktualisieren von setrgb4.c * Update setrgb4.c * Update loadrgb4.c * change CL in any case * Implement Changesprite * Update loadrgb4.c * Update setrgb4.c --------- Co-authored-by: Willem Drijver <[email protected]>
1 parent a9b6344 commit 6376653

File tree

5 files changed

+255
-4
lines changed

5 files changed

+255
-4
lines changed

rom/graphics/changesprite.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 1995-2007, The AROS Development Team. All rights reserved.
2+
Copyright © 1995-2007, The AROS Development Team. All rights reserved.
33
$Id$
44
55
Desc: Graphics function ChangeSprite()
@@ -50,8 +50,13 @@
5050
{
5151
AROS_LIBFUNC_INIT
5252

53-
/* TODO: Write graphics/ChangeSprite() */
54-
aros_print_not_implemented ("ChangeSprite");
53+
WORD x,y;
54+
55+
s->posctldata = newdata;
56+
x = s->x;
57+
y = s->y;
58+
59+
MoveSprite(vp, s, x, y);
5560

5661
AROS_LIBFUNC_EXIT
5762
} /* ChangeSprite */

rom/graphics/gfxfuncsupport.c

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,3 +1242,94 @@ void GenMinterms(struct RastPort *rp)
12421242
}
12431243
}
12441244
}
1245+
1246+
/****************************************************************************************/
1247+
1248+
void pokeCL(UWORD *ci, UWORD target, UWORD table)
1249+
{
1250+
ULONG targ = (ULONG)target;
1251+
if(!ci) return;
1252+
targ &= 0x1fe;
1253+
for(;ci;ci+=2)
1254+
{
1255+
if( ((*ci)==0xffff) && ((*(ci+1) == 0xfffe))) return;
1256+
if(*ci == targ) break;
1257+
}
1258+
if (((*ci) == 0xffff) && ((*(ci+1)==0xfffe))) return;
1259+
if(*ci == targ)
1260+
{
1261+
ci++;
1262+
*ci++ = table;
1263+
}
1264+
}
1265+
1266+
/****************************************************************************************/
1267+
1268+
struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2)
1269+
{
1270+
struct CopIns *c;
1271+
UWORD op = COPPER_MOVE;
1272+
c = ci;
1273+
if(c)
1274+
{
1275+
short out = FALSE;
1276+
while(!out)
1277+
{
1278+
switch(c->OpCode & 3)
1279+
{
1280+
case COPPER_MOVE:
1281+
{
1282+
if(c->DESTADDR == (((UWORD)field1) & 0x1fe))
1283+
{
1284+
short mask;
1285+
if((mask = op&0xC000))
1286+
{
1287+
if(c->OpCode & mask)
1288+
{
1289+
c->DESTDATA = field2;
1290+
return c;
1291+
}
1292+
}
1293+
else
1294+
{
1295+
c->DESTDATA = field2;
1296+
return c;
1297+
}
1298+
}
1299+
c++;
1300+
break;
1301+
}
1302+
case COPPER_WAIT:
1303+
{
1304+
if(c->HWAITPOS == 255)
1305+
{
1306+
return 0;
1307+
}
1308+
else c++;
1309+
break;
1310+
}
1311+
case CPRNXTBUF:
1312+
{
1313+
if(c->NXTLIST == NULL)
1314+
{
1315+
out = TRUE;
1316+
}
1317+
else
1318+
{
1319+
if((c = c->NXTLIST->CopIns) == NULL)
1320+
{
1321+
out = TRUE;
1322+
}
1323+
}
1324+
break;
1325+
}
1326+
default:
1327+
{
1328+
out=TRUE;
1329+
break;
1330+
}
1331+
}
1332+
}
1333+
}
1334+
return 0;
1335+
}

rom/graphics/gfxfuncsupport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ void BltRastPortBitMap(struct RastPort *srcRastPort, WORD xSrc, WORD ySrc,
220220
struct GfxBase *GfxBase);
221221

222222
void GenMinterms(struct RastPort *rp);
223+
void pokeCL(UWORD *ci, UWORD target, UWORD table);
224+
struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2);
223225

224226
/****************************************************************************************/
225227

rom/graphics/loadrgb4.c

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,93 @@
88
#include <aros/debug.h>
99
#include "graphics_intern.h"
1010

11+
static void pokeCL(UWORD *ci, UWORD target, UWORD table)
12+
{
13+
ULONG targ = (ULONG)target;
14+
if(!ci) return;
15+
targ &= 0x1fe;
16+
for(;ci;ci+=2)
17+
{
18+
if( ((*ci)==0xffff) && ((*(ci+1) == 0xfffe))) return;
19+
if(*ci == targ) break;
20+
}
21+
if (((*ci) == 0xffff) && ((*(ci+1)==0xfffe))) return;
22+
if(*ci == targ)
23+
{
24+
ci++;
25+
*ci++ = table;
26+
}
27+
}
28+
29+
static struct CopIns *pokeCI(struct CopIns *ci, UWORD *field1, short field2)
30+
{
31+
struct CopIns *c;
32+
UWORD op=COPPER_MOVE;
33+
c = ci;
34+
if(c)
35+
{
36+
short out = FALSE;
37+
while(!out)
38+
{
39+
switch(c->OpCode & 3)
40+
{
41+
case COPPER_MOVE:
42+
{
43+
if(c->DESTADDR == (((UWORD)field1) & 0x1fe))
44+
{
45+
short mask;
46+
if((mask = op&0xC000))
47+
{
48+
if(c->OpCode & mask)
49+
{
50+
c->DESTDATA = field2;
51+
return c;
52+
}
53+
}
54+
else
55+
{
56+
c->DESTDATA = field2;
57+
return c;
58+
}
59+
}
60+
c++;
61+
break;
62+
}
63+
case COPPER_WAIT:
64+
{
65+
if(c->HWAITPOS == 255)
66+
{
67+
return 0;
68+
}
69+
else c++;
70+
break;
71+
}
72+
case CPRNXTBUF:
73+
{
74+
if(c->NXTLIST == NULL)
75+
{
76+
out = TRUE;
77+
}
78+
else
79+
{
80+
if((c = c->NXTLIST->CopIns) == NULL)
81+
{
82+
out = TRUE;
83+
}
84+
}
85+
break;
86+
}
87+
default:
88+
{
89+
out=TRUE;
90+
break;
91+
}
92+
}
93+
}
94+
}
95+
return 0;
96+
}
97+
1198
/*****************************************************************************
1299
13100
NAME */
@@ -55,14 +142,35 @@
55142
AROS_LIBFUNC_INIT
56143

57144
WORD t;
145+
int i;
146+
volatile struct Custom *custom = (struct Custom *)0xdff000;
58147

59148
if (!vp)
149+
{
150+
// No ViewPort? Then alter the colors directly
151+
for (i = 0; i < count ; i++)
152+
custom->color[i] = *colors++;
60153
return;
61-
154+
}
62155
ASSERT_VALID_PTR(vp);
63156
ASSERT_VALID_PTR(colors);
64157

65158
/* TODO: Optimization */
159+
struct ColorMap *cm;
160+
UWORD *ct;
161+
162+
// Why do we need this? Answer: For non hidd screens SetRGB32 might fail to fill the color table. This is a good place, I think
163+
if(vp->ColorMap)
164+
{
165+
cm = vp->ColorMap;
166+
ct = cm->ColorTable;
167+
if(count > cm->Count) count = cm->Count;
168+
for(i = 0; i<count; i++)
169+
{
170+
*ct++ = *colors++;
171+
}
172+
colors -= count; // back to first color
173+
}
66174

67175
for (t = 0; t < count; t ++ )
68176
{
@@ -79,6 +187,25 @@
79187

80188
SetRGB32( vp, t, r, g, b );
81189
}
190+
191+
ObtainSemaphore(GfxBase->ActiViewCprSemaphore);
192+
for (t = 0; t < count; t ++ )
193+
{
194+
// Remaining question: Do we need to check VP_HIDE?
195+
if(vp->DspIns)
196+
{
197+
// we need to store it into the intermediate CopperList too
198+
pokeCL(vp->DspIns->CopLStart, &custom->color[t], colors[t]);
199+
pokeCL(vp->DspIns->CopSStart, &custom->color[t], colors[t]);
200+
pokeCI(vp->DspIns->CopIns, &custom->color[t], colors[t]);
201+
}
202+
}
203+
ReleaseSemaphore(GfxBase->ActiViewCprSemaphore);
204+
205+
// To make it visible immediately we need to update the view. To simplify it, we call MrgCop
206+
MrgCop(GfxBase->ActiView);
207+
if(TypeOfMem(GfxBase->ActiView->LOFCprList->start) == MEMF_CHIP)
208+
GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start;
82209

83210
AROS_LIBFUNC_EXIT
84211

rom/graphics/setrgb4.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
NAME */
1313
#include <graphics/view.h>
1414
#include <proto/graphics.h>
15+
#include "gfxfuncsupport.h"
1516

1617
AROS_LH5(void, SetRGB4,
1718

@@ -63,8 +64,29 @@
6364
{
6465
AROS_LIBFUNC_INIT
6566

67+
UWORD col;
68+
volatile struct Custom *custom = (struct Custom *)0xdff000;
69+
70+
col = ((r & 0xF) << 8) | ((g & 0xF) << 4) | (b & 0xF);
71+
6672
if (!vp)
73+
{
74+
custom->color[n] = col;
6775
return;
76+
}
77+
78+
if(vp->ColorMap)
79+
SetRGB4CM(vp->ColorMap, n, r, g, b);
80+
81+
if(vp->DspIns)
82+
{
83+
ObtainSemaphore(GfxBase->ActiViewCprSemaphore);
84+
pokeCL(vp->DspIns->CopLStart, &custom->color[n], col);
85+
pokeCL(vp->DspIns->CopSStart, &custom->color[n], col);
86+
87+
pokeCI(vp->DspIns->CopIns,&custom->color[n],col);
88+
ReleaseSemaphore(GfxBase->ActiViewCprSemaphore);
89+
}
6890

6991
r = (( r & 0xF) << 4) | (r & 0xFF );
7092
r = r | (r << 8) | ( r << 16 ) | (r << 24 );
@@ -75,6 +97,10 @@
7597

7698
SetRGB32( vp, n, r, g, b );
7799

100+
MrgCop(GfxBase->ActiView);
101+
if(TypeOfMem(GfxBase->ActiView->LOFCprList->start) == MEMF_CHIP)
102+
GfxBase->LOFlist = GfxBase->ActiView->LOFCprList->start;
103+
78104
/************************************************************
79105
/ This is the code that works correctly on the real thing
80106
struct ColorMap * CM = vp->ColorMap;

0 commit comments

Comments
 (0)