summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortwinaphex2015-11-08 03:01:23 +0100
committertwinaphex2015-11-08 03:01:23 +0100
commit6617a40eda2d432948f44e00eb7a3ae09adb7113 (patch)
treeb1c1ce02bfb38794eeaa921ae90ad369254cd457 /src
parent6668281f17bbee8463e1fa4c97333d5d0b8d08c8 (diff)
downloadsnes9x2002-6617a40eda2d432948f44e00eb7a3ae09adb7113.tar.gz
snes9x2002-6617a40eda2d432948f44e00eb7a3ae09adb7113.tar.bz2
snes9x2002-6617a40eda2d432948f44e00eb7a3ae09adb7113.zip
Add more non-ARM_ASM codepaths
Diffstat (limited to 'src')
-rw-r--r--src/tile16.cpp121
-rw-r--r--src/tile16.h5
-rw-r--r--src/tile16fsub1_2.cpp25
3 files changed, 150 insertions, 1 deletions
diff --git a/src/tile16.cpp b/src/tile16.cpp
index 747209c..d923eec 100644
--- a/src/tile16.cpp
+++ b/src/tile16.cpp
@@ -52,6 +52,8 @@
extern uint32 HeadMask [4];
extern uint32 TailMask [5];
+#ifdef ARM_ASM
+
#define f(from, to_lo, to_hi, pix) \
" movs " #from ", " #from ", lsl #(17) \n" \
" addcs " #to_hi ", " #to_hi ", #(1 << ( 0 + 1 + " #pix ")) \n" \
@@ -214,8 +216,127 @@ void SelectConvertTile() {
ConvertTile = &ConvertTile2bpp;
break;
}
+}
+#else
+uint8 ConvertTile (uint8 *pCache, uint32 TileAddr)
+{
+ register uint8 *tp = &Memory.VRAM[TileAddr];
+ uint32 *p = (uint32 *) pCache;
+ uint32 non_zero = 0;
+ uint8 line;
+
+ switch (BG.BitShift)
+ {
+ case 8:
+ for (line = 8; line != 0; line--, tp += 2)
+ {
+ uint32 p1 = 0;
+ uint32 p2 = 0;
+ register uint8 pix;
+
+ if ((pix = *(tp + 0)))
+ {
+ p1 |= odd_high[0][pix >> 4];
+ p2 |= odd_low[0][pix & 0xf];
+ }
+ if ((pix = *(tp + 1)))
+ {
+ p1 |= even_high[0][pix >> 4];
+ p2 |= even_low[0][pix & 0xf];
+ }
+ if ((pix = *(tp + 16)))
+ {
+ p1 |= odd_high[1][pix >> 4];
+ p2 |= odd_low[1][pix & 0xf];
+ }
+ if ((pix = *(tp + 17)))
+ {
+ p1 |= even_high[1][pix >> 4];
+ p2 |= even_low[1][pix & 0xf];
+ }
+ if ((pix = *(tp + 32)))
+ {
+ p1 |= odd_high[2][pix >> 4];
+ p2 |= odd_low[2][pix & 0xf];
+ }
+ if ((pix = *(tp + 33)))
+ {
+ p1 |= even_high[2][pix >> 4];
+ p2 |= even_low[2][pix & 0xf];
+ }
+ if ((pix = *(tp + 48)))
+ {
+ p1 |= odd_high[3][pix >> 4];
+ p2 |= odd_low[3][pix & 0xf];
+ }
+ if ((pix = *(tp + 49)))
+ {
+ p1 |= even_high[3][pix >> 4];
+ p2 |= even_low[3][pix & 0xf];
+ }
+ *p++ = p1;
+ *p++ = p2;
+ non_zero |= p1 | p2;
+ }
+ break;
+ case 4:
+ for (line = 8; line != 0; line--, tp += 2)
+ {
+ uint32 p1 = 0;
+ uint32 p2 = 0;
+ register uint8 pix;
+ if ((pix = *(tp + 0)))
+ {
+ p1 |= odd_high[0][pix >> 4];
+ p2 |= odd_low[0][pix & 0xf];
+ }
+ if ((pix = *(tp + 1)))
+ {
+ p1 |= even_high[0][pix >> 4];
+ p2 |= even_low[0][pix & 0xf];
+ }
+ if ((pix = *(tp + 16)))
+ {
+ p1 |= odd_high[1][pix >> 4];
+ p2 |= odd_low[1][pix & 0xf];
+ }
+ if ((pix = *(tp + 17)))
+ {
+ p1 |= even_high[1][pix >> 4];
+ p2 |= even_low[1][pix & 0xf];
+ }
+ *p++ = p1;
+ *p++ = p2;
+ non_zero |= p1 | p2;
+ }
+ break;
+
+ case 2:
+ for (line = 8; line != 0; line--, tp += 2)
+ {
+ uint32 p1 = 0;
+ uint32 p2 = 0;
+ register uint8 pix;
+ if ((pix = *(tp + 0)))
+ {
+ p1 |= odd_high[0][pix >> 4];
+ p2 |= odd_low[0][pix & 0xf];
+ }
+ if ((pix = *(tp + 1)))
+ {
+ p1 |= even_high[0][pix >> 4];
+ p2 |= even_low[0][pix & 0xf];
+ }
+ *p++ = p1;
+ *p++ = p2;
+ non_zero |= p1 | p2;
+ }
+ break;
+ }
+ return (non_zero ? TRUE : BLANK_TILE);
}
+#endif
void SelectPalette() {
// GFX.ScreenColors = &GFX.ScreenColorsPre[(Tile & GFX.PaletteMask) >> GFX.PaletteShift];
diff --git a/src/tile16.h b/src/tile16.h
index 3fc1be6..f856b8e 100644
--- a/src/tile16.h
+++ b/src/tile16.h
@@ -44,7 +44,12 @@
void SelectConvertTile();
void SelectPalette();
+
+#ifdef ARM_ASM
extern uint8 (*ConvertTile) (uint8 *pCache, uint32 TileAddr);
+#else
+uint8 ConvertTile (uint8 *pCache, uint32 TileAddr);
+#endif
extern uint32 TileBlank;
diff --git a/src/tile16fsub1_2.cpp b/src/tile16fsub1_2.cpp
index a22c4a5..b7f2adb 100644
--- a/src/tile16fsub1_2.cpp
+++ b/src/tile16fsub1_2.cpp
@@ -39,7 +39,8 @@
* Nintendo Co., Limited and its subsidiary companies.
*/
-// ARM V5 Assembly by bitrider
+#ifdef ARM_ASM
+/* ARM V5 Assembly by bitrider */
#define FIXEDCOLOUR ((GFX.FixedColour >> 1) & (~0x0C30))
#define ROPNAME FixedSub1_2
@@ -61,4 +62,26 @@
#include "tile16f_t.h"
+#else
+void DrawTile16FixedSub1_2 (uint32 Tile, uint32 Offset, uint32 StartLine,
+ uint32 LineCount)
+{
+ TILE_PREAMBLE
+ register uint8 *bp;
+
+ RENDER_TILE(WRITE_4PIXELS16_SUBF1_2, WRITE_4PIXELS16_FLIPPED_SUBF1_2, 4)
+}
+
+void DrawClippedTile16FixedSub1_2 (uint32 Tile, uint32 Offset,
+ uint32 StartPixel, uint32 Width,
+ uint32 StartLine, uint32 LineCount)
+{
+ TILE_PREAMBLE
+ register uint8 *bp;
+
+ TILE_CLIP_PREAMBLE
+ RENDER_CLIPPED_TILE(WRITE_4PIXELS16_SUBF1_2,
+ WRITE_4PIXELS16_FLIPPED_SUBF1_2, 4)
+}
+#endif