diff --git a/ugbc/src/hw/cpc.c b/ugbc/src/hw/cpc.c
index af58d3cdf..d049e7396 100755
--- a/ugbc/src/hw/cpc.c
+++ b/ugbc/src/hw/cpc.c
@@ -1201,6 +1201,33 @@ void cpc_initialization( Environment * _environment ) {
 
 void cpc_finalization( Environment * _environment ) {
 
+    if ( ! _environment->vestigialConfig.rchack_pick_the_star_1163 ) {
+        outhead0("PALETTE:");
+        int defaultPalette[] = { 
+                4,  10,  19,  12,
+                11,  20,  21,  13,
+                6,  30,  31,   7,
+                18, 25,  10,   7
+        };
+
+        if ( ! commonPalette ) {
+            out0("DB ");
+            for( int i=0; i<15; ++i ) {
+                out1("%d,", defaultPalette[i] );
+            }
+            outline1("%d", defaultPalette[15] );
+        } else {
+            out0("DB ");
+            for( int i=0; i<lastUsedSlotInCommonPalette; ++i ) {
+                out1("%d,", commonPalette[i].hardwareIndex );
+            }
+            for( int i=lastUsedSlotInCommonPalette; i<16; ++i ) {
+                out1("%d,", defaultPalette[i] );
+            }
+            outline0("0");
+        }
+    }
+
     if ( _environment->vestigialConfig.clsImplicit ) {
         deploy( clsGraphic, src_hw_cpc_cls_graphic_asm );
     }
diff --git a/ugbc/src/hw/cpc/startup.asm b/ugbc/src/hw/cpc/startup.asm
index 3cfd09026..09d087594 100755
--- a/ugbc/src/hw/cpc/startup.asm
+++ b/ugbc/src/hw/cpc/startup.asm
@@ -45,12 +45,6 @@ PALETTE:
 
 @ELSE
 
-PALETTE:    
-    DB      4,  10,  19,  12 
-    DB     11,  20,  21,  13
-    DB      6,  30,  31,   7 
-    DB      18, 25,  10,   7
-
 @ENDIF
 
 PALETTEUNUSED:
diff --git a/ugbc/src/targets/cpc/_cleanup.c b/ugbc/src/targets/cpc/_cleanup.c
index 503f67d93..ce7f46c5e 100755
--- a/ugbc/src/targets/cpc/_cleanup.c
+++ b/ugbc/src/targets/cpc/_cleanup.c
@@ -49,6 +49,7 @@ void target_finalization( Environment * _environment ) {
     // outhead0("section code_user");
 
     ay8910_finalization( _environment );
+    cpc_finalization( _environment );
 
     if ( ! _environment->anyProtothread ) {
         outhead0("PROTOTHREADINIT:" );