[PATCH] Improve doubled TV monitor mode for 32-bit output

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Having every other line black makes the screen too dark, use half the
intensity instead.  This is done only for 32-bit mode as it's simple
there, 16-bit mode would have required extra lookup table or
bit-twiddling, and 16-bit mode is used only when absolutely needed for
speed, so I didn't want to slow that down.

This was request from Atari-forum:
	http://www.atari-forum.com/viewtopic.php?f=51&t=27730
---
 src/convert/macros.h | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/convert/macros.h b/src/convert/macros.h
index f0f1955f..0268ba8e 100644
--- a/src/convert/macros.h
+++ b/src/convert/macros.h
@@ -157,12 +157,15 @@ static const Uint32 Remap_2_Planes_Upper[256] = {
 
 /*
  * 32 bit screen format
- */
+ *
+ * In doubled 640-low TV mode, half intensity of every other scanlines
+ * In double-Y RGB mode, every other scanline is a copy
+*/
 
 /* Plot Low Resolution (320xH) 32-Bit pixels */
 #define PLOT_LOW_320_32BIT(offset)  \
 { \
-	esi[offset]   = (Uint32)STRGBPalette[ecx & 0x00ff]; \
+	esi[offset+0] = (Uint32)STRGBPalette[ecx & 0x00ff]; \
 	esi[offset+1] = (Uint32)STRGBPalette[(ecx >> 8) & 0x00ff]; \
 	esi[offset+2] = (Uint32)STRGBPalette[(ecx >> 16) & 0x00ff]; \
 	esi[offset+3] = (Uint32)STRGBPalette[(ecx >> 24) & 0x00ff]; \
@@ -175,6 +178,10 @@ static const Uint32 Remap_2_Planes_Upper[256] = {
 	esi[offset+2] = esi[offset+3] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
 	esi[offset+4] = esi[offset+5] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
 	esi[offset+6] = esi[offset+7] = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
+	esi[offset+0+Screen4BytesPerLine] = esi[offset+1+Screen4BytesPerLine] = esi[offset+0] >> 1; \
+	esi[offset+2+Screen4BytesPerLine] = esi[offset+3+Screen4BytesPerLine] = esi[offset+2] >> 1; \
+	esi[offset+4+Screen4BytesPerLine] = esi[offset+5+Screen4BytesPerLine] = esi[offset+4] >> 1; \
+	esi[offset+6+Screen4BytesPerLine] = esi[offset+7+Screen4BytesPerLine] = esi[offset+6] >> 1; \
 } 
 
 /* Plot Low Resolution (640xH) 16-Bit pixels (Double on Y) */
@@ -201,6 +208,10 @@ static const Uint32 Remap_2_Planes_Upper[256] = {
 	esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
 	esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
 	esi[offset+3] = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
+	esi[offset+0+Screen4BytesPerLine] = esi[offset+0] >> 1; \
+	esi[offset+1+Screen4BytesPerLine] = esi[offset+1] >> 1; \
+	esi[offset+2+Screen4BytesPerLine] = esi[offset+2] >> 1; \
+	esi[offset+3+Screen4BytesPerLine] = esi[offset+3] >> 1; \
 }
 
 /* Plot Medium Resolution(640xH) 32-Bit pixels (Double on Y) */
@@ -229,7 +240,7 @@ static const Uint32 Remap_2_Planes_Upper[256] = {
 /* Plot Spectrum512 Resolution(320xH) 32-Bit pixels */
 #define PLOT_SPEC512_END_LOW_320_32BIT(offset) \
 { \
-	esi[offset]   = STRGBPalette[ecx & 0x000000ff]; \
+	esi[offset+0] = STRGBPalette[ecx & 0x000000ff]; \
 	esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
 	esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
 }
@@ -239,6 +250,7 @@ static const Uint32 Remap_2_Planes_Upper[256] = {
 #define PLOT_SPEC512_LEFT_LOW_640_32BIT(offset)	\
 { \
 	esi[offset] = esi[offset+1] = STRGBPalette[ecx & 0x000000ff]; \
+	esi[offset+Screen4BytesPerLine] = esi[offset+1+Screen4BytesPerLine] = esi[offset] >> 1; \
 }
 
 /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels */
@@ -250,6 +262,9 @@ static const Uint32 Remap_2_Planes_Upper[256] = {
 	esi[offset+0] = esi[offset+1] = STRGBPalette[ecx & 0x000000ff]; \
 	esi[offset+2] = esi[offset+3] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
 	esi[offset+4] = esi[offset+5] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
+	esi[offset+0+Screen4BytesPerLine] = esi[offset+1+Screen4BytesPerLine] = esi[offset+0] >> 1; \
+	esi[offset+2+Screen4BytesPerLine] = esi[offset+3+Screen4BytesPerLine] = esi[offset+0] >> 1; \
+	esi[offset+4+Screen4BytesPerLine] = esi[offset+5+Screen4BytesPerLine] = esi[offset+0] >> 1; \
 }
 
 /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels (Double on Y) */
@@ -310,6 +325,8 @@ static const Uint32 Remap_2_Planes_Upper[256] = {
 
 /*
  * 16 bit screen format
+ *
+ * In TV mode, leave every other scanline black for simplicity & speed
  */
 
 /* Plot Low Resolution (320xH) 16-Bit pixels */
-- 
2.20.1


--------------2248120B456CCD1329E61674--



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/