summaryrefslogtreecommitdiff
path: root/apps/codecs/libgme/nsf_emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libgme/nsf_emu.c')
-rw-r--r--apps/codecs/libgme/nsf_emu.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/apps/codecs/libgme/nsf_emu.c b/apps/codecs/libgme/nsf_emu.c
index ec32ef3595..1b8d98e51a 100644
--- a/apps/codecs/libgme/nsf_emu.c
+++ b/apps/codecs/libgme/nsf_emu.c
@@ -31,7 +31,7 @@ int const fade_shift = 8; // fade ends with gain at 1.0 / (1 << fade_shift)
31int const initial_play_delay = 7; // KikiKaikai needed this to work 31int const initial_play_delay = 7; // KikiKaikai needed this to work
32int const rom_addr = 0x8000; 32int const rom_addr = 0x8000;
33 33
34void clear_track_vars( struct Nsf_Emu* this ) 34static void clear_track_vars( struct Nsf_Emu* this )
35{ 35{
36 this->current_track = -1; 36 this->current_track = -1;
37 this->out_time = 0; 37 this->out_time = 0;
@@ -82,7 +82,7 @@ void Nsf_init( struct Nsf_Emu* this )
82 82
83// Setup 83// Setup
84 84
85blargg_err_t init_sound( struct Nsf_Emu* this ) 85static blargg_err_t init_sound( struct Nsf_Emu* this )
86{ 86{
87 /* if ( header_.chip_flags & ~(fds_flag | namco_flag | vrc6_flag | fme7_flag) ) 87 /* if ( header_.chip_flags & ~(fds_flag | namco_flag | vrc6_flag | fme7_flag) )
88 warning( "Uses unsupported audio expansion hardware" ); **/ 88 warning( "Uses unsupported audio expansion hardware" ); **/
@@ -168,7 +168,7 @@ blargg_err_t init_sound( struct Nsf_Emu* this )
168} 168}
169 169
170// Header stuff 170// Header stuff
171bool valid_tag( struct header_t* this ) 171static bool valid_tag( struct header_t* this )
172{ 172{
173 return 0 == memcmp( this->tag, "NESM\x1A", 5 ); 173 return 0 == memcmp( this->tag, "NESM\x1A", 5 );
174} 174}
@@ -184,7 +184,7 @@ static double clock_rate( struct header_t* this )
184 return pal_only( this ) ? 1662607.125 : 1789772.727272727; 184 return pal_only( this ) ? 1662607.125 : 1789772.727272727;
185} 185}
186 186
187int play_period( struct header_t* this ) 187static int play_period( struct header_t* this )
188{ 188{
189 // NTSC 189 // NTSC
190 int clocks = 29780; 190 int clocks = 29780;
@@ -370,7 +370,7 @@ void map_memory( struct Nsf_Emu* this )
370 Cpu_map_code( &this->cpu, rom_addr, fdsram_size, fdsram( this ), 0 ); 370 Cpu_map_code( &this->cpu, rom_addr, fdsram_size, fdsram( this ), 0 );
371} 371}
372 372
373void set_voice( struct Nsf_Emu* this, int i, struct Blip_Buffer* buf, struct Blip_Buffer* left, struct Blip_Buffer* right) 373static void set_voice( struct Nsf_Emu* this, int i, struct Blip_Buffer* buf, struct Blip_Buffer* left, struct Blip_Buffer* right)
374{ 374{
375#if defined(ROCKBOX) 375#if defined(ROCKBOX)
376 (void) left; 376 (void) left;
@@ -500,7 +500,7 @@ inline void push_byte( struct Nsf_Emu* this, int b )
500 500
501// Jumps to routine, given pointer to address in file header. Pushes idle_addr 501// Jumps to routine, given pointer to address in file header. Pushes idle_addr
502// as return address, NOT old PC. 502// as return address, NOT old PC.
503void jsr_then_stop( struct Nsf_Emu* this, byte const addr [] ) 503static void jsr_then_stop( struct Nsf_Emu* this, byte const addr [] )
504{ 504{
505 this->cpu.r.pc = get_addr( addr ); 505 this->cpu.r.pc = get_addr( addr );
506 push_byte( this, (idle_addr - 1) >> 8 ); 506 push_byte( this, (idle_addr - 1) >> 8 );
@@ -533,7 +533,8 @@ int cpu_read( struct Nsf_Emu* this, addr_t addr )
533 return addr >> 8; 533 return addr >> 8;
534} 534}
535 535
536int unmapped_read( struct Nsf_Emu* this, addr_t addr ) 536#if 0 /* function currently unused */
537static int unmapped_read( struct Nsf_Emu* this, addr_t addr )
537{ 538{
538 (void) this; 539 (void) this;
539 540
@@ -548,6 +549,7 @@ int unmapped_read( struct Nsf_Emu* this, addr_t addr )
548 // Unmapped read 549 // Unmapped read
549 return addr >> 8; 550 return addr >> 8;
550} 551}
552#endif
551 553
552void cpu_write( struct Nsf_Emu* this, addr_t addr, int data ) 554void cpu_write( struct Nsf_Emu* this, addr_t addr, int data )
553{ 555{
@@ -643,7 +645,8 @@ void cpu_write( struct Nsf_Emu* this, addr_t addr, int data )
643 // Unmapped_write 645 // Unmapped_write
644} 646}
645 647
646void unmapped_write( struct Nsf_Emu* this, addr_t addr, int data ) 648#if 0 /* function currently unused */
649static void unmapped_write( struct Nsf_Emu* this, addr_t addr, int data )
647{ 650{
648 (void) data; 651 (void) data;
649 652
@@ -662,6 +665,7 @@ void unmapped_write( struct Nsf_Emu* this, addr_t addr, int data )
662 // FDS memory 665 // FDS memory
663 if ( fds_enabled( this ) && (unsigned) (addr - 0x8000) < 0x6000 ) return; 666 if ( fds_enabled( this ) && (unsigned) (addr - 0x8000) < 0x6000 ) return;
664} 667}
668#endif
665 669
666void fill_buf( struct Nsf_Emu* this ); 670void fill_buf( struct Nsf_Emu* this );
667blargg_err_t Nsf_start_track( struct Nsf_Emu* this, int track ) 671blargg_err_t Nsf_start_track( struct Nsf_Emu* this, int track )
@@ -807,7 +811,7 @@ void run_until( struct Nsf_Emu* this, nes_time_t end )
807 run_once( this, end ); 811 run_once( this, end );
808} 812}
809 813
810void end_frame( struct Nsf_Emu* this, nes_time_t end ) 814static void end_frame( struct Nsf_Emu* this, nes_time_t end )
811{ 815{
812 if ( Cpu_time( &this->cpu ) < end ) 816 if ( Cpu_time( &this->cpu ) < end )
813 run_until( this, end ); 817 run_until( this, end );
@@ -833,7 +837,7 @@ void end_frame( struct Nsf_Emu* this, nes_time_t end )
833 837
834// Tell/Seek 838// Tell/Seek
835 839
836blargg_long msec_to_samples( long sample_rate, blargg_long msec ) 840static blargg_long msec_to_samples( long sample_rate, blargg_long msec )
837{ 841{
838 blargg_long sec = msec / 1000; 842 blargg_long sec = msec / 1000;
839 msec -= sec * 1000; 843 msec -= sec * 1000;
@@ -932,7 +936,7 @@ static int int_log( blargg_long x, int step, int unit )
932 return ((unit - fraction) + (fraction >> 1)) >> shift; 936 return ((unit - fraction) + (fraction >> 1)) >> shift;
933} 937}
934 938
935void handle_fade( struct Nsf_Emu* this, long out_count, sample_t* out ) 939static void handle_fade( struct Nsf_Emu* this, long out_count, sample_t* out )
936{ 940{
937 int i; 941 int i;
938 for ( i = 0; i < out_count; i += fade_block_size ) 942 for ( i = 0; i < out_count; i += fade_block_size )