source: dev/trunk/abdev/BasicCompiler32/Compile_Statement.cpp@ 148

Last change on this file since 148 was 142, checked in by dai_9181, 17 years ago

op_ret関数を用意した

File size: 30.8 KB
Line 
1#include "../BasicCompiler_Common/common.h"
2#include "Opcode.h"
3
4void OpcodeOthers( const char *Command ){
5 int i,i2;
6 UserProc *pUserProc;
7
8 char leftTerm[8192];
9 int lastParePos = 0;
10 for(i=0;;i++){
11 if(Command[i]=='\"'){
12 //ダブルクォートは不正なのでエラー扱い
13 leftTerm[i]=0;
14 SetError(3,leftTerm,cp);
15 return;
16 }
17
18 if(Command[i]=='('){
19 lastParePos = i;
20 i2=GetStringInPare(leftTerm+i,Command+i);
21 i+=i2-1;
22 continue;
23 }
24 if(Command[i]=='['){
25 i2=GetStringInBracket(leftTerm+i,Command+i);
26 i+=i2-1;
27 continue;
28 }
29 if(Command[i]=='\0'){
30 leftTerm[i] = 0;
31 break;
32 }
33
34 if( IsNumCalcMark( Command, i ) ){
35 leftTerm[i] = 0;
36 break;
37 }
38
39 leftTerm[i]=Command[i];
40 }
41 if(!(
42 IsVariableTopChar(leftTerm[0])||
43 leftTerm[0]=='.'||
44 (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM)
45 )){
46 SetError(1,NULL,cp);
47 return;
48 }
49
50
51 if(Command[i]=='\0' && lastParePos == 0){
52 //////////////////////////////
53 // パラメータ無しのマクロ検索
54 //////////////////////////////
55
56 pUserProc=GetSubHash(Command);
57
58 //GetSubHash内でエラー提示が行われた場合
59 if(pUserProc==(UserProc *)-1) return;
60
61 if(pUserProc==0){
62 char temporary[VN_SIZE];
63 lstrcpy(temporary,Command);
64
65 CharUpper(temporary);
66 pUserProc=GetSubHash(temporary);
67
68 //GetSubHash内でエラー提示が行われた場合
69 if(pUserProc==(UserProc *)-1) return;
70 }
71
72 if(pUserProc){
73 if( !pUserProc->IsMacro() ){
74 SetError(10,Command,cp);
75 }
76
77 Opcode_CallProc("",pUserProc,0,"",0);
78
79 return;
80 }
81 }
82 else if(IsNumCalcMark(Command,i)){
83 //代入演算
84 OpcodeCalc(Command);
85 return;
86 }
87
88
89 Type resultType;
90 bool isLiteral;
91 BOOL bUseHeap;
92 bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false, NULL, true );
93 if( result ){
94
95 /////////////////////
96 // 戻り値の処理
97 /////////////////////
98
99 if( resultType.IsReal() ){
100 //fstp st(0)
101 OpBuffer[obp++]=(char)0xDD;
102 OpBuffer[obp++]=(char)0xD8;
103 }
104 else if( resultType.IsStruct() ){
105 //mov ebx,eax
106 op_mov_RR(REG_EBX,REG_EAX);
107
108 FreeTempObject(REG_EBX,&resultType.GetClass());
109 }
110
111 //成功
112 return;
113 }
114
115 // 失敗
116 SetError(1, NULL,cp);
117}
118
119void OpcodeIf(char *Parameter){
120 int i,i2,i3,i4;
121 Type tempType;
122
123 for(i=0;;i++){
124 if(Parameter[i]=='\0'){
125 SetError(21,NULL,cp);
126 return;
127 }
128 if(Parameter[i]==1&&Parameter[i+1]==ESC_THEN){
129 Parameter[i]=0;
130 break;
131 }
132 }
133
134 if( !NumOpe(Parameter,Type(),tempType) ){
135 //NumOpe内でエラー
136 i3=-1; //ダミー
137 }
138 else if( tempType.IsDouble() ){
139 //fld qword ptr[esp]
140 op_fld_ptr_esp(DEF_DOUBLE);
141
142 //push 0
143 op_push_V(0);
144
145 //fild dword ptr[esp]
146 op_fld_ptr_esp(DEF_LONG);
147
148 //add esp,sizeof(double)+sizeof(long)
149 op_add_esp(sizeof(double)+sizeof(long));
150
151 //fcompp
152 OpBuffer[obp++]=(char)0xDE;
153 OpBuffer[obp++]=(char)0xD9;
154
155 //fnstsw ax
156 OpBuffer[obp++]=(char)0xDF;
157 OpBuffer[obp++]=(char)0xE0;
158
159 //test ah,40
160 OpBuffer[obp++]=(char)0xF6;
161 OpBuffer[obp++]=(char)0xC4;
162 OpBuffer[obp++]=(char)0x40;
163
164 //jne (endif、または else まで)
165 OpBuffer[obp++]=(char)0x0F;
166 OpBuffer[obp++]=(char)0x85;
167 obp+=sizeof(long);
168
169 //jneの番地
170 i3=obp;
171 }
172 else if( tempType.IsSingle() ){
173 //fld dword ptr[esp]
174 op_fld_ptr_esp(DEF_SINGLE);
175
176 //push 0
177 op_push_V(0);
178
179 //fild dword ptr[esp]
180 op_fld_ptr_esp(DEF_LONG);
181
182 //add esp,sizeof(float)+sizeof(long)
183 op_add_esp(sizeof(float)+sizeof(long));
184
185 //fcompp
186 OpBuffer[obp++]=(char)0xDE;
187 OpBuffer[obp++]=(char)0xD9;
188
189 //fnstsw ax
190 OpBuffer[obp++]=(char)0xDF;
191 OpBuffer[obp++]=(char)0xE0;
192
193 //test ah,40
194 OpBuffer[obp++]=(char)0xF6;
195 OpBuffer[obp++]=(char)0xC4;
196 OpBuffer[obp++]=(char)0x40;
197
198 //jne (endif、または else まで)
199 OpBuffer[obp++]=(char)0x0F;
200 OpBuffer[obp++]=(char)0x85;
201 obp+=sizeof(long);
202
203 //jneの番地
204 i3=obp;
205 }
206 else if( tempType.Is64() ){
207 //64ビット型
208
209 //pop eax
210 op_pop(REG_EAX);
211
212 //pop ebx
213 op_pop(REG_EBX);
214
215 //cmp eax,0
216 OpBuffer[obp++]=(char)0x83;
217 OpBuffer[obp++]=(char)0xF8;
218 OpBuffer[obp++]=(char)0x00;
219
220 //jne
221 OpBuffer[obp++]=(char)0x0F;
222 OpBuffer[obp++]=(char)0x85;
223 obp+=sizeof(long);
224 i3=obp;
225
226
227 //cmp ebx,0
228 OpBuffer[obp++]=(char)0x83;
229 OpBuffer[obp++]=(char)0xFB;
230 OpBuffer[obp++]=(char)0x00;
231
232 //jne
233 OpBuffer[obp++]=(char)0x0F;
234 OpBuffer[obp++]=(char)0x85;
235 obp+=sizeof(long);
236 i4=obp;
237
238
239
240 //jmp (endif、または else までジャンプ)
241 OpBuffer[obp++]=(char)0xE9;
242 obp+=sizeof(long);
243
244 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;
245 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
246
247 //jmpの番地
248 i3=obp;
249 }
250 else{
251 //32ビット型
252
253 //pop eax
254 op_pop(REG_EAX);
255
256 //cmp eax,0
257 OpBuffer[obp++]=(char)0x83;
258 OpBuffer[obp++]=(char)0xF8;
259 OpBuffer[obp++]=(char)0x00;
260
261 //je (endif、または else まで条件ジャンプ)
262 OpBuffer[obp++]=(char)0x0F;
263 OpBuffer[obp++]=(char)0x84;
264 obp+=sizeof(long);
265
266 //jeの番地
267 i3=obp;
268 }
269
270
271 /////////////////////////
272 // If内をコード化
273 /////////////////////////
274
275 //レキシカルスコープをレベルアップ
276 obj_LexScopes.Start( obp, SCOPE_TYPE_IF );
277
278 i2=CompileBuffer(ESC_ENDIF,0);
279
280 //レキシカルスコープをレベルダウン
281 obj_LexScopes.End();
282
283
284 if(i3==-1) return;
285
286 if(i2==ESC_ELSE){
287 //jmp (endifまで)
288 OpBuffer[obp++]=(char)0xE9;
289 obp+=sizeof(long);
290
291 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //ifからelseへのジャンプ先のオフセット値
292
293 i3=obp;
294
295
296 /////////////////////////
297 // Else内をコード化
298 /////////////////////////
299
300 //レキシカルスコープをレベルアップ
301 obj_LexScopes.Start( obp, SCOPE_TYPE_IF );
302
303 CompileBuffer(ESC_ENDIF,0);
304
305 //レキシカルスコープをレベルダウン
306 obj_LexScopes.End();
307
308
309 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //jmpジャンプ先のオフセット値
310 }
311 else{
312 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //jeジャンプ先のオフセット値
313 }
314}
315
316int GetLabelAddress(char *LabelName,int LineNum){
317 extern int MaxLabelNum;
318 extern LABEL *pLabelNames;
319 int i;
320
321 if(LabelName){
322 for(i=0;i<MaxLabelNum;i++){
323 if(pLabelNames[i].pName){
324 if(lstrcmp(LabelName,pLabelNames[i].pName)==0) return pLabelNames[i].address;
325 }
326 }
327 }
328 else{
329 for(i=0;i<MaxLabelNum;i++){
330 if(pLabelNames[i].pName==0){
331 if(LineNum==pLabelNames[i].line) return pLabelNames[i].address;
332 }
333 }
334 }
335 return -1;
336}
337void OpcodeGoto(char *Parameter){
338 extern HANDLE hHeap;
339 extern GOTOLABELSCHEDULE *pGotoLabelSchedule;
340 extern int GotoLabelScheduleNum;
341 int i,LineNum;
342
343 if(Parameter[0]=='*'){
344 i=GetLabelAddress(Parameter+1,0);
345
346 //jmp ...
347 OpBuffer[obp++]=(char)0xE9;
348 if(i==-1){
349 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
350 pGotoLabelSchedule[GotoLabelScheduleNum].pName=(char *)HeapAlloc(hHeap,0,lstrlen(Parameter+1)+1);
351 lstrcpy(pGotoLabelSchedule[GotoLabelScheduleNum].pName,Parameter+1);
352 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
353 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
354 GotoLabelScheduleNum++;
355 }
356 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
357 obp+=sizeof(long);
358 }
359 else{
360 LineNum=atoi(Parameter);
361 i=GetLabelAddress(0,LineNum);
362
363 //jmp ...
364 OpBuffer[obp++]=(char)0xE9;
365 if(i==-1){
366 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
367 pGotoLabelSchedule[GotoLabelScheduleNum].pName=0;
368 pGotoLabelSchedule[GotoLabelScheduleNum].line=LineNum;
369 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
370 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
371 GotoLabelScheduleNum++;
372 }
373 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
374 obp+=sizeof(long);
375 }
376}
377void OpcodeWhile(char *Parameter){
378 extern HANDLE hHeap;
379 int i2,i3 = 0;
380
381 //Continueアドレスのバックアップとセット
382 extern DWORD dwContinueAddress;
383 DWORD dwTempContinue;
384 dwTempContinue=dwContinueAddress;
385 dwContinueAddress=obp;
386
387 if(!Parameter[0]) SetError(10,"While",cp);
388
389 int je_schedule;
390 Type tempType;
391 if( !NumOpe(Parameter,Type(),tempType) ){
392 //ダミー
393 i3=-1;
394 }
395 else if( tempType.IsDouble() ){
396 //fld qword ptr[esp]
397 op_fld_ptr_esp(DEF_DOUBLE);
398
399 //push 0
400 op_push_V(0);
401
402 //fild dword ptr[esp]
403 op_fld_ptr_esp(DEF_LONG);
404
405 //add esp,sizeof(double)+sizeof(long)
406 op_add_esp(sizeof(double)+sizeof(long));
407
408 //fcompp
409 OpBuffer[obp++]=(char)0xDE;
410 OpBuffer[obp++]=(char)0xD9;
411
412 //fnstsw ax
413 OpBuffer[obp++]=(char)0xDF;
414 OpBuffer[obp++]=(char)0xE0;
415
416 //test ah,40
417 OpBuffer[obp++]=(char)0xF6;
418 OpBuffer[obp++]=(char)0xC4;
419 OpBuffer[obp++]=(char)0x40;
420
421 //jne (Wend まで)
422 OpBuffer[obp++]=(char)0x0F;
423 OpBuffer[obp++]=(char)0x85;
424 obp+=sizeof(long);
425
426 //jeの番地
427 je_schedule=obp;
428 }
429 else if( tempType.IsSingle() ){
430 //fld dword ptr[esp]
431 op_fld_ptr_esp(DEF_SINGLE);
432
433 //push 0
434 op_push_V(0);
435
436 //fild dword ptr[esp]
437 op_fld_ptr_esp(DEF_LONG);
438
439 //add esp,sizeof(float)+sizeof(long)
440 op_add_esp(sizeof(float)+sizeof(long));
441
442 //fcompp
443 OpBuffer[obp++]=(char)0xDE;
444 OpBuffer[obp++]=(char)0xD9;
445
446 //fnstsw ax
447 OpBuffer[obp++]=(char)0xDF;
448 OpBuffer[obp++]=(char)0xE0;
449
450 //test ah,40
451 OpBuffer[obp++]=(char)0xF6;
452 OpBuffer[obp++]=(char)0xC4;
453 OpBuffer[obp++]=(char)0x40;
454
455 //jne (Wend まで)
456 OpBuffer[obp++]=(char)0x0F;
457 OpBuffer[obp++]=(char)0x85;
458 obp+=sizeof(long);
459
460 //jeの番地
461 je_schedule=obp;
462 }
463 else if( tempType.Is64() ){
464 //64ビット型
465
466 //pop eax
467 op_pop(REG_EAX);
468
469 //pop ebx
470 op_pop(REG_EBX);
471
472 //cmp eax,0
473 OpBuffer[obp++]=(char)0x83;
474 OpBuffer[obp++]=(char)0xF8;
475 OpBuffer[obp++]=(char)0x00;
476
477 //jne
478 OpBuffer[obp++]=(char)0x0F;
479 OpBuffer[obp++]=(char)0x85;
480 obp+=sizeof(long);
481 i2=obp;
482
483
484 //cmp ebx,0
485 OpBuffer[obp++]=(char)0x83;
486 OpBuffer[obp++]=(char)0xFB;
487 OpBuffer[obp++]=(char)0x00;
488
489 //jne
490 OpBuffer[obp++]=(char)0x0F;
491 OpBuffer[obp++]=(char)0x85;
492 obp+=sizeof(long);
493 i3=obp;
494
495
496 //jmp (endif、または else までジャンプ)
497 OpBuffer[obp++]=(char)0xE9;
498 obp+=sizeof(long);
499
500 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
501 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;
502
503 //jmpの番地
504 je_schedule=obp;
505 }
506 else{
507 //その他整数型
508
509 //pop eax
510 op_pop(REG_EAX);
511
512 //cmp eax,0
513 OpBuffer[obp++]=(char)0x83;
514 OpBuffer[obp++]=(char)0xF8;
515 OpBuffer[obp++]=(char)0x00;
516
517 //je (Wend まで)
518 OpBuffer[obp++]=(char)0x0F;
519 OpBuffer[obp++]=(char)0x84;
520 obp+=sizeof(long);
521
522 //実行中の番地
523 je_schedule=obp;
524 }
525
526 //レキシカルスコープをレベルアップ
527 obj_LexScopes.Start( obp, SCOPE_TYPE_WHILE );
528
529 //While内をコンパイル
530 CompileBuffer(0,COM_WEND);
531
532 obj_LexScopes.CallDestructorsOfScopeEnd();
533
534 if( i3 == -1 ){
535 return;
536 }
537
538 //jmp ...
539 OpBuffer[obp++]=(char)0xE9;
540 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
541 obp+=sizeof(long);
542
543 //レキシカルスコープをレベルダウン
544 obj_LexScopes.End();
545
546 *((long *)(OpBuffer+je_schedule-sizeof(long)))=obp-je_schedule; //jeジャンプ先のオフセット値
547
548 //Continueアドレスを復元
549 dwContinueAddress=dwTempContinue;
550}
551
552char szNextVariable[VN_SIZE];
553void OpcodeFor(char *Parameter){
554 extern HANDLE hHeap;
555 int i,i2,i3;
556 char temporary[VN_SIZE],variable[VN_SIZE],JudgeNum[VN_SIZE],StepNum[VN_SIZE];
557
558 //第1パラメータを取得
559 i=GetOneParameter(Parameter,0,temporary);
560 if(!Parameter[i]){
561 SetError(12,"For",cp);
562 goto ErrorStep;
563 }
564
565 for(i2=0;;i2++){
566 if(temporary[i2]=='='){
567 variable[i2]=0;
568
569 //カウンタ初期化
570 OpcodeCalc(temporary);
571 break;
572 }
573 if(temporary[i2]=='\0'){
574 SetError(12,"For",cp);
575 goto ErrorStep;
576 }
577 variable[i2]=temporary[i2];
578 }
579
580 //jmp ...
581 OpBuffer[obp++]=(char)0xE9;
582 i2=obp;
583 obp+=sizeof(long);
584
585 //Continueアドレスのバックアップとセット
586 extern DWORD dwContinueAddress;
587 DWORD dwTempContinue;
588 dwTempContinue=dwContinueAddress;
589 dwContinueAddress=obp;
590
591 //第2パラメータを取得(to~)
592 i=GetOneParameter(Parameter,i,JudgeNum);
593
594 //第3パラメータを取得(step~)
595 if(Parameter[i]){
596 i=GetOneParameter(Parameter,i,StepNum);
597 if(Parameter[i]) SetError(12,"For",cp);
598 }
599 else lstrcpy(StepNum,"1");
600
601 //カウンタを増加させる
602 sprintf(temporary,"%s=(%s)+(%s)",variable,variable,StepNum);
603 OpcodeCalc(temporary);
604
605 *((long *)(OpBuffer+i2))=obp-(i2+sizeof(long));
606
607 //増加か減少かを区別する
608 sprintf(temporary,"(%s)>=0",StepNum);
609 NumOpe(temporary,Type(),Type());
610
611 //pop eax
612 op_pop(REG_EAX);
613
614 //cmp eax,0
615 OpBuffer[obp++]=(char)0x83;
616 OpBuffer[obp++]=(char)0xF8;
617 OpBuffer[obp++]=(char)0x00;
618
619 //je [カウンタ減少の場合の判定]
620 OpBuffer[obp++]=(char)0x0F;
621 OpBuffer[obp++]=(char)0x84;
622 i2=obp;
623 obp+=sizeof(long);
624
625 //判定(カウンタ増加の場合)
626 sprintf(temporary,"%s<=(%s)",variable,JudgeNum);
627 NumOpe(temporary,Type(),Type());
628
629 //pop eax
630 op_pop(REG_EAX);
631
632 //jmp [カウンタ減少の場合の判定を飛び越す]
633 OpBuffer[obp++]=(char)0xE9;
634 i3=obp;
635 obp+=sizeof(long);
636
637 *((long *)(OpBuffer+i2))=obp-(i2+sizeof(long)); //jeジャンプ先のオフセット値
638
639 //判定(カウンタ減少の場合)
640 sprintf(temporary,"%s>=(%s)",variable,JudgeNum);
641 NumOpe(temporary,Type(),Type());
642
643 //pop eax
644 op_pop(REG_EAX);
645
646 *((long *)(OpBuffer+i3))=obp-(i3+sizeof(long)); //jmpジャンプ先のオフセット値
647
648 //cmp eax,0
649 OpBuffer[obp++]=(char)0x83;
650 OpBuffer[obp++]=(char)0xF8;
651 OpBuffer[obp++]=(char)0x00;
652
653ErrorStep:
654
655 //je ...
656 OpBuffer[obp++]=(char)0x0F;
657 OpBuffer[obp++]=(char)0x84;
658 int je_schedule=obp;
659 obp+=sizeof(long);
660
661 //レキシカルスコープをレベルアップ
662 obj_LexScopes.Start( obp, SCOPE_TYPE_FOR );
663
664 //For内をコンパイル
665 CompileBuffer(0,COM_NEXT);
666
667 obj_LexScopes.CallDestructorsOfScopeEnd();
668
669 if(szNextVariable[0]){
670 if(lstrcmp(szNextVariable,variable)!=0){
671 SetError(55,szNextVariable,cp);
672 }
673 }
674
675 //jmp ...
676 OpBuffer[obp++]=(char)0xE9;
677 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
678 obp+=sizeof(long);
679
680 //レキシカルスコープをレベルダウン
681 obj_LexScopes.End();
682
683 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jeジャンプ先のオフセット値
684
685 //Continueアドレスを復元
686 dwContinueAddress=dwTempContinue;
687}
688
689void OpcodeDo(char *Parameter){
690 extern HANDLE hHeap;
691 int i,i2,i3,i4;
692
693 if(Parameter[0]) SetError(10,"Do",cp);
694
695 //Continueアドレスのバックアップとセット
696 extern DWORD dwContinueAddress;
697 DWORD dwTempContinue;
698 dwTempContinue=dwContinueAddress;
699 dwContinueAddress=obp;
700
701 //レキシカルスコープをレベルアップ
702 obj_LexScopes.Start( obp, SCOPE_TYPE_DO );
703
704 //Do内をコンパイル
705 CompileBuffer(0,COM_LOOP);
706
707 obj_LexScopes.CallDestructorsOfScopeEnd();
708
709 extern char *basbuf;
710 char temporary[VN_SIZE];
711 for(i=cp-1;;i--){
712 if(IsCommandDelimitation(basbuf[i])){
713 i+=3;
714 if(!(basbuf[i]=='0'||basbuf[i]=='1')){
715 //無条件ループ
716 break;
717 }
718 i3=i;
719
720 for(i+=2,i2=0;;i++,i2++){
721 if(IsCommandDelimitation(basbuf[i])){
722 temporary[i2]=0;
723 break;
724 }
725 temporary[i2]=basbuf[i];
726 }
727
728 Type tempType;
729 NumOpe(temporary,Type(),tempType);
730
731 if( tempType.IsDouble() ){
732 //fld qword ptr[esp]
733 op_fld_ptr_esp(DEF_DOUBLE);
734
735 //push 0
736 op_push_V(0);
737
738 //fild dword ptr[esp]
739 op_fld_ptr_esp(DEF_LONG);
740
741 //add esp,sizeof(double)+sizeof(long)
742 op_add_esp(sizeof(double)+sizeof(long));
743
744 //fcompp
745 OpBuffer[obp++]=(char)0xDE;
746 OpBuffer[obp++]=(char)0xD9;
747
748 //fnstsw ax
749 OpBuffer[obp++]=(char)0xDF;
750 OpBuffer[obp++]=(char)0xE0;
751
752 //test ah,40
753 OpBuffer[obp++]=(char)0xF6;
754 OpBuffer[obp++]=(char)0xC4;
755 OpBuffer[obp++]=(char)0x40;
756
757 if(basbuf[i3]=='0'){
758 //While
759
760 //jne 5(ループ終了)
761 OpBuffer[obp++]=(char)0x75;
762 OpBuffer[obp++]=(char)0x05;
763 }
764 else if(basbuf[i3]=='1'){
765 //Until
766
767 //je 5(ループ終了)
768 OpBuffer[obp++]=(char)0x74;
769 OpBuffer[obp++]=(char)0x05;
770 }
771 }
772 else if( tempType.IsSingle() ){
773 //fld dword ptr[esp]
774 op_fld_ptr_esp(DEF_SINGLE);
775
776 //push 0
777 op_push_V(0);
778
779 //fild dword ptr[esp]
780 op_fld_ptr_esp(DEF_LONG);
781
782 //add esp,sizeof(float)+sizeof(long)
783 op_add_esp(sizeof(float)+sizeof(long));
784
785 //fcompp
786 OpBuffer[obp++]=(char)0xDE;
787 OpBuffer[obp++]=(char)0xD9;
788
789 //fnstsw ax
790 OpBuffer[obp++]=(char)0xDF;
791 OpBuffer[obp++]=(char)0xE0;
792
793 //test ah,40
794 OpBuffer[obp++]=(char)0xF6;
795 OpBuffer[obp++]=(char)0xC4;
796 OpBuffer[obp++]=(char)0x40;
797
798 if(basbuf[i3]=='0'){
799 //While
800
801 //jne 5(ループ終了)
802 OpBuffer[obp++]=(char)0x75;
803 OpBuffer[obp++]=(char)0x05;
804 }
805 else if(basbuf[i3]=='1'){
806 //Until
807
808 //je 5(ループ終了)
809 OpBuffer[obp++]=(char)0x74;
810 OpBuffer[obp++]=(char)0x05;
811 }
812 }
813 else if( tempType.Is64() ){
814 //64ビット型
815
816 //pop eax
817 op_pop(REG_EAX);
818
819 //pop ebx
820 op_pop(REG_EBX);
821
822 //cmp eax,0
823 OpBuffer[obp++]=(char)0x83;
824 OpBuffer[obp++]=(char)0xF8;
825 OpBuffer[obp++]=(char)0x00;
826
827 //jne
828 OpBuffer[obp++]=(char)0x0F;
829 OpBuffer[obp++]=(char)0x85;
830 obp+=sizeof(long);
831 i2=obp;
832
833
834 //cmp ebx,0
835 OpBuffer[obp++]=(char)0x83;
836 OpBuffer[obp++]=(char)0xFB;
837 OpBuffer[obp++]=(char)0x00;
838
839 //jne
840 OpBuffer[obp++]=(char)0x0F;
841 OpBuffer[obp++]=(char)0x85;
842 obp+=sizeof(long);
843 i4=obp;
844
845
846 if(basbuf[i3]=='0'){
847 //While
848
849 //jmp 5(ループ終了)
850 OpBuffer[obp++]=(char)0xEB;
851 OpBuffer[obp++]=(char)0x05;
852
853 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
854 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
855 }
856 else if(basbuf[i3]=='1'){
857 //Until
858
859 //jmp 2(ループを続ける)
860 OpBuffer[obp++]=(char)0xEB;
861 OpBuffer[obp++]=(char)0x02;
862
863 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
864 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
865
866 //jmp 5(ループ終了)
867 OpBuffer[obp++]=(char)0xEB;
868 OpBuffer[obp++]=(char)0x05;
869 }
870 }
871 else{
872 //pop eax
873 op_pop(REG_EAX);
874
875 //cmp eax,0
876 OpBuffer[obp++]=(char)0x83;
877 OpBuffer[obp++]=(char)0xF8;
878 OpBuffer[obp++]=(char)0x00;
879
880 if(basbuf[i3]=='0'){
881 //While
882
883 //je 5(ループ終了)
884 OpBuffer[obp++]=(char)0x74;
885 OpBuffer[obp++]=(char)0x05;
886 }
887 else if(basbuf[i3]=='1'){
888 //Until
889
890 //jne 5(ループ終了)
891 OpBuffer[obp++]=(char)0x75;
892 OpBuffer[obp++]=(char)0x05;
893 }
894 }
895 break;
896 }
897 }
898
899 //jmp ...
900 OpBuffer[obp++]=(char)0xE9;
901 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
902 obp+=sizeof(long);
903
904 //jmp ...
905 OpBuffer[obp++]=(char)0xE9;
906 int je_schedule=obp;
907 obp+=sizeof(long);
908
909 //レキシカルスコープをレベルダウン
910 obj_LexScopes.End();
911
912 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jmpジャンプ先のオフセット値
913
914
915 //Continueアドレスを復元
916 dwContinueAddress=dwTempContinue;
917}
918void OpcodeContinue(void){
919 extern DWORD dwContinueAddress;
920
921 if(dwContinueAddress==-1){
922 SetError(12,"Continue",cp);
923 return;
924 }
925
926 //jmp ...(Continue addr)
927 OpBuffer[obp++]=(char)0xE9;
928
929 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
930 obp+=sizeof(long);
931}
932
933void OpcodeExitSub(void){
934 extern DWORD *pExitSubSchedule;
935 extern int ExitSubScheduleNum;
936 extern HANDLE hHeap;
937
938 if( UserProc::IsGlobalAreaCompiling() ){
939 SetError(12,"Exit Sub/Function",cp);
940 return;
941 }
942
943 //未解放のローカルオブジェクトのデストラクタを呼び出す
944 obj_LexScopes.CallDestructorsOfReturn();
945
946 //jmp ...(End Sub/Function)
947 OpBuffer[obp++]=(char)0xE9;
948
949 pExitSubSchedule=(DWORD *)HeapReAlloc(hHeap,0,pExitSubSchedule,(ExitSubScheduleNum+1)*sizeof(DWORD));
950 pExitSubSchedule[ExitSubScheduleNum]=obp;
951 ExitSubScheduleNum++;
952
953 obp+=sizeof(long);
954}
955
956void AddCaseSchedule(void){
957 extern DWORD *pCaseSchedule;
958 extern int CaseScheduleNum;
959 extern HANDLE hHeap;
960
961 pCaseSchedule=(DWORD *)HeapReAlloc(hHeap,0,pCaseSchedule,(CaseScheduleNum+1)*sizeof(DWORD));
962 pCaseSchedule[CaseScheduleNum]=obp;
963 CaseScheduleNum++;
964}
965
966int CaseTypeSize;
967void OpcodeSelect(const char *lpszParms){
968 extern DWORD *pCaseSchedule;
969 extern int CaseScheduleNum;
970 extern int NowCaseSchedule;
971 extern int CaseTypeSize;
972 extern HANDLE hHeap;
973 extern char *basbuf;
974 int i,i2,i3,sw,NowCaseCp;
975 char temporary[VN_SIZE];
976
977 DWORD *temp_pCaseSchedule;
978 int temp_CaseScheduleNum;
979 int temp_NowCaseSchedule;
980 int temp_CaseTypeSize;
981
982 temp_pCaseSchedule=pCaseSchedule;
983 temp_CaseScheduleNum=CaseScheduleNum;
984 temp_NowCaseSchedule=NowCaseSchedule;
985 temp_CaseTypeSize=CaseTypeSize;
986 pCaseSchedule=(DWORD *)HeapAlloc(hHeap,0,1);
987 CaseScheduleNum=0;
988 NowCaseSchedule=0;
989
990 Type type1;
991 if( !NumOpe(lpszParms,Type(), type1 ) ){
992 return;
993 }
994
995 CaseTypeSize = type1.GetSize();
996 if( CaseTypeSize < sizeof(long) ){
997 CaseTypeSize=sizeof(long);
998 }
999
1000 for(i=cp,sw=0;;i++){
1001 if(basbuf[i]=='\0'){
1002 HeapDefaultFree(pCaseSchedule);
1003 pCaseSchedule=temp_pCaseSchedule;
1004 CaseScheduleNum=temp_CaseScheduleNum;
1005 NowCaseSchedule=temp_NowCaseSchedule;
1006 CaseTypeSize=temp_CaseTypeSize;
1007 SetError(22,"Select",cp);
1008 return;
1009 }
1010 if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE){
1011 for(i2=0;;i++){
1012 if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE) i2++;
1013 if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT){
1014 i2--;
1015 if(i2==0) break;
1016 }
1017 }
1018 continue;
1019 }
1020 if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT){
1021 if(sw==0){
1022 //add esp,CaseTypeSize
1023 op_add_esp(CaseTypeSize);
1024 }
1025 break;
1026 }
1027 if(basbuf[i]==1&&basbuf[i+1]==ESC_CASE){
1028 NowCaseCp=i;
1029
1030 i++;
1031 while(1){
1032 for(i++,i2=0;;i++,i2++){
1033 if(basbuf[i]=='\"'){
1034 i3=GetStringInQuotation(temporary+i2,basbuf+i);
1035 i+=i3-1;
1036 i2+=i3-1;
1037 continue;
1038 }
1039 if(basbuf[i]=='('){
1040 i3=GetStringInPare(temporary+i2,basbuf+i);
1041 i+=i3-1;
1042 i2+=i3-1;
1043 continue;
1044 }
1045 if(basbuf[i]=='['){
1046 i3=GetStringInBracket(temporary+i2,basbuf+i);
1047 i+=i3-1;
1048 i2+=i3-1;
1049 continue;
1050 }
1051
1052 if(IsCommandDelimitation(basbuf[i])){
1053 temporary[i2]=0;
1054 break;
1055 }
1056 if(basbuf[i]==','){
1057 temporary[i2]=0;
1058 break;
1059 }
1060
1061 temporary[i2]=basbuf[i];
1062 }
1063
1064 //エラー用
1065 i2=cp;
1066 cp=NowCaseCp;
1067
1068 Type type2;
1069 if( !NumOpe(temporary,type1,type2) ){
1070 return;
1071 }
1072
1073 cp=i2;
1074
1075 if(type1.IsObject()){
1076 std::vector<UserProc *> subs;
1077 type1.GetClass().GetMethods().Enum( CALC_EQUAL, subs );
1078 if( subs.size() == 0 ){
1079 return;
1080 }
1081
1082 Parameters params;
1083 params.push_back( new Parameter( "", Type( type2 ) ) );
1084
1085 //オーバーロードを解決
1086 UserProc *pUserProc;
1087 pUserProc=OverloadSolution("==",subs, params, NULL);
1088
1089 delete params[0];
1090
1091 if(!pUserProc){
1092 //エラー
1093 return;
1094 }
1095
1096
1097 //pop edx
1098 op_pop(REG_EDX);
1099
1100 //mov ecx,dword ptr[esp]
1101 op_mov_RM(sizeof(long),REG_ECX,REG_ESP,0,MOD_BASE);
1102
1103 //push edx
1104 op_push(REG_EDX);
1105
1106 //push ecx
1107 op_push(REG_ECX);
1108
1109 //call operator_proc ※ ==演算子
1110 op_call(pUserProc);
1111
1112 //test eax,eax
1113 op_test(REG_EAX,REG_EAX);
1114
1115 //jne ...
1116 OpBuffer[obp++]=(char)0x0F;
1117 OpBuffer[obp++]=(char)0x85;
1118 AddCaseSchedule();
1119 obp+=sizeof(long);
1120 }
1121 else if(type1.IsDouble()){
1122 ChangeTypeToDouble(type2.GetBasicType());
1123
1124 //fld qword ptr[esp]
1125 op_fld_ptr_esp(DEF_DOUBLE);
1126
1127 //add esp,CaseTypeSize
1128 op_add_esp(CaseTypeSize);
1129
1130 //fld qword ptr[esp]
1131 op_fld_ptr_esp(DEF_DOUBLE);
1132
1133 //fcompp
1134 OpBuffer[obp++]=(char)0xDE;
1135 OpBuffer[obp++]=(char)0xD9;
1136
1137 //fnstsw ax
1138 OpBuffer[obp++]=(char)0xDF;
1139 OpBuffer[obp++]=(char)0xE0;
1140
1141 //test ah,40
1142 OpBuffer[obp++]=(char)0xF6;
1143 OpBuffer[obp++]=(char)0xC4;
1144 OpBuffer[obp++]=(char)0x40;
1145
1146 //jne ...
1147 OpBuffer[obp++]=(char)0x0F;
1148 OpBuffer[obp++]=(char)0x85;
1149 AddCaseSchedule();
1150 obp+=sizeof(long);
1151 }
1152 else if(type1.IsSingle()){
1153 ChangeTypeToSingle(type2.GetBasicType());
1154
1155 //fld dword ptr[esp]
1156 op_fld_ptr_esp(DEF_SINGLE);
1157
1158 //add esp,CaseTypeSize
1159 op_add_esp(CaseTypeSize);
1160
1161 //fld dword ptr[esp]
1162 op_fld_ptr_esp(DEF_SINGLE);
1163
1164 //fcompp
1165 OpBuffer[obp++]=(char)0xDE;
1166 OpBuffer[obp++]=(char)0xD9;
1167
1168 //fnstsw ax
1169 OpBuffer[obp++]=(char)0xDF;
1170 OpBuffer[obp++]=(char)0xE0;
1171
1172 //test ah,40
1173 OpBuffer[obp++]=(char)0xF6;
1174 OpBuffer[obp++]=(char)0xC4;
1175 OpBuffer[obp++]=(char)0x40;
1176
1177 //jne ...
1178 OpBuffer[obp++]=(char)0x0F;
1179 OpBuffer[obp++]=(char)0x85;
1180 AddCaseSchedule();
1181 obp+=sizeof(long);
1182 }
1183 else{
1184 //その他整数型
1185
1186 //pop ebx
1187 op_pop(REG_EBX);
1188
1189 //mov eax,dword ptr[esp]
1190 OpBuffer[obp++]=(char)0x8B;
1191 OpBuffer[obp++]=(char)0x04;
1192 OpBuffer[obp++]=(char)0x24;
1193
1194 //cmp eax,ebx
1195 OpBuffer[obp++]=(char)0x3B;
1196 OpBuffer[obp++]=(char)0xC3;
1197
1198 //je ...
1199 OpBuffer[obp++]=(char)0x0F;
1200 OpBuffer[obp++]=(char)0x84;
1201 AddCaseSchedule();
1202 obp+=sizeof(long);
1203 }
1204
1205 if(basbuf[i]!=',') break;
1206 }
1207 }
1208 if(basbuf[i]==1&&basbuf[i+1]==ESC_CASEELSE){
1209 sw=1;
1210
1211 //jmp ...
1212 OpBuffer[obp++]=(char)0xE9;
1213 AddCaseSchedule();
1214 obp+=sizeof(long);
1215 }
1216 }
1217
1218 //レキシカルスコープをレベルアップ
1219 obj_LexScopes.Start( obp, SCOPE_TYPE_SELECT );
1220
1221 //Select Case内をコンパイル
1222 CompileBuffer(ESC_ENDSELECT,0);
1223
1224 //jmp EndSelect
1225 OpBuffer[obp++]=(char)0xE9;
1226 AddCaseSchedule();
1227 obp+=sizeof(long);
1228
1229 //最終スケジュール
1230 for(i=NowCaseSchedule;i<CaseScheduleNum;i++){
1231 *(long *)(OpBuffer+pCaseSchedule[i])=obp-(pCaseSchedule[i]+sizeof(long));
1232 }
1233 HeapDefaultFree(pCaseSchedule);
1234
1235 //レキシカルスコープをレベルダウン
1236 obj_LexScopes.End();
1237
1238 pCaseSchedule=temp_pCaseSchedule;
1239 CaseScheduleNum=temp_CaseScheduleNum;
1240 NowCaseSchedule=temp_NowCaseSchedule;
1241 CaseTypeSize=temp_CaseTypeSize;
1242}
1243void OpcodeCase(char *Parameter){
1244 extern DWORD *pCaseSchedule;
1245 extern int NowCaseSchedule;
1246 extern int CaseTypeSize;
1247 int i;
1248
1249 if(!pCaseSchedule){
1250 SetError(30,"Case",cp);
1251 return;
1252 }
1253
1254 //jmp EndSelect
1255 OpBuffer[obp++]=(char)0xE9;
1256 AddCaseSchedule();
1257 obp+=sizeof(long);
1258
1259 i=0;
1260 while(1){
1261 //Caseスケジュール
1262 *(long *)(OpBuffer+pCaseSchedule[NowCaseSchedule])=obp-(pCaseSchedule[NowCaseSchedule]+sizeof(long));
1263 NowCaseSchedule++;
1264
1265 i=JumpOneParameter(Parameter,i);
1266 if(Parameter[i]=='\0') break;
1267 }
1268
1269 //add esp,CaseTypeSize
1270 op_add_esp(CaseTypeSize);
1271}
1272
1273void OpcodeGosub(char *Parameter){
1274 extern HANDLE hHeap;
1275 extern GOTOLABELSCHEDULE *pGotoLabelSchedule;
1276 extern int GotoLabelScheduleNum;
1277 int i,LineNum;
1278
1279 if(Parameter[0]=='*'){
1280 i=GetLabelAddress(Parameter+1,0);
1281
1282 //call ...
1283 OpBuffer[obp++]=(char)0xE8;
1284 if(i==-1){
1285 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
1286 pGotoLabelSchedule[GotoLabelScheduleNum].pName=(char *)HeapAlloc(hHeap,0,lstrlen(Parameter+1)+1);
1287 lstrcpy(pGotoLabelSchedule[GotoLabelScheduleNum].pName,Parameter+1);
1288 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
1289 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
1290 GotoLabelScheduleNum++;
1291 }
1292 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
1293 obp+=sizeof(long);
1294 }
1295 else{
1296 LineNum=atoi(Parameter);
1297 i=GetLabelAddress(0,LineNum);
1298
1299 //call ...
1300 OpBuffer[obp++]=(char)0xE8;
1301 if(i==-1){
1302 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
1303 pGotoLabelSchedule[GotoLabelScheduleNum].pName=0;
1304 pGotoLabelSchedule[GotoLabelScheduleNum].line=LineNum;
1305 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
1306 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
1307 GotoLabelScheduleNum++;
1308 }
1309 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
1310 obp+=sizeof(long);
1311 }
1312}
1313void OpcodeReturn(char *Parameter){
1314 if( UserProc::IsGlobalAreaCompiling() ){
1315 //Gosub~Returnとして扱う
1316
1317 //ret
1318 op_ret();
1319 }
1320 else{
1321 //戻り値をセット
1322 if(Parameter[0]){
1323 UserProc &proc = UserProc::CompilingUserProc();
1324
1325 const char *temp = "_System_ReturnValue";
1326 if(proc.GetName()[0]==1&&proc.GetName()[1]==ESC_OPERATOR)
1327 {
1328 }
1329 else{
1330 temp=proc.GetName().c_str();
1331 }
1332
1333 char temporary[VN_SIZE];
1334 sprintf(temporary,"%s=%s",temp,Parameter);
1335 OpcodeCalc(temporary);
1336 }
1337
1338 //プロシージャを抜け出す(C言語のreturnと同様の処理を行う)
1339 OpcodeExitSub();
1340 }
1341}
1342
1343
1344////////////
1345// ポインタ
1346
1347void OpcodeSetPtrData(char *Parameter,int type){
1348 int i;
1349 char temporary[VN_SIZE];
1350
1351 if(Parameter[0]=='('){
1352 i=JumpStringInPare(Parameter,1);
1353 if(Parameter[i+1]=='\0'){
1354 for(i=0;;i++){
1355 Parameter[i]=Parameter[i+1];
1356 if(Parameter[i]=='\0') break;
1357 }
1358 Parameter[i-1]=0;
1359 }
1360 }
1361
1362 //第1パラメータを取得
1363 i=GetOneParameter(Parameter,0,temporary);
1364 if(!Parameter[i]){
1365 SetError(1,NULL,cp);
1366 return;
1367 }
1368
1369 Type resultType;
1370 if( !NumOpe(temporary,Type(),resultType) ){
1371 return;
1372 }
1373 if(!resultType.IsWhole()){
1374 SetError(11,Parameter,cp);
1375 return;
1376 }
1377
1378 ChangeTypeToLong( resultType.GetBasicType() );
1379
1380 //第2パラメータを取得
1381 i=GetOneParameter(Parameter,i,temporary);
1382 if(Parameter[i]){
1383 SetError(1,NULL,cp);
1384 return;
1385 }
1386
1387 if( !NumOpe(temporary,Type(),resultType) ){
1388 return;
1389 }
1390
1391 if(type==DEF_DOUBLE){
1392 ChangeTypeToDouble_ToFpuReg( resultType.GetBasicType() );
1393
1394 //pop eax
1395 op_pop(REG_EAX);
1396
1397 //fstp qword ptr[eax]
1398 OpBuffer[obp++]=(char)0xDD;
1399 OpBuffer[obp++]=(char)0x18;
1400 }
1401 else if(type==DEF_SINGLE){
1402 ChangeTypeToSingle( resultType.GetBasicType() );
1403
1404 //pop ebx
1405 op_pop(REG_EBX);
1406
1407 //pop eax
1408 op_pop(REG_EAX);
1409
1410 //mov dword ptr[eax],ebx
1411 OpBuffer[obp++]=(char)0x89;
1412 OpBuffer[obp++]=(char)0x18;
1413 }
1414 else if(type==DEF_QWORD){
1415 ChangeTypeToInt64( resultType.GetBasicType() );
1416
1417 //pop ecx
1418 op_pop(REG_ECX);
1419
1420 //pop ebx
1421 op_pop(REG_EBX);
1422
1423 //pop eax
1424 op_pop(REG_EAX);
1425
1426 //mov dword ptr[eax],ecx
1427 OpBuffer[obp++]=(char)0x89;
1428 OpBuffer[obp++]=(char)0x08;
1429
1430 //mov dword ptr[eax+sizeof(long)],ebx
1431 OpBuffer[obp++]=(char)0x89;
1432 OpBuffer[obp++]=(char)0x58;
1433 OpBuffer[obp++]=(char)0x04;
1434 }
1435 else if(type==DEF_DWORD){
1436 ChangeTypeToLong( resultType.GetBasicType() );
1437
1438 //pop ebx
1439 op_pop(REG_EBX);
1440
1441 //pop eax
1442 op_pop(REG_EAX);
1443
1444 //mov dword ptr[eax],ebx
1445 OpBuffer[obp++]=(char)0x89;
1446 OpBuffer[obp++]=(char)0x18;
1447 }
1448 else if(type==DEF_WORD){
1449 ChangeTypeToLong( resultType.GetBasicType() );
1450
1451 //pop ebx
1452 op_pop(REG_EBX);
1453
1454 //pop eax
1455 op_pop(REG_EAX);
1456
1457 //mov word ptr[eax],bx
1458 OpBuffer[obp++]=(char)0x66;
1459 OpBuffer[obp++]=(char)0x89;
1460 OpBuffer[obp++]=(char)0x18;
1461 }
1462 else if(type==DEF_BYTE){
1463 ChangeTypeToLong( resultType.GetBasicType() );
1464
1465 //pop ebx
1466 op_pop(REG_EBX);
1467
1468 //pop eax
1469 op_pop(REG_EAX);
1470
1471 //mov byte ptr[eax],bl
1472 OpBuffer[obp++]=(char)0x88;
1473 OpBuffer[obp++]=(char)0x18;
1474 }
1475}
Note: See TracBrowser for help on using the repository browser.