From 2a646c5564539889e55c177a202fd6ca5aeba350 Mon Sep 17 00:00:00 2001 From: Lo Def Date: Wed, 8 Sep 2021 01:59:37 -0400 Subject: [PATCH 1/9] Support background color changes - pf/background used to change background color once per line resulting in higher visual quality. --- src/emucore/CartMVC.cxx | 306 ++++++++++++++++++++++++---------------- 1 file changed, 188 insertions(+), 118 deletions(-) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index 37d3d6024..87853a787 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -78,9 +78,11 @@ class StreamReader : public Serializable myColor[colorSize - 2] = 0; myColor[colorSize - 1] = 0; } + + myColorBK[0] = 0; } - void swapField(bool index) { + void swapField(bool index, int frame) { uInt8* offset = index ? myBuffer1 : myBuffer2; myVersion = offset + VERSION_DATA_OFFSET; @@ -89,6 +91,11 @@ class StreamReader : public Serializable myGraph = offset + GRAPH_DATA_OFFSET; myTimecode = offset + TIMECODE_DATA_OFFSET; myColor = offset + COLOR_DATA_OFFSET; + myColorBK = offset + COLORBK_DATA_OFFSET; + + myColorBK++; + if (!(frame & 1)) + myColorBK++; } bool readField(uInt32 fnum, bool index) { @@ -112,7 +119,8 @@ class StreamReader : public Serializable uInt8 readVersion() { return *myVersion++; } uInt8 readFrame() { return *myFrame++; } - uInt8 readColor() { return *myColor++; } + uInt8 readColor() { return *myColor++; } + uInt8 readColorBK() { return *myColorBK++; } uInt8 readGraph() { return myGraphOverride ? *myGraphOverride++ : *myGraph++; @@ -138,6 +146,7 @@ class StreamReader : public Serializable const uInt8* myGraphOverride const uInt8* myTimecode const uInt8* myColor + const uInt8* myColorBK const uInt8* myVersion const uInt8* myFrame #endif @@ -161,6 +170,7 @@ class StreamReader : public Serializable const uInt8* myGraphOverride const uInt8* myTimecode const uInt8* myColor + const uInt8* myColorBK const uInt8* myVersion const uInt8* myFrame #endif @@ -180,7 +190,8 @@ class StreamReader : public Serializable GRAPH_DATA_OFFSET = 269, TIMECODE_DATA_OFFSET = 1229, COLOR_DATA_OFFSET = 1289, - END_DATA_OFFSET = 2249; + COLORBK_DATA_OFFSET = 2249, + END_DATA_OFFSET = 2441; const uInt8* myAudio{nullptr}; @@ -189,6 +200,7 @@ class StreamReader : public Serializable const uInt8* myTimecode{nullptr}; uInt8* myColor{nullptr}; + uInt8* myColorBK{nullptr}; const uInt8* myVersion{nullptr}; const uInt8* myFrame{nullptr}; @@ -287,20 +299,27 @@ class MovieInputs : public Serializable #define DEFAULT_LEVEL 6 #define BLANK_LINE_SIZE (30+3+37-1) // 70-1 -// #define addr_kernel_48 0x800 -#define addr_right_line 0x946 -#define addr_set_aud_right 0x94a -#define addr_set_gdata9 0x94c -#define addr_set_gcol9 0x950 -#define addr_set_gdata6 0x952 -#define addr_set_gcol6 0x956 -#define addr_set_gdata5 0x95a -#define addr_set_gcol5 0x95e -#define addr_set_gdata8 0x962 -#define addr_set_gcol7 0x966 -#define addr_set_gdata7 0x96a -#define addr_set_gcol8 0x96e -// #define addr_left_line 0x980 + +// Automatically generated +// Several not used +#define addr_kernel_48 0x800 +#define addr_transport_direction 0x880 +#define addr_transport_buttons 0x896 +#define addr_right_line 0x944 +#define addr_set_aud_right 0x948 +#define addr_set_gdata9 0x94a +#define addr_set_gcol9 0x94e +#define addr_set_gdata6 0x950 +#define addr_set_gcol6 0x954 +#define addr_set_gdata5 0x958 +#define addr_set_gcol5 0x95c +#define addr_set_gdata8 0x960 +#define addr_set_gcol7 0x964 +#define addr_set_gdata7 0x968 +#define addr_set_gcol8 0x96c +#define addr_set_colubk_r 0x976 +#define addr_set_colupf_r 0x97c +#define addr_left_line 0x980 #define addr_set_gdata1 0x982 #define addr_set_aud_left 0x986 #define addr_set_gdata4 0x98a @@ -312,31 +331,30 @@ class MovieInputs : public Serializable #define addr_set_gcol2 0x99e #define addr_set_gdata2 0x9a2 #define addr_set_gcol3 0x9a6 -#define addr_pick_continue 0x9b4 -// #define addr_main_start 0xa00 -// #define addr_aud_bank_setup 0xa0c -// #define addr_tg0 0xa24 -// #define addr_title_again 0xa3b -// #define addr_wait_cnt 0xa77 +#define addr_set_colubk_l 0x9b4 +#define addr_set_colupf_l 0x9b8 +#define addr_pick_continue 0x9ba +#define addr_main_start 0xa00 +#define addr_aud_bank_setup 0xa0c +#define addr_tg0 0xa24 +#define addr_title_again 0xa3b +#define addr_wait_cnt 0xa77 #define addr_end_lines 0xa80 #define addr_set_aud_endlines 0xa8c -#define addr_set_overscan_size 0xa90 -#define addr_set_vblank_size 0xaa6 -#define addr_pick_extra_lines 0xaaf -#define addr_pick_transport 0xab6 -#define addr_transport_direction 0xab9 -#define addr_transport_buttons 0xac2 -// #define addr_transport_done 0xacb -// #define addr_wait_lines 0xad0 -// #define addr_transport_done1 0xae1 -// #define addr_draw_title 0xb00 +#define addr_set_overscan_size 0xa9c +#define addr_set_vblank_size 0xab2 +#define addr_pick_extra_lines 0xabb +#define addr_pick_transport 0xac8 +#define addr_wait_lines 0xacb +#define addr_transport_done1 0xadc +#define addr_draw_title 0xb00 #define addr_title_loop 0xb50 -// #define addr_black_bar 0xb52 -// #define addr_animate_bar1 0xb58 -// #define addr_animate_bar_again1 0xb5a -// #define addr_animate_dex1 0xb65 +#define addr_black_bar 0xb52 +#define addr_animate_bar1 0xb58 +#define addr_animate_bar_again1 0xb5a +#define addr_animate_dex1 0xb65 #define addr_audio_bank 0xb80 -// #define addr_reset_loop 0xbfa +#define addr_reset_loop 0xbfa // scale adjustments, automatically generated static constexpr uInt8 scale0[16] = { @@ -385,70 +403,70 @@ static constexpr uInt8 shiftBright[16 + MAX_LEVEL - 1] = { // Compiled kernel static constexpr unsigned char kernelROM[] = { - 133, 2, 185, 50, 248, 133, 27, 185, 62, 248, 133, 28, 185, 74, 248, 133, - 27, 185, 86, 248, 133, 135, 185, 98, 248, 190, 110, 248, 132, 136, 164, 135, - 132, 28, 133, 27, 134, 28, 134, 27, 164, 136, 102, 137, 176, 210, 136, 16, - 207, 96, 0, 1, 1, 1, 0, 0, 48, 48, 50, 53, 56, 48, 249, 129, - 129, 128, 248, 0, 99, 102, 102, 102, 230, 99, 140, 252, 140, 136, 112, 0, - 192, 97, 99, 102, 102, 198, 198, 198, 248, 198, 248, 0, 193, 32, 48, 24, - 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, - 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 133, 2, 133, 42, 169, 0, 162, 223, 133, 25, - 160, 98, 169, 159, 133, 28, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, - 133, 6, 169, 247, 133, 28, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, - 133, 7, 134, 27, 132, 6, 133, 43, 133, 128, 133, 128, 133, 128, 133, 42, - 133, 2, 169, 207, 133, 28, 169, 0, 133, 25, 162, 191, 160, 114, 169, 54, - 133, 7, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 238, - 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, 132, 6, 169, 128, - 133, 32, 133, 33, 76, 70, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 120, 216, 162, 255, 154, 169, 0, 149, 0, 202, 208, 251, 169, 128, 133, 130, - 169, 251, 133, 131, 169, 1, 133, 37, 133, 38, 169, 3, 133, 4, 133, 5, - 133, 2, 162, 4, 133, 128, 202, 208, 251, 133, 128, 133, 16, 133, 17, 169, - 208, 133, 32, 169, 224, 133, 33, 133, 2, 133, 42, 165, 132, 106, 106, 133, - 6, 133, 7, 169, 85, 133, 137, 32, 0, 251, 176, 239, 169, 0, 133, 9, - 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, - 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, - 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, - 160, 0, 132, 27, 132, 28, 132, 27, 169, 0, 169, 0, 169, 0, 133, 25, - 162, 29, 32, 208, 250, 169, 2, 133, 0, 162, 3, 32, 208, 250, 169, 0, - 133, 0, 169, 2, 133, 1, 162, 37, 32, 208, 250, 162, 0, 134, 1, 162, - 0, 240, 3, 32, 208, 250, 76, 194, 250, 173, 128, 2, 74, 74, 74, 76, - 203, 250, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, 129, 76, 70, 249, - 133, 2, 169, 0, 177, 130, 133, 25, 165, 129, 240, 5, 198, 129, 173, 128, - 20, 200, 202, 208, 235, 96, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 162, 30, 32, 82, 251, 169, 2, 133, 0, 162, 3, 32, 82, 251, 169, 0, - 133, 0, 169, 2, 133, 1, 162, 37, 32, 82, 251, 169, 0, 133, 1, 198, - 132, 165, 132, 133, 133, 160, 255, 162, 30, 32, 88, 251, 162, 54, 32, 82, - 251, 160, 11, 32, 0, 248, 169, 0, 133, 27, 133, 28, 133, 27, 133, 28, - 162, 54, 32, 82, 251, 165, 132, 133, 133, 160, 1, 162, 30, 32, 88, 251, - 56, 96, 169, 0, 133, 133, 160, 0, 132, 134, 24, 165, 133, 101, 134, 133, - 133, 133, 2, 133, 9, 202, 208, 242, 96, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 250, 0, 250, 0, 250, + 133, 2, 185, 50, 248, 133, 27, 185, 62, 248, 133, 28, 185, 74, 248, 133, + 27, 185, 86, 248, 133, 135, 185, 98, 248, 190, 110, 248, 132, 136, 164, 135, + 132, 28, 133, 27, 134, 28, 134, 27, 164, 136, 102, 137, 176, 210, 136, 16, + 207, 96, 0, 1, 1, 1, 0, 0, 48, 48, 50, 53, 56, 48, 249, 129, + 129, 128, 248, 0, 99, 102, 102, 102, 230, 99, 140, 252, 140, 136, 112, 0, + 192, 97, 99, 102, 102, 198, 198, 198, 248, 198, 248, 0, 193, 32, 48, 24, + 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, + 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, + 173, 128, 2, 74, 74, 74, 133, 129, 234, 133, 128, 133, 128, 133, 128, 133, + 128, 169, 0, 76, 68, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, + 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 68, 249, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 133, 8, 133, 42, 169, 0, 162, 223, 133, 25, 160, 98, + 169, 159, 133, 28, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, 133, 6, + 169, 247, 133, 28, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, 133, 7, + 134, 27, 132, 6, 133, 43, 169, 0, 133, 9, 169, 0, 169, 0, 133, 42, + 133, 8, 169, 207, 133, 28, 169, 0, 133, 25, 162, 191, 160, 114, 169, 54, + 133, 7, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 238, + 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, 132, 6, 169, 128, + 133, 32, 133, 33, 169, 0, 133, 9, 169, 0, 76, 68, 249, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 120, 216, 162, 255, 154, 169, 0, 149, 0, 202, 208, 251, 169, 128, 133, 130, + 169, 251, 133, 131, 169, 1, 133, 37, 133, 38, 169, 3, 133, 4, 133, 5, + 133, 2, 162, 4, 133, 128, 202, 208, 251, 133, 128, 133, 16, 133, 17, 169, + 208, 133, 32, 169, 224, 133, 33, 133, 2, 133, 42, 165, 132, 106, 106, 133, + 6, 133, 7, 169, 85, 133, 137, 32, 0, 251, 176, 239, 169, 0, 133, 9, + 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, + 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, + 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, + 160, 0, 132, 27, 132, 28, 132, 27, 169, 0, 169, 0, 169, 0, 133, 25, + 169, 48, 133, 13, 169, 204, 133, 14, 169, 51, 133, 15, 162, 29, 32, 203, + 250, 169, 2, 133, 0, 162, 3, 32, 203, 250, 169, 0, 133, 0, 169, 2, + 133, 1, 162, 37, 32, 203, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, + 203, 250, 234, 234, 133, 128, 133, 128, 76, 150, 248, 133, 2, 169, 0, 177, + 130, 133, 25, 165, 129, 240, 5, 198, 129, 173, 128, 20, 200, 202, 208, 235, + 96, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 162, 30, 32, 82, 251, 169, 2, 133, 0, 162, 3, 32, 82, 251, 169, 0, + 133, 0, 169, 2, 133, 1, 162, 37, 32, 82, 251, 169, 0, 133, 1, 198, + 132, 165, 132, 133, 133, 160, 255, 162, 30, 32, 88, 251, 162, 54, 32, 82, + 251, 160, 11, 32, 0, 248, 169, 0, 133, 27, 133, 28, 133, 27, 133, 28, + 162, 54, 32, 82, 251, 165, 132, 133, 133, 160, 1, 162, 30, 32, 88, 251, + 56, 96, 169, 0, 133, 133, 160, 0, 132, 134, 24, 165, 133, 101, 134, 133, + 133, 133, 2, 133, 9, 202, 208, 242, 96, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 250, 0, 250, 0, 250, }; // OSD labels @@ -759,7 +777,7 @@ class MovieCart : public Serializable writeROM(addr_title_loop + 0, 0x18); } - void writeColor(uInt16 address); + void writeColor(uInt16 address, uInt8 val); void writeAudioData(uInt16 address, uInt8 val) { writeROM(address, myVolumeScale[val]); } @@ -861,16 +879,14 @@ bool MovieCart::init(const string& path) if(!myStream.open(path)) return false; - myStream.swapField(true); + myStream.swapField(true, myFrameNumber); return true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MovieCart::writeColor(uInt16 address) +void MovieCart::writeColor(uInt16 address, uInt8 v) { - uint8_t v = myStream.readColor(); - v = (v & 0xf0) | shiftBright[(v & 0x0f) + myBright]; if(myForceColor) @@ -1079,6 +1095,7 @@ void MovieCart::updateTransport() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void MovieCart::fill_addr_right_line() { + uint8_t v; writeAudio(addr_set_aud_right + 1); writeGraph(addr_set_gdata5 + 1); @@ -1087,16 +1104,43 @@ void MovieCart::fill_addr_right_line() writeGraph(addr_set_gdata8 + 1); writeGraph(addr_set_gdata9 + 1); - writeColor(addr_set_gcol5 + 1); - writeColor(addr_set_gcol6 + 1); - writeColor(addr_set_gcol7 + 1); - writeColor(addr_set_gcol8 + 1); - writeColor(addr_set_gcol9 + 1); + v = myStream.readColor(); + writeColor(addr_set_gcol5 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol6 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol7 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol8 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol9 + 1, v); + + // alternate between background color and playfield color + if (myForceColor) + { + v = 0; + writeROM(addr_set_colubk_r + 1, v); + writeROM(addr_set_colupf_r + 1, v); + } + else + { + v = myStream.readColorBK(); + writeColor(addr_set_colubk_r + 1, v); + + v = 0; + writeROM(addr_set_colupf_r + 1, v); // don't modify black color + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void MovieCart::fill_addr_left_line(bool again) { + uint8_t v; + writeAudio(addr_set_aud_left + 1); writeGraph(addr_set_gdata0 + 1); @@ -1105,11 +1149,37 @@ void MovieCart::fill_addr_left_line(bool again) writeGraph(addr_set_gdata3 + 1); writeGraph(addr_set_gdata4 + 1); - writeColor(addr_set_gcol0 + 1); - writeColor(addr_set_gcol1 + 1); - writeColor(addr_set_gcol2 + 1); - writeColor(addr_set_gcol3 + 1); - writeColor(addr_set_gcol4 + 1); + v = myStream.readColor(); + writeColor(addr_set_gcol0 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol1 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol2 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol3 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol4 + 1, v); + + + // alternate between background color and playfield color + if (myForceColor) + { + v = 0; + writeROM(addr_set_colubk_l + 1, v); // don't modify black color + writeROM(addr_set_colupf_l + 1, v); + } + else + { + v = 0; + writeROM(addr_set_colubk_l + 1, v); // don't modify black color + + v = myStream.readColorBK(); + writeColor(addr_set_colupf_l + 1, v); + } // addr_pick_line_end // jmp right_line @@ -1300,7 +1370,7 @@ void MovieCart::runStateMachine() fill_addr_left_line(0); fill_addr_end_lines(); - myStream.swapField(myBufferIndex); + myStream.swapField(myBufferIndex, myFrameNumber); myStream.blankPartialLines(myOdd); myBufferIndex = !myBufferIndex; From 51d856f9a5dea94f7941d43c2053b9d712ee3e58 Mon Sep 17 00:00:00 2001 From: Lo Def Date: Sun, 12 Sep 2021 05:30:20 -0400 Subject: [PATCH 2/9] - blank out left/right sides based on kernel modifications by Thomas Jentzch work in progress, stray pixel remaining --- src/emucore/CartMVC.cxx | 88 ++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 49 deletions(-) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index 87853a787..250ac98f8 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -93,7 +93,7 @@ class StreamReader : public Serializable myColor = offset + COLOR_DATA_OFFSET; myColorBK = offset + COLORBK_DATA_OFFSET; - myColorBK++; +// myColorBK++; if (!(frame & 1)) myColorBK++; } @@ -305,42 +305,40 @@ class MovieInputs : public Serializable #define addr_kernel_48 0x800 #define addr_transport_direction 0x880 #define addr_transport_buttons 0x896 -#define addr_right_line 0x944 -#define addr_set_aud_right 0x948 -#define addr_set_gdata9 0x94a -#define addr_set_gcol9 0x94e -#define addr_set_gdata6 0x950 -#define addr_set_gcol6 0x954 -#define addr_set_gdata5 0x958 -#define addr_set_gcol5 0x95c -#define addr_set_gdata8 0x960 -#define addr_set_gcol7 0x964 -#define addr_set_gdata7 0x968 -#define addr_set_gcol8 0x96c -#define addr_set_colubk_r 0x976 -#define addr_set_colupf_r 0x97c +#define addr_right_line 0x948 +#define addr_set_gdata6 0x948 +#define addr_set_aud_right 0x94e +#define addr_set_gdata9 0x952 +#define addr_set_gcol9 0x954 +#define addr_set_gcol6 0x956 +#define addr_set_gdata5 0x95a +#define addr_set_gcol5 0x95e +#define addr_set_gdata8 0x962 +#define addr_set_colubk_r 0x966 +#define addr_set_gcol7 0x96a +#define addr_set_gdata7 0x96e +#define addr_set_gcol8 0x972 #define addr_left_line 0x980 -#define addr_set_gdata1 0x982 -#define addr_set_aud_left 0x986 -#define addr_set_gdata4 0x98a -#define addr_set_gcol4 0x98c -#define addr_set_gcol1 0x98e +#define addr_set_gdata1 0x980 +#define addr_set_gcol1 0x986 +#define addr_set_aud_left 0x98a +#define addr_set_gdata4 0x98e +#define addr_set_gcol4 0x990 #define addr_set_gdata0 0x992 #define addr_set_gcol0 0x996 #define addr_set_gdata3 0x99a -#define addr_set_gcol2 0x99e -#define addr_set_gdata2 0x9a2 -#define addr_set_gcol3 0x9a6 -#define addr_set_colubk_l 0x9b4 -#define addr_set_colupf_l 0x9b8 -#define addr_pick_continue 0x9ba +#define addr_set_colupf_l 0x99e +#define addr_set_gcol2 0x9a2 +#define addr_set_gdata2 0x9a6 +#define addr_set_gcol3 0x9aa +#define addr_pick_continue 0x9be #define addr_main_start 0xa00 #define addr_aud_bank_setup 0xa0c #define addr_tg0 0xa24 #define addr_title_again 0xa3b #define addr_wait_cnt 0xa77 #define addr_end_lines 0xa80 -#define addr_set_aud_endlines 0xa8c +#define addr_set_aud_endlines 0xa86 #define addr_set_overscan_size 0xa9c #define addr_set_vblank_size 0xab2 #define addr_pick_extra_lines 0xabb @@ -412,8 +410,8 @@ static constexpr unsigned char kernelROM[] = { 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, 173, 128, 2, 74, 74, 74, 133, 129, 234, 133, 128, 133, 128, 133, 128, 133, - 128, 169, 0, 76, 68, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, - 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 68, 249, 255, 255, 255, + 128, 169, 0, 76, 72, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, + 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 72, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -423,15 +421,15 @@ static constexpr unsigned char kernelROM[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 133, 8, 133, 42, 169, 0, 162, 223, 133, 25, 160, 98, - 169, 159, 133, 28, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, 133, 6, - 169, 247, 133, 28, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, 133, 7, - 134, 27, 132, 6, 133, 43, 169, 0, 133, 9, 169, 0, 169, 0, 133, 42, - 133, 8, 169, 207, 133, 28, 169, 0, 133, 25, 162, 191, 160, 114, 169, 54, - 133, 7, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 238, - 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, 132, 6, 169, 128, - 133, 32, 133, 33, 169, 0, 133, 9, 169, 0, 76, 68, 249, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 169, 159, 133, 28, 133, 42, 169, 0, + 133, 25, 162, 223, 160, 98, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, + 133, 6, 169, 247, 133, 28, 169, 0, 133, 9, 169, 172, 133, 6, 169, 253, + 133, 27, 169, 216, 133, 7, 134, 27, 132, 6, 169, 0, 133, 9, 133, 43, + 169, 207, 133, 42, 133, 28, 169, 54, 133, 7, 169, 0, 133, 25, 162, 191, + 160, 114, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 0, + 133, 8, 169, 238, 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, + 132, 6, 169, 0, 133, 8, 169, 128, 133, 32, 133, 33, 169, 0, 76, 72, + 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -443,8 +441,8 @@ static constexpr unsigned char kernelROM[] = { 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, - 160, 0, 132, 27, 132, 28, 132, 27, 169, 0, 169, 0, 169, 0, 133, 25, - 169, 48, 133, 13, 169, 204, 133, 14, 169, 51, 133, 15, 162, 29, 32, 203, + 160, 0, 132, 27, 132, 28, 169, 0, 133, 25, 132, 27, 169, 0, 169, 0, + 169, 207, 133, 13, 169, 51, 133, 14, 169, 204, 133, 15, 162, 29, 32, 203, 250, 169, 2, 133, 0, 162, 3, 32, 203, 250, 169, 0, 133, 0, 169, 2, 133, 1, 162, 37, 32, 203, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, 203, 250, 234, 234, 133, 128, 133, 128, 76, 150, 248, 133, 2, 169, 0, 177, @@ -1124,15 +1122,11 @@ void MovieCart::fill_addr_right_line() { v = 0; writeROM(addr_set_colubk_r + 1, v); - writeROM(addr_set_colupf_r + 1, v); } else { v = myStream.readColorBK(); - writeColor(addr_set_colubk_r + 1, v); - - v = 0; - writeROM(addr_set_colupf_r + 1, v); // don't modify black color + writeColor(addr_set_colubk_r + 1, v); } } @@ -1169,14 +1163,10 @@ void MovieCart::fill_addr_left_line(bool again) if (myForceColor) { v = 0; - writeROM(addr_set_colubk_l + 1, v); // don't modify black color writeROM(addr_set_colupf_l + 1, v); } else { - v = 0; - writeROM(addr_set_colubk_l + 1, v); // don't modify black color - v = myStream.readColorBK(); writeColor(addr_set_colupf_l + 1, v); } From 6c9ed28b835afad40bdc8093d35d0854e329f260 Mon Sep 17 00:00:00 2001 From: Lo Def Date: Sun, 12 Sep 2021 11:30:24 -0400 Subject: [PATCH 3/9] MovieCart: Fixed delayed right side kernel --- src/emucore/CartMVC.cxx | 70 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index 250ac98f8..c049aaefa 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -304,11 +304,11 @@ class MovieInputs : public Serializable // Several not used #define addr_kernel_48 0x800 #define addr_transport_direction 0x880 -#define addr_transport_buttons 0x896 +#define addr_transport_buttons 0x894 #define addr_right_line 0x948 #define addr_set_gdata6 0x948 #define addr_set_aud_right 0x94e -#define addr_set_gdata9 0x952 +#define addr_set_gdata9 0x950 #define addr_set_gcol9 0x954 #define addr_set_gcol6 0x956 #define addr_set_gdata5 0x95a @@ -319,18 +319,18 @@ class MovieInputs : public Serializable #define addr_set_gdata7 0x96e #define addr_set_gcol8 0x972 #define addr_left_line 0x980 -#define addr_set_gdata1 0x980 -#define addr_set_gcol1 0x986 -#define addr_set_aud_left 0x98a -#define addr_set_gdata4 0x98e -#define addr_set_gcol4 0x990 -#define addr_set_gdata0 0x992 -#define addr_set_gcol0 0x996 -#define addr_set_gdata3 0x99a -#define addr_set_colupf_l 0x99e -#define addr_set_gcol2 0x9a2 -#define addr_set_gdata2 0x9a6 -#define addr_set_gcol3 0x9aa +#define addr_set_gdata1 0x982 +#define addr_set_gcol1 0x988 +#define addr_set_aud_left 0x98c +#define addr_set_gdata4 0x990 +#define addr_set_gcol4 0x992 +#define addr_set_gdata0 0x994 +#define addr_set_gcol0 0x998 +#define addr_set_gdata3 0x99c +#define addr_set_colupf_l 0x9a0 +#define addr_set_gcol2 0x9a4 +#define addr_set_gdata2 0x9a8 +#define addr_set_gcol3 0x9ac #define addr_pick_continue 0x9be #define addr_main_start 0xa00 #define addr_aud_bank_setup 0xa0c @@ -338,13 +338,13 @@ class MovieInputs : public Serializable #define addr_title_again 0xa3b #define addr_wait_cnt 0xa77 #define addr_end_lines 0xa80 -#define addr_set_aud_endlines 0xa86 -#define addr_set_overscan_size 0xa9c -#define addr_set_vblank_size 0xab2 -#define addr_pick_extra_lines 0xabb -#define addr_pick_transport 0xac8 -#define addr_wait_lines 0xacb -#define addr_transport_done1 0xadc +#define addr_set_aud_endlines 0xa80 +#define addr_set_overscan_size 0xa9a +#define addr_set_vblank_size 0xab0 +#define addr_pick_extra_lines 0xab9 +#define addr_pick_transport 0xac6 +#define addr_wait_lines 0xac9 +#define addr_transport_done1 0xada #define addr_draw_title 0xb00 #define addr_title_loop 0xb50 #define addr_black_bar 0xb52 @@ -410,8 +410,8 @@ static constexpr unsigned char kernelROM[] = { 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, 173, 128, 2, 74, 74, 74, 133, 129, 234, 133, 128, 133, 128, 133, 128, 133, - 128, 169, 0, 76, 72, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, - 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 72, 249, 255, 255, 255, + 128, 76, 72, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, 129, 234, + 133, 128, 133, 128, 133, 128, 76, 72, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -422,13 +422,13 @@ static constexpr unsigned char kernelROM[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 169, 159, 133, 28, 133, 42, 169, 0, - 133, 25, 162, 223, 160, 98, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, + 162, 223, 133, 25, 160, 98, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, 133, 6, 169, 247, 133, 28, 169, 0, 133, 9, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, 133, 7, 134, 27, 132, 6, 169, 0, 133, 9, 133, 43, - 169, 207, 133, 42, 133, 28, 169, 54, 133, 7, 169, 0, 133, 25, 162, 191, - 160, 114, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 0, - 133, 8, 169, 238, 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, - 132, 6, 169, 0, 133, 8, 169, 128, 133, 32, 133, 33, 169, 0, 76, 72, + 169, 0, 169, 207, 133, 42, 133, 28, 169, 54, 133, 7, 169, 0, 133, 25, + 162, 191, 160, 114, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, + 169, 0, 133, 8, 169, 238, 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, + 134, 27, 132, 6, 169, 0, 133, 8, 169, 128, 133, 32, 133, 33, 76, 72, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -441,13 +441,13 @@ static constexpr unsigned char kernelROM[] = { 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, - 160, 0, 132, 27, 132, 28, 169, 0, 133, 25, 132, 27, 169, 0, 169, 0, - 169, 207, 133, 13, 169, 51, 133, 14, 169, 204, 133, 15, 162, 29, 32, 203, - 250, 169, 2, 133, 0, 162, 3, 32, 203, 250, 169, 0, 133, 0, 169, 2, - 133, 1, 162, 37, 32, 203, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, - 203, 250, 234, 234, 133, 128, 133, 128, 76, 150, 248, 133, 2, 169, 0, 177, - 130, 133, 25, 165, 129, 240, 5, 198, 129, 173, 128, 20, 200, 202, 208, 235, - 96, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 169, 0, 162, 0, 160, 0, 132, 27, 132, 28, 133, 25, 132, 27, 169, 207, + 133, 13, 169, 51, 133, 14, 169, 204, 133, 15, 162, 29, 32, 201, 250, 169, + 2, 133, 0, 162, 3, 32, 201, 250, 169, 0, 133, 0, 169, 2, 133, 1, + 162, 37, 32, 201, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, 201, 250, + 234, 234, 133, 128, 133, 128, 76, 148, 248, 133, 2, 169, 0, 177, 130, 133, + 25, 165, 129, 240, 5, 198, 129, 173, 128, 20, 200, 202, 208, 235, 96, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 162, 30, 32, 82, 251, 169, 2, 133, 0, 162, 3, 32, 82, 251, 169, 0, 133, 0, 169, 2, 133, 1, 162, 37, 32, 82, 251, 169, 0, 133, 1, 198, From a36ce4da72618cf0b9680ef7dc2c631453fd472f Mon Sep 17 00:00:00 2001 From: Lo Def Date: Wed, 8 Sep 2021 01:59:37 -0400 Subject: [PATCH 4/9] Support background color changes - pf/background used to change background color once per line resulting in higher visual quality. --- src/emucore/CartMVC.cxx | 306 ++++++++++++++++++++++++---------------- 1 file changed, 188 insertions(+), 118 deletions(-) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index 37d3d6024..87853a787 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -78,9 +78,11 @@ class StreamReader : public Serializable myColor[colorSize - 2] = 0; myColor[colorSize - 1] = 0; } + + myColorBK[0] = 0; } - void swapField(bool index) { + void swapField(bool index, int frame) { uInt8* offset = index ? myBuffer1 : myBuffer2; myVersion = offset + VERSION_DATA_OFFSET; @@ -89,6 +91,11 @@ class StreamReader : public Serializable myGraph = offset + GRAPH_DATA_OFFSET; myTimecode = offset + TIMECODE_DATA_OFFSET; myColor = offset + COLOR_DATA_OFFSET; + myColorBK = offset + COLORBK_DATA_OFFSET; + + myColorBK++; + if (!(frame & 1)) + myColorBK++; } bool readField(uInt32 fnum, bool index) { @@ -112,7 +119,8 @@ class StreamReader : public Serializable uInt8 readVersion() { return *myVersion++; } uInt8 readFrame() { return *myFrame++; } - uInt8 readColor() { return *myColor++; } + uInt8 readColor() { return *myColor++; } + uInt8 readColorBK() { return *myColorBK++; } uInt8 readGraph() { return myGraphOverride ? *myGraphOverride++ : *myGraph++; @@ -138,6 +146,7 @@ class StreamReader : public Serializable const uInt8* myGraphOverride const uInt8* myTimecode const uInt8* myColor + const uInt8* myColorBK const uInt8* myVersion const uInt8* myFrame #endif @@ -161,6 +170,7 @@ class StreamReader : public Serializable const uInt8* myGraphOverride const uInt8* myTimecode const uInt8* myColor + const uInt8* myColorBK const uInt8* myVersion const uInt8* myFrame #endif @@ -180,7 +190,8 @@ class StreamReader : public Serializable GRAPH_DATA_OFFSET = 269, TIMECODE_DATA_OFFSET = 1229, COLOR_DATA_OFFSET = 1289, - END_DATA_OFFSET = 2249; + COLORBK_DATA_OFFSET = 2249, + END_DATA_OFFSET = 2441; const uInt8* myAudio{nullptr}; @@ -189,6 +200,7 @@ class StreamReader : public Serializable const uInt8* myTimecode{nullptr}; uInt8* myColor{nullptr}; + uInt8* myColorBK{nullptr}; const uInt8* myVersion{nullptr}; const uInt8* myFrame{nullptr}; @@ -287,20 +299,27 @@ class MovieInputs : public Serializable #define DEFAULT_LEVEL 6 #define BLANK_LINE_SIZE (30+3+37-1) // 70-1 -// #define addr_kernel_48 0x800 -#define addr_right_line 0x946 -#define addr_set_aud_right 0x94a -#define addr_set_gdata9 0x94c -#define addr_set_gcol9 0x950 -#define addr_set_gdata6 0x952 -#define addr_set_gcol6 0x956 -#define addr_set_gdata5 0x95a -#define addr_set_gcol5 0x95e -#define addr_set_gdata8 0x962 -#define addr_set_gcol7 0x966 -#define addr_set_gdata7 0x96a -#define addr_set_gcol8 0x96e -// #define addr_left_line 0x980 + +// Automatically generated +// Several not used +#define addr_kernel_48 0x800 +#define addr_transport_direction 0x880 +#define addr_transport_buttons 0x896 +#define addr_right_line 0x944 +#define addr_set_aud_right 0x948 +#define addr_set_gdata9 0x94a +#define addr_set_gcol9 0x94e +#define addr_set_gdata6 0x950 +#define addr_set_gcol6 0x954 +#define addr_set_gdata5 0x958 +#define addr_set_gcol5 0x95c +#define addr_set_gdata8 0x960 +#define addr_set_gcol7 0x964 +#define addr_set_gdata7 0x968 +#define addr_set_gcol8 0x96c +#define addr_set_colubk_r 0x976 +#define addr_set_colupf_r 0x97c +#define addr_left_line 0x980 #define addr_set_gdata1 0x982 #define addr_set_aud_left 0x986 #define addr_set_gdata4 0x98a @@ -312,31 +331,30 @@ class MovieInputs : public Serializable #define addr_set_gcol2 0x99e #define addr_set_gdata2 0x9a2 #define addr_set_gcol3 0x9a6 -#define addr_pick_continue 0x9b4 -// #define addr_main_start 0xa00 -// #define addr_aud_bank_setup 0xa0c -// #define addr_tg0 0xa24 -// #define addr_title_again 0xa3b -// #define addr_wait_cnt 0xa77 +#define addr_set_colubk_l 0x9b4 +#define addr_set_colupf_l 0x9b8 +#define addr_pick_continue 0x9ba +#define addr_main_start 0xa00 +#define addr_aud_bank_setup 0xa0c +#define addr_tg0 0xa24 +#define addr_title_again 0xa3b +#define addr_wait_cnt 0xa77 #define addr_end_lines 0xa80 #define addr_set_aud_endlines 0xa8c -#define addr_set_overscan_size 0xa90 -#define addr_set_vblank_size 0xaa6 -#define addr_pick_extra_lines 0xaaf -#define addr_pick_transport 0xab6 -#define addr_transport_direction 0xab9 -#define addr_transport_buttons 0xac2 -// #define addr_transport_done 0xacb -// #define addr_wait_lines 0xad0 -// #define addr_transport_done1 0xae1 -// #define addr_draw_title 0xb00 +#define addr_set_overscan_size 0xa9c +#define addr_set_vblank_size 0xab2 +#define addr_pick_extra_lines 0xabb +#define addr_pick_transport 0xac8 +#define addr_wait_lines 0xacb +#define addr_transport_done1 0xadc +#define addr_draw_title 0xb00 #define addr_title_loop 0xb50 -// #define addr_black_bar 0xb52 -// #define addr_animate_bar1 0xb58 -// #define addr_animate_bar_again1 0xb5a -// #define addr_animate_dex1 0xb65 +#define addr_black_bar 0xb52 +#define addr_animate_bar1 0xb58 +#define addr_animate_bar_again1 0xb5a +#define addr_animate_dex1 0xb65 #define addr_audio_bank 0xb80 -// #define addr_reset_loop 0xbfa +#define addr_reset_loop 0xbfa // scale adjustments, automatically generated static constexpr uInt8 scale0[16] = { @@ -385,70 +403,70 @@ static constexpr uInt8 shiftBright[16 + MAX_LEVEL - 1] = { // Compiled kernel static constexpr unsigned char kernelROM[] = { - 133, 2, 185, 50, 248, 133, 27, 185, 62, 248, 133, 28, 185, 74, 248, 133, - 27, 185, 86, 248, 133, 135, 185, 98, 248, 190, 110, 248, 132, 136, 164, 135, - 132, 28, 133, 27, 134, 28, 134, 27, 164, 136, 102, 137, 176, 210, 136, 16, - 207, 96, 0, 1, 1, 1, 0, 0, 48, 48, 50, 53, 56, 48, 249, 129, - 129, 128, 248, 0, 99, 102, 102, 102, 230, 99, 140, 252, 140, 136, 112, 0, - 192, 97, 99, 102, 102, 198, 198, 198, 248, 198, 248, 0, 193, 32, 48, 24, - 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, - 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 133, 2, 133, 42, 169, 0, 162, 223, 133, 25, - 160, 98, 169, 159, 133, 28, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, - 133, 6, 169, 247, 133, 28, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, - 133, 7, 134, 27, 132, 6, 133, 43, 133, 128, 133, 128, 133, 128, 133, 42, - 133, 2, 169, 207, 133, 28, 169, 0, 133, 25, 162, 191, 160, 114, 169, 54, - 133, 7, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 238, - 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, 132, 6, 169, 128, - 133, 32, 133, 33, 76, 70, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 120, 216, 162, 255, 154, 169, 0, 149, 0, 202, 208, 251, 169, 128, 133, 130, - 169, 251, 133, 131, 169, 1, 133, 37, 133, 38, 169, 3, 133, 4, 133, 5, - 133, 2, 162, 4, 133, 128, 202, 208, 251, 133, 128, 133, 16, 133, 17, 169, - 208, 133, 32, 169, 224, 133, 33, 133, 2, 133, 42, 165, 132, 106, 106, 133, - 6, 133, 7, 169, 85, 133, 137, 32, 0, 251, 176, 239, 169, 0, 133, 9, - 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, - 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, - 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, - 160, 0, 132, 27, 132, 28, 132, 27, 169, 0, 169, 0, 169, 0, 133, 25, - 162, 29, 32, 208, 250, 169, 2, 133, 0, 162, 3, 32, 208, 250, 169, 0, - 133, 0, 169, 2, 133, 1, 162, 37, 32, 208, 250, 162, 0, 134, 1, 162, - 0, 240, 3, 32, 208, 250, 76, 194, 250, 173, 128, 2, 74, 74, 74, 76, - 203, 250, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, 129, 76, 70, 249, - 133, 2, 169, 0, 177, 130, 133, 25, 165, 129, 240, 5, 198, 129, 173, 128, - 20, 200, 202, 208, 235, 96, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 162, 30, 32, 82, 251, 169, 2, 133, 0, 162, 3, 32, 82, 251, 169, 0, - 133, 0, 169, 2, 133, 1, 162, 37, 32, 82, 251, 169, 0, 133, 1, 198, - 132, 165, 132, 133, 133, 160, 255, 162, 30, 32, 88, 251, 162, 54, 32, 82, - 251, 160, 11, 32, 0, 248, 169, 0, 133, 27, 133, 28, 133, 27, 133, 28, - 162, 54, 32, 82, 251, 165, 132, 133, 133, 160, 1, 162, 30, 32, 88, 251, - 56, 96, 169, 0, 133, 133, 160, 0, 132, 134, 24, 165, 133, 101, 134, 133, - 133, 133, 2, 133, 9, 202, 208, 242, 96, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 250, 0, 250, 0, 250, + 133, 2, 185, 50, 248, 133, 27, 185, 62, 248, 133, 28, 185, 74, 248, 133, + 27, 185, 86, 248, 133, 135, 185, 98, 248, 190, 110, 248, 132, 136, 164, 135, + 132, 28, 133, 27, 134, 28, 134, 27, 164, 136, 102, 137, 176, 210, 136, 16, + 207, 96, 0, 1, 1, 1, 0, 0, 48, 48, 50, 53, 56, 48, 249, 129, + 129, 128, 248, 0, 99, 102, 102, 102, 230, 99, 140, 252, 140, 136, 112, 0, + 192, 97, 99, 102, 102, 198, 198, 198, 248, 198, 248, 0, 193, 32, 48, 24, + 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, + 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, + 173, 128, 2, 74, 74, 74, 133, 129, 234, 133, 128, 133, 128, 133, 128, 133, + 128, 169, 0, 76, 68, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, + 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 68, 249, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 133, 8, 133, 42, 169, 0, 162, 223, 133, 25, 160, 98, + 169, 159, 133, 28, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, 133, 6, + 169, 247, 133, 28, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, 133, 7, + 134, 27, 132, 6, 133, 43, 169, 0, 133, 9, 169, 0, 169, 0, 133, 42, + 133, 8, 169, 207, 133, 28, 169, 0, 133, 25, 162, 191, 160, 114, 169, 54, + 133, 7, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 238, + 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, 132, 6, 169, 128, + 133, 32, 133, 33, 169, 0, 133, 9, 169, 0, 76, 68, 249, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 120, 216, 162, 255, 154, 169, 0, 149, 0, 202, 208, 251, 169, 128, 133, 130, + 169, 251, 133, 131, 169, 1, 133, 37, 133, 38, 169, 3, 133, 4, 133, 5, + 133, 2, 162, 4, 133, 128, 202, 208, 251, 133, 128, 133, 16, 133, 17, 169, + 208, 133, 32, 169, 224, 133, 33, 133, 2, 133, 42, 165, 132, 106, 106, 133, + 6, 133, 7, 169, 85, 133, 137, 32, 0, 251, 176, 239, 169, 0, 133, 9, + 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, + 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, + 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, + 160, 0, 132, 27, 132, 28, 132, 27, 169, 0, 169, 0, 169, 0, 133, 25, + 169, 48, 133, 13, 169, 204, 133, 14, 169, 51, 133, 15, 162, 29, 32, 203, + 250, 169, 2, 133, 0, 162, 3, 32, 203, 250, 169, 0, 133, 0, 169, 2, + 133, 1, 162, 37, 32, 203, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, + 203, 250, 234, 234, 133, 128, 133, 128, 76, 150, 248, 133, 2, 169, 0, 177, + 130, 133, 25, 165, 129, 240, 5, 198, 129, 173, 128, 20, 200, 202, 208, 235, + 96, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 162, 30, 32, 82, 251, 169, 2, 133, 0, 162, 3, 32, 82, 251, 169, 0, + 133, 0, 169, 2, 133, 1, 162, 37, 32, 82, 251, 169, 0, 133, 1, 198, + 132, 165, 132, 133, 133, 160, 255, 162, 30, 32, 88, 251, 162, 54, 32, 82, + 251, 160, 11, 32, 0, 248, 169, 0, 133, 27, 133, 28, 133, 27, 133, 28, + 162, 54, 32, 82, 251, 165, 132, 133, 133, 160, 1, 162, 30, 32, 88, 251, + 56, 96, 169, 0, 133, 133, 160, 0, 132, 134, 24, 165, 133, 101, 134, 133, + 133, 133, 2, 133, 9, 202, 208, 242, 96, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 250, 0, 250, 0, 250, }; // OSD labels @@ -759,7 +777,7 @@ class MovieCart : public Serializable writeROM(addr_title_loop + 0, 0x18); } - void writeColor(uInt16 address); + void writeColor(uInt16 address, uInt8 val); void writeAudioData(uInt16 address, uInt8 val) { writeROM(address, myVolumeScale[val]); } @@ -861,16 +879,14 @@ bool MovieCart::init(const string& path) if(!myStream.open(path)) return false; - myStream.swapField(true); + myStream.swapField(true, myFrameNumber); return true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MovieCart::writeColor(uInt16 address) +void MovieCart::writeColor(uInt16 address, uInt8 v) { - uint8_t v = myStream.readColor(); - v = (v & 0xf0) | shiftBright[(v & 0x0f) + myBright]; if(myForceColor) @@ -1079,6 +1095,7 @@ void MovieCart::updateTransport() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void MovieCart::fill_addr_right_line() { + uint8_t v; writeAudio(addr_set_aud_right + 1); writeGraph(addr_set_gdata5 + 1); @@ -1087,16 +1104,43 @@ void MovieCart::fill_addr_right_line() writeGraph(addr_set_gdata8 + 1); writeGraph(addr_set_gdata9 + 1); - writeColor(addr_set_gcol5 + 1); - writeColor(addr_set_gcol6 + 1); - writeColor(addr_set_gcol7 + 1); - writeColor(addr_set_gcol8 + 1); - writeColor(addr_set_gcol9 + 1); + v = myStream.readColor(); + writeColor(addr_set_gcol5 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol6 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol7 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol8 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol9 + 1, v); + + // alternate between background color and playfield color + if (myForceColor) + { + v = 0; + writeROM(addr_set_colubk_r + 1, v); + writeROM(addr_set_colupf_r + 1, v); + } + else + { + v = myStream.readColorBK(); + writeColor(addr_set_colubk_r + 1, v); + + v = 0; + writeROM(addr_set_colupf_r + 1, v); // don't modify black color + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void MovieCart::fill_addr_left_line(bool again) { + uint8_t v; + writeAudio(addr_set_aud_left + 1); writeGraph(addr_set_gdata0 + 1); @@ -1105,11 +1149,37 @@ void MovieCart::fill_addr_left_line(bool again) writeGraph(addr_set_gdata3 + 1); writeGraph(addr_set_gdata4 + 1); - writeColor(addr_set_gcol0 + 1); - writeColor(addr_set_gcol1 + 1); - writeColor(addr_set_gcol2 + 1); - writeColor(addr_set_gcol3 + 1); - writeColor(addr_set_gcol4 + 1); + v = myStream.readColor(); + writeColor(addr_set_gcol0 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol1 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol2 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol3 + 1, v); + + v = myStream.readColor(); + writeColor(addr_set_gcol4 + 1, v); + + + // alternate between background color and playfield color + if (myForceColor) + { + v = 0; + writeROM(addr_set_colubk_l + 1, v); // don't modify black color + writeROM(addr_set_colupf_l + 1, v); + } + else + { + v = 0; + writeROM(addr_set_colubk_l + 1, v); // don't modify black color + + v = myStream.readColorBK(); + writeColor(addr_set_colupf_l + 1, v); + } // addr_pick_line_end // jmp right_line @@ -1300,7 +1370,7 @@ void MovieCart::runStateMachine() fill_addr_left_line(0); fill_addr_end_lines(); - myStream.swapField(myBufferIndex); + myStream.swapField(myBufferIndex, myFrameNumber); myStream.blankPartialLines(myOdd); myBufferIndex = !myBufferIndex; From 963570b302961abfe4df733e91bf65f206c84c15 Mon Sep 17 00:00:00 2001 From: Lo Def Date: Sun, 12 Sep 2021 05:30:20 -0400 Subject: [PATCH 5/9] - blank out left/right sides based on kernel modifications by Thomas Jentzch work in progress, stray pixel remaining --- src/emucore/CartMVC.cxx | 88 ++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 49 deletions(-) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index 87853a787..250ac98f8 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -93,7 +93,7 @@ class StreamReader : public Serializable myColor = offset + COLOR_DATA_OFFSET; myColorBK = offset + COLORBK_DATA_OFFSET; - myColorBK++; +// myColorBK++; if (!(frame & 1)) myColorBK++; } @@ -305,42 +305,40 @@ class MovieInputs : public Serializable #define addr_kernel_48 0x800 #define addr_transport_direction 0x880 #define addr_transport_buttons 0x896 -#define addr_right_line 0x944 -#define addr_set_aud_right 0x948 -#define addr_set_gdata9 0x94a -#define addr_set_gcol9 0x94e -#define addr_set_gdata6 0x950 -#define addr_set_gcol6 0x954 -#define addr_set_gdata5 0x958 -#define addr_set_gcol5 0x95c -#define addr_set_gdata8 0x960 -#define addr_set_gcol7 0x964 -#define addr_set_gdata7 0x968 -#define addr_set_gcol8 0x96c -#define addr_set_colubk_r 0x976 -#define addr_set_colupf_r 0x97c +#define addr_right_line 0x948 +#define addr_set_gdata6 0x948 +#define addr_set_aud_right 0x94e +#define addr_set_gdata9 0x952 +#define addr_set_gcol9 0x954 +#define addr_set_gcol6 0x956 +#define addr_set_gdata5 0x95a +#define addr_set_gcol5 0x95e +#define addr_set_gdata8 0x962 +#define addr_set_colubk_r 0x966 +#define addr_set_gcol7 0x96a +#define addr_set_gdata7 0x96e +#define addr_set_gcol8 0x972 #define addr_left_line 0x980 -#define addr_set_gdata1 0x982 -#define addr_set_aud_left 0x986 -#define addr_set_gdata4 0x98a -#define addr_set_gcol4 0x98c -#define addr_set_gcol1 0x98e +#define addr_set_gdata1 0x980 +#define addr_set_gcol1 0x986 +#define addr_set_aud_left 0x98a +#define addr_set_gdata4 0x98e +#define addr_set_gcol4 0x990 #define addr_set_gdata0 0x992 #define addr_set_gcol0 0x996 #define addr_set_gdata3 0x99a -#define addr_set_gcol2 0x99e -#define addr_set_gdata2 0x9a2 -#define addr_set_gcol3 0x9a6 -#define addr_set_colubk_l 0x9b4 -#define addr_set_colupf_l 0x9b8 -#define addr_pick_continue 0x9ba +#define addr_set_colupf_l 0x99e +#define addr_set_gcol2 0x9a2 +#define addr_set_gdata2 0x9a6 +#define addr_set_gcol3 0x9aa +#define addr_pick_continue 0x9be #define addr_main_start 0xa00 #define addr_aud_bank_setup 0xa0c #define addr_tg0 0xa24 #define addr_title_again 0xa3b #define addr_wait_cnt 0xa77 #define addr_end_lines 0xa80 -#define addr_set_aud_endlines 0xa8c +#define addr_set_aud_endlines 0xa86 #define addr_set_overscan_size 0xa9c #define addr_set_vblank_size 0xab2 #define addr_pick_extra_lines 0xabb @@ -412,8 +410,8 @@ static constexpr unsigned char kernelROM[] = { 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, 173, 128, 2, 74, 74, 74, 133, 129, 234, 133, 128, 133, 128, 133, 128, 133, - 128, 169, 0, 76, 68, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, - 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 68, 249, 255, 255, 255, + 128, 169, 0, 76, 72, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, + 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 72, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -423,15 +421,15 @@ static constexpr unsigned char kernelROM[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 133, 8, 133, 42, 169, 0, 162, 223, 133, 25, 160, 98, - 169, 159, 133, 28, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, 133, 6, - 169, 247, 133, 28, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, 133, 7, - 134, 27, 132, 6, 133, 43, 169, 0, 133, 9, 169, 0, 169, 0, 133, 42, - 133, 8, 169, 207, 133, 28, 169, 0, 133, 25, 162, 191, 160, 114, 169, 54, - 133, 7, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 238, - 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, 132, 6, 169, 128, - 133, 32, 133, 33, 169, 0, 133, 9, 169, 0, 76, 68, 249, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 169, 159, 133, 28, 133, 42, 169, 0, + 133, 25, 162, 223, 160, 98, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, + 133, 6, 169, 247, 133, 28, 169, 0, 133, 9, 169, 172, 133, 6, 169, 253, + 133, 27, 169, 216, 133, 7, 134, 27, 132, 6, 169, 0, 133, 9, 133, 43, + 169, 207, 133, 42, 133, 28, 169, 54, 133, 7, 169, 0, 133, 25, 162, 191, + 160, 114, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 0, + 133, 8, 169, 238, 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, + 132, 6, 169, 0, 133, 8, 169, 128, 133, 32, 133, 33, 169, 0, 76, 72, + 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -443,8 +441,8 @@ static constexpr unsigned char kernelROM[] = { 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, - 160, 0, 132, 27, 132, 28, 132, 27, 169, 0, 169, 0, 169, 0, 133, 25, - 169, 48, 133, 13, 169, 204, 133, 14, 169, 51, 133, 15, 162, 29, 32, 203, + 160, 0, 132, 27, 132, 28, 169, 0, 133, 25, 132, 27, 169, 0, 169, 0, + 169, 207, 133, 13, 169, 51, 133, 14, 169, 204, 133, 15, 162, 29, 32, 203, 250, 169, 2, 133, 0, 162, 3, 32, 203, 250, 169, 0, 133, 0, 169, 2, 133, 1, 162, 37, 32, 203, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, 203, 250, 234, 234, 133, 128, 133, 128, 76, 150, 248, 133, 2, 169, 0, 177, @@ -1124,15 +1122,11 @@ void MovieCart::fill_addr_right_line() { v = 0; writeROM(addr_set_colubk_r + 1, v); - writeROM(addr_set_colupf_r + 1, v); } else { v = myStream.readColorBK(); - writeColor(addr_set_colubk_r + 1, v); - - v = 0; - writeROM(addr_set_colupf_r + 1, v); // don't modify black color + writeColor(addr_set_colubk_r + 1, v); } } @@ -1169,14 +1163,10 @@ void MovieCart::fill_addr_left_line(bool again) if (myForceColor) { v = 0; - writeROM(addr_set_colubk_l + 1, v); // don't modify black color writeROM(addr_set_colupf_l + 1, v); } else { - v = 0; - writeROM(addr_set_colubk_l + 1, v); // don't modify black color - v = myStream.readColorBK(); writeColor(addr_set_colupf_l + 1, v); } From d57ea48f3a60ffa91ae249549205ca51bc5fb1ae Mon Sep 17 00:00:00 2001 From: Lo Def Date: Sun, 12 Sep 2021 11:30:24 -0400 Subject: [PATCH 6/9] MovieCart: Fixed delayed right side kernel --- src/emucore/CartMVC.cxx | 70 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index 250ac98f8..c049aaefa 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -304,11 +304,11 @@ class MovieInputs : public Serializable // Several not used #define addr_kernel_48 0x800 #define addr_transport_direction 0x880 -#define addr_transport_buttons 0x896 +#define addr_transport_buttons 0x894 #define addr_right_line 0x948 #define addr_set_gdata6 0x948 #define addr_set_aud_right 0x94e -#define addr_set_gdata9 0x952 +#define addr_set_gdata9 0x950 #define addr_set_gcol9 0x954 #define addr_set_gcol6 0x956 #define addr_set_gdata5 0x95a @@ -319,18 +319,18 @@ class MovieInputs : public Serializable #define addr_set_gdata7 0x96e #define addr_set_gcol8 0x972 #define addr_left_line 0x980 -#define addr_set_gdata1 0x980 -#define addr_set_gcol1 0x986 -#define addr_set_aud_left 0x98a -#define addr_set_gdata4 0x98e -#define addr_set_gcol4 0x990 -#define addr_set_gdata0 0x992 -#define addr_set_gcol0 0x996 -#define addr_set_gdata3 0x99a -#define addr_set_colupf_l 0x99e -#define addr_set_gcol2 0x9a2 -#define addr_set_gdata2 0x9a6 -#define addr_set_gcol3 0x9aa +#define addr_set_gdata1 0x982 +#define addr_set_gcol1 0x988 +#define addr_set_aud_left 0x98c +#define addr_set_gdata4 0x990 +#define addr_set_gcol4 0x992 +#define addr_set_gdata0 0x994 +#define addr_set_gcol0 0x998 +#define addr_set_gdata3 0x99c +#define addr_set_colupf_l 0x9a0 +#define addr_set_gcol2 0x9a4 +#define addr_set_gdata2 0x9a8 +#define addr_set_gcol3 0x9ac #define addr_pick_continue 0x9be #define addr_main_start 0xa00 #define addr_aud_bank_setup 0xa0c @@ -338,13 +338,13 @@ class MovieInputs : public Serializable #define addr_title_again 0xa3b #define addr_wait_cnt 0xa77 #define addr_end_lines 0xa80 -#define addr_set_aud_endlines 0xa86 -#define addr_set_overscan_size 0xa9c -#define addr_set_vblank_size 0xab2 -#define addr_pick_extra_lines 0xabb -#define addr_pick_transport 0xac8 -#define addr_wait_lines 0xacb -#define addr_transport_done1 0xadc +#define addr_set_aud_endlines 0xa80 +#define addr_set_overscan_size 0xa9a +#define addr_set_vblank_size 0xab0 +#define addr_pick_extra_lines 0xab9 +#define addr_pick_transport 0xac6 +#define addr_wait_lines 0xac9 +#define addr_transport_done1 0xada #define addr_draw_title 0xb00 #define addr_title_loop 0xb50 #define addr_black_bar 0xb52 @@ -410,8 +410,8 @@ static constexpr unsigned char kernelROM[] = { 24, 25, 24, 24, 24, 24, 126, 0, 249, 97, 97, 97, 97, 249, 0, 0, 0, 0, 0, 0, 248, 128, 128, 224, 128, 248, 255, 255, 255, 255, 255, 255, 173, 128, 2, 74, 74, 74, 133, 129, 234, 133, 128, 133, 128, 133, 128, 133, - 128, 169, 0, 76, 72, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, - 129, 234, 133, 128, 133, 128, 133, 128, 169, 0, 76, 72, 249, 255, 255, 255, + 128, 76, 72, 249, 165, 12, 10, 173, 130, 2, 42, 41, 23, 133, 129, 234, + 133, 128, 133, 128, 133, 128, 76, 72, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -422,13 +422,13 @@ static constexpr unsigned char kernelROM[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 169, 159, 133, 28, 133, 42, 169, 0, - 133, 25, 162, 223, 160, 98, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, + 162, 223, 133, 25, 160, 98, 169, 248, 133, 7, 169, 231, 133, 27, 169, 242, 133, 6, 169, 247, 133, 28, 169, 0, 133, 9, 169, 172, 133, 6, 169, 253, 133, 27, 169, 216, 133, 7, 134, 27, 132, 6, 169, 0, 133, 9, 133, 43, - 169, 207, 133, 42, 133, 28, 169, 54, 133, 7, 169, 0, 133, 25, 162, 191, - 160, 114, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, 169, 0, - 133, 8, 169, 238, 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, 134, 27, - 132, 6, 169, 0, 133, 8, 169, 128, 133, 32, 133, 33, 169, 0, 76, 72, + 169, 0, 169, 207, 133, 42, 133, 28, 169, 54, 133, 7, 169, 0, 133, 25, + 162, 191, 160, 114, 169, 243, 133, 27, 169, 66, 133, 6, 169, 239, 133, 28, + 169, 0, 133, 8, 169, 238, 133, 6, 169, 251, 133, 27, 169, 182, 133, 7, + 134, 27, 132, 6, 169, 0, 133, 8, 169, 128, 133, 32, 133, 33, 76, 72, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -441,13 +441,13 @@ static constexpr unsigned char kernelROM[] = { 133, 37, 133, 27, 133, 16, 234, 133, 17, 133, 28, 133, 27, 133, 28, 169, 6, 133, 4, 169, 2, 133, 5, 169, 1, 133, 38, 169, 0, 133, 32, 169, 240, 133, 33, 133, 42, 162, 5, 202, 208, 253, 133, 43, 76, 128, 250, 255, - 160, 0, 132, 27, 132, 28, 169, 0, 133, 25, 132, 27, 169, 0, 169, 0, - 169, 207, 133, 13, 169, 51, 133, 14, 169, 204, 133, 15, 162, 29, 32, 203, - 250, 169, 2, 133, 0, 162, 3, 32, 203, 250, 169, 0, 133, 0, 169, 2, - 133, 1, 162, 37, 32, 203, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, - 203, 250, 234, 234, 133, 128, 133, 128, 76, 150, 248, 133, 2, 169, 0, 177, - 130, 133, 25, 165, 129, 240, 5, 198, 129, 173, 128, 20, 200, 202, 208, 235, - 96, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 169, 0, 162, 0, 160, 0, 132, 27, 132, 28, 133, 25, 132, 27, 169, 207, + 133, 13, 169, 51, 133, 14, 169, 204, 133, 15, 162, 29, 32, 201, 250, 169, + 2, 133, 0, 162, 3, 32, 201, 250, 169, 0, 133, 0, 169, 2, 133, 1, + 162, 37, 32, 201, 250, 162, 0, 134, 1, 162, 0, 240, 9, 32, 201, 250, + 234, 234, 133, 128, 133, 128, 76, 148, 248, 133, 2, 169, 0, 177, 130, 133, + 25, 165, 129, 240, 5, 198, 129, 173, 128, 20, 200, 202, 208, 235, 96, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 162, 30, 32, 82, 251, 169, 2, 133, 0, 162, 3, 32, 82, 251, 169, 0, 133, 0, 169, 2, 133, 1, 162, 37, 32, 82, 251, 169, 0, 133, 1, 198, From cdb03cbc83fc4044f4b2dc50c84c2da9f3e4536c Mon Sep 17 00:00:00 2001 From: Lo Def Date: Sun, 12 Sep 2021 14:58:35 -0400 Subject: [PATCH 7/9] MovieCart: Fixed random pixels between OSD + bars --- src/emucore/CartMVC.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index c049aaefa..14de73ffb 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -481,6 +481,8 @@ static constexpr uInt8 brightLabelEven[] = { 0, 49, 48, 12, 96, 6, 140, 231, 96, 0, 0, 225, 48, 12, 96, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0 }; static constexpr uInt8 brightLabelOdd[] = { @@ -495,6 +497,8 @@ static constexpr uInt8 brightLabelOdd[] = { 6, 156, 195, 96, 0, 0, 113, 48, 12, 96, 7, 142, 127, 96, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -511,6 +515,8 @@ static constexpr uInt8 volumeLabelEven[] = { 0, 12, 192, 15, 192, 30, 112, 119, 176, 0, 0, 7, 252, 12, 254, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0 }; static constexpr uInt8 volumeLabelOdd[] = { @@ -525,6 +531,8 @@ static constexpr uInt8 volumeLabelOdd[] = { 30, 112, 99, 176, 0, 0, 14, 192, 13, 192, 14, 224, 62, 48, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; From fa4429d0a4335d118d8a199a0c6d36c84b9f84a4 Mon Sep 17 00:00:00 2001 From: lodefmode Date: Sun, 12 Sep 2021 15:19:07 -0400 Subject: [PATCH 8/9] Random pixels betwen OSD and bars (#824) * Support background color changes - pf/background used to change background color once per line resulting in higher visual quality. * - blank out left/right sides based on kernel modifications by Thomas Jentzch work in progress, stray pixel remaining * MovieCart: Fixed delayed right side kernel * MovieCart: Fixed random pixels between OSD + bars --- src/emucore/CartMVC.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index c049aaefa..14de73ffb 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -481,6 +481,8 @@ static constexpr uInt8 brightLabelEven[] = { 0, 49, 48, 12, 96, 6, 140, 231, 96, 0, 0, 225, 48, 12, 96, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0 }; static constexpr uInt8 brightLabelOdd[] = { @@ -495,6 +497,8 @@ static constexpr uInt8 brightLabelOdd[] = { 6, 156, 195, 96, 0, 0, 113, 48, 12, 96, 7, 142, 127, 96, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -511,6 +515,8 @@ static constexpr uInt8 volumeLabelEven[] = { 0, 12, 192, 15, 192, 30, 112, 119, 176, 0, 0, 7, 252, 12, 254, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0 }; static constexpr uInt8 volumeLabelOdd[] = { @@ -525,6 +531,8 @@ static constexpr uInt8 volumeLabelOdd[] = { 30, 112, 99, 176, 0, 0, 14, 192, 13, 192, 14, 224, 62, 48, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; From 716c14ecfc95b54031428566af179fcaf78f3962 Mon Sep 17 00:00:00 2001 From: Lo Def Date: Sun, 12 Sep 2021 15:55:47 -0400 Subject: [PATCH 9/9] Fixed background color shifting when consecutives frames encoded. --- src/emucore/CartMVC.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index 14de73ffb..88de9280c 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -82,7 +82,7 @@ class StreamReader : public Serializable myColorBK[0] = 0; } - void swapField(bool index, int frame) { + void swapField(bool index, bool odd) { uInt8* offset = index ? myBuffer1 : myBuffer2; myVersion = offset + VERSION_DATA_OFFSET; @@ -93,8 +93,7 @@ class StreamReader : public Serializable myColor = offset + COLOR_DATA_OFFSET; myColorBK = offset + COLORBK_DATA_OFFSET; -// myColorBK++; - if (!(frame & 1)) + if (!odd) myColorBK++; } @@ -885,7 +884,7 @@ bool MovieCart::init(const string& path) if(!myStream.open(path)) return false; - myStream.swapField(true, myFrameNumber); + myStream.swapField(true, myOdd); return true; } @@ -1368,7 +1367,7 @@ void MovieCart::runStateMachine() fill_addr_left_line(0); fill_addr_end_lines(); - myStream.swapField(myBufferIndex, myFrameNumber); + myStream.swapField(myBufferIndex, myOdd); myStream.blankPartialLines(myOdd); myBufferIndex = !myBufferIndex;