Index: trunk/abdev/BasicCompiler32/Compile_Var.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 230)
+++ trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 231)
@@ -978,61 +978,34 @@
 
 		//mov dword ptr[ebp+offset+sizeof(long)],eax
-		OpBuffer[obp++]=(char)0x89;
-		OpBuffer[obp++]=(char)0x85;
-		*((long *)(OpBuffer+obp))=offset+sizeof(long);
-		AddLocalVarAddrSchedule();
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset+sizeof(long), MOD_BASE_DISP32, Schedule::LocalVar );
 
 		//mov eax,LOLONG(dbl)
-		OpBuffer[obp++]=(char)0xB8;
-		*((long *)(OpBuffer+obp))=*(long *)(&dbl);
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)(&dbl) );
 
 		//mov dword ptr[ebp+offset],eax
-		OpBuffer[obp++]=(char)0x89;
-		OpBuffer[obp++]=(char)0x85;
-		*((long *)(OpBuffer+obp))=offset;
-		AddLocalVarAddrSchedule();
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, Schedule::LocalVar );
 	}
 	else if( type.IsSingle() ){
 		float flt;
 		flt=(float)dbl;
+
 		//mov eax,InitValue
-		OpBuffer[obp++]=(char)0xB8;
-		*((long *)(OpBuffer+obp))=*(long *)&flt;
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)&flt );
 
 		//mov dword ptr[ebp+offset],eax
-		OpBuffer[obp++]=(char)0x89;
-		OpBuffer[obp++]=(char)0x85;
-		*((long *)(OpBuffer+obp))=offset;
-		AddLocalVarAddrSchedule();
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar );
 	}
 	else if( type.Is64() ){
 		//mov eax,HILONG(i64data)
-		OpBuffer[obp++]=(char)0xB8;
-		*((long *)(OpBuffer+obp))=(long)*(long *)(((char *)(&i64data))+4);
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)(((char *)(&i64data))+4) );
 
 		//mov dword ptr[ebp+offset+sizeof(long)],eax
-		OpBuffer[obp++]=(char)0x89;
-		OpBuffer[obp++]=(char)0x85;
-		*((long *)(OpBuffer+obp))=offset+sizeof(long);
-		AddLocalVarAddrSchedule();
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset+sizeof(long), MOD_BASE_DISP32, Schedule::LocalVar );
 
 		//mov eax,LOLONG(i64data)
-		OpBuffer[obp++]=(char)0xB8;
-		*((long *)(OpBuffer+obp))=*(long *)(&i64data);
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_RV( REG_EAX, *(long *)(&i64data) );
 
 		//mov dword ptr[ebp+offset],eax
-		OpBuffer[obp++]=(char)0x89;
-		OpBuffer[obp++]=(char)0x85;
-		*((long *)(OpBuffer+obp))=offset;
-		AddLocalVarAddrSchedule();
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, Schedule::LocalVar );
 	}
 	else if( type.IsDWord() || type.IsLong() || type.IsPointer() ){
@@ -1053,15 +1026,9 @@
 		else{
 			//mov eax,InitValue
-			OpBuffer[obp++]=(char)0xB8;
-			*((long *)(OpBuffer+obp))=(long)i64data;
-			obp+=sizeof(long);
+			compiler.codeGenerator.op_mov_RV( REG_EAX, (long)i64data );
 		}
 
 		//mov dword ptr[ebp+offset],eax
-		OpBuffer[obp++]=(char)0x89;
-		OpBuffer[obp++]=(char)0x85;
-		*((long *)(OpBuffer+obp))=offset;
-		AddLocalVarAddrSchedule();
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar );
 	}
 	else if( type.IsWord() || type.IsInteger() ){
@@ -1073,10 +1040,5 @@
 
 		//mov word ptr[ebp+offset],ax
-		OpBuffer[obp++]=(char)0x66;
-		OpBuffer[obp++]=(char)0x89;
-		OpBuffer[obp++]=(char)0x85;
-		*((long *)(OpBuffer+obp))=offset;
-		AddLocalVarAddrSchedule();
-		obp+=sizeof(long);
+		compiler.codeGenerator.op_mov_MR( sizeof(short), REG_EAX, REG_EBP, offset, MOD_BASE_DISP32, Schedule::LocalVar );
 	}
 	else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){
@@ -1287,27 +1249,17 @@
 		if(pRelativeVar->bOffsetOffset){
 			//mov eax,ecx
-			OpBuffer[obp++]=(char)0x8B;
-			OpBuffer[obp++]=(char)0xC1;
+			compiler.codeGenerator.op_mov_RR( REG_EAX, REG_ECX );
 
 			//add eax,dword ptr[ebp+offset]
-			OpBuffer[obp++]=(char)0x03;
-			OpBuffer[obp++]=(char)0x85;
-			*((long *)(OpBuffer+obp))=pRelativeVar->offset;
-			AddLocalVarAddrSchedule();
-			obp+=sizeof(long);
+			compiler.codeGenerator.op_add_RM( sizeof(long), REG_EAX, REG_EBP, pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar );
 		}
 		else{
 			//mov eax,dword ptr[ebp+offset]
-			OpBuffer[obp++]=(char)0x8B;
-			OpBuffer[obp++]=(char)0x85;
-			*((long *)(OpBuffer+obp))=pRelativeVar->offset;
-			AddLocalVarAddrSchedule();
-			obp+=sizeof(long);
+			compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, pRelativeVar->offset, MOD_BASE_DISP32, Schedule::LocalVar );
 		}
 	}
 	else if(pRelativeVar->dwKind==VAR_DIRECTMEM){
 		//mov eax,ecx
-		OpBuffer[obp++]=(char)0x8B;
-		OpBuffer[obp++]=(char)0xC1;
+		compiler.codeGenerator.op_mov_RR( REG_EAX, REG_ECX );
 	}
 }
@@ -1340,8 +1292,5 @@
 
 			//mov eax,offset
-			compiler.codeGenerator.op_mov_RV(REG_EAX,(int)pVar->GetOffsetAddress());
-			obp-=sizeof(long);
-			pobj_GlobalVarSchedule->add();
-			obp+=sizeof(long);
+			compiler.codeGenerator.op_mov_RV(REG_EAX,(int)pVar->GetOffsetAddress(), Schedule::GlobalVar );
 
 			//push eax
