Index: /trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 250)
+++ /trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 251)
@@ -244,5 +244,5 @@
 	extern HANDLE hHeap;
 	extern BOOL bDebugCompile;
-	int i3,i4,LocalVarSchedule,EspOffsetSchedule,BaseOffset;
+	int i3,i4,LocalVarSchedule,BaseOffset;
 	char temporary[VN_SIZE];
 
@@ -440,10 +440,8 @@
 	compiler.codeGenerator.ClearContinueArea();
 
+	const PertialSchedule *pEspOffsetPertialSchedule = NULL;
 	if(bDebugCompile&&bDebugSupportProc==0){
 		//push dword ptr[ebp+(AllLocalVarSize-BaseOffset)]（スケジュール）
-		OpBuffer[obp++]=(char)0xFF;
-		OpBuffer[obp++]=(char)0xB5;
-		EspOffsetSchedule=obp;
-		obp+=sizeof(long);	
+		pEspOffsetPertialSchedule = compiler.codeGenerator.op_push_M( REG_EBP, 0, Schedule::None, true );
 
 		//push dword ptr[ebp]（以前のebp）
@@ -621,5 +619,5 @@
 
 	if(bDebugCompile&&bDebugSupportProc==0){
-		*((long *)(OpBuffer+EspOffsetSchedule))=AllLocalVarSize-BaseOffset-sizeof(long);
+		compiler.codeGenerator.opfix( pEspOffsetPertialSchedule, AllLocalVarSize-BaseOffset-sizeof(long) );
 
 		//call _DebugSys_EndProc
Index: /trunk/abdev/BasicCompiler32/x86CodeGenerator.cpp
===================================================================
--- /trunk/abdev/BasicCompiler32/x86CodeGenerator.cpp	(revision 250)
+++ /trunk/abdev/BasicCompiler32/x86CodeGenerator.cpp	(revision 251)
@@ -19,5 +19,7 @@
 #define INDEX_NON	0x04
 
-void CodeGenerator::set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType ){
+const PertialSchedule * CodeGenerator::set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType, bool isPertialSchedule )
+{
+	const PertialSchedule *pPertialSchedule = NULL;
 
 	// エラーチェック
@@ -30,4 +32,8 @@
 		SetError();
 	}
+	if( isPertialSchedule && !( mod == MOD_DISP32 || mod == MOD_BASE_DISP32 ) )
+	{
+		SetError();
+	}
 
 	if(mod==MOD_DISP32){
@@ -45,5 +51,5 @@
 
 	//レジスタモードの場合は、ここで終了
-	if(mod==MOD_REG) return;
+	if(mod==MOD_REG) return pPertialSchedule;
 
 
@@ -57,5 +63,5 @@
 
 	//ディスプレースメントを必要としない場合は、ここで終了
-	if(mod==MOD_BASE) return;
+	if(mod==MOD_BASE) return pPertialSchedule;
 
 
@@ -70,6 +76,14 @@
 	else
 	{
+		if( isPertialSchedule )
+		{
+			pertialSchedules.push_back( new PertialSchedule( pNativeCode->GetSize(), sizeof(long) ) );
+			pPertialSchedule = pertialSchedules.back();
+		}
+
 		pNativeCode->Put( disp, scheduleType );
 	}
+
+	return pPertialSchedule;
 }
 
@@ -86,5 +100,5 @@
 	pNativeCode->Put( (char)(opcode|REGISTER_OPERAND(reg)) );
 }
-void CodeGenerator::__op_format(char op_prefix,char opcode1,char opcode2,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
+const PertialSchedule *CodeGenerator::__op_format(char op_prefix,char opcode1,char opcode2,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//命令プリフィックス
 	if(op_prefix)
@@ -101,5 +115,5 @@
 
 	//ModR/M, SIB, disp
-	set_mod_rm_sib_disp(mod,reg,SCALE_NON,INDEX_NON,base_reg,offset, scheduleType );
+	return set_mod_rm_sib_disp(mod,reg,SCALE_NON,INDEX_NON,base_reg,offset, scheduleType, isPertialSchedule );
 }
 
@@ -731,16 +745,18 @@
 	}
 }
-void CodeGenerator::op_push_M( int base_reg, long offset, Schedule::Type scheduleType )
-{
+const PertialSchedule *CodeGenerator::op_push_M( int base_reg, long offset, Schedule::Type scheduleType, bool isPertialSchedule )
+{
+	const PertialSchedule *pPertialSchedule = NULL;
 	if( base_reg == REG_NON )
 	{
 		// push dword ptr[offset]
-		__op_format( 0, (char)0xFF, 0, /*opcode->*/0x06, 0, offset, MOD_DISP32, scheduleType );
+		pPertialSchedule = __op_format( 0, (char)0xFF, 0, /*opcode->*/0x06, 0, offset, MOD_DISP32, scheduleType, isPertialSchedule );
 	}
 	else
 	{
 		// push dword ptr[base_reg+offset]
-		__op_format( 0, (char)0xFF, 0, /*opcode->*/0x06, base_reg, offset, MOD_BASE_DISP32, scheduleType );
-	}
+		pPertialSchedule = __op_format( 0, (char)0xFF, 0, /*opcode->*/0x06, base_reg, offset, MOD_BASE_DISP32, scheduleType, isPertialSchedule );
+	}
+	return pPertialSchedule;
 }
 void CodeGenerator::op_pop(int reg){
Index: /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 250)
+++ /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 251)
@@ -255,4 +255,5 @@
 	void CheckUnresolveSchedule();
 
+	void opfix( const PertialSchedule *pPertialSchedule, long newValue );
 	void opfix_JmpPertialSchedule( const PertialSchedule *pPertialSchedule );
 
@@ -365,7 +366,7 @@
 	/////////////////////////////////////////////////////////////////
 private:
-	void set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType = Schedule::None );
+	const PertialSchedule *set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType, bool isPertialSchedule );
 	void __op_format(char op_prefix,char opcode,int reg);
-	void __op_format(char op_prefix,char opcode1,char opcode2,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType = Schedule::None );
+	const PertialSchedule *__op_format(char op_prefix,char opcode1,char opcode2,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType = Schedule::None, bool isPertialSchedule = false );
 public:
 	void op_mov_MV			( int op_size, int base_reg, long offset, Schedule::Type offsetScheduleType, long value, Schedule::Type valueScheduleType = Schedule::None );
@@ -409,5 +410,5 @@
 	void op_push_V( long data, Schedule::Type scheduleType = Schedule::None );
 	void op_push_M( int base_reg );
-	void op_push_M( int base_reg, long offset, Schedule::Type scheduleType = Schedule::None );
+	const PertialSchedule *op_push_M( int base_reg, long offset, Schedule::Type scheduleType = Schedule::None, bool isPertialSchedule = false );
 	void op_pop(int reg = REG_NON);
 	void op_add_esp(long num);
Index: /trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp	(revision 250)
+++ /trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp	(revision 251)
@@ -27,7 +27,5 @@
 }
 
-
-// 分岐関連
-void CodeGenerator::opfix_JmpPertialSchedule( const PertialSchedule *pPertialSchedule )
+void CodeGenerator::opfix( const PertialSchedule *pPertialSchedule, long newValue )
 {
 	bool isSuccessful = false;
@@ -38,9 +36,4 @@
 		if( (*it) == pPertialSchedule )
 		{
-			long newValue = pNativeCode->GetSize() - (pPertialSchedule->GetCodePos()+pPertialSchedule->GetTypeSize());
-
-			extern int obp;
-			long newValueOld = obp - (pPertialSchedule->GetObpOld()+pPertialSchedule->GetTypeSize());
-
 			if( pPertialSchedule->GetTypeSize() == sizeof(char) )
 			{
@@ -54,4 +47,62 @@
 
 				// TODO: 未完成（用が無くなったら消す）
+				pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), (char)newValue );
+			}
+			else if( pPertialSchedule->GetTypeSize() == sizeof(long) )
+			{
+				pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), newValue );
+
+				// TODO: 未完成（用が無くなったら消す）
+				pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), newValue );
+			}
+			else
+			{
+				SetError();
+			}
+
+			it = pertialSchedules.erase( it );
+			delete pPertialSchedule;
+
+			isSuccessful = true;
+		}
+		else
+		{
+			it++;
+		}
+	}
+
+	if( isSuccessful == false )
+	{
+		SetError();
+	}
+}
+
+
+// 分岐関連
+void CodeGenerator::opfix_JmpPertialSchedule( const PertialSchedule *pPertialSchedule )
+{
+	bool isSuccessful = false;
+
+	PertialSchedules::iterator it = pertialSchedules.begin();
+	while( it != pertialSchedules.end() )
+	{
+		if( (*it) == pPertialSchedule )
+		{
+			long newValue = pNativeCode->GetSize() - (pPertialSchedule->GetCodePos()+pPertialSchedule->GetTypeSize());
+
+			extern int obp;
+			long newValueOld = obp - (pPertialSchedule->GetObpOld()+pPertialSchedule->GetTypeSize());
+
+			if( pPertialSchedule->GetTypeSize() == sizeof(char) )
+			{
+				if( newValue < -128 || 127 < newValue )
+				{
+					// 範囲外
+					SetError();
+				}
+
+				pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), (char)newValue );
+
+				// TODO: 未完成（用が無くなったら消す）
 				pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), (char)newValueOld );
 			}
@@ -130,5 +181,5 @@
 	{
 		pertialSchedules.push_back( new PertialSchedule( pNativeCode->GetSize(), op_size ) );
-		pPertialSchedule = pertialSchedules[pertialSchedules.size()-1];
+		pPertialSchedule = pertialSchedules.back();
 	}
 
