Skip to content

Commit 3098846

Browse files
authored
MIDI
1 parent 0646b50 commit 3098846

File tree

5 files changed

+2379
-151
lines changed

5 files changed

+2379
-151
lines changed

c64screen.cpp

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -488,18 +488,19 @@ int getMainMenuSelection( int key, char **FILE, int *addIdx, char *menuItemStr )
488488

489489
extern void deactivateCart();
490490

491-
#define MAX_SETTINGS 14
491+
#define MAX_SETTINGS 17
492+
#define MAX_SETTINGS_SAVED 64
492493
u32 curSettingsLine = 0;
493-
s32 rangeSettings[ MAX_SETTINGS ] = { 4, 10, 6, 2, 16, 15, 4, 4, 16, 15, 2, 16, 15, 2 };
494-
s32 settings[ MAX_SETTINGS ] = { 0, 0, 0, 0, 15, 0, 0, 0, 15, 14, 0, 15, 7, 0 };
494+
s32 rangeSettings[ MAX_SETTINGS ] = { 4, 10, 6, 2, 16, 15, 4, 4, 16, 15, 2, 16, 15, 2, 4, 16, 2 };
495+
s32 settings[ MAX_SETTINGS ] = { 0, 0, 0, 0, 15, 0, 0, 0, 15, 14, 0, 15, 7, 0, 7, 0 };
495496
u8 geoRAM_SlotNames[ 10 ][ 21 ];
496497

497498
void writeSettingsFile()
498499
{
499500
char cfg[ 16384 ];
500501
u32 cfgBytes = 0;
501502
memset( cfg, 0, 16384 );
502-
cfgBytes = sizeof( s32 ) * MAX_SETTINGS;
503+
cfgBytes = sizeof( s32 ) * MAX_SETTINGS_SAVED;
503504
memcpy( cfg, settings, cfgBytes );
504505
memcpy( &cfg[ cfgBytes ], geoRAM_SlotNames, sizeof( u8 ) * 10 * 21 );
505506
cfgBytes += sizeof( u8 ) * 10 * 21;
@@ -513,14 +514,14 @@ void readSettingsFile()
513514
u32 cfgBytes;
514515
memset( cfg, 0, 16384 );
515516

516-
memset( settings, 0, sizeof( s32 ) * MAX_SETTINGS );
517+
memset( settings, 0, sizeof( s32 ) * MAX_SETTINGS_SAVED );
517518
memset( geoRAM_SlotNames, 32, sizeof( u8 ) * 10 * 21 );
518519

519520
if ( !readFile( logger, DRIVE, SETTINGS_FILE, (u8*)cfg, &cfgBytes ) )
520521
writeSettingsFile();
521522

522-
memcpy( settings, cfg, sizeof( s32 ) * MAX_SETTINGS );
523-
memcpy( geoRAM_SlotNames, &cfg[ sizeof( s32 ) * MAX_SETTINGS ], sizeof( u8 ) * 10 * 21 );
523+
memcpy( settings, cfg, sizeof( s32 ) * MAX_SETTINGS_SAVED );
524+
memcpy( geoRAM_SlotNames, &cfg[ sizeof( s32 ) * MAX_SETTINGS_SAVED ], sizeof( u8 ) * 10 * 21 );
524525
}
525526

526527
u32 octaSIDMode = 0;
@@ -529,9 +530,9 @@ void applySIDSettings()
529530
{
530531
octaSIDMode = ( settings[ 2 ] > 2 ) ? 1 : 0;
531532
// how elegant...
532-
extern void setSIDConfiguration( u32 mode, u32 sid1, u32 sid2, u32 sid2addr, u32 rr, u32 addr, u32 exp, s32 v1, s32 p1, s32 v2, s32 p2, s32 v3, s32 p3, s32 outputPWMHDMI );
533+
extern void setSIDConfiguration( u32 mode, u32 sid1, u32 sid2, u32 sid2addr, u32 rr, u32 addr, u32 exp, s32 v1, s32 p1, s32 v2, s32 p2, s32 v3, s32 p3, s32 outputPWMHDMI, s32 midi, s32 soundfont, s32 midiVol );
533534
setSIDConfiguration( 0, settings[2], settings[6], settings[7]-1, settings[3], settings[7], settings[10],
534-
settings[4], settings[5], settings[8], settings[9], settings[11], settings[12], settings[ 13 ] );
535+
settings[4], settings[5], settings[8], settings[9], settings[11], settings[12], settings[ 16 ], settings[13], settings[14], settings[15] );
535536
}
536537

537538
int lastKeyDebug = 0;
@@ -1706,15 +1707,15 @@ void printSettingsScreen()
17061707
printC64( 4, 23, "F5", skinValues.SKIN_MENU_TEXT_FOOTER, 128, 0 );
17071708
printC64( 21, 23, "S", skinValues.SKIN_MENU_TEXT_FOOTER, 128, 0 );
17081709

1709-
u32 x = 1, x2 = 7,y1 = 1, y2 = 1;
1710-
u32 l = curSettingsLine;
1710+
s32 x = 1, x2 = 7,y1 = 1-1, y2 = 1-2;
1711+
s32 l = curSettingsLine;
17111712

17121713
extern u32 wireSIDAvailable;
17131714

17141715
if ( !wireSIDAvailable ) { y1 --; y2 --; }
17151716

17161717
// special menu
1717-
printC64( x+1, y1+3, "GeoRAM", skinValues.SKIN_MENU_TEXT_CATEGORY, 0 );
1718+
printC64( x+1, y1+3+1, "GeoRAM", skinValues.SKIN_MENU_TEXT_CATEGORY, 0 );
17181719

17191720
printC64( x+1, y1+5, "Memory", skinValues.SKIN_MENU_TEXT_ITEM, (l==0)?0x80:0 );
17201721

@@ -1730,16 +1731,21 @@ void printSettingsScreen()
17301731
printC64( x2+11, y1+7, (const char*)geoRAM_SlotNames[ settings[ 1 ] ], skinValues.SKIN_MENU_TEXT_ITEM, (typeInName==1)?0x80:0 );
17311732
if ( typeInName )
17321733
c64color[ x2+11+typeCurPos + (y1+7)*40 ] = skinValues.SKIN_MENU_TEXT_CATEGORY;
1733-
1734-
printC64( x+1, y2+9, "SID+FM (using reSID and fmopl)", skinValues.SKIN_MENU_TEXT_CATEGORY, 0 );
1734+
printC64( x+1, y2+10, "SID+FM (reSID/fmopl/TinySoundFont)", skinValues.SKIN_MENU_TEXT_CATEGORY, 0 );
17351735
if ( !wireSIDAvailable )
1736-
printC64( x+1, y2+10, "No SID-wire, only SFX will work!", skinValues.SKIN_ERROR_BAR, 0 );
1736+
printC64( x+1, y2+11, "No SID-wire, only SFX will work!", skinValues.SKIN_ERROR_BAR, 0 );
17371737

17381738
if ( !wireSIDAvailable ) { y2 ++; }
17391739

17401740
char sidStrS[ 6 ][ 21 ] = { "6581", "8580", "8580 w/ Digiboost", "8x 6581", "8x 8580", "8x 8580 w/ Digiboost" };
17411741
char sidStrO[ 3 ][ 8 ] = { "off", "on" };
17421742
char sidStrS2[ 4 ][ 20 ] = { "6581", "8580", "8580 w/ Digiboost", "none" };
1743+
// MIDI
1744+
// 0 = off
1745+
// 1 = Datel
1746+
// 2 = SEQUENTIAL CIRCUITS INC.
1747+
// 3 = PASSPORT & SENTECH
1748+
char sidStrM[ 3 ][ 24 ] = { "off", "Datel/Sequential" };
17431749
char sidStrA[ 4 ][ 8 ] = { "$D400", "$D420", "$D500", "$DE00" };
17441750
char sidStrOutput[ 3 ][ 9 ] = { "PWM", "HDMI", "PWM+HDMI" };
17451751

@@ -1787,8 +1793,24 @@ void printSettingsScreen()
17871793
sprintf( t, "%2d", settings[ 12 ] - 7 );
17881794
printC64( x2+15, y2+18, t, skinValues.SKIN_MENU_TEXT_ITEM, (l==12)?0x80:0 );
17891795

1790-
printC64( x+1, y2+20, "Output", skinValues.SKIN_MENU_TEXT_ITEM, (l==13)?0x80:0 );
1791-
printC64( x2+10, y2+20, sidStrOutput[ settings[13] ], skinValues.SKIN_MENU_TEXT_ITEM, (l==13)?0x80:0 );
1796+
// MIDI
1797+
// 0 = off
1798+
// 1 = Datel
1799+
// 2 = PASSPORT & SENTECH
1800+
// 3 = SEQUENTIAL CIRCUITS INC.
1801+
1802+
printC64( x+1, y2+19, "MIDI", skinValues.SKIN_MENU_TEXT_KEY, (l==13)?0x80:0 );
1803+
printC64( x2+10, y2+19, sidStrM[ settings[13] ], skinValues.SKIN_MENU_TEXT_KEY, (l==13)?0x80:0 );
1804+
printC64( x+1, y2+20, "Sound Font", skinValues.SKIN_MENU_TEXT_KEY, (l==14)?0x80:0 );
1805+
sprintf( t, "instrument%02d.sf2", settings[ 14 ] );
1806+
printC64( x2+10, y2+20, t, skinValues.SKIN_MENU_TEXT_KEY, (l==14)?0x80:0 );
1807+
printC64( x+1, y2+21, "Volume", skinValues.SKIN_MENU_TEXT_KEY, (l==15)?0x80:0 );
1808+
sprintf( t, "%2d", settings[ 15 ] );
1809+
printC64( x2+10, y2+21, t, skinValues.SKIN_MENU_TEXT_KEY, (l==15)?0x80:0 );
1810+
1811+
1812+
printC64( x+1, y2+22, "Output", skinValues.SKIN_MENU_TEXT_ITEM, (l==16)?0x80:0 );
1813+
printC64( x2+10, y2+22, sidStrOutput[ settings[16] ], skinValues.SKIN_MENU_TEXT_ITEM, (l==16)?0x80:0 );
17921814

17931815
} else
17941816
{

kernel_menu.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,14 @@ __attribute__( ( always_inline ) ) inline void warmCache( void *fiqh )
226226
{
227227
CACHE_PRELOAD_DATA_CACHE( c64screen, 1024, CACHE_PRELOADL2STRM );
228228
CACHE_PRELOAD_DATA_CACHE( c64color, 1024, CACHE_PRELOADL2STRM );
229-
CACHE_PRELOAD_DATA_CACHE( cartCBM80, 512, CACHE_PRELOADL1KEEP );
230-
CACHE_PRELOAD_DATA_CACHE( prgData, 65536, CACHE_PRELOADL2STRM );
229+
CACHE_PRELOAD_DATA_CACHE( cartCBM80, 512, CACHE_PRELOADL2KEEP );
230+
CACHE_PRELOAD_DATA_CACHE( prgData, prgSize, CACHE_PRELOADL2STRM );
231231
CACHE_PRELOAD_DATA_CACHE( injectCode, 256, CACHE_PRELOADL2KEEP );
232232

233233
CACHE_PRELOAD_INSTRUCTION_CACHE( (void*)fiqh, 2048*2 );
234234

235+
FORCE_READ_LINEARa( prgData, prgSize, prgSize * 16 )
235236
FORCE_READ_LINEAR32a( cartCBM80, 512, 512 * 16 );
236-
237-
FORCE_READ_LINEARa( prgData, prgSize, 65536 * 4 )
238237
if ( fiqh )
239238
{
240239
FORCE_READ_LINEARa( (void*)fiqh, 1024*3, 65536 );
@@ -491,9 +490,9 @@ void CKernelMenu::Run( void )
491490

492491
pFIQ = (void*)this->FIQHandler;
493492
warmCache( pFIQ );
494-
DELAY(1<<18);
493+
//DELAY(1<<18);
495494
warmCache( pFIQ );
496-
DELAY(1<<18);
495+
DELAY(1<<20);
497496

498497
// start c64
499498
SET_GPIO( bNMI | bDMA );
@@ -507,7 +506,7 @@ void CKernelMenu::Run( void )
507506
{
508507
first = 0;
509508
latchSetClearImm( LATCH_LED0, LATCH_RESET );
510-
DELAY(1<<27);
509+
DELAY(1<<20);
511510
latchSetClearImm( LATCH_RESET | LATCH_LED0, 0 );
512511
}
513512

@@ -560,7 +559,6 @@ void CKernelMenu::Run( void )
560559
//temperature = m_CPUThrottle.GetTemperature();
561560
renderC64();
562561
warmCache( pFIQ );
563-
// DELAY(1<<28);
564562
doneWithHandling = 1;
565563
updateMenu = 0;
566564
}
@@ -821,7 +819,7 @@ int main( void )
821819
SET_GPIO( bNMI | bDMA );
822820

823821
BEGIN_CYCLE_COUNTER
824-
WAIT_UP_TO_CYCLE( 5000*1000 )
822+
//WAIT_UP_TO_CYCLE( 5000*1000 )
825823

826824

827825
char geoRAMFile[ 2048 ];
@@ -835,6 +833,10 @@ int main( void )
835833
u32 loadC128PRG = 0;
836834
u32 playingPSID = 0;
837835

836+
CleanDataCache();
837+
InvalidateDataCache();
838+
InvalidateInstructionCache();
839+
838840
/* for debugging purposes only*/
839841
if ( launchKernel == 255 )
840842
{

0 commit comments

Comments
 (0)