Skip to content

Commit

Permalink
Startup palette fix on cpc #1097
Browse files Browse the repository at this point in the history
  • Loading branch information
spotlessmind1975 committed Dec 15, 2024
1 parent 3c56750 commit f719f51
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
27 changes: 27 additions & 0 deletions ugbc/src/hw/cpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
6 changes: 0 additions & 6 deletions ugbc/src/hw/cpc/startup.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions ugbc/src/targets/cpc/_cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void target_finalization( Environment * _environment ) {
// outhead0("section code_user");

ay8910_finalization( _environment );
cpc_finalization( _environment );

if ( ! _environment->anyProtothread ) {
outhead0("PROTOTHREADINIT:" );
Expand Down

0 comments on commit f719f51

Please sign in to comment.