diff --git a/cpu.c b/cpu.c index b6ac9c6..0cb0754 100644 --- a/cpu.c +++ b/cpu.c @@ -696,10 +696,6 @@ void print_register_usage(void) pc_address_block = load_gamepak_page(pc_region & 0x3FF); \ } \ -u32 branch_targets = 0; -u32 high_frequency_branch_targets = 0; - -#define BRANCH_ACTIVITY_THRESHOLD 50 #define arm_update_pc() \ pc = reg[REG_PC] \ @@ -1532,13 +1528,6 @@ const u32 cpu_modes[32] = u32 instruction_count = 0; -u32 output_field = 0; -const u32 num_output_fields = 2; - -u32 last_instruction = 0; - -u32 in_interrupt = 0; - void set_cpu_mode(cpu_mode_type new_mode) { u32 i; diff --git a/cpu.h b/cpu.h index 468d397..cc36f26 100644 --- a/cpu.h +++ b/cpu.h @@ -103,7 +103,6 @@ typedef enum } translation_region_type; extern u32 instruction_count; -extern u32 last_instruction; void execute_arm(u32 cycles); void raise_interrupt(irq_type irq_raised); @@ -157,8 +156,6 @@ extern u32 iwram_stack_optimize; extern u32 translation_gate_targets; extern u32 translation_gate_target_pc[MAX_TRANSLATION_GATES]; -extern u32 in_interrupt; - extern u32 *rom_branch_hash[ROM_BRANCH_HASH_SIZE]; void flush_translation_cache_rom(void); diff --git a/cpu_threaded.c b/cpu_threaded.c index bc5ac26..87c39b5 100644 --- a/cpu_threaded.c +++ b/cpu_threaded.c @@ -2660,10 +2660,7 @@ u8 function_cc *block_lookup_address_##type(u32 pc) \ should never be hit) */ \ if(translation_recursion_level == 0) \ { \ - char buffer[256]; \ - sprintf(buffer, "bad jump %x (%x) (%x)\n", pc, reg[REG_PC], \ - last_instruction); \ - printf("%s", buffer); \ + printf("bad jump %x (%x)\n", pc, reg[REG_PC]); \ } \ block_address = (u8 *)(-1); \ break; \ diff --git a/gba_memory.c b/gba_memory.c index 7270dcd..b061ecb 100644 --- a/gba_memory.c +++ b/gba_memory.c @@ -82,7 +82,7 @@ write_ioreg(REG_SOUND3CNT_L, value); \ } \ -static u32 gbc_sound_wave_volume[4] = { 0, 16384, 8192, 4096 }; +static const u32 gbc_sound_wave_volume[4] = { 0, 16384, 8192, 4096 }; #define gbc_sound_tone_control_low_wave() \ { \ @@ -206,7 +206,7 @@ static void sound_control_x(u32 value) /* Main */ extern timer_type timer[4]; -static u32 prescale_table[] = { 0, 6, 8, 10 }; +static const u32 prescale_table[] = { 0, 6, 8, 10 }; #define count_timer(timer_number) \ timer[timer_number].reload = 0x10000 - value; \ @@ -273,7 +273,7 @@ static void trigger_timer(u32 timer_number, u32 value) // This table is configured for sequential access on system defaults -u32 waitstate_cycles_sequential[16][3] = +const u32 waitstate_cycles_sequential[16][3] = { { 1, 1, 1 }, // BIOS { 1, 1, 1 }, // Invalid @@ -293,7 +293,7 @@ u32 waitstate_cycles_sequential[16][3] = // Different settings for gamepak ws0-2 sequential (2nd) access -u32 gamepak_waitstate_sequential[2][3][3] = +const u32 gamepak_waitstate_sequential[2][3][3] = { { { 3, 3, 6 }, @@ -2328,7 +2328,7 @@ typedef enum DMA_REGION_NULL } dma_region_type; -dma_region_type dma_region_map[16] = +const dma_region_type dma_region_map[16] = { DMA_REGION_BIOS, // 0x00 - BIOS DMA_REGION_NULL, // 0x01 - Nothing diff --git a/gba_memory.h b/gba_memory.h index 9d87cc2..92199af 100644 --- a/gba_memory.h +++ b/gba_memory.h @@ -205,7 +205,7 @@ void function_cc write_backup(u32 address, u32 value); void function_cc write_rtc(u32 address, u32 value); /* EDIT: Shouldn't this be extern ?! */ -extern u32 waitstate_cycles_sequential[16][3]; +extern const u32 waitstate_cycles_sequential[16][3]; extern u32 gamepak_size; extern char gamepak_title[13]; diff --git a/main.c b/main.c index ce2bb0b..de56043 100644 --- a/main.c +++ b/main.c @@ -22,18 +22,14 @@ timer_type timer[4]; -u32 global_cycles_per_instruction = 1; +const u32 global_cycles_per_instruction = 1; u32 cpu_ticks = 0; u32 execute_cycles = 960; s32 video_count = 960; -u32 ticks; -u32 arm_frame = 0; -u32 thumb_frame = 0; u32 last_frame = 0; - u32 flush_ram_count = 0; u32 gbc_update_count = 0; u32 oam_update_count = 0; diff --git a/main.h b/main.h index 111b4d6..669bb9e 100644 --- a/main.h +++ b/main.h @@ -78,13 +78,11 @@ typedef enum extern u32 cpu_ticks; extern u32 execute_cycles; -extern u32 global_cycles_per_instruction; +extern const u32 global_cycles_per_instruction; extern u32 skip_next_frame; extern u32 flush_ram_count; -extern u64 base_timestamp; - extern char main_path[512]; extern char save_path[512]; diff --git a/sound.c b/sound.c index 7618a07..46cdc19 100644 --- a/sound.c +++ b/sound.c @@ -19,12 +19,11 @@ #include "common.h" -u32 global_enable_audio = 1; direct_sound_struct direct_sound_channel[2]; gbc_sound_struct gbc_sound_channel[4]; -u32 sound_frequency = GBA_SOUND_FREQUENCY; +const u32 sound_frequency = GBA_SOUND_FREQUENCY; u32 sound_on; static s16 sound_buffer[BUFFER_SIZE]; @@ -202,9 +201,9 @@ s8 wave_samples[64]; u32 noise_table15[1024]; u32 noise_table7[4]; -u32 gbc_sound_master_volume_table[4] = { 1, 2, 4, 0 }; +const u32 gbc_sound_master_volume_table[4] = { 1, 2, 4, 0 }; -u32 gbc_sound_channel_volume_table[8] = +const u32 gbc_sound_channel_volume_table[8] = { fixed_div(0, 7, 12), fixed_div(1, 7, 12), @@ -216,7 +215,7 @@ u32 gbc_sound_channel_volume_table[8] = fixed_div(7, 7, 12) }; -u32 gbc_sound_envelope_volume_table[16] = +const u32 gbc_sound_envelope_volume_table[16] = { fixed_div(0, 15, 14), fixed_div(1, 15, 14), diff --git a/sound.h b/sound.h index 08d1de5..f8b2ef2 100644 --- a/sound.h +++ b/sound.h @@ -104,12 +104,9 @@ extern u32 gbc_sound_master_volume; extern u32 gbc_sound_buffer_index; extern u32 gbc_sound_last_cpu_ticks; -extern u32 sound_frequency; +extern const u32 sound_frequency; extern u32 sound_on; -extern u32 global_enable_audio; -extern u32 enable_low_pass_filter; - void sound_timer_queue8(u32 channel, u8 value); void sound_timer_queue16(u32 channel, u16 value); void sound_timer_queue32(u32 channel, u32 value);