• R/O
  • SSH
  • HTTPS

gpsp-kai: Commit


Commit MetaInfo

Revision418 (tree)
Time2009-05-27 13:56:21
Authortakka

Log Message

(empty log message)

Change Summary

Incremental Difference

--- trunk/gpsp-kai-test/src/zip.c (revision 417)
+++ trunk/gpsp-kai-test/src/zip.c (revision 418)
@@ -61,21 +61,21 @@
6161 u32 write_tmp_flag = NO;
6262
6363 if(psp_model == PSP_2000)
64+ {
65+ zip_buffer_size = 16 * 1024 * 1024;
66+ cbuffer = malloc(zip_buffer_size);
67+
68+ while(cbuffer == NULL)
6469 {
65- zip_buffer_size = 16 * 1024 * 1024;
70+ zip_buffer_size -= (1 * 1024 * 1024);
6671 cbuffer = malloc(zip_buffer_size);
67-
68- while(cbuffer == NULL)
69- {
70- zip_buffer_size -= (1 * 1024 * 1024);
71- cbuffer = malloc(zip_buffer_size);
72- }
7372 }
73+ }
7474 else
75- {
76- zip_buffer_size = ZIP_BUFFER_SIZE;
77- cbuffer = (u8 *)UNIVERSAL_VRAM_ADDR; // 汎用フレームバッファを使用
78- }
75+ {
76+ zip_buffer_size = ZIP_BUFFER_SIZE;
77+ cbuffer = (u8 *)UNIVERSAL_VRAM_ADDR; // 汎用フレームバッファを使用
78+ }
7979
8080 chdir(rom_path);
8181 FILE_OPEN(fd, filename, READ);
--- trunk/gpsp-kai-test/src/mips_emit.h (revision 417)
+++ trunk/gpsp-kai-test/src/mips_emit.h (revision 418)
@@ -448,7 +448,7 @@
448448 } \
449449 else \
450450 { \
451- if(((u32)imm >> 16) == 0x0000) \
451+ if((u32)(imm >> 16) == 0x0000) \
452452 { \
453453 mips_emit_ori(ireg, reg_zero, imm); \
454454 } \
@@ -456,7 +456,7 @@
456456 { \
457457 mips_emit_lui(ireg, imm >> 16); \
458458 \
459- if(((u32)imm & 0x0000FFFF) != 0x00000000) \
459+ if((u32)(imm & 0x0000FFFF) != 0x00000000) \
460460 { \
461461 mips_emit_ori(ireg, ireg, imm & 0xFFFF); \
462462 } \
@@ -2405,7 +2405,7 @@
24052405 generate_indirect_branch_dual() \
24062406
24072407 #define arm_swi() \
2408- if (((opcode >> 16) &0xFF) >= 0x2B) break; \
2408+ if (((opcode >> 16) & 0xFF) >= 0x2B) break; \
24092409 generate_swi_hle_handler((opcode >> 16) & 0xFF); \
24102410 generate_load_pc(reg_a0, (pc + 4)); \
24112411 generate_function_call_swap_delay(execute_swi); \
@@ -2507,7 +2507,7 @@
25072507 { \
25082508 generate_function_call(bios_halt); \
25092509 } \
2510- \
2510+ \
25112511 /* Div */ \
25122512 if(swi_number == 0x06) \
25132513 { \
--- trunk/gpsp-kai-test/src/bios.c (revision 417)
+++ trunk/gpsp-kai-test/src/bios.c (revision 418)
@@ -111,7 +111,7 @@
111111 load_reg();
112112 return;
113113 }
114-
114+
115115 u32 b_count = b_cnt & 0x1FFFFF;
116116
117117 // 32-bit ?
@@ -172,7 +172,7 @@
172172 // needed for 32-bit mode!
173173 b_source &= 0x0FFFFFFC;
174174 b_dest &= 0x0FFFFFFC;
175-
175+
176176 u32 b_count = b_cnt & 0x1FFFFF;
177177 u32 b_i;
178178
@@ -229,7 +229,7 @@
229229 s16 b_dmx = (b_rx * b_b)>>14;
230230 s16 b_dy = (b_ry * b_b)>>14;
231231 s16 b_dmy = (b_ry * b_a)>>14;
232-
232+
233233 write_memory16(b_dest, b_dx);
234234 b_dest += 2;
235235 write_memory16(b_dest, -b_dmx);
@@ -241,7 +241,7 @@
241241
242242 s32 b_startx = b_cx - b_dx * b_dispx + b_dmx * b_dispy;
243243 s32 b_starty = b_cy - b_dy * b_dispx - b_dmy * b_dispy;
244-
244+
245245 write_memory32(b_dest, b_startx);
246246 b_dest += 4;
247247 write_memory32(b_dest, b_starty);
@@ -248,7 +248,7 @@
248248 b_dest += 4;
249249 }
250250 load_reg();
251-}
251+}
252252
253253 void bios_objaffineset(u32 b_src, u32 b_dest, u32 b_num, u32 b_offset)
254254 {
@@ -265,11 +265,11 @@
265265 s32 b_a = (s32)b_sinetable[(b_theta+0x40)&255];
266266 s32 b_b = (s32)b_sinetable[b_theta];
267267
268- s16 b_dx = ((s32)b_rx * b_a)>>14;
269- s16 b_dmx = ((s32)b_rx * b_b)>>14;
270- s16 b_dy = ((s32)b_ry * b_b)>>14;
271- s16 b_dmy = ((s32)b_ry * b_a)>>14;
272-
268+ s16 b_dx = (s32)((b_rx * b_a)>>14);
269+ s16 b_dmx = (s32)((b_rx * b_b)>>14);
270+ s16 b_dy = (s32)((b_ry * b_b)>>14);
271+ s16 b_dmy = (s32)((b_ry * b_a)>>14);
272+
273273 write_memory16(b_dest, b_dx);
274274 b_dest += b_offset;
275275 write_memory16(b_dest, -b_dmx);
--- trunk/gpsp-kai-test/src/input.c (revision 417)
+++ trunk/gpsp-kai-test/src/input.c (revision 418)
@@ -346,7 +346,7 @@
346346
347347 case BUTTON_ID_FASTFORWARD:
348348 // PRINT_STRING_BG("FASTFORWARD", 0xFFFF, 0x0000, 0, 50);
349- synchronize_flag ^= 1;
349+ g_synchronize_flag ^= 1;
350350 break;
351351 // return 0;
352352
--- trunk/gpsp-kai-test/src/video.c (revision 417)
+++ trunk/gpsp-kai-test/src/video.c (revision 418)
@@ -1976,7 +1976,7 @@
19761976 obj_attribute_2 = oam_ptr[2]; \
19771977 obj_size = ((obj_attribute_0 >> 12) & 0x0C) | (obj_attribute_1 >> 14); \
19781978 \
1979- obj_x = (s32)(obj_attribute_1 << 23) >> 23; \
1979+ obj_x = ((s32)(obj_attribute_1 << 23) >> 23); \
19801980 obj_width = (s32)obj_width_table[obj_size]; \
19811981 \
19821982 render_scanline_obj_prologue_##combine_op(alpha_op); \
@@ -2054,7 +2054,7 @@
20542054
20552055 if(((obj_y + obj_height) > 0) && (obj_y < 160))
20562056 {
2057- obj_x = (s32)(obj_attribute_1 << 23) >> 23;
2057+ obj_x = ((s32)(obj_attribute_1 << 23) >> 23);
20582058
20592059 if(((obj_x + obj_width) > 0) && (obj_x < 240))
20602060 {
--- trunk/gpsp-kai-test/src/memory.c (revision 417)
+++ trunk/gpsp-kai-test/src/memory.c (revision 418)
@@ -805,7 +805,7 @@
805805 case 0x28:
806806 access_register8_low(0x28);
807807 access_register16_low(0x28);
808- affine_reference_x[0] = (s32)(value << 4) >> 4;
808+ affine_reference_x[0] = ((s32)(value << 4) >> 4);
809809 ADDRESS32(io_registers, 0x28) = value;
810810 break;
811811
@@ -812,7 +812,7 @@
812812 case 0x29:
813813 access_register8_high(0x28);
814814 access_register16_low(0x28);
815- affine_reference_x[0] = (s32)(value << 4) >> 4;
815+ affine_reference_x[0] = ((s32)(value << 4) >> 4);
816816 ADDRESS32(io_registers, 0x28) = value;
817817 break;
818818
@@ -819,7 +819,7 @@
819819 case 0x2A:
820820 access_register8_low(0x2A);
821821 access_register16_high(0x28);
822- affine_reference_x[0] = (s32)(value << 4) >> 4;
822+ affine_reference_x[0] = ((s32)(value << 4) >> 4);
823823 ADDRESS32(io_registers, 0x28) = value;
824824 break;
825825
@@ -826,7 +826,7 @@
826826 case 0x2B:
827827 access_register8_high(0x2A);
828828 access_register16_high(0x28);
829- affine_reference_x[0] = (s32)(value << 4) >> 4;
829+ affine_reference_x[0] = ((s32)(value << 4) >> 4);
830830 ADDRESS32(io_registers, 0x28) = value;
831831 break;
832832
@@ -834,7 +834,7 @@
834834 case 0x2C:
835835 access_register8_low(0x2C);
836836 access_register16_low(0x2C);
837- affine_reference_y[0] = (s32)(value << 4) >> 4;
837+ affine_reference_y[0] = ((s32)(value << 4) >> 4);
838838 ADDRESS32(io_registers, 0x2C) = value;
839839 break;
840840
@@ -841,7 +841,7 @@
841841 case 0x2D:
842842 access_register8_high(0x2C);
843843 access_register16_low(0x2C);
844- affine_reference_y[0] = (s32)(value << 4) >> 4;
844+ affine_reference_y[0] = ((s32)(value << 4) >> 4);
845845 ADDRESS32(io_registers, 0x2C) = value;
846846 break;
847847
@@ -848,7 +848,7 @@
848848 case 0x2E:
849849 access_register8_low(0x2E);
850850 access_register16_high(0x2C);
851- affine_reference_y[0] = (s32)(value << 4) >> 4;
851+ affine_reference_y[0] = ((s32)(value << 4) >> 4);
852852 ADDRESS32(io_registers, 0x2C) = value;
853853 break;
854854
@@ -855,7 +855,7 @@
855855 case 0x2F:
856856 access_register8_high(0x2E);
857857 access_register16_high(0x2C);
858- affine_reference_y[0] = (s32)(value << 4) >> 4;
858+ affine_reference_y[0] = ((s32)(value << 4) >> 4);
859859 ADDRESS32(io_registers, 0x2C) = value;
860860 break;
861861
@@ -863,7 +863,7 @@
863863 case 0x38:
864864 access_register8_low(0x38);
865865 access_register16_low(0x38);
866- affine_reference_x[1] = (s32)(value << 4) >> 4;
866+ affine_reference_x[1] = ((s32)(value << 4) >> 4);
867867 ADDRESS32(io_registers, 0x38) = value;
868868 break;
869869
@@ -870,7 +870,7 @@
870870 case 0x39:
871871 access_register8_high(0x38);
872872 access_register16_low(0x38);
873- affine_reference_x[1] = (s32)(value << 4) >> 4;
873+ affine_reference_x[1] = ((s32)(value << 4) >> 4);
874874 ADDRESS32(io_registers, 0x38) = value;
875875 break;
876876
@@ -877,7 +877,7 @@
877877 case 0x3A:
878878 access_register8_low(0x3A);
879879 access_register16_high(0x38);
880- affine_reference_x[1] = (s32)(value << 4) >> 4;
880+ affine_reference_x[1] = ((s32)(value << 4) >> 4);
881881 ADDRESS32(io_registers, 0x38) = value;
882882 break;
883883
@@ -884,7 +884,7 @@
884884 case 0x3B:
885885 access_register8_high(0x3A);
886886 access_register16_high(0x38);
887- affine_reference_x[1] = (s32)(value << 4) >> 4;
887+ affine_reference_x[1] = ((s32)(value << 4) >> 4);
888888 ADDRESS32(io_registers, 0x38) = value;
889889 break;
890890
@@ -892,7 +892,7 @@
892892 case 0x3C:
893893 access_register8_low(0x3C);
894894 access_register16_low(0x3C);
895- affine_reference_y[1] = (s32)(value << 4) >> 4;
895+ affine_reference_y[1] = ((s32)(value << 4) >> 4);
896896 ADDRESS32(io_registers, 0x3C) = value;
897897 break;
898898
@@ -899,7 +899,7 @@
899899 case 0x3D:
900900 access_register8_high(0x3C);
901901 access_register16_low(0x3C);
902- affine_reference_y[1] = (s32)(value << 4) >> 4;
902+ affine_reference_y[1] = ((s32)(value << 4) >> 4);
903903 ADDRESS32(io_registers, 0x3C) = value;
904904 break;
905905
@@ -906,7 +906,7 @@
906906 case 0x3E:
907907 access_register8_low(0x3E);
908908 access_register16_high(0x3C);
909- affine_reference_y[1] = (s32)(value << 4) >> 4;
909+ affine_reference_y[1] = ((s32)(value << 4) >> 4);
910910 ADDRESS32(io_registers, 0x3C) = value;
911911 break;
912912
@@ -913,7 +913,7 @@
913913 case 0x3F:
914914 access_register8_high(0x3E);
915915 access_register16_high(0x3C);
916- affine_reference_y[1] = (s32)(value << 4) >> 4;
916+ affine_reference_y[1] = ((s32)(value << 4) >> 4);
917917 ADDRESS32(io_registers, 0x3C) = value;
918918 break;
919919
@@ -1573,25 +1573,25 @@
15731573 {
15741574 // BG2 reference X
15751575 case 0x28:
1576- affine_reference_x[0] = (s32)(value << 4) >> 4;
1576+ affine_reference_x[0] = ((s32)(value << 4) >> 4);
15771577 ADDRESS32(io_registers, 0x28) = value;
15781578 break;
15791579
15801580 // BG2 reference Y
15811581 case 0x2C:
1582- affine_reference_y[0] = (s32)(value << 4) >> 4;
1582+ affine_reference_y[0] = ((s32)(value << 4) >> 4);
15831583 ADDRESS32(io_registers, 0x2C) = value;
15841584 break;
15851585
15861586 // BG3 reference X
15871587 case 0x38:
1588- affine_reference_x[1] = (s32)(value << 4) >> 4;
1588+ affine_reference_x[1] = ((s32)(value << 4) >> 4);
15891589 ADDRESS32(io_registers, 0x38) = value;
15901590 break;
15911591
15921592 // BG3 reference Y
15931593 case 0x3C:
1594- affine_reference_y[1] = (s32)(value << 4) >> 4;
1594+ affine_reference_y[1] = ((s32)(value << 4) >> 4);
15951595 ADDRESS32(io_registers, 0x3C) = value;
15961596 break;
15971597
@@ -1875,6 +1875,7 @@
18751875 // Bit 1: IO, input/output command data
18761876 // Bit 2: CS, select input/output? If high make I/O write only
18771877 case 0xC4:
1878+#if 0
18781879 if((value & 0x04) == 0)
18791880 {
18801881 value &= 0x07;
@@ -1907,7 +1908,7 @@
19071908 }
19081909 }
19091910 DBGOUT("OUT : %X\n\n", rtc_registers[0]);
1910-#if 0
1911+#else
19111912 if(rtc_state == RTC_DISABLED)
19121913 rtc_state = RTC_IDLE;
19131914 if(!(rtc_registers[0] & 0x04))
@@ -2133,9 +2134,9 @@
21332134 \
21342135 case 0x06: \
21352136 /* VRAM */ \
2136- /*address &= 0x1FFFF; \
2137- if(address >= 0x18000) \
2138- address -= 0x8000;*/ \
2137+ /*address &= 0x1FFFF;*/ \
2138+ /*if(address >= 0x18000)*/ \
2139+ /* address -= 0x8000;*/ \
21392140 \
21402141 write_vram##type(); \
21412142 break; \
@@ -2147,7 +2148,7 @@
21472148 \
21482149 case 0x08: \
21492150 /* gamepak ROM or RTC */ \
2150- write_cart_io##type(); \
2151+ write_cart_io##type(); \
21512152 break; \
21522153 \
21532154 case 0x09 ... 0x0C: \
--- trunk/gpsp-kai-test/src/main.c (revision 417)
+++ trunk/gpsp-kai-test/src/main.c (revision 418)
@@ -39,7 +39,7 @@
3939 * グローバル変数の定義
4040 ******************************************************************************/
4141
42-u32 global_cycles_per_instruction = 1;
42+//u32 global_cycles_per_instruction = 1;
4343 //u64 frame_count_initial_timestamp = 0;
4444 //u64 last_frame_interval_timestamp;
4545 u32 psp_fps_debug = 0;
@@ -49,7 +49,7 @@
4949 u32 cpu_ticks = 0;
5050 u32 frame_ticks = 0;
5151
52-u32 execute_cycles = 960;
52+u32 g_execute_cycles = 960;
5353 s32 video_count = 960;
5454 //u32 ticks;
5555
@@ -57,7 +57,7 @@
5757 //u32 thumb_frame = 0;
5858 u32 last_frame = 0;
5959
60-u32 synchronize_flag = 1;
60+u32 g_synchronize_flag = 1;
6161
6262 char main_path[MAX_PATH];
6363 char rom_path[MAX_PATH];
@@ -103,8 +103,8 @@
103103
104104 // エミュレーション サイクルの決定
105105 #define CHECK_COUNT(count_var) \
106- if((count_var) < execute_cycles) \
107- execute_cycles = count_var; \
106+ if((count_var) < g_execute_cycles) \
107+ g_execute_cycles = count_var; \
108108
109109 #define CHECK_TIMER(timer_number) \
110110 if(timer[timer_number].status == TIMER_PRESCALE) \
@@ -120,7 +120,7 @@
120120 { \
121121 /* タイマーがプリスケールモードだった場合 */ \
122122 /* タイマー変更 */ \
123- timer[timer_number].count -= execute_cycles; \
123+ timer[timer_number].count -= g_execute_cycles; \
124124 /* レジスタに書込 */ \
125125 io_registers[REG_TM##timer_number##D] = \
126126 0x10000 - (timer[timer_number].count >> timer[timer_number].prescale); \
@@ -202,7 +202,7 @@
202202 cpu_ticks = 0;
203203 frame_ticks = 0;
204204
205- execute_cycles = 960;
205+ g_execute_cycles = 960;
206206 video_count = 960;
207207
208208 bios_mode = USE_BIOS;
@@ -323,6 +323,12 @@
323323 getcwd(main_path, MAX_FILE);
324324 chdir(main_path);
325325
326+#ifdef USE_DEBUG
327+ // デバッグ出力ファイルのオープン
328+ g_dbg_file = fopen(DBG_FILE_NAME, "awb");
329+ DBGOUT("\nStart gpSP\n");
330+#endif
331+
326332 // 設定ファイルの読込み
327333 load_config_file();
328334
@@ -349,13 +355,7 @@
349355 sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0, vblank_interrupt_handler, NULL);
350356 sceKernelEnableSubIntr(PSP_VBLANK_INT, 0);
351357
352-#ifdef USE_DEBUG
353- // デバッグ出力ファイルのオープン
354- g_dbg_file = fopen(DBG_FILE_NAME, "awb");
355- DBGOUT("\nStart gpSP\n");
356-#endif
357-
358-#ifdef USE_ADHOC
358+ #ifdef USE_ADHOC
359359 // adhoc用モジュールのロード
360360 if (load_adhoc_modules() != 0)
361361 error_msg("not load adhoc modules!!\n");
@@ -508,11 +508,11 @@
508508 // エミュレートの開始
509509 #ifdef USE_C_CORE
510510 if(g_gpsp_config.emulate_core == ASM_CORE)
511- execute_arm_translate(execute_cycles);
511+ execute_arm_translate(g_execute_cycles);
512512 else
513- execute_arm(execute_cycles);
513+ execute_arm(g_execute_cycles);
514514 #else
515- execute_arm_translate(execute_cycles);
515+ execute_arm_translate(g_execute_cycles);
516516 #endif
517517
518518 return 0;
@@ -545,7 +545,7 @@
545545
546546 do
547547 {
548- cpu_ticks += execute_cycles;
548+ cpu_ticks += g_execute_cycles;
549549
550550 reg[CHANGED_PC_STATUS] = 0;
551551
@@ -560,7 +560,7 @@
560560 update_timer(2);
561561 update_timer(3);
562562
563- video_count -= execute_cycles;
563+ video_count -= g_execute_cycles;
564564
565565 if(video_count <= 0)
566566 { // 状態移行の発生
@@ -610,10 +610,10 @@
610610 if(dispstat & 0x8)
611611 irq_raised |= IRQ_VBLANK;
612612
613- affine_reference_x[0] = (s32)(ADDRESS32(io_registers, 0x28) << 4) >> 4;
614- affine_reference_y[0] = (s32)(ADDRESS32(io_registers, 0x2C) << 4) >> 4;
615- affine_reference_x[1] = (s32)(ADDRESS32(io_registers, 0x38) << 4) >> 4;
616- affine_reference_y[1] = (s32)(ADDRESS32(io_registers, 0x3C) << 4) >> 4;
613+ affine_reference_x[0] = ((s32)(ADDRESS32(io_registers, 0x28) << 4) >> 4);
614+ affine_reference_y[0] = ((s32)(ADDRESS32(io_registers, 0x2C) << 4) >> 4);
615+ affine_reference_x[1] = ((s32)(ADDRESS32(io_registers, 0x38) << 4) >> 4);
616+ affine_reference_y[1] = ((s32)(ADDRESS32(io_registers, 0x3C) << 4) >> 4);
617617
618618 if(dma[0].start_type == DMA_START_VBLANK)
619619 dma_transfer(dma);
@@ -683,7 +683,7 @@
683683 io_registers[REG_DISPSTAT] = dispstat;
684684 }
685685
686- execute_cycles = video_count;
686+ g_execute_cycles = video_count;
687687
688688 if(irq_raised)
689689 raise_interrupt(irq_raised);
@@ -696,7 +696,7 @@
696696 // 画面のシンクロ・フリップ・ウェイト処理はここで行うべきでは?
697697
698698 } while(reg[CPU_HALT_STATE] != CPU_ACTIVE);
699- return execute_cycles;
699+ return g_execute_cycles;
700700 }
701701
702702 void vblank_interrupt_handler(u32 sub, u32 *parg)
@@ -769,7 +769,7 @@
769769 }
770770
771771 // 内部フレーム数が実機を上回る場合
772- if((real_frame_count < virtual_frame_count) && (synchronize_flag) && (skip_next_frame_flag == 0))
772+ if((real_frame_count < virtual_frame_count) && (g_synchronize_flag) && (skip_next_frame_flag == 0))
773773 {
774774 // VBANK待ち
775775 synchronize_sound();
@@ -801,7 +801,7 @@
801801 }
802802
803803 // 内部フレーム数が実機を上回る場合
804- if((real_frame_count < virtual_frame_count) && (synchronize_flag) && (skip_next_frame_flag == 0))
804+ if((real_frame_count < virtual_frame_count) && (g_synchronize_flag) && (skip_next_frame_flag == 0))
805805 {
806806 // VBANK待ち
807807 synchronize_sound();
@@ -815,7 +815,7 @@
815815 case no_frameskip:
816816 frames_drawn_count++;
817817 virtual_frame_count++;
818- if((real_frame_count < virtual_frame_count) && (synchronize_flag))
818+ if((real_frame_count < virtual_frame_count) && (g_synchronize_flag))
819819 {
820820 // 内部フレーム数が実機を上回る場合
821821 // VBANK待ち
@@ -838,7 +838,7 @@
838838 frames_drawn_count = 0;
839839 }
840840
841- if(!synchronize_flag)
841+ if(!g_synchronize_flag)
842842 PRINT_STRING_BG("--FF--", 0xFFFF, 0x000, 0, 10);
843843 }
844844
@@ -871,7 +871,7 @@
871871 #define MAIN_SAVESTATE_BODY(type) \
872872 { \
873873 FILE_##type##_VARIABLE(g_state_buffer_ptr, cpu_ticks); \
874- FILE_##type##_VARIABLE(g_state_buffer_ptr, execute_cycles); \
874+ FILE_##type##_VARIABLE(g_state_buffer_ptr, g_execute_cycles); \
875875 FILE_##type##_VARIABLE(g_state_buffer_ptr, video_count); \
876876 FILE_##type##_ARRAY(g_state_buffer_ptr, timer); \
877877 } \
@@ -957,17 +957,20 @@
957957
958958 MODEL_TYPE get_model()
959959 {
960- if((kuKernelGetModel() <= 0 /* original PSP */) || ( g_gpsp_config.fake_fat == YES))
960+ if((kuKernelGetModel() <= 0) || ( g_gpsp_config.fake_fat == YES))
961961 {
962+ DBGOUT("PSP_1000\n");
962963 return PSP_1000;
963964 }
964965 else
965- if(sceKernelDevkitVersion() < 0x03070110 || sctrlSEGetVersion() < 0x00001012)
966+ if(sceKernelDevkitVersion() < 0x03070110 /* Ver3.71以上を対象 */)
966967 {
968+ DBGOUT("PSP_1000\n");
967969 return PSP_1000;
968970 }
969971 else
970972 {
973+ DBGOUT("PSP_2000\n");
971974 return PSP_2000;
972975 }
973976 }
--- trunk/gpsp-kai-test/src/gui.c (revision 417)
+++ trunk/gpsp-kai-test/src/gui.c (revision 418)
@@ -802,7 +802,10 @@
802802 g_gpsp_config.emulate_core = ASM_CORE;
803803 g_gpsp_config.debug_flag = NO;
804804 g_gpsp_config.fake_fat = NO;
805+ g_gpsp_config.boot_mode = GAME_CART;
806+#if 0
805807 g_gpsp_config.solar_level = 0;
808+#endif
806809 }
807810
808811 /*--------------------------------------------------------
@@ -1254,6 +1257,12 @@
12541257 lang[11]
12551258 };
12561259
1260+ char *boot_mode_options[] =
1261+ {
1262+ "GAME CART",
1263+ "GBA BIOS"
1264+ };
1265+
12571266 #ifdef USE_C_CORE
12581267 char *emulate_core_options[] =
12591268 {
@@ -1333,8 +1342,10 @@
13331342
13341343 STRING_SELECTION_OPTION(NULL, "言語 : %s", language_options, &g_gpsp_config.language, 12, "言語", 5), /* TODO */
13351344 STRING_SELECTION_OPTION(NULL, "Fake Fat : %s", yes_no_options, &g_gpsp_config.fake_fat, 2, "Fake Fat", 6), /* TODO */
1345+ STRING_SELECTION_OPTION(NULL, "Boot Mode : %s", boot_mode_options, &g_gpsp_config.boot_mode, 2, "Boot Mode", 8), /* TODO */
1346+#if 0
13361347 NUMERIC_SELECTION_OPTION(NULL, "周囲の明るさ : %d", &g_gpsp_config.solar_level, 25, "周囲の明るさ", 8), /* TODO */
1337-
1348+#endif
13381349 SUBMENU_OPTION(NULL, msg[MSG_CHEAT_MENU_4], msg[MSG_CHEAT_MENU_HELP_4], 16)
13391350 };
13401351
--- trunk/gpsp-kai-test/src/cpu_asm.c (revision 417)
+++ trunk/gpsp-kai-test/src/cpu_asm.c (revision 418)
@@ -123,8 +123,8 @@
123123 #define arm_decode_data_proc_imm() \
124124 u32 rn = (opcode >> 16) & 0x0F; \
125125 u32 rd = (opcode >> 12) & 0x0F; \
126- u32 imm; \
127- ROR(imm, opcode & 0xFF, (opcode >> 7) & 0x1E) \
126+ u32 imm; DBGOUT("imm %d\n",opcode & 0xFF); \
127+ ROR(imm, opcode & 0xFF, (opcode >> 7) & 0x1E); DBGOUT("ror %d\n",imm); \
128128
129129 #define arm_decode_psr_reg() \
130130 u32 psr_field = (opcode >> 16) & 0x0F; \
@@ -182,7 +182,7 @@
182182 u32 reg_list = opcode & 0xFFFF \
183183
184184 #define arm_decode_branch() \
185- s32 offset = (s32)(opcode << 8) >> 6 \
185+ s32 offset = ((s32)(opcode << 8) >> 6); \
186186
187187 #define thumb_decode_shift() \
188188 u32 imm = (opcode >> 6) & 0x1F; \
@@ -256,7 +256,7 @@
256256 check_pc_region(pc); \
257257 opcode = ADDRESS32(pc_address_block, (pc & 0x7FFF)); \
258258 condition = block_data[block_data_position].condition; \
259- \
259+ DBGOUT("PC %0X:CODE %0X:PTR %0X\n",pc,opcode,translation_ptr); \
260260 if((condition != last_condition) || (condition >= 0x20)) \
261261 { \
262262 \
@@ -2797,7 +2797,7 @@
27972797 translation_flush_count = 0; \
27982798 /* modeにあわせてPCの位置を調整 */ \
27992799 block_lookup_address_pc_##type(); \
2800- \
2800+ DBGOUT("PC:%0X\n",pc); \
28012801 switch(pc >> 24) \
28022802 { \
28032803 case 0x0: \
@@ -2880,6 +2880,8 @@
28802880 if(translation_recursion_level == 0) \
28812881 { \
28822882 char buffer[256]; \
2883+ u16 *current_screen = copy_screen(); \
2884+ save_state("dump", current_screen, 0);\
28832885 video_resolution(FRAME_MENU); \
28842886 sprintf(buffer, "bad jump %x (%x)\n", (int)pc, (int)reg[REG_PC]); \
28852887 PRINT_STRING_BG(buffer, COLOR_WHITE, COLOR_BLACK, 0, 10); \
@@ -2938,7 +2940,7 @@
29382940 block_end_pc += 4 \
29392941
29402942 #define arm_branch_target() \
2941- branch_target = (block_end_pc + 4 + ((s32)(opcode << 8) >> 6)) \
2943+ branch_target = (block_end_pc + 4 + ((s32)(opcode << 8) >> 6)); \
29422944
29432945 // Contiguous conditional block flags modification - it will set 0x20 in the
29442946 // condition's bits if this instruction modifies flags. Taken from the CPU
@@ -3565,7 +3567,7 @@
35653567 }
35663568
35673569 reg[REG_SP] = 0x03007F00;
3568- reg[REG_PC] = 0x08000000;
3570+ reg[REG_PC] = (g_gpsp_config.boot_mode?0x00000000:0x08000000);
35693571 reg[REG_CPSR] = 0x0000001F;
35703572 reg[CPU_HALT_STATE] = CPU_ACTIVE;
35713573 reg[CPU_MODE] = MODE_USR;
--- trunk/gpsp-kai-test/src/main.h (revision 417)
+++ trunk/gpsp-kai-test/src/main.h (revision 418)
@@ -139,12 +139,12 @@
139139 ADDRESS16(io_registers, 0x100 + (timer_number * 4)) = \
140140 0x10000 - timer_reload; \
141141 \
142- if(timer[timer_number].count < execute_cycles) \
143- execute_cycles = timer[timer_number].count; \
142+ if(timer[timer_number].count < g_execute_cycles) \
143+ g_execute_cycles = timer[timer_number].count; \
144144 \
145145 if(timer_number < 2) \
146146 { \
147- /* 小数点以下を切り捨てていたので、GBCサウンドと同様の処理にした*/ \
147+ /* 小数点以下を切り捨てていたので、GBCサウンドと同様の処理にした*/ \
148148 SOUND_UPDATE_FREQUENCY_STEP(timer_number); \
149149 ADJUST_SOUND_BUFFER(timer_number, 0); \
150150 ADJUST_SOUND_BUFFER(timer_number, 1); \
@@ -163,9 +163,9 @@
163163 /******************************************************************************
164164 * グローバル変数の宣言
165165 ******************************************************************************/
166-extern u32 execute_cycles;
167-extern u32 global_cycles_per_instruction;
168-extern u32 synchronize_flag;
166+extern u32 g_execute_cycles;
167+//extern u32 global_cycles_per_instruction;
168+extern u32 g_synchronize_flag;
169169 extern u32 skip_next_frame_flag;
170170 extern TIMER_TYPE timer[4];
171171 extern u32 prescale_table[];
--- trunk/gpsp-kai-test/src/gui.h (revision 417)
+++ trunk/gpsp-kai-test/src/gui.h (revision 418)
@@ -42,7 +42,10 @@
4242 u32 emulate_core;
4343 u32 debug_flag;
4444 u32 fake_fat;
45+ u32 boot_mode;
46+#if 0
4547 u32 solar_level;
48+#endif
4649 } gpsp_config_t;
4750
4851 typedef struct
@@ -62,6 +65,9 @@
6265 #define ASM_CORE 0
6366 #define C_CORE 1
6467
68+#define GAME_CART 0
69+#define GBA_BIOS 1
70+
6571 /******************************************************************************
6672 * グローバル変数の宣言
6773 ******************************************************************************/
--- trunk/gpsp-kai-test/src/cpu_c.c (revision 417)
+++ trunk/gpsp-kai-test/src/cpu_c.c (revision 418)
@@ -113,7 +113,7 @@
113113 u32 reg_list = opcode & 0xFFFF \
114114
115115 #define arm_decode_branch() \
116- s32 offset = ((s32)(opcode & 0xFFFFFF) << 8) >> 6 \
116+ s32 offset = ((s32)((opcode & 0xFFFFFF) << 8) >> 6) \
117117
118118 #define calculate_z_flag(dest) \
119119 z_flag = ((dest) == 0) \
@@ -190,9 +190,9 @@
190190 reg_sh = reg[rm]; \
191191 \
192192 if(imm == 0) \
193- reg_sh = (s32)reg_sh >> 31; \
193+ reg_sh = (s32)(reg_sh >> 31); \
194194 else \
195- reg_sh = (s32)reg_sh >> imm; \
195+ reg_sh = (s32)(reg_sh >> imm); \
196196 break; \
197197 } \
198198 \
@@ -201,9 +201,9 @@
201201 { \
202202 get_shift_register(reg_sh); \
203203 if(shift <= 31) \
204- reg_sh = (s32)reg_sh >> shift; \
204+ reg_sh = (s32)(reg_sh >> shift); \
205205 else \
206- reg_sh = (s32)reg_sh >> 31; \
206+ reg_sh = (s32)(reg_sh >> 31); \
207207 break; \
208208 } \
209209 \
@@ -318,13 +318,13 @@
318318 reg_sh = reg[rm]; \
319319 if(imm == 0) \
320320 { \
321- reg_sh = (s32)reg_sh >> 31; \
321+ reg_sh = (s32)(reg_sh >> 31); \
322322 c_flag = reg_sh & 0x01; \
323323 } \
324324 else \
325325 { \
326326 c_flag = (reg_sh >> (imm - 1)) & 0x01; \
327- reg_sh = (s32)reg_sh >> imm; \
327+ reg_sh = (s32)(reg_sh >> imm); \
328328 } \
329329 break; \
330330 } \
@@ -337,13 +337,13 @@
337337 { \
338338 if(shift > 31) \
339339 { \
340- reg_sh = (s32)reg_sh >> 31; \
340+ reg_sh = (s32)(reg_sh >> 31); \
341341 c_flag = reg_sh & 0x01; \
342342 } \
343343 else \
344344 { \
345345 c_flag = (reg_sh >> (shift - 1)) & 0x01; \
346- reg_sh = (s32)reg_sh >> shift; \
346+ reg_sh = (s32)(reg_sh >> shift); \
347347 } \
348348 } \
349349 break; \
@@ -408,9 +408,9 @@
408408 { \
409409 u32 imm = (opcode >> 7) & 0x1F; \
410410 if(imm == 0) \
411- reg_offset = (s32)reg[rm] >> 31; \
411+ reg_offset = (s32)(reg[rm] >> 31); \
412412 else \
413- reg_offset = (s32)reg[rm] >> imm; \
413+ reg_offset = (s32)(reg[rm] >> imm); \
414414 break; \
415415 } \
416416 \
@@ -1152,13 +1152,13 @@
11521152 { \
11531153 if(shift > 31) \
11541154 { \
1155- dest = (s32)dest >> 31; \
1155+ dest = (s32)(dest >> 31); \
11561156 c_flag = dest & 0x01; \
11571157 } \
11581158 else \
11591159 { \
11601160 c_flag = (dest >> (shift - 1)) & 0x01; \
1161- dest = (s32)dest >> shift; \
1161+ dest = (s32)(dest >> shift); \
11621162 } \
11631163 } \
11641164
@@ -1197,7 +1197,7 @@
11971197 u32 dest; \
11981198 if(imm == 0) \
11991199 { \
1200- dest = (s32)reg[rs] >> 31; \
1200+ dest = (s32)(reg[rs] >> 31); \
12011201 c_flag = dest & 0x01; \
12021202 } \
12031203 else \
@@ -1204,7 +1204,7 @@
12041204 { \
12051205 dest = reg[rs]; \
12061206 c_flag = (dest >> (imm - 1)) & 0x01; \
1207- dest = (s32)dest >> imm; \
1207+ dest = (s32)(dest >> imm); \
12081208 } \
12091209
12101210 #define thumb_shift_ror_imm() \
@@ -3803,7 +3803,7 @@
38033803 u8 *pc_address_block = memory_map_read[pc_region];
38043804 u32 new_pc_region;
38053805 s32 cycles_remaining;
3806- u32 cycles_per_instruction = global_cycles_per_instruction;
3806+// u32 cycles_per_instruction = global_cycles_per_instruction;
38073807 CPU_ALERT_TYPE cpu_alert;
38083808
38093809 if(pc_address_block == NULL)
@@ -3823,10 +3823,11 @@
38233823 arm_loop:
38243824
38253825 collapse_flags();
3826- cycles_per_instruction = global_cycles_per_instruction;
3826+// cycles_per_instruction = global_cycles_per_instruction;
38273827
38283828 execute_arm_instruction();
3829- cycles_remaining -= cycles_per_instruction;
3829+// cycles_remaining -= cycles_per_instruction;
3830+ cycles_remaining--;
38303831 } while(cycles_remaining > 0);
38313832
38323833 collapse_flags();
@@ -3840,7 +3841,8 @@
38403841 collapse_flags();
38413842
38423843 execute_thumb_instruction();
3843- cycles_remaining -= cycles_per_instruction;
3844+// cycles_remaining -= cycles_per_instruction;
3845+ cycles_remaining--;
38443846 } while(cycles_remaining > 0);
38453847
38463848 collapse_flags();
--- trunk/gpsp-kai-test/src/common.h (revision 417)
+++ trunk/gpsp-kai-test/src/common.h (revision 418)
@@ -75,14 +75,14 @@
7575 typedef u32 FIXED16_16; // 整数部16bit 実数部16bit の固定小数点
7676 typedef u32 FIXED8_24; // 整数部 8bit 実数部24bit の固定小数点
7777
78-#define MAX_PATH 1024
79-#define MAX_FILE 512
78+#define MAX_PATH 512
79+#define MAX_FILE 256
8080 #define FILE_ID SceUID
8181
8282 #define SYS_CLOCK (16777216.0)
8383
8484 #define ROR(dest, value, shift) \
85- dest = ((u32)(value) >> (shift)) | ((u32)(value) << (32 - (shift))) \
85+ dest = ((u32)((value) >> (shift))) | ((u32)((value) << (32 - (shift)))) \
8686
8787 #define PSP_FILE_OPEN_APPEND (PSP_O_CREAT | PSP_O_APPEND | PSP_O_TRUNC)
8888
--- trunk/gpsp-kai-test/prx/homehookprx/Makefile (revision 417)
+++ trunk/gpsp-kai-test/prx/homehookprx/Makefile (revision 418)
@@ -9,7 +9,7 @@
99 BUILD_PRX = 1
1010 PRX_EXPORTS = $(TARGET).exp
1111
12-PSP_FW_VERSION=150
12+PSP_FW_VERSION=300
1313
1414 USE_KERNEL_LIBC=1
1515 USE_KERNEL_LIBS=1
--- trunk/gpsp-kai-test/prx/dvemgr/Makefile (revision 417)
+++ trunk/gpsp-kai-test/prx/dvemgr/Makefile (revision 418)
@@ -6,7 +6,7 @@
66 CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
77 ASFLAGS = $(CFLAGS)
88
9-PSP_FW_VERSION=150
9+PSP_FW_VERSION=300
1010
1111 BUILD_PRX = 1
1212 PRX_EXPORTS = exports.exp
--- trunk/gpsp-kai-test/prx/systembuttons_prx/Makefile (revision 417)
+++ trunk/gpsp-kai-test/prx/systembuttons_prx/Makefile (revision 418)
@@ -10,7 +10,7 @@
1010 BUILD_PRX = 1
1111 PRX_EXPORTS = $(TARGET).exp
1212
13-PSP_FW_VERSION=150
13+PSP_FW_VERSION=300
1414
1515 USE_KERNEL_LIBC=1
1616 USE_KERNEL_LIBS=1
--- trunk/gpsp-kai-test/readme_kai_jp.html (revision 417)
+++ trunk/gpsp-kai-test/readme_kai_jp.html (revision 418)
@@ -5,14 +5,18 @@
55
66 -- Release log --
77 <!--
8--UnOfficial gpSP kai 3.3 test 3
98 (現在修正中)HBLANK割込の処理を修正
109 (現在修正中)メッセージの変更
1110 (現在修正中)MULTIモードの通信に対応(現状では2台のみ)
1211 (現在修正中)ASMコアのthumb BLの修正(Cコアでは正常)
12+ (現在修正中)ERAMとIRAMのキャッシュを分離
1313 -->
1414
15+-UnOfficial gpSP kai 3.4 test 1 build 2
16+ ChickHEN R2に対応(PSP-2000で32MBのメモリ利用とZIPファイルのロードを確認)
1517 PSP-1000でZIPファイルを使用したときのバグを修正
18+ BIOSからの起動に対応(あのピコーンが聞きたいだけです)
19+ そのほか軽微な修正
1620
1721 -UnOfficial gpSP kai 3.3 test 2 build 132 svn.402
1822 ZIPファイルを2回目にロードしたときのフリーズを修正
Show on old repository browser