Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #define _TOKR_
  2.  
  3.  
  4.  
  5. #include "tok.h"
  6.  
  7.  
  8.  
  9. char useasm=FALSE;
  10.  
  11. char asmparam=FALSE;
  12.  
  13. #include "asmnemon.h"
  14.  
  15.  
  16.  
  17. void asmtwo1(int basecode); // used for ADD ADC SUB SBB CMP AND OR XOR.
  18.  
  19. void asmregmem(int out1,int out2); // used for LEA LDS LES LFS LGS LSS.
  20.  
  21. void Scanbit(int basecode);
  22.  
  23. void CheckBit(int code);
  24.  
  25. void asmone1(int basecode);                     // used for INC and DEC.
  26.  
  27. void asmone2(int basecode);                     // used for NEG NOT MUL IMUL DIV IDIV.
  28.  
  29. void asmshortjump(int shortcode,int nearcode);
  30.  
  31. void lar_lsl(int code);
  32.  
  33. unsigned char tabldeckr(int code);
  34.  
  35. void protectinstr(int code,int code2);
  36.  
  37. void doasmmov();                 // do MOV
  38.  
  39. void asmextend(int basecode);   // procedure MOVSX and MOVZX
  40.  
  41. void movd();
  42.  
  43. void movq();
  44.  
  45. void packMMX(int code,int code1,int code2);
  46.  
  47. void asmshift(int basecode);                    // used for ROL ROR RCL RCR SHL SAL SHR SAR.
  48.  
  49. void Shxd(int code);
  50.  
  51. void FpuType1(unsigned int addrm);
  52.  
  53. void FpuType2(unsigned int addrm,unsigned int addrm2);
  54.  
  55. void FpuType3(unsigned int opcode,unsigned int addrm);
  56.  
  57. void FpuType4(unsigned int opcode,unsigned int addrm);
  58.  
  59. void FpuType5(unsigned int opcode,unsigned int addrm);
  60.  
  61. void FpuType6(unsigned int opcode,unsigned int addrm);
  62.  
  63. void FpuType7(unsigned int addrm);
  64.  
  65. void FpuType8(unsigned int opcode,unsigned int addrm);
  66.  
  67. void addlocaljump(int callkind);
  68.  
  69. unsigned long SaveNumber(int type,int tok4,char *name);
  70.  
  71. void cmov(int num);
  72.  
  73. void mmxiii(int type);
  74.  
  75. void prefetch(int code, int type);
  76.  
  77. void pextrw();
  78.  
  79. void pinsrw();
  80.  
  81. void pshufw();
  82.  
  83. void xmminstr(int type,int sec,int op1=tk_xmmreg,int op2=tk_xmmreg);
  84.  
  85. void xmm3instr(int type,int sec);
  86.  
  87. void xmm2xmm(int code,int code2=0,int type=tk_xmmreg);
  88.  
  89. void movxmm(int code,int code2,int addc=1);
  90.  
  91. void movxmm2(int code,int code2=0);
  92.  
  93. void movxmm3(int code,int code2=0,int type=tk_xmmreg);
  94.  
  95. void movxmm4(int code,int code2);
  96.  
  97. void shiftxmm(int rm);  //rxmm,i8
  98.  
  99. void DDDW(int faradd);
  100.  
  101. void AADM(int code);
  102.  
  103.  
  104.  
  105. extern void shortjumperror();
  106.  
  107. extern void invalidfarjumpitem();
  108.  
  109. extern void invalidfarcallitem();
  110.  
  111. extern void bytedxexpected();
  112.  
  113. extern void axalexpected();
  114.  
  115. extern void clornumberexpected();
  116.  
  117. extern void reg32regexpected(int type);
  118.  
  119. extern void begexpected(int type);
  120.  
  121. extern void regexpected(int type);
  122.  
  123. extern void invalidoperand(int type);
  124.  
  125. extern void mmxregexpected(int type=0);
  126.  
  127. extern void mmxregordwordexpected(int type);
  128.  
  129. extern void mmxormem(int type);
  130.  
  131. extern void reg32orword(int type);
  132.  
  133. extern void xmmregorvarexpected(int type);
  134.  
  135. extern void xmmregexpected(int type);
  136.  
  137. extern void fpustakexpected(int type);
  138.  
  139. extern void fpuvarexpected(int type);
  140.  
  141.  
  142.  
  143. void doasm(int nexta)
  144.  
  145. {
  146.  
  147. unsigned char possiblecpu=0,next=1;
  148.  
  149. int htok;
  150.  
  151. ITOK hstok;
  152.  
  153. char *hbuf;
  154.  
  155. SINFO hstr;
  156.  
  157. unsigned int i=0;
  158.  
  159. int razr=r16;
  160.  
  161. unsigned long hnumber;
  162.  
  163. int faradd=0;
  164.  
  165.         if(nexta==FALSE){
  166.  
  167.                 useasm=TRUE;
  168.  
  169.                 nexttok();
  170.  
  171.                 useasm=FALSE;
  172.  
  173.         }
  174.  
  175.         if(tok==tk_idasm){
  176.  
  177.                 htok=itok.rm;
  178.  
  179.                 goto sw_asm;
  180.  
  181.         }
  182.  
  183.         if(tok==tk_ID||tok==tk_id||tok==tk_undefproc){
  184.  
  185.                 if(tok2==tk_colon){     //¬¥âª 
  186.  
  187.                         if(tok==tk_undefproc)doanyundefproc();
  188.  
  189.                         else doid((char)(tok==tk_ID?1:0),tk_void);
  190.  
  191.                         return;
  192.  
  193.                 }
  194.  
  195.                 strupr((char *)string);
  196.  
  197.                 htok=FastSearch((unsigned char *)asmMnem,ofsmnem,0,(char *)string);
  198.  
  199. sw_asm:
  200.  
  201.                 asmparam=TRUE;
  202.  
  203.                 switch(htok){
  204.  
  205.                         case a_add: //ADD
  206.  
  207.                         case a_or:      //OR
  208.  
  209.                         case a_adc: //ADC
  210.  
  211.                         case a_sbb:     //SBB
  212.  
  213.                         case a_and:     //AND
  214.  
  215.                         case a_sub:     //SUB
  216.  
  217.                         case a_xor:     //XOR
  218.  
  219.                         case a_cmp:     //CMP
  220.  
  221.                                 asmtwo1(htok*8);
  222.  
  223.                                 next=0;
  224.  
  225.                                 break;
  226.  
  227.                         case a_not:     //NOT
  228.  
  229.                         case a_neg:     //NEG
  230.  
  231.                         case a_mul:     //MUL
  232.  
  233.                         case a_div:     //DIV
  234.  
  235.                         case a_idiv:    //IDIV
  236.  
  237.                                 asmone2((htok-a_not)*8+16);
  238.  
  239.                                 break;
  240.  
  241.                         case a_rol:     //ROL
  242.  
  243.                         case a_ror:     //ROR
  244.  
  245.                         case a_rcl:     //RCL
  246.  
  247.                         case a_rcr:     //RCR
  248.  
  249.                         case a_shl:     //SHL
  250.  
  251.                         case a_shr:     //SHR
  252.  
  253.                         case a_sar:     //SAR
  254.  
  255.                                 asmshift((htok-a_rol)*8);
  256.  
  257.                                 next=0;
  258.  
  259.                                 break;
  260.  
  261.                         case a_btc:     //BTC
  262.  
  263.                         case a_btr: //BTR
  264.  
  265.                         case a_bts: //BTS
  266.  
  267.                         case a_bt:      //BT
  268.  
  269.                                 CheckBit((htok-a_bt)*8);
  270.  
  271.                                 next=0;
  272.  
  273.                                 break;
  274.  
  275.                         case a_dec:     //DEC
  276.  
  277.                         case a_inc:     //INC
  278.  
  279.                                 asmone1((htok-a_inc)*8);
  280.  
  281.                                 break;
  282.  
  283.                         case a_shrd:    //SHRD
  284.  
  285.                         case a_shld:    //SHLD
  286.  
  287.                                 Shxd((htok-a_shld)*8+0xa4);
  288.  
  289.                                 next=0;
  290.  
  291.                                 break;
  292.  
  293.                         case a_aaa:
  294.  
  295.                                 ClearReg(AX);
  296.  
  297.                                 op(0x37);       //AAA
  298.  
  299.                                 break;
  300.  
  301.                         case a_aad:
  302.  
  303.                                 ClearReg(AX);
  304.  
  305.                                 AADM(0xD5);     //AAD
  306.  
  307.                                 break;
  308.  
  309.                         case a_aam:
  310.  
  311.                                 ClearReg(AX);
  312.  
  313.                                 AADM(0xD4);     //AAM
  314.  
  315.                                 break;
  316.  
  317.                         case a_aas:
  318.  
  319.                                 ClearReg(AX);
  320.  
  321.                                 op(0x3F);       //AAS
  322.  
  323.                                 break;
  324.  
  325.                         case a_adrsiz:
  326.  
  327.                                 op(0x67);
  328.  
  329.                                 possiblecpu=3;
  330.  
  331.                                 break;
  332.  
  333.                         case a_arpl:    //ARPL
  334.  
  335.                                 nexttok();
  336.  
  337.                                 htok=tok;
  338.  
  339.                                 hstok=itok;
  340.  
  341.                                 hbuf=bufrm;
  342.  
  343.                                 bufrm=NULL;
  344.  
  345.                                 hstr=strinf;
  346.  
  347.                                 strinf.bufstr=NULL;
  348.  
  349.                                 nextexpecting2(tk_camma);
  350.  
  351.                                 if(tok!=tk_reg)regexpected(2);
  352.  
  353.                                 switch(htok){
  354.  
  355.                                         case tk_intvar:
  356.  
  357.                                         case tk_wordvar:
  358.  
  359. #ifdef OPTVARCONST
  360.  
  361.                                         ClearVarByNum(&hstok);
  362.  
  363. #endif
  364.  
  365.                                                 CheckAllMassiv(hbuf,2,&hstr,&hstok);
  366.  
  367.                                                 KillVar(hstok.name);
  368.  
  369.                                                 outseg(&hstok,2);
  370.  
  371.                                                 op(0x63);
  372.  
  373.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  374.  
  375.                                                 outaddress(&hstok);
  376.  
  377.                                                 break;
  378.  
  379.                                         case tk_reg:
  380.  
  381.                                                 ClearReg(hstok.number);
  382.  
  383.                                                 op(0x63);
  384.  
  385.                                                 op(192+(unsigned int)itok.number*8+hstok.number);
  386.  
  387.                                                 break;
  388.  
  389.                                         default: wordvalexpected();
  390.  
  391.                                 }
  392.  
  393.                                 possiblecpu=2;
  394.  
  395.                                 break;
  396.  
  397.                         case a_bound:   //BOUND
  398.  
  399.                                 asmregmem(0x62,0);
  400.  
  401.                                 possiblecpu=2;
  402.  
  403.                                 break;
  404.  
  405.                         case a_lea:
  406.  
  407.                                 asmregmem(0x8D,0);      //LEA
  408.  
  409.                                 break;
  410.  
  411.                         case a_lds:     //LDS
  412.  
  413.                         case a_les:     //LES
  414.  
  415.                                 asmregmem(htok-a_les+0xC4,0);
  416.  
  417.                                 break;
  418.  
  419.                         case a_lss:     //LSS
  420.  
  421.                                 asmregmem(0xF,0xB2);
  422.  
  423.                                 possiblecpu=3;
  424.  
  425.                                 break;
  426.  
  427.                         case a_lgs:     //LGS
  428.  
  429.                         case a_lfs:     //LFS
  430.  
  431.                                 asmregmem(0xF,htok-a_lfs+0xB4);
  432.  
  433.                                 possiblecpu=3;
  434.  
  435.                                 break;
  436.  
  437.                         case a_bswap:   //BSWAP
  438.  
  439.                                 nexttok();
  440.  
  441.                                 ClearReg(itok.number);
  442.  
  443.                                 if(tok==tk_reg32||tok==tk_reg){
  444.  
  445.                                         op66(tok==tk_reg?r16:r32);
  446.  
  447.                                         op(0x0F);
  448.  
  449.                                         op(0xC8+(unsigned int)itok.number);
  450.  
  451.                                 }
  452.  
  453.                                 else preerror("Expecting 32 bit Register for BSWAP");
  454.  
  455.                                 possiblecpu=4;
  456.  
  457.                                 break;
  458.  
  459.                         case a_bsf:     //BSF
  460.  
  461.                         case a_bsr:     //BSR
  462.  
  463.                                 Scanbit(htok-a_bsf+0xbc);
  464.  
  465.                                 break;
  466.  
  467.                         case a_call:    //CALL
  468.  
  469.                                 nexttok();
  470.  
  471.                                 htok=0;
  472.  
  473.                                 if(tok==tk_ID||tok==tk_id){
  474.  
  475.                                         if(stricmp("FAR",(char *)string)==0){
  476.  
  477.                                                 nexttok();
  478.  
  479.                                                 faradd=8;
  480.  
  481.                                                 htok=1;
  482.  
  483.                                         }
  484.  
  485.                                         else if(stricmp("NEAR",(char *)string)==0){
  486.  
  487.                                                 nexttok();
  488.  
  489.                                                 htok=1;
  490.  
  491.                                         }
  492.  
  493.                                 }
  494.  
  495.                                 else if(tok==tk_far){
  496.  
  497.                                         nexttok();
  498.  
  499.                                         faradd=8;
  500.  
  501.                                         htok=1;
  502.  
  503.                                 }
  504.  
  505. //                              printf("call %d\n",tok);
  506.  
  507.                                 switch(tok){
  508.  
  509.                                         case tk_proc:
  510.  
  511.                                                 if(faradd==0){
  512.  
  513.                                                         if(itok.segm==DYNAMIC){
  514.  
  515.                                                                 itok.segm=DYNAMIC_USED;
  516.  
  517.                                                                 updatetree();
  518.  
  519.                                                         }
  520.  
  521.                                                         int flag=itok.flag;
  522.  
  523.                                                         if(itok.segm<NOT_DYNAMIC){      //¤¨­ ¬¨ç¥áª ï ¯à®æ¥¤ãà 
  524.  
  525.                                                                 addacall(itok.number,(unsigned char)(am32!=FALSE?CALL_32:CALL_NEAR));
  526.  
  527.                                                                 callloc0();
  528.  
  529.                                                         }
  530.  
  531.                                                         else callloc(itok.number);
  532.  
  533.                                                 }
  534.  
  535.                                                 else invalidfarcallitem();
  536.  
  537.                                                 break;
  538.  
  539.                                         case tk_number:
  540.  
  541.                                                 asmparam=FALSE;
  542.  
  543.                                                 hnumber=doconstdwordmath();
  544.  
  545.                                                 if(faradd==0)callloc(hnumber);
  546.  
  547.                                                 else{
  548.  
  549.                                                         op(0x9A);
  550.  
  551.                                                         expecting2(tk_colon);
  552.  
  553.                                                         unsigned long tempi=doconstdwordmath();
  554.  
  555.                                                         if(am32==FALSE)outword((unsigned int)tempi);
  556.  
  557.                                                         else outdword(tempi);
  558.  
  559.                                                         outword(hnumber);
  560.  
  561.                                                 }
  562.  
  563.                                                 next=0;
  564.  
  565.                                                 break;   /* CALL num */
  566.  
  567.                                         case tk_postnumber:
  568.  
  569.                                                 if(faradd==0){
  570.  
  571.                                                         itok.number=itok.number-outptr-3;
  572.  
  573.                                                         op(0xE8);
  574.  
  575.                                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  576.  
  577.                                                         if(am32==FALSE)outword(itok.number);
  578.  
  579.                                                         else outdword(itok.number-2);
  580.  
  581. /*                                                      op(0xE8);
  582.  
  583.                                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  584.  
  585.                                                         if(am32==FALSE)outword((unsigned int)itok.number);
  586.  
  587.                                                         else outdword(itok.number);*/
  588.  
  589.                                                 }
  590.  
  591.                                                 else invalidfarcallitem();
  592.  
  593.                                                 break;
  594.  
  595.                                         case tk_reg32:
  596.  
  597.                                                 op66(r32);
  598.  
  599.                                                 goto callreg;
  600.  
  601.                                         case tk_reg:
  602.  
  603.                                                 op66(r16);
  604.  
  605. callreg:
  606.  
  607.                                                 if(faradd==0){
  608.  
  609.                                                         op(0xFF);
  610.  
  611.                                                         op(0xD0+(unsigned int)itok.number);
  612.  
  613.                                                 }        /* CALL reg */
  614.  
  615.                                                 else invalidfarcallitem();
  616.  
  617.                                                 break;
  618.  
  619.                                         case tk_ID:
  620.  
  621.                                         case tk_id:
  622.  
  623.                                                 if(faradd==0){
  624.  
  625.                                                         tobedefined(am32==FALSE?CALL_NEAR:CALL_32,tk_void);
  626.  
  627.                                                         callloc0();
  628.  
  629.                                                 }                /* CALL NEAR */
  630.  
  631.                                                 else invalidfarcallitem();
  632.  
  633.                                                 break;
  634.  
  635.                                         case tk_declare:
  636.  
  637.                                                 tok=tk_undefproc;
  638.  
  639.                                                 updatetree();
  640.  
  641.                                         case tk_locallabel:
  642.  
  643.                                         case tk_undefproc:
  644.  
  645.                                                 if(faradd==0){
  646.  
  647.                                                         addacall((unsigned int)itok.number,
  648.  
  649. (unsigned char)((itok.flag&f_extern)!=0?CALL_EXT:(am32==FALSE?CALL_NEAR:CALL_32)));
  650.  
  651.                                                         callloc0();
  652.  
  653.                                                 }                       /* CALL NEAR */
  654.  
  655.                                                 else invalidfarcallitem();
  656.  
  657.                                                 break;
  658.  
  659.                                         case tk_dwordvar:
  660.  
  661.                                         case tk_longvar:
  662.  
  663.                                                 i=2;
  664.  
  665.                                                 if(am32==FALSE&&htok==0)faradd=8;
  666.  
  667.                                         case tk_intvar:
  668.  
  669.                                         case tk_wordvar:
  670.  
  671.                                                 i+=2;
  672.  
  673.                                                 CheckAllMassiv(bufrm,i,&strinf);
  674.  
  675.                                                 outseg(&itok,2);
  676.  
  677.                                                 op(0xFF); op(0x10+itok.rm+faradd);
  678.  
  679.                                                 outaddress(&itok);
  680.  
  681.                                                 break;
  682.  
  683.                                         default:
  684.  
  685.                                                 preerror("Invalid item for CALL");
  686.  
  687.                                                 break;
  688.  
  689.                                 }
  690.  
  691. #ifdef OPTVARCONST
  692.  
  693.                                 FreeGlobalConst();
  694.  
  695. #endif
  696.  
  697.                                 clearregstat();
  698.  
  699.                                 break;
  700.  
  701.                         case a_cbw:
  702.  
  703.                                 ClearReg(AX);
  704.  
  705.                                 if(am32)op(0x66);
  706.  
  707.                                 op(0x98);       //CBW
  708.  
  709.                                 break;
  710.  
  711.                         case a_cdq:
  712.  
  713.                                 ClearReg(DX);
  714.  
  715.                                 op66(r32);
  716.  
  717.                                 op(0x99);
  718.  
  719.                                 possiblecpu=3;  //CDQ
  720.  
  721.                                 break;
  722.  
  723.                         case a_clc:
  724.  
  725.                                 op(0xF8);       //CLC
  726.  
  727.                                 break;
  728.  
  729.                         case a_cld:
  730.  
  731.                                 op(0xFC);       //CLD
  732.  
  733.                                 break;
  734.  
  735.                         case a_cli:
  736.  
  737.                                 op(0xFA);       //CLI
  738.  
  739.                                 break;
  740.  
  741.                         case a_clts:    //CLTS
  742.  
  743.                                 outword(0x060F);
  744.  
  745.                                 possiblecpu=2;
  746.  
  747.                                 break;
  748.  
  749.                         case a_cmc:
  750.  
  751.                                 op(0xF5);       //CMC
  752.  
  753.                                 break;
  754.  
  755.                         case a_cmpsb:
  756.  
  757.                                 ClearReg(SI);
  758.  
  759.                                 ClearReg(DI);
  760.  
  761.                                 op(0xA6);
  762.  
  763.                                 break;
  764.  
  765.                         case a_cmpsw:
  766.  
  767.                                 ClearReg(SI);
  768.  
  769.                                 ClearReg(DI);
  770.  
  771.                                 op66(r16);
  772.  
  773.                                 op(0xA7);
  774.  
  775.                                 break;
  776.  
  777.                         case a_cmpsd:
  778.  
  779.                                 if(ScanTok3()==tk_camma&&tok2==tk_xmmreg){
  780.  
  781.                                         xmm3instr(0xC2,0xF2);
  782.  
  783.                                         possiblecpu=9;
  784.  
  785.                                         next=0;
  786.  
  787.                                 }
  788.  
  789.                                 else{
  790.  
  791.                                         ClearReg(SI);
  792.  
  793.                                         ClearReg(DI);
  794.  
  795.                                         op66(r32);
  796.  
  797.                                         op(0xA7);
  798.  
  799.                                         possiblecpu=3;
  800.  
  801.                                 }
  802.  
  803.                                 break;
  804.  
  805.                         case a_cmpxchg: //CMPXCHG
  806.  
  807.                                 nexttok();
  808.  
  809.                                 htok=tok;
  810.  
  811.                                 hstok=itok;
  812.  
  813.                                 hbuf=bufrm;
  814.  
  815.                                 bufrm=NULL;
  816.  
  817.                                 hstr=strinf;
  818.  
  819.                                 strinf.bufstr=NULL;
  820.  
  821.                                 nextexpecting2(tk_camma);
  822.  
  823.                                 i=r16;
  824.  
  825.                                 ClearReg(AX);
  826.  
  827.                                 switch(htok){
  828.  
  829.                                         case tk_reg32:
  830.  
  831.                                                 i=r32;
  832.  
  833.                                         case tk_reg:
  834.  
  835.                                                 ClearReg(hstok.number);
  836.  
  837.                                                 switch(tok){
  838.  
  839.                                                         case tk_reg32:
  840.  
  841.                                                                 if(i==r16)goto erreg;
  842.  
  843.                                                         case tk_reg:
  844.  
  845.                                                                 op66(i);
  846.  
  847.                                                                 outword(0xB10F);
  848.  
  849.                                                                 op(128+64+(unsigned int)itok.number*8+hstok.number);
  850.  
  851.                                                                 break;
  852.  
  853.                                                         case tk_longvar:
  854.  
  855.                                                         case tk_dwordvar:
  856.  
  857.                                                                 if(i==r16)goto erreg;
  858.  
  859.                                                         case tk_intvar:
  860.  
  861.                                                         case tk_wordvar:
  862.  
  863. #ifdef OPTVARCONST
  864.  
  865.                                                                 ClearVarByNum(&itok);
  866.  
  867. #endif
  868.  
  869.                                                                 CheckAllMassiv(bufrm,i,&strinf);
  870.  
  871.                                                                 op66(i);
  872.  
  873.                                                                 outseg(&itok,3);
  874.  
  875.                                                                 outword(0xB10F);
  876.  
  877.                                                                 op(itok.rm+hstok.number*8);
  878.  
  879.                                                                 outaddress(&itok);
  880.  
  881.                                                                 break;
  882.  
  883.                                                         default:
  884.  
  885. erreg:
  886.  
  887.                                                                 if(i==r16)wordvalexpected();
  888.  
  889.                                                                 else dwordvalexpected();
  890.  
  891.                                                                 break;
  892.  
  893.                                                 }
  894.  
  895.                                                 break;
  896.  
  897.                                         case tk_beg:
  898.  
  899.                                                 ClearReg(hstok.number);
  900.  
  901.                                                 switch(tok){
  902.  
  903.                                                         case tk_beg:
  904.  
  905.                                                                 outword(0xB00F);
  906.  
  907.                                                                 op(128+64+(unsigned int)itok.number*8+hstok.number);
  908.  
  909.                                                                 break;
  910.  
  911.                                                         case tk_charvar:
  912.  
  913.                                                         case tk_bytevar:
  914.  
  915.                                                                 CheckAllMassiv(bufrm,1,&strinf);
  916.  
  917.                                                                 outseg(&itok,3);
  918.  
  919.                                                                 outword(0xB00F);
  920.  
  921.                                                                 op(itok.rm+hstok.number*8);
  922.  
  923.                                                                 outaddress(&itok);
  924.  
  925.                                                                 break;
  926.  
  927.                                                         default: bytevalexpected(2);
  928.  
  929.                                                                 break;
  930.  
  931.                                                 }
  932.  
  933.                                                 break;
  934.  
  935.                                         case tk_charvar:
  936.  
  937.                                         case tk_bytevar:
  938.  
  939. #ifdef OPTVARCONST
  940.  
  941.                                                 ClearVarByNum(&hstok);
  942.  
  943. #endif
  944.  
  945.                                                 if(tok!=tk_beg)begexpected(2);
  946.  
  947.                                                 CheckAllMassiv(hbuf,1,&hstr,&hstok);
  948.  
  949.                                                 KillVar(hstok.name);
  950.  
  951.                                                 outseg(&hstok,3);
  952.  
  953.                                                 outword(0xB00F);
  954.  
  955.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  956.  
  957.                                                 outaddress(&hstok);
  958.  
  959.                                                 break;
  960.  
  961.                                         case tk_longvar:
  962.  
  963.                                         case tk_dwordvar:
  964.  
  965.                                                 if(tok!=tk_reg32)reg32expected(2);
  966.  
  967.                                                 i=r32;
  968.  
  969.                                                 goto noint;
  970.  
  971.                                         case tk_intvar:
  972.  
  973.                                         case tk_wordvar:
  974.  
  975.                                                 if(tok!=tk_reg)regexpected(2);
  976.  
  977. noint:
  978.  
  979. #ifdef OPTVARCONST
  980.  
  981.                                                 ClearVarByNum(&hstok);
  982.  
  983. #endif
  984.  
  985.                                                 CheckAllMassiv(hbuf,i,&hstr,&hstok);
  986.  
  987.                                                 KillVar(hstok.name);
  988.  
  989.                                                 op66(i);
  990.  
  991.                                                 outseg(&hstok,3);
  992.  
  993.                                                 outword(0xB10F);
  994.  
  995.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  996.  
  997.                                                 outaddress(&hstok);
  998.  
  999.                                                 break;
  1000.  
  1001.                                         default:
  1002.  
  1003.                                                 varexpected(1);
  1004.  
  1005.                                                 break;
  1006.  
  1007.                                 }
  1008.  
  1009.                                 possiblecpu=4;
  1010.  
  1011.                                 break;
  1012.  
  1013.                         case a_cmpxchg8b:       //CMPXCHG8B
  1014.  
  1015.                                 nexttok();
  1016.  
  1017.                                 if(tok!=tk_qwordvar)qwordvalexpected();
  1018.  
  1019. #ifdef OPTVARCONST
  1020.  
  1021.                                 ClearVarByNum(&itok);
  1022.  
  1023. #endif
  1024.  
  1025.                                 CheckAllMassiv(bufrm,8,&strinf);
  1026.  
  1027.                                 KillVar(itok.name);
  1028.  
  1029.                                 outseg(&itok,3);
  1030.  
  1031.                                 outword(0xc70f);
  1032.  
  1033.                                 op(itok.rm+8);
  1034.  
  1035.                                 outaddress(&itok);
  1036.  
  1037.                                 possiblecpu=5;
  1038.  
  1039.                                 break;
  1040.  
  1041.                         case a_cwd:
  1042.  
  1043.                                 ClearReg(DX);
  1044.  
  1045.                                 op66(r16);
  1046.  
  1047.                                 op(0x99);       //CWD
  1048.  
  1049.                                 break;
  1050.  
  1051.                         case a_cwde:
  1052.  
  1053.                                 ClearReg(AX);
  1054.  
  1055.                                 if(!am32)op(0x66);
  1056.  
  1057.                                 op(0x98);
  1058.  
  1059.                                 possiblecpu=3;
  1060.  
  1061.                                 break;
  1062.  
  1063.                         case a_cpuid:
  1064.  
  1065.                                 ClearReg(AX);
  1066.  
  1067.                                 ClearReg(BX);
  1068.  
  1069.                                 ClearReg(CX);
  1070.  
  1071.                                 ClearReg(DX);
  1072.  
  1073.                                 outword(0xa20f);        //CPUID
  1074.  
  1075.                                 possiblecpu=5;
  1076.  
  1077.                                 break;
  1078.  
  1079.                         case a_daa:
  1080.  
  1081.                                 ClearReg(AX);
  1082.  
  1083.                                 op(0x27);       //DAA
  1084.  
  1085.                                 break;
  1086.  
  1087.                         case a_das:
  1088.  
  1089.                                 ClearReg(AX);
  1090.  
  1091.                                 op(0x2F);       //DAS
  1092.  
  1093.                                 break;
  1094.  
  1095.                         case a_db:      //DB
  1096.  
  1097.                                 dbgact++;
  1098.  
  1099.                                 asmparam=FALSE;
  1100.  
  1101.                                 do{
  1102.  
  1103.                                         i=1;
  1104.  
  1105.                                         nexttok();
  1106.  
  1107.                                         CheckIP();
  1108.  
  1109.                                         if(tok==tk_number){
  1110.  
  1111.                                                 hnumber=doconstdwordmath();
  1112.  
  1113.                                                 if(tok==tk_id&&strcmp((char *)string,"dup")==0){
  1114.  
  1115.                                                         i=hnumber;
  1116.  
  1117.                                                         nexttok();
  1118.  
  1119.                                                         CheckMinusNum();
  1120.  
  1121.                                                         if(tok==tk_number)hnumber=doconstdwordmath();
  1122.  
  1123.                                                         else numexpected();
  1124.  
  1125.                                                 }
  1126.  
  1127.                                                 for(;i!=0;i--)op(hnumber);
  1128.  
  1129.                                         }
  1130.  
  1131.                                         else if(tok==tk_string){
  1132.  
  1133.                                                 for(i=0;i<(unsigned int)itok.number;i++)opd(string[i]);
  1134.  
  1135.                                                 switch(itok.flag&3){
  1136.  
  1137.                                                         case zero_term:
  1138.  
  1139.                                                                 if(itok.flag&s_unicod)opd(0);
  1140.  
  1141.                                                                 opd(0);
  1142.  
  1143.                                                                 break;
  1144.  
  1145.                                                         case dos_term:
  1146.  
  1147.                                                                 if(itok.flag&s_unicod)opd(0);
  1148.  
  1149.                                                                 opd('$');
  1150.  
  1151.                                                                 break;
  1152.  
  1153.                                                 }
  1154.  
  1155.                                                 nexttok();
  1156.  
  1157.                                         }
  1158.  
  1159.                                         else{
  1160.  
  1161.                                                 numexpected();
  1162.  
  1163.                                                 nexttok();
  1164.  
  1165.                                         }
  1166.  
  1167.                                 }while(tok==tk_camma);
  1168.  
  1169.                                 dbgact--;
  1170.  
  1171.                                 next=0;
  1172.  
  1173.                                 break;
  1174.  
  1175.                         case a_dd:      //DD
  1176.  
  1177.                                 faradd++;
  1178.  
  1179.                         case a_dw:      //DW
  1180.  
  1181.                                 DDDW(faradd);
  1182.  
  1183.                                 next=0;
  1184.  
  1185.                                 break;
  1186.  
  1187.                         case a_enter:   //ENTER
  1188.  
  1189.                                 ClearReg(BP);
  1190.  
  1191.                                 op(0xC8);
  1192.  
  1193.                                 nexttok();
  1194.  
  1195.                                 if(tok==tk_number)outword((unsigned int)doconstlongmath());
  1196.  
  1197.                                 else{
  1198.  
  1199.                                         numexpected(1);
  1200.  
  1201.                                         nexttok();
  1202.  
  1203.                                 }
  1204.  
  1205.                                 expecting2(tk_camma);
  1206.  
  1207.                                 if(tok==tk_number)op((int)doconstlongmath());
  1208.  
  1209.                                 else{
  1210.  
  1211.                                         numexpected(2);
  1212.  
  1213.                                         nexttok();
  1214.  
  1215.                                 }
  1216.  
  1217.                                 next=0;
  1218.  
  1219.                                 possiblecpu=2;
  1220.  
  1221.                                 break;
  1222.  
  1223.                         case a_emms:    //EMMS
  1224.  
  1225.                                 outword(0x770f);
  1226.  
  1227.                                 possiblecpu=6;
  1228.  
  1229.                                 break;
  1230.  
  1231.                         case a_imul:    //IMUL
  1232.  
  1233.                                 nexttok();
  1234.  
  1235.                                 if(tok2!=tk_camma){
  1236.  
  1237.                                 ClearReg(AX);
  1238.  
  1239.                                         switch(tok){
  1240.  
  1241.                                                 case tk_reg32:
  1242.  
  1243.                                                         possiblecpu=3;
  1244.  
  1245.                                                         razr=r32;
  1246.  
  1247.                                                 case tk_reg:
  1248.  
  1249.                                                         ClearReg(DX);
  1250.  
  1251.                                                         op66(razr);
  1252.  
  1253.                                                   op(246+1);
  1254.  
  1255.                                                         op(128+64+40+(unsigned int)itok.number);
  1256.  
  1257.                                                         break;
  1258.  
  1259.                                                 case tk_beg:
  1260.  
  1261.                                                         op(246);
  1262.  
  1263.                                                         op(128+64+40+(unsigned int)itok.number);
  1264.  
  1265.                                                         break;
  1266.  
  1267.                                                 case tk_charvar:
  1268.  
  1269.                                                 case tk_bytevar:
  1270.  
  1271.                                                         CheckAllMassiv(bufrm,1,&strinf);
  1272.  
  1273.                                                         outseg(&itok,2);
  1274.  
  1275.                                                         op(246);
  1276.  
  1277.                                                         op(itok.rm+40);
  1278.  
  1279.                                                         outaddress(&itok);
  1280.  
  1281.                                                         break;
  1282.  
  1283.                                                 case tk_longvar:
  1284.  
  1285.                                                 case tk_dwordvar:
  1286.  
  1287.                                                         CheckAllMassiv(bufrm,4,&strinf);
  1288.  
  1289.                                                         possiblecpu=3;
  1290.  
  1291.                                                         razr=r32;
  1292.  
  1293.                                                 case tk_intvar:
  1294.  
  1295.                                                 case tk_wordvar:
  1296.  
  1297.                                                         CheckAllMassiv(bufrm,2,&strinf);
  1298.  
  1299.                                                         ClearReg(DX);
  1300.  
  1301.                                                         op66(razr);
  1302.  
  1303.                                                         outseg(&itok,2);
  1304.  
  1305.                                                         op(247);
  1306.  
  1307.                                                         op(itok.rm+40);
  1308.  
  1309.                                                         outaddress(&itok);
  1310.  
  1311.                                                         break;
  1312.  
  1313.                                                 default: varexpected(1);        break;
  1314.  
  1315.                                         }
  1316.  
  1317.                                 }
  1318.  
  1319.                                 else{
  1320.  
  1321.                                         htok=tok;
  1322.  
  1323.                                         hnumber=itok.number;
  1324.  
  1325.                                         ClearReg(hnumber);
  1326.  
  1327.                                         nextexpecting2(tk_camma);
  1328.  
  1329.                                         possiblecpu=2;
  1330.  
  1331.                                         if(tok2!=tk_camma){
  1332.  
  1333.                                                 switch(tok){
  1334.  
  1335.                                                         case tk_number:
  1336.  
  1337.                                                                 switch(htok){
  1338.  
  1339.                                                                         case tk_reg32:
  1340.  
  1341.                                                                                 possiblecpu=3;
  1342.  
  1343.                                                                                 razr=r32;
  1344.  
  1345.                                                                         case tk_reg:
  1346.  
  1347.                                                                                 op66(razr);
  1348.  
  1349.                                                                                 if(short_ok(itok.number,TRUE))i=2;      //ª®à®âª ï ä®à¬ 
  1350.  
  1351.                                                                                 op(0x69+i);
  1352.  
  1353.                                                                                 op(0xc0+(unsigned int)hnumber+(unsigned int)hnumber*8);
  1354.  
  1355.                                                                                 if(i==2)op(itok.number);
  1356.  
  1357.                                                                                 else{
  1358.  
  1359.                                                                                         if(htok==tk_reg)outword(itok.number);
  1360.  
  1361.                                                                                         else outdword(itok.number);
  1362.  
  1363.                                                                                 }
  1364.  
  1365.                                                                                 break;
  1366.  
  1367.                                                                         default: reg32regexpected(1);
  1368.  
  1369.                                                                 }
  1370.  
  1371.                                                                 break;
  1372.  
  1373.                                                         case tk_reg32:
  1374.  
  1375.                                                                 razr=r32;
  1376.  
  1377.                                                         case tk_reg:
  1378.  
  1379.                                                                 op66(razr);
  1380.  
  1381.                                                                 possiblecpu=3;
  1382.  
  1383.                                                                 if(htok!=tok)reg32regexpected(1);
  1384.  
  1385.                                                                 outword(0xaf0f);
  1386.  
  1387.                                                                 op(0xc0+(unsigned int)itok.number+(unsigned int)hnumber*8);
  1388.  
  1389.                                                                 break;
  1390.  
  1391.                                                         case tk_longvar:
  1392.  
  1393.                                                                 tok++;
  1394.  
  1395.                                                         case tk_dwordvar:
  1396.  
  1397.                                                                 if(htok!=tk_reg32)reg32expected(1);
  1398.  
  1399.                                                                 CheckAllMassiv(bufrm,4,&strinf);
  1400.  
  1401.                                                                 razr=r32;
  1402.  
  1403.                                                                 goto imul1;
  1404.  
  1405.                                                         case tk_intvar:
  1406.  
  1407.                                                                 tok++;
  1408.  
  1409.                                                         case tk_wordvar:
  1410.  
  1411. imul1:
  1412.  
  1413.                                                                 possiblecpu=3;
  1414.  
  1415.                                                                 if(htok!=tk_reg&&(tok==tk_intvar||tok==tk_wordvar))regexpected(1);
  1416.  
  1417.                                                                 CheckAllMassiv(bufrm,2,&strinf);
  1418.  
  1419.                                                                 op66(razr);
  1420.  
  1421.                                                                 outseg(&itok,3);
  1422.  
  1423.                                                                 outword(0xaf0f);
  1424.  
  1425.                                                                 op(itok.rm+hnumber*8);
  1426.  
  1427.                                                                 outaddress(&itok);
  1428.  
  1429.                                                                 break;
  1430.  
  1431.                                                         default: varexpected(2);
  1432.  
  1433.                                                 }
  1434.  
  1435.                                         }
  1436.  
  1437.                                         else{
  1438.  
  1439.                                                 int htok2=tok;
  1440.  
  1441.                                                 hstok=itok;
  1442.  
  1443.                                                 hbuf=bufrm;
  1444.  
  1445.                                                 hstr=strinf;
  1446.  
  1447.                                                 strinf.bufstr=NULL;
  1448.  
  1449.                                                 bufrm=NULL;
  1450.  
  1451.                                                 nextexpecting2(tk_camma);
  1452.  
  1453.                                                 if(tok!=tk_number)numexpected(3);
  1454.  
  1455.                                                 switch(htok2){
  1456.  
  1457.                                                         case tk_reg32:
  1458.  
  1459.                                                                 possiblecpu=3;
  1460.  
  1461.                                                                 razr=r32;
  1462.  
  1463.                                                         case tk_reg:
  1464.  
  1465.                                                                 op66(razr);
  1466.  
  1467.                                                                 if(htok!=htok2)reg32regexpected(2);
  1468.  
  1469.                                                                 if(short_ok(itok.number,TRUE))i=2;      //ª®à®âª ï ä®à¬ 
  1470.  
  1471.                                                                 op(0x69+i);
  1472.  
  1473.                                                                 op(0xc0+(unsigned int)hstok.number+(unsigned int)hnumber*8);
  1474.  
  1475.                                                                 if(i==2)op(itok.number);
  1476.  
  1477.                                                                 else{
  1478.  
  1479.                                                                         if(htok==tk_reg)outword(itok.number);
  1480.  
  1481.                                                                         else outdword(itok.number);
  1482.  
  1483.                                                                 }
  1484.  
  1485.                                                                 break;
  1486.  
  1487.                                                         case tk_longvar:
  1488.  
  1489.                                                                 tok++;
  1490.  
  1491.                                                         case tk_dwordvar:
  1492.  
  1493.                                                                 possiblecpu=3;
  1494.  
  1495.                                                                 if(htok!=tk_reg32)reg32expected(2);
  1496.  
  1497.                                                                 CheckAllMassiv(hbuf,4,&hstr,&hstok);
  1498.  
  1499.                                                                 razr=r32;
  1500.  
  1501.                                                                 goto imul2;
  1502.  
  1503.                                                         case tk_intvar:
  1504.  
  1505.                                                                 tok++;
  1506.  
  1507.                                                         case tk_wordvar:
  1508.  
  1509. imul2:
  1510.  
  1511.                                                                 if(htok!=tk_reg&&(htok2==tk_intvar||htok2==tk_wordvar))regexpected(1);
  1512.  
  1513.                                                                 CheckAllMassiv(hbuf,2,&hstr,&hstok);
  1514.  
  1515.                                                                 op66(razr);
  1516.  
  1517.                                                                 if(short_ok(itok.number,TRUE))i=2;      //ª®à®âª ï ä®à¬ 
  1518.  
  1519.                                                                 outseg(&hstok,2);
  1520.  
  1521.                                                                 op(0x69+i);
  1522.  
  1523.                                                                 op(hstok.rm+hnumber*8);
  1524.  
  1525.                                                                 outaddress(&hstok);
  1526.  
  1527.                                                                 if(i==2)op(itok.number);
  1528.  
  1529.                                                                 else{
  1530.  
  1531.                                                                         if(htok==tk_reg)outword(itok.number);
  1532.  
  1533.                                                                         else outdword(itok.number);
  1534.  
  1535.                                                                 }
  1536.  
  1537.                                                                 break;
  1538.  
  1539.                                                         default: varexpected(2);
  1540.  
  1541.                                                 }
  1542.  
  1543.                                         }
  1544.  
  1545.                                 }
  1546.  
  1547.                                 break;
  1548.  
  1549.                         case a_in:      //IN
  1550.  
  1551.                                 ClearReg(AX);
  1552.  
  1553.                                 nexttok();
  1554.  
  1555.                                 if((tok==tk_reg||tok==tk_reg32)&&(unsigned int)itok.number==AX){
  1556.  
  1557.                                         op66(tok==tk_reg?r16:r32);
  1558.  
  1559.                                         if(tok==tk_reg32)possiblecpu=3;
  1560.  
  1561.                                         nexttok();
  1562.  
  1563.                                         expecting(tk_camma);
  1564.  
  1565.                                         if(tok==tk_number){
  1566.  
  1567.                                                 op(0xE5);
  1568.  
  1569.                                                 asmparam=FALSE;
  1570.  
  1571.                                                 if((hnumber=doconstdwordmath())>255)bytedxexpected();
  1572.  
  1573.                                                 op(hnumber);
  1574.  
  1575.                                                 next = 0;
  1576.  
  1577.                                         }
  1578.  
  1579.                                         else if(tok==tk_reg&&(unsigned int)itok.number==DX)op(0xED);
  1580.  
  1581.                                         else bytedxexpected();
  1582.  
  1583.                                 }
  1584.  
  1585.                                 else if(tok==tk_beg&&(unsigned int)itok.number==AL){
  1586.  
  1587.                                         nexttok();
  1588.  
  1589.                                         expecting(tk_camma);
  1590.  
  1591.                                         if(tok==tk_number){
  1592.  
  1593.                                                 op(0xE4);
  1594.  
  1595.                                                 asmparam=FALSE;
  1596.  
  1597.                                                 if((hnumber=doconstdwordmath())>255)bytedxexpected();
  1598.  
  1599.                                                 op(hnumber);
  1600.  
  1601.                                                 next=0;
  1602.  
  1603.                                         }
  1604.  
  1605.                                         else if(tok==tk_reg&&(unsigned int)itok.number==DX)op(0xEC);
  1606.  
  1607.                                         else bytedxexpected();
  1608.  
  1609.                                 }
  1610.  
  1611.                                 else axalexpected();
  1612.  
  1613.                                 break;
  1614.  
  1615.                         case a_insb:    //INSB
  1616.  
  1617.                                 ClearReg(AX);
  1618.  
  1619.                                 ClearReg(DI);
  1620.  
  1621.                                 op(0x6C);
  1622.  
  1623.                                 possiblecpu=2;
  1624.  
  1625.                                 break;
  1626.  
  1627.                         case a_insw:    //INSW
  1628.  
  1629.                                 op66(r16);
  1630.  
  1631.                                 possiblecpu=2;
  1632.  
  1633.                                 goto insd;
  1634.  
  1635.                                 break;
  1636.  
  1637.                         case a_insd:    //INSD
  1638.  
  1639.                                 op66(r32);
  1640.  
  1641.                                 possiblecpu=3;
  1642.  
  1643. insd:
  1644.  
  1645.                                 op(0x6D);
  1646.  
  1647.                                 ClearReg(AX);
  1648.  
  1649.                                 ClearReg(DI);
  1650.  
  1651.                                 break;
  1652.  
  1653.                         case a_int:     //INT
  1654.  
  1655.                                 clearregstat();
  1656.  
  1657.                                 nexttok();
  1658.  
  1659.                                 if(tok==tk_number){
  1660.  
  1661.                                         asmparam=FALSE;
  1662.  
  1663.                                         htok=doconstlongmath();
  1664.  
  1665.                                         if(htok==3)op(0xCC);
  1666.  
  1667.                                         else{
  1668.  
  1669.                                                 op(0xCD);
  1670.  
  1671.                                                 op(htok);
  1672.  
  1673.                                         }
  1674.  
  1675.                                         next=0;
  1676.  
  1677.                                 }
  1678.  
  1679.                                 else numexpected();
  1680.  
  1681.                                 break;
  1682.  
  1683.                         case a_into:
  1684.  
  1685.                                 op(0xCE);       //INTO
  1686.  
  1687.                                 break;
  1688.  
  1689.                         case a_invd:    //INVD
  1690.  
  1691.                                 outword(0x080F);
  1692.  
  1693.                                 possiblecpu=4;
  1694.  
  1695.                                 break;
  1696.  
  1697.                         case a_invlpg:  //INVLPG
  1698.  
  1699.                                 nexttok();
  1700.  
  1701.                                 switch(tok){
  1702.  
  1703.                                         case tk_longvar:
  1704.  
  1705.                                         case tk_dwordvar:
  1706.  
  1707.                                                 CheckAllMassiv(bufrm,4,&strinf);
  1708.  
  1709.                                                 goto invlgp;
  1710.  
  1711.                                         case tk_intvar:
  1712.  
  1713.                                         case tk_wordvar:
  1714.  
  1715.                                                 CheckAllMassiv(bufrm,2,&strinf);
  1716.  
  1717. invlgp:
  1718.  
  1719.                                                 outseg(&itok,3);
  1720.  
  1721.                                                 outword(0x010F);
  1722.  
  1723.                                                 op(itok.rm+0x38);
  1724.  
  1725.                                                 outaddress(&itok);
  1726.  
  1727.                                                 break;
  1728.  
  1729.  
  1730.  
  1731.                                         case tk_undefofs:
  1732.  
  1733.                                                 strcpy(hstok.name,itok.name);
  1734.  
  1735.                                                 tok=tk_number;
  1736.  
  1737.                                         case tk_number:
  1738.  
  1739.                                                 hnumber=doconstdwordmath();
  1740.  
  1741.                                                 outword(0x010f);
  1742.  
  1743.                                                 op((am32==FALSE?rm_d16:rm_d32)+0x38);
  1744.  
  1745.                                                 if(postnumflag&f_reloc)AddReloc();
  1746.  
  1747.                                                 if(htok==tk_undefofs)AddUndefOff(2,hstok.name);
  1748.  
  1749.                                                 if(am32)outdword(hnumber);
  1750.  
  1751.                                                 else outword(hnumber);
  1752.  
  1753.                                                 next=0;
  1754.  
  1755.                                                 break;
  1756.  
  1757.                                         case tk_postnumber:
  1758.  
  1759.                                                 outword(0x010F);
  1760.  
  1761.                                                 op((am32==FALSE?rm_d16:rm_d32)+0x38);
  1762.  
  1763.                                                 (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  1764.  
  1765.                                                 if(am32==FALSE)outword(itok.number);    //¡ë«® 0
  1766.  
  1767.                                                 outdword(itok.number);
  1768.  
  1769.                                                 break;
  1770.  
  1771.  
  1772.  
  1773.                                         default:
  1774.  
  1775.                                                 varexpected(0); break;
  1776.  
  1777.                                 }
  1778.  
  1779.                                 possiblecpu=4;
  1780.  
  1781.                                 break;
  1782.  
  1783.                         case a_iret:
  1784.  
  1785. #ifdef OPTVARCONST
  1786.  
  1787.                                 ClearLVIC();
  1788.  
  1789. #endif
  1790.  
  1791.                                 RestoreStack();
  1792.  
  1793.                                 clearregstat();
  1794.  
  1795.                                 op66(r16);
  1796.  
  1797.                                 op(0xCF);       //IRET
  1798.  
  1799.                                 break;
  1800.  
  1801.                         case a_iretd:
  1802.  
  1803. #ifdef OPTVARCONST
  1804.  
  1805.                                 ClearLVIC();
  1806.  
  1807. #endif
  1808.  
  1809.                                 RestoreStack();
  1810.  
  1811.                                 clearregstat();
  1812.  
  1813.                                 op66(r32);
  1814.  
  1815.                                 op(0xCF);       //IRETD
  1816.  
  1817.                                 break;
  1818.  
  1819.                         case a_jo:
  1820.  
  1821.                         case a_jno:
  1822.  
  1823.                         case a_jc:
  1824.  
  1825.                         case a_jnc:
  1826.  
  1827.                         case a_jz:
  1828.  
  1829.                         case a_jnz:
  1830.  
  1831.                         case a_jna:
  1832.  
  1833.                         case a_ja:
  1834.  
  1835.                         case a_js:
  1836.  
  1837.                         case a_jns:
  1838.  
  1839.                         case a_jp:
  1840.  
  1841.                         case a_jnp:
  1842.  
  1843.                         case a_jl:
  1844.  
  1845.                         case a_jnl:
  1846.  
  1847.                         case a_jng:
  1848.  
  1849.                         case a_jg:
  1850.  
  1851.                                 RestoreStack();
  1852.  
  1853.                                 asmshortjump((htok-a_jo)+0x70,(htok-a_jo)+0x80);
  1854.  
  1855.                                 next=0;
  1856.  
  1857.                                 break;
  1858.  
  1859.                         case a_jecxz:   //JECXZ
  1860.  
  1861.                                 RestoreStack();
  1862.  
  1863.                                 op67(r32);
  1864.  
  1865.                                 asmshortjump(0xE3,0);
  1866.  
  1867.                                 next=0;
  1868.  
  1869.                                 break;
  1870.  
  1871.                         case a_jcxz:    //JCXZ
  1872.  
  1873.                                 RestoreStack();
  1874.  
  1875.                                 op67(r16);
  1876.  
  1877.                                 asmshortjump(0xE3,0);
  1878.  
  1879.                                 next=0;
  1880.  
  1881.                                 break;
  1882.  
  1883.                         case a_jmp:     //JMP
  1884.  
  1885.                                 RestoreStack();
  1886.  
  1887.                                 nexttok();
  1888.  
  1889.                                 faradd=0;
  1890.  
  1891.                                 lastcommand=tk_goto;
  1892.  
  1893.                                 if(stricmp("FAR",itok.name)==0){
  1894.  
  1895.                                         nexttok();
  1896.  
  1897.                                         faradd=8;
  1898.  
  1899.                                 }
  1900.  
  1901.                                 else if(stricmp("NEAR",itok.name)==0)nexttok();
  1902.  
  1903.                                 else if(stricmp("SHORT",itok.name)==0){  // case insensitive
  1904.  
  1905.                                         nexttok();
  1906.  
  1907.                                         next=(unsigned char)GOTO();
  1908.  
  1909.                                         break;
  1910.  
  1911.                                 }
  1912.  
  1913.                                 next=gotol(faradd);
  1914.  
  1915.                                 break;
  1916.  
  1917.                         case a_lahf:
  1918.  
  1919.                                 ClearReg(AX);
  1920.  
  1921.                                 op(0x9F);       //LAHF
  1922.  
  1923.                                 break;
  1924.  
  1925.                         case a_lar:     //LAR
  1926.  
  1927.                         case a_lsl:     //LSL
  1928.  
  1929.                                 lar_lsl(htok-a_lar+2);
  1930.  
  1931.                                 break;
  1932.  
  1933.                         case a_leave:   //LEAVE
  1934.  
  1935.                                 RestoreStack();
  1936.  
  1937.                                 op(0xC9);
  1938.  
  1939.                                 ClearReg(BP);
  1940.  
  1941.                                 possiblecpu = 2;
  1942.  
  1943.                                 break;
  1944.  
  1945.                         case a_lmsw:
  1946.  
  1947.                                 protectinstr(1,0x30);   //LMSW
  1948.  
  1949.                                 break;
  1950.  
  1951.                         case a_loadall: // LOADALL 80286 only
  1952.  
  1953.                                 outword(0x050F);
  1954.  
  1955.                                 possiblecpu=2;
  1956.  
  1957.                                 break;
  1958.  
  1959.                         case a_lodsb:
  1960.  
  1961.                                 ClearReg(SI);
  1962.  
  1963.                                 ClearReg(AX);
  1964.  
  1965.                                 op(0xAC);       //LODSB
  1966.  
  1967.                                 break;
  1968.  
  1969.                         case a_lodsw:
  1970.  
  1971.                                 op66(r16);
  1972.  
  1973.                                 ClearReg(SI);
  1974.  
  1975.                                 ClearReg(AX);
  1976.  
  1977.                                 op(0xAD);       //LODSW
  1978.  
  1979.                                 break;
  1980.  
  1981.                         case a_lodsd:
  1982.  
  1983.                                 op66(r32);
  1984.  
  1985.                                 ClearReg(SI);
  1986.  
  1987.                                 ClearReg(AX);
  1988.  
  1989.                                 op(0xAD);
  1990.  
  1991.                                 possiblecpu =3; //LODSD
  1992.  
  1993.                                 break;
  1994.  
  1995.                         case a_lock:
  1996.  
  1997.                                 op(0xF0);       //LOCK
  1998.  
  1999.                                 break;
  2000.  
  2001.                         case a_loop:
  2002.  
  2003.                                 ConstToReg(0,CX,(am32+1)*2);
  2004.  
  2005.                                 op67(r16);
  2006.  
  2007.                                 asmshortjump(0xE2,0);
  2008.  
  2009.                                 next=0;
  2010.  
  2011.                                 break;
  2012.  
  2013.                         case a_loopd:
  2014.  
  2015.                                 ConstToReg(0,CX,r32);
  2016.  
  2017.                                 possiblecpu=3;
  2018.  
  2019.                                 op67(r32);
  2020.  
  2021.                                 asmshortjump(0xE2,0);
  2022.  
  2023.                                 next=0;
  2024.  
  2025.                                 break;
  2026.  
  2027.                         case a_loopz:   //LOOPE LOOPZ
  2028.  
  2029.                                 ClearReg(CX);
  2030.  
  2031.                                 asmshortjump(0xE1,0);
  2032.  
  2033.                                 next=0;
  2034.  
  2035.                                 break;
  2036.  
  2037.                         case a_loopnz:  //LOOPNZ LOOPNE
  2038.  
  2039.                                 ClearReg(CX);
  2040.  
  2041.                                 asmshortjump(0xE0,0);
  2042.  
  2043.                                 next=0;
  2044.  
  2045.                                 break;
  2046.  
  2047.                         case a_ltr:
  2048.  
  2049.                                 protectinstr(0,0x18);   //LTR
  2050.  
  2051.                                 break;
  2052.  
  2053.                         case a_str:
  2054.  
  2055.                                 protectinstr(0,0x08);   //STR
  2056.  
  2057.                                 break;
  2058.  
  2059.                         case a_lgdt:
  2060.  
  2061.                                 next=tabldeckr(0x10);
  2062.  
  2063.                                 break;
  2064.  
  2065.                         case a_lidt:    //LIDT
  2066.  
  2067.                                 next=tabldeckr(0x18);
  2068.  
  2069.                                 break;
  2070.  
  2071.                         case a_lldt:
  2072.  
  2073.                                 protectinstr(0,0x10);   //LLDT
  2074.  
  2075.                                 break;
  2076.  
  2077.                         case a_mov:
  2078.  
  2079.                                 doasmmov();
  2080.  
  2081.                                 next=0;
  2082.  
  2083.                                 break;
  2084.  
  2085.                         case a_movsb:
  2086.  
  2087.                                 movsb();        //MOVSB
  2088.  
  2089.                                 break;
  2090.  
  2091.                         case a_movsd:
  2092.  
  2093.                                 if(ScanTok3()==tk_camma&&(tok2==tk_xmmreg||(tok2>=tk_charvar&&tok2<tk_qwordvar))){
  2094.  
  2095.                                         movxmm(0x10,0xf2);
  2096.  
  2097.                                         possiblecpu=9;
  2098.  
  2099.                                 }
  2100.  
  2101.                                 else movsd();   //MOVSD
  2102.  
  2103.                                 break;
  2104.  
  2105.                         case a_movsw:
  2106.  
  2107.                                 movsw();        //MOVSW
  2108.  
  2109.                                 break;
  2110.  
  2111.                         case a_movzx:
  2112.  
  2113.                         case a_movsx:
  2114.  
  2115.                                 asmextend((htok-a_movzx)*8+0xB6);
  2116.  
  2117.                                 break;
  2118.  
  2119.                         case a_movd:
  2120.  
  2121.                                 movd(); //MOVD
  2122.  
  2123.                                 break;
  2124.  
  2125.                         case a_movq:
  2126.  
  2127.                                 movq(); //MOVQ
  2128.  
  2129.                                 break;
  2130.  
  2131.                         case a_nop:
  2132.  
  2133.                                 op(0x90);       //NOP
  2134.  
  2135.                                 break;
  2136.  
  2137.                         case a_opsiz:   //OPSIZ OPSIZE
  2138.  
  2139.                                 op(0x66);
  2140.  
  2141.                                 possiblecpu=3;
  2142.  
  2143.                                 break;
  2144.  
  2145.                         case a_out:     //OUT
  2146.  
  2147.                                 nexttok();
  2148.  
  2149.                                 if(tok==tk_number){
  2150.  
  2151.                                         if((hnumber=doconstdwordmath())>255)bytedxexpected();
  2152.  
  2153.                                         expecting2(tk_camma);
  2154.  
  2155.                                         if((tok==tk_reg||tok==tk_reg32)&&(unsigned int)itok.number==AX){
  2156.  
  2157.                                                 op66(tok==tk_reg?r16:r32);
  2158.  
  2159.                                                 if(tok==tk_reg32)possiblecpu=3;
  2160.  
  2161.                                                 op(0xE7);       op(hnumber);
  2162.  
  2163.                                         }
  2164.  
  2165.                                         else if(tok==tk_beg&&(unsigned int)itok.number==AL){
  2166.  
  2167.                                                 op(0xE6);       op(hnumber);
  2168.  
  2169.                                         }
  2170.  
  2171.                                         else axalexpected();
  2172.  
  2173.                                 }
  2174.  
  2175.                                 else if(tok==tk_reg&&(unsigned int)itok.number==DX){
  2176.  
  2177.                                         nextexpecting2(tk_camma);
  2178.  
  2179.                                         if((tok==tk_reg||tok==tk_reg32)&&(unsigned int)itok.number==AX){
  2180.  
  2181.                                                 op66(tok==tk_reg?r16:r32);
  2182.  
  2183.                                                 if(tok==tk_reg32)possiblecpu=3;
  2184.  
  2185.                                                 op(0xEF);
  2186.  
  2187.                                         }
  2188.  
  2189.                                         else if(tok==tk_beg&&(unsigned int)itok.number==AL)op(0xEE);
  2190.  
  2191.                                         else axalexpected();
  2192.  
  2193.                                 }
  2194.  
  2195.                                 else bytedxexpected();
  2196.  
  2197.                                 break;
  2198.  
  2199.                         case a_outsb:   //OUTSB
  2200.  
  2201.                                 ClearReg(SI);
  2202.  
  2203.                                 op(0x6E);
  2204.  
  2205.                                 possiblecpu=2;
  2206.  
  2207.                                 break;
  2208.  
  2209.                         case a_outsw:   //OUTSW
  2210.  
  2211.                                 ClearReg(SI);
  2212.  
  2213.                                 op66(r16);
  2214.  
  2215.                                 op(0x6F);
  2216.  
  2217.                                 possiblecpu=2;
  2218.  
  2219.                                 break;
  2220.  
  2221.                         case a_outsd:   //OUTSD
  2222.  
  2223.                                 ClearReg(SI);
  2224.  
  2225.                                 op66(r32);
  2226.  
  2227.                                 op(0x6F);
  2228.  
  2229.                                 possiblecpu=3;
  2230.  
  2231.                                 break;
  2232.  
  2233.                         case a_pop:     //POP
  2234.  
  2235.                                 RestoreStack();
  2236.  
  2237.                                 do{
  2238.  
  2239.                                         possiblecpu=0;
  2240.  
  2241.                                         asmparam=TRUE;
  2242.  
  2243.                                         nexttok();
  2244.  
  2245.                                         razr=r16;
  2246.  
  2247.                                         switch(tok){
  2248.  
  2249.                                                 case tk_reg32:
  2250.  
  2251.                                                         possiblecpu=3;
  2252.  
  2253.                                                         razr=r32;
  2254.  
  2255.                                                 case tk_reg:
  2256.  
  2257.                                                         ClearReg(itok.number);
  2258.  
  2259.                                                         op66(razr);
  2260.  
  2261.                                                   op(0x58+(unsigned int)itok.number); break;
  2262.  
  2263.                                                 case tk_dwordvar:
  2264.  
  2265.                                                         tok--;
  2266.  
  2267.                                                 case tk_longvar:
  2268.  
  2269.                                                         CheckAllMassiv(bufrm,4,&strinf);
  2270.  
  2271.                                                         possiblecpu=3;
  2272.  
  2273.                                                         razr=r32;
  2274.  
  2275.                                                         goto pop;
  2276.  
  2277.                                                 case tk_wordvar:
  2278.  
  2279.                                                         tok--;
  2280.  
  2281.                                                 case tk_intvar:
  2282.  
  2283.                                                         CheckAllMassiv(bufrm,2,&strinf);
  2284.  
  2285. pop:
  2286.  
  2287. #ifdef OPTVARCONST
  2288.  
  2289.                                                         ClearVarByNum(&itok);
  2290.  
  2291. #endif
  2292.  
  2293.                                                         KillVar(itok.name);
  2294.  
  2295.                                                         op66(razr);
  2296.  
  2297.                                                         outseg(&itok,2);
  2298.  
  2299.                                                         op(0x8F);       op(itok.rm);
  2300.  
  2301.                                                         outaddress(&itok);
  2302.  
  2303.                                                         break;
  2304.  
  2305.                                                 case tk_seg:
  2306.  
  2307.                                                         if(itok.number!=CS){
  2308.  
  2309.                                                                 PopSeg((unsigned int)itok.number);
  2310.  
  2311.                                                                 break;
  2312.  
  2313.                                                         }
  2314.  
  2315.                                                 default:
  2316.  
  2317.                                                         preerror("Invalid operand for POP");
  2318.  
  2319.                                                         break;
  2320.  
  2321.                                         }
  2322.  
  2323.                                         if(cpu<possiblecpu)cpu=possiblecpu;
  2324.  
  2325.                                         asmparam=FALSE;
  2326.  
  2327.                                         addESP-=razr==r16?2:4;
  2328.  
  2329.                                         nexttok();
  2330.  
  2331.                                 }while(tok==tk_camma);
  2332.  
  2333.                                 next=0;
  2334.  
  2335.                                 break;
  2336.  
  2337.                         case a_popa:    //POPA
  2338.  
  2339.                                 razr=r16;
  2340.  
  2341.                                 possiblecpu=2;
  2342.  
  2343.                                 goto POPAD;
  2344.  
  2345.                         case a_popad:   //POPAD
  2346.  
  2347.                                 razr=r32;
  2348.  
  2349.                                 possiblecpu=3;
  2350.  
  2351. POPAD:
  2352.  
  2353.                                 op66(razr);
  2354.  
  2355.                                 addESP-=razr==r16?16:32;
  2356.  
  2357.                                 RestoreStack();
  2358.  
  2359.                                 clearregstat();
  2360.  
  2361.                                 op(0x61);
  2362.  
  2363.                                 break;
  2364.  
  2365.                         case a_popf:
  2366.  
  2367.                                 razr=r16;
  2368.  
  2369.                                 goto POPFD;
  2370.  
  2371.                         case a_popfd:   //POPFD
  2372.  
  2373.                                 razr=r32;
  2374.  
  2375.                                 possiblecpu = 3;
  2376.  
  2377. POPFD:
  2378.  
  2379.                                 op66(razr);
  2380.  
  2381.                                 addESP-=razr==r16?2:4;
  2382.  
  2383.                                 RestoreStack();
  2384.  
  2385.                                 op(0x9D);
  2386.  
  2387.                                 break;
  2388.  
  2389.                         case a_push:    //PUSH
  2390.  
  2391.                                 RestoreStack();
  2392.  
  2393.                                 do{
  2394.  
  2395.                                         asmparam=TRUE;
  2396.  
  2397.                                         nexttok();
  2398.  
  2399.                                         if((razr=Push())==FALSE)preerror("Invalid operand for PUSH");
  2400.  
  2401.                                         asmparam=FALSE;
  2402.  
  2403.                                         addESP+=razr==r16?2:4;
  2404.  
  2405.                                 }while(tok==tk_camma);
  2406.  
  2407.                                 next=0;
  2408.  
  2409.                                 break;
  2410.  
  2411.                         case a_pusha:   //PUSHA
  2412.  
  2413.                                 razr=r16;
  2414.  
  2415.                                 possiblecpu=2;
  2416.  
  2417.                                 goto PUSHAD;
  2418.  
  2419.                         case a_pushad:  //PUSHAD
  2420.  
  2421.                                 razr=r32;
  2422.  
  2423.                                 possiblecpu=3;
  2424.  
  2425. PUSHAD:
  2426.  
  2427.                                 op66(razr);
  2428.  
  2429.                                 addESP+=razr==r16?16:32;
  2430.  
  2431.                                 RestoreStack();
  2432.  
  2433.                                 op(0x60);
  2434.  
  2435.                                 break;
  2436.  
  2437.                         case a_pushf:
  2438.  
  2439.                                 razr=r16;
  2440.  
  2441.                                 goto PUSHFD;
  2442.  
  2443.                         case a_pushfd:  //PUSHFD
  2444.  
  2445.                                 razr=r32;
  2446.  
  2447.                                 possiblecpu=3;
  2448.  
  2449. PUSHFD:
  2450.  
  2451.                                 op66(razr);
  2452.  
  2453.                                 RestoreStack();
  2454.  
  2455.                                 op(0x9C);
  2456.  
  2457.                                 addESP+=razr==r16?2:4;
  2458.  
  2459.                                 break;
  2460.  
  2461.                         case a_pcmpeqd:
  2462.  
  2463.                         case a_pcmpeqw:
  2464.  
  2465.                         case a_pcmpeqb:
  2466.  
  2467.                         case a_packssdw:  //+xmm
  2468.  
  2469.                         case a_punpckhdq:
  2470.  
  2471.                         case a_punpckhwd:
  2472.  
  2473.                         case a_punpckhbw:
  2474.  
  2475.                         case a_packuswb:    //+xmm
  2476.  
  2477.                         case a_pcmpgtd:
  2478.  
  2479.                         case a_pcmpgtw:
  2480.  
  2481.                         case a_pcmpgtb:
  2482.  
  2483.                         case a_packsswb:        //+xmm
  2484.  
  2485.                         case a_punpckldq:
  2486.  
  2487.                         case a_punpcklwd:
  2488.  
  2489.                         case a_punpcklbw:
  2490.  
  2491.                                 mmxiii(htok-a_punpcklbw+0x60);
  2492.  
  2493.                                 break;
  2494.  
  2495.                         case a_pmullw:
  2496.  
  2497.                                 mmxiii(0xD5);   //PMULLW
  2498.  
  2499.                                 break;
  2500.  
  2501.                         case a_pmuludq:
  2502.  
  2503.                                 mmxiii(0xF4);   //PMULUDQ
  2504.  
  2505.                                 break;
  2506.  
  2507.                         case a_psubusb:
  2508.  
  2509.                                 mmxiii(0xD8);   //PSUBUSB
  2510.  
  2511.                                 break;
  2512.  
  2513.                         case a_psubusw:
  2514.  
  2515.                                 mmxiii(0xD9);//PSUBUSW
  2516.  
  2517.                                 break;
  2518.  
  2519.                         case a_pand:    //+xmm
  2520.  
  2521.                                 mmxiii(0xDB);   //PAND
  2522.  
  2523.                                 break;
  2524.  
  2525.                         case a_paddusb: //+xmm
  2526.  
  2527.                                 mmxiii(0xDC);   //PADDUSB
  2528.  
  2529.                                 break;
  2530.  
  2531.                         case a_paddusw: //+xmm
  2532.  
  2533.                                 mmxiii(0xDD);//PADDUSW
  2534.  
  2535.                                 break;
  2536.  
  2537.                         case a_pandn:   //+xmm
  2538.  
  2539.                                 mmxiii(0xDF);//PANDN
  2540.  
  2541.                                 break;
  2542.  
  2543.                         case a_pause:
  2544.  
  2545.                                 outword(0x90F3);
  2546.  
  2547.                                 possiblecpu=9;
  2548.  
  2549.                                 break;
  2550.  
  2551.                         case a_pmulhw:
  2552.  
  2553.                                 mmxiii(0xE5);   //PMULHW
  2554.  
  2555.                                 break;
  2556.  
  2557.                         case a_psubsb:
  2558.  
  2559.                                 mmxiii(0xE8);   //PSUBSB
  2560.  
  2561.                                 break;
  2562.  
  2563.                         case a_psubsw:
  2564.  
  2565.                                 mmxiii(0xE9);//PSUBSW
  2566.  
  2567.                                 break;
  2568.  
  2569.                         case a_por:
  2570.  
  2571.                                 mmxiii(0xEB);   //POR
  2572.  
  2573.                                 break;
  2574.  
  2575.                         case a_paddsb:  //+xmm
  2576.  
  2577.                                 mmxiii(0xEC);   //PADDSB
  2578.  
  2579.                                 break;
  2580.  
  2581.                         case a_paddsw:  //+xmm
  2582.  
  2583.                                 mmxiii(0xED);//PADDSW
  2584.  
  2585.                                 break;
  2586.  
  2587.                         case a_pxor:
  2588.  
  2589.                                 mmxiii(0xEF);   //PXOR
  2590.  
  2591.                                 break;
  2592.  
  2593.                         case a_pmaddwd:
  2594.  
  2595.                                 mmxiii(0xF5);   //PMADDWD
  2596.  
  2597.                                 break;
  2598.  
  2599.                         case a_psubb:
  2600.  
  2601.                                 mmxiii(0xF8);   //PSUBB
  2602.  
  2603.                                 break;
  2604.  
  2605.                         case a_psubw:
  2606.  
  2607.                                 mmxiii(0xF9);//PSUBW
  2608.  
  2609.                                 break;
  2610.  
  2611.                         case a_psubd:
  2612.  
  2613.                                 mmxiii(0xFA);//PSUBD
  2614.  
  2615.                                 break;
  2616.  
  2617.                         case a_psubq:
  2618.  
  2619.                                 mmxiii(0xFB);//PSUBQ
  2620.  
  2621.                                 possiblecpu=9;
  2622.  
  2623.                                 break;
  2624.  
  2625.                         case a_paddb:   //+xmm
  2626.  
  2627.                                 mmxiii(0xFC);   //PADDB
  2628.  
  2629.                                 break;
  2630.  
  2631.                         case a_paddw:   //+xmm
  2632.  
  2633.                                 mmxiii(0xFD);//PADDW
  2634.  
  2635.                                 break;
  2636.  
  2637.                         case a_paddd:   //+xmm
  2638.  
  2639.                                 mmxiii(0xFE);//PADDD
  2640.  
  2641.                                 break;
  2642.  
  2643.                         case a_paddq:   //+xmm
  2644.  
  2645.                                 mmxiii(0xD4);//PADDQ
  2646.  
  2647.                                 possiblecpu=9;
  2648.  
  2649.                                 break;
  2650.  
  2651.  
  2652.  
  2653.                         case a_psrlw:
  2654.  
  2655.                                 packMMX(0xD1,0x71,0xd0);        //PSRLW
  2656.  
  2657.                                 next=0;
  2658.  
  2659.                                 break;
  2660.  
  2661.                         case a_psrld:
  2662.  
  2663.                                 packMMX(0xD2,0x72,0xd0);//PSRLD
  2664.  
  2665.                                 next=0;
  2666.  
  2667.                                 break;
  2668.  
  2669.                         case a_psrlq:
  2670.  
  2671.                                 packMMX(0xD3,0x73,0xd0);//PSRLQ
  2672.  
  2673.                                 next=0;
  2674.  
  2675.                                 break;
  2676.  
  2677.                         case a_psraw:
  2678.  
  2679.                                 packMMX(0xE1,0x71,0xe0);        //PSRAW
  2680.  
  2681.                                 next=0;
  2682.  
  2683.                                 break;
  2684.  
  2685.                         case a_psrad:
  2686.  
  2687.                                 packMMX(0xE2,0x72,0xe0);//PSRAD
  2688.  
  2689.                                 next=0;
  2690.  
  2691.                                 break;
  2692.  
  2693.                         case a_psllw:
  2694.  
  2695.                                 packMMX(0xF1,0x71,0xf0);        //PSLLW
  2696.  
  2697.                                 next=0;
  2698.  
  2699.                                 break;
  2700.  
  2701.                         case a_pslld:
  2702.  
  2703.                                 packMMX(0xF2,0x72,0xf0);//PSLLD
  2704.  
  2705.                                 next=0;
  2706.  
  2707.                                 break;
  2708.  
  2709.                         case a_psllq:
  2710.  
  2711.                                 packMMX(0xF3,0x73,0xf0);//PSLLQ
  2712.  
  2713.                                 next=0;
  2714.  
  2715.                                 break;
  2716.  
  2717.                         case a_pslldq:
  2718.  
  2719.                                 shiftxmm(7);
  2720.  
  2721.                                 next=0;
  2722.  
  2723.                                 possiblecpu=9;
  2724.  
  2725.                                 break;
  2726.  
  2727.                         case a_psrldq:
  2728.  
  2729.                                 shiftxmm(3);
  2730.  
  2731.                                 next=0;
  2732.  
  2733.                                 possiblecpu=9;
  2734.  
  2735.                                 break;
  2736.  
  2737.                         case a_rdmsr:
  2738.  
  2739.                                 ClearReg(AX);
  2740.  
  2741.                                 ClearReg(DX);
  2742.  
  2743.                                 outword(0X320F);
  2744.  
  2745.                                 possiblecpu=5;
  2746.  
  2747.                                 break;
  2748.  
  2749.                         case a_rdtsc:
  2750.  
  2751.                                 outword(0X310F);
  2752.  
  2753.                                 possiblecpu=5;
  2754.  
  2755.                                 break;
  2756.  
  2757.                         case a_rep:
  2758.  
  2759.               op(0xF3);//REP REPE REPZ
  2760.  
  2761.                                 ClearReg(CX);
  2762.  
  2763.                                 break;
  2764.  
  2765.                         case a_repnz:
  2766.  
  2767.               op(0xF2); //REPNE REPNZ
  2768.  
  2769.                                 ClearReg(CX);
  2770.  
  2771.                                 break;
  2772.  
  2773.                         case a_ret:     //RET
  2774.  
  2775. #ifdef OPTVARCONST
  2776.  
  2777.                                 ClearLVIC();
  2778.  
  2779. #endif
  2780.  
  2781.                                 RestoreStack();
  2782.  
  2783.                                 clearregstat();
  2784.  
  2785.                                 next=0;
  2786.  
  2787.                                 if(tok2==tk_number){
  2788.  
  2789. //                                      usedirectiv=TRUE;
  2790.  
  2791.                                         nexttok();
  2792.  
  2793.                                         op(0xC2);
  2794.  
  2795.                                         asmparam=FALSE;
  2796.  
  2797.                                         outword((unsigned int)doconstlongmath());
  2798.  
  2799. //                                      usedirectiv=FALSE;
  2800.  
  2801.                                 }
  2802.  
  2803.                                 else{
  2804.  
  2805.                                         op(0xC3);
  2806.  
  2807.                                         nexttok();
  2808.  
  2809.                                 }
  2810.  
  2811.                                 break;
  2812.  
  2813.                         case a_retf:
  2814.  
  2815. #ifdef OPTVARCONST
  2816.  
  2817.                                 ClearLVIC();
  2818.  
  2819. #endif
  2820.  
  2821.                                 RestoreStack();
  2822.  
  2823.                                 clearregstat();
  2824.  
  2825.                                 next=0;
  2826.  
  2827.                                 if(tok2==tk_number){
  2828.  
  2829.                                         nexttok();
  2830.  
  2831.                                         op(0xCA);
  2832.  
  2833.                                         asmparam=FALSE;
  2834.  
  2835.                                         outword((unsigned int)doconstlongmath());
  2836.  
  2837.                                 }
  2838.  
  2839.                                 else{
  2840.  
  2841.                                         op(0xCB);
  2842.  
  2843.                                         nexttok();
  2844.  
  2845.                                 }//RETF
  2846.  
  2847.                                 break;
  2848.  
  2849.                         case a_rsm:     //RSM
  2850.  
  2851.                                 outword(0Xaa0F);
  2852.  
  2853.                                 possiblecpu=5;
  2854.  
  2855.                                 break;
  2856.  
  2857.                         case a_sahf:
  2858.  
  2859.                                 op(0x9E);       //SAHF
  2860.  
  2861.                                 break;
  2862.  
  2863.                         case a_scasb:
  2864.  
  2865.                                 op(0xAE);       //SCASB
  2866.  
  2867.                                 ClearReg(DI);
  2868.  
  2869.                                 break;
  2870.  
  2871.                         case a_scasw:
  2872.  
  2873.                                 op66(r16);
  2874.  
  2875.                                 op(0xAF);  //SCASW
  2876.  
  2877.                                 ClearReg(DI);
  2878.  
  2879.                                 break;
  2880.  
  2881.                         case a_scasd:   //SCASD
  2882.  
  2883.                                 op66(r32);
  2884.  
  2885.                                 op(0xAF);
  2886.  
  2887.                                 possiblecpu=3;
  2888.  
  2889.                                 ClearReg(DI);
  2890.  
  2891.                                 break;
  2892.  
  2893.                         case a_smsw:
  2894.  
  2895.                                 protectinstr(1,0x20);   //SMSW
  2896.  
  2897.                                 break;
  2898.  
  2899.                         case a_stc:
  2900.  
  2901.                                 op(0xF9);       //STC
  2902.  
  2903.                                 break;
  2904.  
  2905.                         case a_std:
  2906.  
  2907.                                 op(0xFD);       //STD
  2908.  
  2909.                                 break;
  2910.  
  2911.                         case a_sti:
  2912.  
  2913.                                 op(0xFB);       //STI
  2914.  
  2915.                                 break;
  2916.  
  2917.                         case a_stosb:
  2918.  
  2919.                                 stosb();        //STOSB
  2920.  
  2921.                                 break;
  2922.  
  2923.                         case a_stosw:
  2924.  
  2925.                                 stosw();        //STOSW
  2926.  
  2927.                                 break;
  2928.  
  2929.                         case a_stosd:
  2930.  
  2931.                                 stosd();        //STOSD
  2932.  
  2933.                                 break;
  2934.  
  2935.                         case a_seto:
  2936.  
  2937.                         case a_setno:
  2938.  
  2939.                         case a_setc:
  2940.  
  2941.                         case a_setnc:
  2942.  
  2943.                         case a_setz:
  2944.  
  2945.                         case a_setnz:
  2946.  
  2947.                         case a_setna:
  2948.  
  2949.                         case a_seta:
  2950.  
  2951.                         case a_sets:
  2952.  
  2953.                         case a_setns:
  2954.  
  2955.                         case a_setp:
  2956.  
  2957.                         case a_setnp:
  2958.  
  2959.                         case a_setl:
  2960.  
  2961.                         case a_setnl:
  2962.  
  2963.                         case a_setng:
  2964.  
  2965.                         case a_setg:
  2966.  
  2967.                                 i=htok-a_seto;
  2968.  
  2969.                                 nexttok();
  2970.  
  2971.                                 switch(tok){
  2972.  
  2973.                                         case tk_beg:
  2974.  
  2975.                                                 ClearReg(itok.number%4);
  2976.  
  2977.                                                 op(0xf);
  2978.  
  2979.                                                 op(0x90+i);
  2980.  
  2981.                                                 op(0xc0+(unsigned int)itok.number);
  2982.  
  2983.                                                 break;
  2984.  
  2985.                                         case tk_charvar:
  2986.  
  2987.                                         case tk_bytevar:
  2988.  
  2989.                                                 CheckAllMassiv(bufrm,1,&strinf);
  2990.  
  2991.                                                 KillVar(itok.name);
  2992.  
  2993.                                                 outseg(&itok,3);
  2994.  
  2995.                                                 op(0xf);
  2996.  
  2997.                                                 op(0x90+i);
  2998.  
  2999.                                                 op(itok.rm);
  3000.  
  3001.                                                 outaddress(&itok);
  3002.  
  3003.                                                 break;
  3004.  
  3005.                                         default: bytevalexpected(0);
  3006.  
  3007.                                 }
  3008.  
  3009.                                 possiblecpu=3;
  3010.  
  3011.                                 break;
  3012.  
  3013.                         case a_sgdt:
  3014.  
  3015.                                 next=tabldeckr(0);
  3016.  
  3017.                                 break;
  3018.  
  3019.                         case a_sidt:
  3020.  
  3021.                                 next=tabldeckr(0x8);
  3022.  
  3023.                                 break;
  3024.  
  3025.                         case a_sldt:
  3026.  
  3027.                                 protectinstr(0,0);      //SLDT
  3028.  
  3029.                                 break;
  3030.  
  3031.                         case a_fwait:   //FWAIT
  3032.  
  3033.                         case a_wait:
  3034.  
  3035.                                 fwait();//WAIT
  3036.  
  3037.                                 break;
  3038.  
  3039.                         case a_wbinvd:  //WBINVD
  3040.  
  3041.                                 outword(0x090F);
  3042.  
  3043.                                 possiblecpu=4;
  3044.  
  3045.                                 break;
  3046.  
  3047.                         case a_wrmsr:   //WRMSR
  3048.  
  3049.                                 outword(0x300F);
  3050.  
  3051.                                 possiblecpu=5;
  3052.  
  3053.                                 break;
  3054.  
  3055.                         case a_xadd:    //XADD
  3056.  
  3057.                                 nexttok();
  3058.  
  3059.                                 hstok=itok;
  3060.  
  3061.                                 htok=tok;
  3062.  
  3063.                                 hbuf=bufrm;
  3064.  
  3065.                                 bufrm=NULL;
  3066.  
  3067.                                 hstr=strinf;
  3068.  
  3069.                                 strinf.bufstr=NULL;
  3070.  
  3071.                                 nextexpecting2(tk_camma);
  3072.  
  3073.                                 switch(htok){
  3074.  
  3075.                                         case tk_reg32:
  3076.  
  3077.                                                 razr=r32;
  3078.  
  3079.                                         case tk_reg:
  3080.  
  3081.                                                 switch(tok){
  3082.  
  3083.                                                         case tk_reg32:
  3084.  
  3085.                                                                 if(razr==r16)goto erxreg;
  3086.  
  3087.                                                         case tk_reg:
  3088.  
  3089.                                                                 RegToReg(itok.number,hstok.number,razr);
  3090.  
  3091.                                                                 ClearReg(hstok.number);
  3092.  
  3093.                                                                 op66(razr);
  3094.  
  3095.                                                                 outword(0xC10F);
  3096.  
  3097.                                                                 op(128+64+(unsigned int)itok.number*8+hstok.number);
  3098.  
  3099.                                                                 break;
  3100.  
  3101.                                                         case tk_longvar:
  3102.  
  3103.                                                         case tk_dwordvar:
  3104.  
  3105.                                                                 if(razr==r16)goto erxreg;
  3106.  
  3107.                                                         case tk_intvar:
  3108.  
  3109.                                                         case tk_wordvar:
  3110.  
  3111.                                                                 KillVar(hstok.name);
  3112.  
  3113.                                                                 /*if(bufrm==0&&strinf.bufstr==NULL)*/AddRegVar(hstok.number,razr,&itok);
  3114.  
  3115.                                                                 CheckAllMassiv(bufrm,razr,&strinf);
  3116.  
  3117.                                                                 op66(razr);
  3118.  
  3119.                                                                 outseg(&itok,3);
  3120.  
  3121.                                                                 outword(0xC10F);
  3122.  
  3123.                                                                 op(itok.rm+hstok.number*8);
  3124.  
  3125.                                                                 outaddress(&itok);
  3126.  
  3127.                                                                 break;
  3128.  
  3129.                                                         default:
  3130.  
  3131. erxreg:
  3132.  
  3133.                                                                 wordvalexpected(); break;
  3134.  
  3135.                                                 }
  3136.  
  3137.                                                 break;
  3138.  
  3139.                                         case tk_beg:
  3140.  
  3141.                                                 switch(tok){
  3142.  
  3143.                                                         case tk_beg:
  3144.  
  3145.                                                                 RegToReg(itok.number,hstok.number,r8);
  3146.  
  3147.                                                                 ClearReg(hstok.number%4);
  3148.  
  3149.                                                                 outword(0xC00F);
  3150.  
  3151.                                                                 op(128+64+(unsigned int)itok.number*8+hstok.number);
  3152.  
  3153.                                                                 break;
  3154.  
  3155.                                                         case tk_charvar:
  3156.  
  3157.                                                         case tk_bytevar:
  3158.  
  3159.                                                                 KillVar(hstok.name);
  3160.  
  3161.                                                                 /*if(bufrm==0&&strinf.bufstr==NULL)*/AddRegVar(hstok.number,r8,&itok);
  3162.  
  3163.                                                                 CheckAllMassiv(bufrm,1,&strinf);
  3164.  
  3165.                                                                 outseg(&itok,3);
  3166.  
  3167.                                                                 outword(0xC00F);
  3168.  
  3169.                                                                 op(itok.rm+hstok.number*8);
  3170.  
  3171.                                                                 outaddress(&itok);
  3172.  
  3173.                                                                 break;
  3174.  
  3175.                                                         default: bytevalexpected(2); break;
  3176.  
  3177.                                                 }
  3178.  
  3179.                                                 break;
  3180.  
  3181.                                         case tk_charvar:
  3182.  
  3183.                                         case tk_bytevar:
  3184.  
  3185.                                                 if(tok!=tk_beg)begexpected(2);
  3186.  
  3187.                                                 CheckAllMassiv(hbuf,1,&hstr,&hstok);
  3188.  
  3189.                                                 ClearReg(itok.number);
  3190.  
  3191.                                                 KillVar(hstok.name);
  3192.  
  3193.                                                 outseg(&hstok,3);
  3194.  
  3195.                                                 outword(0xC00F);
  3196.  
  3197.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  3198.  
  3199.                                                 outaddress(&hstok);
  3200.  
  3201.                                                 break;
  3202.  
  3203.                                         case tk_longvar:
  3204.  
  3205.                                         case tk_dwordvar:
  3206.  
  3207.                                                 if(tok!=tk_reg32)reg32expected(2);
  3208.  
  3209.                                                 razr=r32;
  3210.  
  3211.                                                 goto nointxadd;
  3212.  
  3213.                                         case tk_intvar:
  3214.  
  3215.                                         case tk_wordvar:
  3216.  
  3217.                                                 if(tok!=tk_reg)regexpected(1);
  3218.  
  3219. nointxadd:
  3220.  
  3221.                                                 CheckAllMassiv(hbuf,razr,&hstr,&hstok);
  3222.  
  3223.                                                 ClearReg(itok.number);
  3224.  
  3225.                                                 KillVar(hstok.name);
  3226.  
  3227.                                                 op66(razr);
  3228.  
  3229.                                                 outseg(&hstok,3);
  3230.  
  3231.                                                 outword(0xC10F);
  3232.  
  3233.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  3234.  
  3235.                                                 outaddress(&hstok);
  3236.  
  3237.                                                 break;
  3238.  
  3239.                                         default: varexpected(1); break;
  3240.  
  3241.                                 }
  3242.  
  3243.                                 possiblecpu=4;
  3244.  
  3245.                                 break;
  3246.  
  3247.                         case a_xchg:    //XCHG
  3248.  
  3249.                                 nexttok();
  3250.  
  3251.                                 htok=tok;
  3252.  
  3253.                                 hstok=itok;
  3254.  
  3255.                                 hbuf=bufrm;
  3256.  
  3257.                                 bufrm=NULL;
  3258.  
  3259.                                 hstr=strinf;
  3260.  
  3261.                                 strinf.bufstr=NULL;
  3262.  
  3263.                                 nextexpecting2(tk_camma);
  3264.  
  3265.                                 switch(htok){
  3266.  
  3267.                                         case tk_reg32:
  3268.  
  3269.                                                 razr=r32;
  3270.  
  3271.                                                 possiblecpu=3;
  3272.  
  3273.                                         case tk_reg:
  3274.  
  3275.                                                 switch(tok){
  3276.  
  3277.                                                         case tk_reg32:
  3278.  
  3279.                                                                 if(razr==r16)goto erregx;
  3280.  
  3281.                                                         case tk_reg:
  3282.  
  3283.                                                                 op66(razr);
  3284.  
  3285.                                                                 RegSwapReg(hstok.number,itok.number,razr);
  3286.  
  3287.                                                                 if(hstok.number==AX)op(0x90+(unsigned int)itok.number);
  3288.  
  3289.                                                                 else if((unsigned int)itok.number==AX)op(0x90+hstok.number);
  3290.  
  3291.                                                                 else{
  3292.  
  3293.                                                                         op(0x87);
  3294.  
  3295.                                                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  3296.  
  3297.                                                                 }
  3298.  
  3299.                                                                 break;
  3300.  
  3301.                                                         case tk_longvar:
  3302.  
  3303.                                                         case tk_dwordvar:
  3304.  
  3305.                                                                 if(razr==r16)goto erregx;
  3306.  
  3307.                                                         case tk_intvar:
  3308.  
  3309.                                                         case tk_wordvar:
  3310.  
  3311.                                                                 CheckAllMassiv(bufrm,razr,&strinf);
  3312.  
  3313.                                                                 KillVar(itok.name);
  3314.  
  3315.                                                                 IDZToReg(itok.name,hstok.number,razr);
  3316.  
  3317.                                                                 op66(razr);
  3318.  
  3319.                                                                 outseg(&itok,2);
  3320.  
  3321.                                                                 op(0x87);
  3322.  
  3323.                                                                 op(itok.rm+hstok.number*8);
  3324.  
  3325.                                                                 outaddress(&itok);
  3326.  
  3327.                                                                 break;
  3328.  
  3329.                                                         default:
  3330.  
  3331. erregx:
  3332.  
  3333.                                                                 wordvalexpected(); break;
  3334.  
  3335.                                                 }
  3336.  
  3337.                                                 break;
  3338.  
  3339.                                         case tk_beg:
  3340.  
  3341.                                                 switch(tok){
  3342.  
  3343.                                                         case tk_beg:
  3344.  
  3345.                                                                 RegSwapReg(hstok.number,itok.number,r8);
  3346.  
  3347.                                                                 op(0x86);
  3348.  
  3349.                                                                 op(128+64+(unsigned int)itok.number*8+hstok.number);
  3350.  
  3351.                                                                 break;
  3352.  
  3353.                                                         case tk_charvar:
  3354.  
  3355.                                                         case tk_bytevar:
  3356.  
  3357.                                                                 CheckAllMassiv(bufrm,1,&strinf);
  3358.  
  3359.                                                                 KillVar(itok.name);
  3360.  
  3361.                                                                 IDZToReg(itok.name,hstok.number,r8);
  3362.  
  3363.                                                                 outseg(&itok,2);
  3364.  
  3365.                                                                 op(0x86);
  3366.  
  3367.                                                                 op(itok.rm+hstok.number*8);
  3368.  
  3369.                                                                 outaddress(&itok);
  3370.  
  3371.                                                                 break;
  3372.  
  3373.                                                         default: bytevalexpected(2); break;
  3374.  
  3375.                                                 }
  3376.  
  3377.                                                 break;
  3378.  
  3379.                                         case tk_charvar:
  3380.  
  3381.                                         case tk_bytevar:
  3382.  
  3383.                                                 if(tok!=tk_beg)begexpected(2);
  3384.  
  3385.                                                 CheckAllMassiv(hbuf,1,&hstr,&hstok);
  3386.  
  3387.                                                 KillVar(hstok.name);
  3388.  
  3389.                                                 IDZToReg(hstok.name,itok.number,r8);
  3390.  
  3391.                                                 outseg(&hstok,2);
  3392.  
  3393.                                                 op(0x86);
  3394.  
  3395.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  3396.  
  3397.                                                 outaddress(&hstok);
  3398.  
  3399.                                                 break;
  3400.  
  3401.                                         case tk_longvar:
  3402.  
  3403.                                         case tk_dwordvar:
  3404.  
  3405.                                                 razr=r32;
  3406.  
  3407.                                                 possiblecpu=3;
  3408.  
  3409.                                                 if(tok!=tk_reg32)reg32expected(2);
  3410.  
  3411.                                                 goto nointx;
  3412.  
  3413.                                         case tk_intvar:
  3414.  
  3415.                                         case tk_wordvar:
  3416.  
  3417.                                                 if(tok!=tk_reg)regexpected(2);
  3418.  
  3419. nointx:
  3420.  
  3421.                                                 CheckAllMassiv(hbuf,razr,&hstr,&hstok);
  3422.  
  3423.                                                 KillVar(hstok.name);
  3424.  
  3425.                                                 IDZToReg(hstok.name,itok.number,razr);
  3426.  
  3427.                                                 op66(razr);
  3428.  
  3429.                                                 outseg(&hstok,2);
  3430.  
  3431.                                                 op(0x87);
  3432.  
  3433.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  3434.  
  3435.                                                 outaddress(&hstok);
  3436.  
  3437.                                                 break;
  3438.  
  3439.                                         default: varexpected(1); break;
  3440.  
  3441.                                 }
  3442.  
  3443.                                 break;
  3444.  
  3445.                         case a_xlat:
  3446.  
  3447.                                 ClearReg(AX);
  3448.  
  3449.                                 op(0xD7);       //XLAT
  3450.  
  3451.                                 break;
  3452.  
  3453.                         case a_hlt:
  3454.  
  3455.               op(0xF4); //HLT
  3456.  
  3457.                                 break;
  3458.  
  3459.                         case a_verr:
  3460.  
  3461.                                 protectinstr(0,0x20);   //VERR
  3462.  
  3463.                                 break;
  3464.  
  3465.                         case a_verw:
  3466.  
  3467.                                 protectinstr(0,0x28);   //VERW
  3468.  
  3469.                                 break;
  3470.  
  3471.                         case a_test:    //TEST
  3472.  
  3473.                                 if(iTest()==FALSE)invalidoperand(0);
  3474.  
  3475.                                 next=0;
  3476.  
  3477.                                 break;
  3478.  
  3479.                         case a_fcom:    //FCOM
  3480.  
  3481.                                 FpuType1(0x10);
  3482.  
  3483.                                 break;
  3484.  
  3485.                         case a_fcomp:   //FCOMP
  3486.  
  3487.                                 FpuType1(0x18);
  3488.  
  3489.                                 break;
  3490.  
  3491.                         case a_fadd:    //FADD
  3492.  
  3493.                                 FpuType2(0,0);
  3494.  
  3495.                                 break;
  3496.  
  3497.                         case a_fdiv:    //FDIV
  3498.  
  3499.                                 FpuType2(0x38,0x30);
  3500.  
  3501.                                 break;
  3502.  
  3503.                         case a_fdivr:   //FDIVR
  3504.  
  3505.                                 FpuType2(0x30,0x38);
  3506.  
  3507.                                 break;
  3508.  
  3509.                         case a_fmul:    //FMUL
  3510.  
  3511.                                 FpuType2(0x8,0x8);
  3512.  
  3513.                                 break;
  3514.  
  3515.                         case a_fsub:    //FSUB
  3516.  
  3517.                                 FpuType2(0x28,0x20);
  3518.  
  3519.                                 break;
  3520.  
  3521.                         case a_fsubr:   //FSUBR
  3522.  
  3523.                                 FpuType2(0x20,0x28);
  3524.  
  3525.                                 break;
  3526.  
  3527.                         case a_faddp:   //FADDP
  3528.  
  3529.                                 FpuType3(0xDE,0);
  3530.  
  3531.                                 break;
  3532.  
  3533.                         case a_fdivp:   //FDIVP
  3534.  
  3535.                                 FpuType3(0xDE,0x38);
  3536.  
  3537.                                 break;
  3538.  
  3539.                         case a_fdivrp:  //FDIVRP
  3540.  
  3541.                                 FpuType3(0xDE,0x30);
  3542.  
  3543.                                 break;
  3544.  
  3545.                         case a_ffree:   //FFREE
  3546.  
  3547.                                 FpuType3(0xDD,0);
  3548.  
  3549.                                 break;
  3550.  
  3551.                         case a_fmulp:   //FMULP
  3552.  
  3553.                                 FpuType3(0xDE,8);
  3554.  
  3555.                                 break;
  3556.  
  3557.                         case a_fsubp:   //FSUBP
  3558.  
  3559.                                 FpuType3(0xDE,0x28);
  3560.  
  3561.                                 break;
  3562.  
  3563.                         case a_fsubrp:  //FSUBRP
  3564.  
  3565.                                 FpuType3(0xDE,0x20);
  3566.  
  3567.                                 break;
  3568.  
  3569.                         case a_fucom:   //FUCOM
  3570.  
  3571.                                 FpuType3(0xDD,0x20);
  3572.  
  3573.                                 break;
  3574.  
  3575.                         case a_fucomp:  //FUCOMP
  3576.  
  3577.                                 FpuType3(0xDD,0x28);
  3578.  
  3579.                                 break;
  3580.  
  3581.                         case a_fxch:    //FXCH
  3582.  
  3583.                                 FpuType3(0xD9,8);
  3584.  
  3585.                                 break;
  3586.  
  3587.  
  3588.  
  3589.                         case a_fiadd:   //FIADD
  3590.  
  3591.                                 FpuType4(0,0);
  3592.  
  3593.                                 break;
  3594.  
  3595.                         case a_ficom:   //FICOM
  3596.  
  3597.                                 FpuType4(0,0x10);
  3598.  
  3599.                                 break;
  3600.  
  3601.                         case a_ficomp:  //FICOMP
  3602.  
  3603.                                 FpuType4(0,0x18);
  3604.  
  3605.                                 break;
  3606.  
  3607.                         case a_fidiv:   //FIDIV
  3608.  
  3609.                                 FpuType4(0,0x30);
  3610.  
  3611.                                 break;
  3612.  
  3613.                         case a_fidivr:  //FIDIVR
  3614.  
  3615.                                 FpuType4(0,0x38);
  3616.  
  3617.                                 break;
  3618.  
  3619.                         case a_fild:    //FILD
  3620.  
  3621.                                 FpuType4(1,0);
  3622.  
  3623.                                 break;
  3624.  
  3625.                         case a_fimul:   //FIMUL
  3626.  
  3627.                                 FpuType4(0,8);
  3628.  
  3629.                                 break;
  3630.  
  3631.                         case a_fist:    //FIST
  3632.  
  3633.                                 FpuType4(1,0x10);
  3634.  
  3635.                                 break;
  3636.  
  3637.                         case a_fistp:   //FISTP
  3638.  
  3639.                                 FpuType4(1,0x18);
  3640.  
  3641.                                 break;
  3642.  
  3643.                         case a_fisub:   //FISUB
  3644.  
  3645.                                 FpuType4(0,0x20);
  3646.  
  3647.                                 break;
  3648.  
  3649.                         case a_fisubr:  //FISUBR
  3650.  
  3651.                                 FpuType4(0,0x28);
  3652.  
  3653.                                 break;
  3654.  
  3655.  
  3656.  
  3657.                         case a_fld:     //FLD
  3658.  
  3659.                                 FpuType5(0xD9,0);
  3660.  
  3661.                                 break;
  3662.  
  3663.                         case a_fst:     //FST
  3664.  
  3665.                                 FpuType5(0xDD,0x10);
  3666.  
  3667.                                 break;
  3668.  
  3669.                         case a_fstp:    //FSTP
  3670.  
  3671.                                 FpuType5(0xDD,0x18);
  3672.  
  3673.                                 break;
  3674.  
  3675.  
  3676.  
  3677.                         case a_fbld:    //FBLD
  3678.  
  3679.                                 FpuType6(0xDF,0X20);
  3680.  
  3681.                                 break;
  3682.  
  3683.                         case a_fbstp:   //FBSTP
  3684.  
  3685.                                 FpuType6(0xDF,0X30);
  3686.  
  3687.                                 break;
  3688.  
  3689.                         case a_fildq:   //FILDQ
  3690.  
  3691.                                 FpuType6(0xDF,0x28);
  3692.  
  3693.                                 break;
  3694.  
  3695.                         case a_fldenv:  //FLDENV …‡ €‡Œ…Ž‘’ˆ
  3696.  
  3697.                                 FpuType6(0xD9,0x20);
  3698.  
  3699.                                 break;
  3700.  
  3701.                         case a_frstor:  //FRSTOR …‡ €‡Œ…Ž‘’ˆ
  3702.  
  3703.                                 FpuType6(0xDD,0x20);
  3704.  
  3705.                                 break;
  3706.  
  3707.                         case a_fsave:   //FSAVE …‡ €‡Œ…Ž‘’ˆ
  3708.  
  3709.                                 fwait();
  3710.  
  3711.                         case a_fnsave:  //FNSAVE …‡ €‡Œ…Ž‘’ˆ
  3712.  
  3713.                                 FpuType6(0xDD,0x30);
  3714.  
  3715.                                 break;
  3716.  
  3717.                         case a_fstenv:  //FSTENV …‡ €‡Œ…Ž‘’ˆ
  3718.  
  3719.                                 fwait();
  3720.  
  3721.                         case a_fnstenv: //FNSTENV …‡ €‡Œ…Ž‘’ˆ
  3722.  
  3723.                                 FpuType6(0xD9,0x30);
  3724.  
  3725.                                 break;
  3726.  
  3727.  
  3728.  
  3729.                         case a_fldcw:   //FLDCW
  3730.  
  3731.                                 FpuType7(0x28);
  3732.  
  3733.                                 break;
  3734.  
  3735.                         case a_fstcw:   //FSTCW
  3736.  
  3737.                                 fwait();
  3738.  
  3739.                         case a_fnstcw:  //FNSTCW
  3740.  
  3741.                                 FpuType7(0x38);
  3742.  
  3743.                                 break;
  3744.  
  3745.  
  3746.  
  3747.                         case a_f2xm1:
  3748.  
  3749.                                 outword(0xf0d9);        //F2XM1
  3750.  
  3751.                                 possiblecpu=2;
  3752.  
  3753.                                 break;
  3754.  
  3755.                         case a_fabs:
  3756.  
  3757.                                 outword(0xE1D9);        //FABS
  3758.  
  3759.                                 break;
  3760.  
  3761.                         case a_fchs:
  3762.  
  3763.                                 outword(0xE0D9);        //FCHS
  3764.  
  3765.                                 break;
  3766.  
  3767.                         case a_fclex:   //FCLEX
  3768.  
  3769.                                 fwait();
  3770.  
  3771. //                              outword(0xE2DB);
  3772.  
  3773. //                              break;
  3774.  
  3775.                         case a_fnclex:
  3776.  
  3777.                                 outword(0xE2DB);        //FNCLEX
  3778.  
  3779.                                 break;
  3780.  
  3781.                         case a_fcompp:
  3782.  
  3783.                                 outword(0xD9DE);        //FCOMPP
  3784.  
  3785.                                 break;
  3786.  
  3787.                         case a_fcos:    //FCOS
  3788.  
  3789.                                 outword(0xFFD9);
  3790.  
  3791.                                 possiblecpu=3;
  3792.  
  3793.                                 break;
  3794.  
  3795.                         case a_fdecstr:
  3796.  
  3797.                                 outword(0xF6D9);        //FDECSTP
  3798.  
  3799.                                 break;
  3800.  
  3801.                         case a_fdisi:
  3802.  
  3803.                                 fwait();
  3804.  
  3805.                         case a_fndisi:
  3806.  
  3807.                                 outword(0xE1DB);        //FDISI
  3808.  
  3809.                                 break;
  3810.  
  3811.                         case a_feni:
  3812.  
  3813.                                 fwait();
  3814.  
  3815.                         case a_fneni:
  3816.  
  3817.                                 outword(0xE0DB);        //FENI
  3818.  
  3819.                                 break;
  3820.  
  3821.                         case a_fincstr:
  3822.  
  3823.                                 outword(0xF7D9);        //FINCSTP
  3824.  
  3825.                                 break;
  3826.  
  3827.                         case a_finit:           //FINIT
  3828.  
  3829.                                 fwait();
  3830.  
  3831.                         case a_fninit:
  3832.  
  3833.                                 outword(0xE3DB);        //FNINIT
  3834.  
  3835.                                 break;
  3836.  
  3837.                         case a_fldlg2:
  3838.  
  3839.                                 outword(0xECD9);        //FLDLG2
  3840.  
  3841.                                 break;
  3842.  
  3843.                         case a_fldln2:
  3844.  
  3845.                                 outword(0xEDD9);        //FLDLN2
  3846.  
  3847.                                 break;
  3848.  
  3849.                         case a_fldl2e:
  3850.  
  3851.                                 outword(0xEAD9);        //FLDL2E
  3852.  
  3853.                                 break;
  3854.  
  3855.                         case a_fldl2t:
  3856.  
  3857.                                 outword(0xE9D9);        //FLDL2T
  3858.  
  3859.                                 break;
  3860.  
  3861.                         case a_fldpi:
  3862.  
  3863.                                 outword(0xEBD9);        //FLDPI
  3864.  
  3865.                                 break;
  3866.  
  3867.                         case a_fldz:
  3868.  
  3869.                                 outword(0xEED9);        //FLDZ
  3870.  
  3871.                                 break;
  3872.  
  3873.                         case a_fld1:
  3874.  
  3875.                                 outword(0xE8D9);        //FLD1
  3876.  
  3877.                                 break;
  3878.  
  3879.                         case a_fnop:
  3880.  
  3881.                                 outword(0xD0D9);        //FNOP
  3882.  
  3883.                                 break;
  3884.  
  3885.                         case a_fpatan:
  3886.  
  3887.                                 outword(0xF3D9);        //FPATAN
  3888.  
  3889.                                 break;
  3890.  
  3891.                         case a_fprem:
  3892.  
  3893.                                 outword(0xF8D9);        //FPREM
  3894.  
  3895.                                 break;
  3896.  
  3897.                         case a_fprem1:
  3898.  
  3899.                                 outword(0xF5D9);        //FPREM1
  3900.  
  3901.                                 possiblecpu=3;
  3902.  
  3903.                                 break;
  3904.  
  3905.                         case a_fptan:
  3906.  
  3907.                                 outword(0xF2D9);        //FPTAN
  3908.  
  3909.                                 break;
  3910.  
  3911.                         case a_frndint:
  3912.  
  3913.                                 outword(0xFCD9);        //FRNDINT
  3914.  
  3915.                                 break;
  3916.  
  3917.                         case a_fsetpm:
  3918.  
  3919.                                 fwait();
  3920.  
  3921.                         case a_fnsetpm:
  3922.  
  3923.                                 outword(0xE4DB);        //FSETPM
  3924.  
  3925.                                 possiblecpu=2;
  3926.  
  3927.                                 break;
  3928.  
  3929.                         case a_fscale:
  3930.  
  3931.                                 outword(0XFDD9);        //FSCALE
  3932.  
  3933.                                 break;
  3934.  
  3935.                         case a_fsin:    //FSIN
  3936.  
  3937.                                 outword(0xFED9);
  3938.  
  3939.                                 possiblecpu=3;
  3940.  
  3941.                                 break;
  3942.  
  3943.                         case a_fsincos: //FSINCOS
  3944.  
  3945.                                 outword(0xFBD9);
  3946.  
  3947.                                 possiblecpu=3;
  3948.  
  3949.                                 break;
  3950.  
  3951.                         case a_fsqrt:
  3952.  
  3953.                                 outword(0xFAD9);        //FSQRT
  3954.  
  3955.                                 break;
  3956.  
  3957.                         case a_fstsw:   //FSTSW
  3958.  
  3959.                                 fwait();
  3960.  
  3961.                         case a_fnstsw:  //FNSTSW
  3962.  
  3963.                                 nexttok();
  3964.  
  3965.                                 switch(tok){
  3966.  
  3967.                                         case tk_wordvar:
  3968.  
  3969.                                         case tk_intvar:
  3970.  
  3971.                                                 CheckAllMassiv(bufrm,2,&strinf);
  3972.  
  3973.                                                 KillVar(itok.name);
  3974.  
  3975.                                                 outseg(&itok,2);
  3976.  
  3977.                                                 op(0xDD);
  3978.  
  3979.                                                 op(itok.rm+0x38);
  3980.  
  3981.                                                 outaddress(&itok);
  3982.  
  3983.                                                 break;
  3984.  
  3985.                                         case tk_reg:
  3986.  
  3987.                                                 if(itok.number==0)outword(0xe0df);
  3988.  
  3989.                                                 else preerror("Use only AX");
  3990.  
  3991.                                                 ClearReg(AX);
  3992.  
  3993.                                                 break;
  3994.  
  3995.                                         default: wordvalexpected();
  3996.  
  3997.                                 }
  3998.  
  3999.                                 break;
  4000.  
  4001.                         case a_ftst:
  4002.  
  4003.                                 outword(0xE4D9);        //FTST
  4004.  
  4005.                                 break;
  4006.  
  4007.                         case a_fucompp: //FUCOMPP
  4008.  
  4009.                                 outword(0xE9DA);
  4010.  
  4011.                                 possiblecpu=3;
  4012.  
  4013.                                 break;
  4014.  
  4015.                         case a_fxam:
  4016.  
  4017.                                 outword(0xE5D9);        //FXAM
  4018.  
  4019.                                 break;
  4020.  
  4021.                         case a_fxtract:
  4022.  
  4023.                                 outword(0xF4D9);        //FXTRACT
  4024.  
  4025.                                 break;
  4026.  
  4027.                         case a_fyl2x:
  4028.  
  4029.                                 outword(0xF1D9);        //FYL2X
  4030.  
  4031.                                 break;
  4032.  
  4033.                         case a_fyl2xp1:
  4034.  
  4035.                                 outword(0xF9D9);        //FYL2XP1
  4036.  
  4037.                                 break;
  4038.  
  4039.                         case a_ud2:
  4040.  
  4041.                                 outword(0x0B0F);        //UD2
  4042.  
  4043.                                 possiblecpu=7;
  4044.  
  4045.                                 break;
  4046.  
  4047.                         case a_sysenter:
  4048.  
  4049.                                 outword(0x340F);        //SYSENTER
  4050.  
  4051.                                 possiblecpu=7;
  4052.  
  4053.                                 break;
  4054.  
  4055.                         case a_sysexit:
  4056.  
  4057.                                 outword(0x350F);        //SYSEXIT
  4058.  
  4059.                                 possiblecpu=7;
  4060.  
  4061.                                 break;
  4062.  
  4063.                         case a_rdpmc:
  4064.  
  4065.                                 outword(0x330F);        //RDPMC
  4066.  
  4067.                                 possiblecpu=7;
  4068.  
  4069.                                 break;
  4070.  
  4071.                         case a_fcmovnu:
  4072.  
  4073.                                 i+=8;
  4074.  
  4075.                         case a_fcmovnbe:
  4076.  
  4077.                                 i+=8;
  4078.  
  4079.                         case a_fcmovne:
  4080.  
  4081.                                 i+=8;
  4082.  
  4083.                         case a_fcmovnb:
  4084.  
  4085.                                 FpuType8(0xDB,i);
  4086.  
  4087.                                 break;
  4088.  
  4089.                         case a_fcmovu:
  4090.  
  4091.                                 i+=8;
  4092.  
  4093.                         case a_fcmovbe:
  4094.  
  4095.                                 i+=8;
  4096.  
  4097.                         case a_fcmove:
  4098.  
  4099.                                 i+=8;
  4100.  
  4101.                         case a_fcmovb:
  4102.  
  4103.                                 FpuType8(0xDA,i);
  4104.  
  4105.                                 break;
  4106.  
  4107.                         case a_fcomi:   //FCOMI
  4108.  
  4109.                                 i+=8;
  4110.  
  4111.                         case a_fucomi:
  4112.  
  4113.                                 FpuType8(0xDB,i+0x28);
  4114.  
  4115.                                 break;
  4116.  
  4117.                         case a_fcomip:
  4118.  
  4119.                                 i+=8;
  4120.  
  4121.                         case a_fucomip:
  4122.  
  4123.                                 FpuType8(0xDF,i+0x28);
  4124.  
  4125.                                 break;
  4126.  
  4127.                         case a_cmovo:
  4128.  
  4129.                         case a_cmovno:
  4130.  
  4131.                         case a_cmovc:
  4132.  
  4133.                         case a_cmovnc:
  4134.  
  4135.                         case a_cmovz:
  4136.  
  4137.                         case a_cmovnz:
  4138.  
  4139.                         case a_cmovna:
  4140.  
  4141.                         case a_cmova:
  4142.  
  4143.                         case a_cmovs:
  4144.  
  4145.                         case a_cmovns:
  4146.  
  4147.                         case a_cmovp:
  4148.  
  4149.                         case a_cmovnp:
  4150.  
  4151.                         case a_cmovl:
  4152.  
  4153.                         case a_cmovnl:
  4154.  
  4155.                         case a_cmovng:
  4156.  
  4157.                         case a_cmovg:
  4158.  
  4159.                                 cmov(htok-a_cmovo);
  4160.  
  4161.                                 possiblecpu=7;
  4162.  
  4163.                                 break;
  4164.  
  4165.                         case a_lfence:  //LFENCE
  4166.  
  4167.                                 outword(0xAE0F);
  4168.  
  4169.                                 op(0xE8);
  4170.  
  4171.                                 possiblecpu=9;
  4172.  
  4173.                                 break;
  4174.  
  4175.                         case a_mfence:  //MFENCE
  4176.  
  4177.                                 outword(0xAE0F);
  4178.  
  4179.                                 op(0xF0);
  4180.  
  4181.                                 possiblecpu=9;
  4182.  
  4183.                                 break;
  4184.  
  4185.                         case a_sfence:  //SFENCE
  4186.  
  4187.                                 outword(0xAE0F);
  4188.  
  4189.                                 op(0xF8);
  4190.  
  4191.                                 possiblecpu=8;
  4192.  
  4193.                                 break;
  4194.  
  4195.                         case a_maskmovq:        //MASKMOVQ
  4196.  
  4197.                                 nexttok();
  4198.  
  4199.                                 hnumber=itok.number;
  4200.  
  4201.                                 if(tok!=tk_mmxreg)mmxregexpected(1);
  4202.  
  4203.                                 nextexpecting2(tk_camma);
  4204.  
  4205.                                 if(tok!=tk_mmxreg)mmxregexpected(2);
  4206.  
  4207.                                 outword(0xF70F);
  4208.  
  4209.                                 op(0xC0+hnumber+itok.number*8);
  4210.  
  4211.                                 possiblecpu=8;
  4212.  
  4213.                                 break;
  4214.  
  4215.                         case a_movntq:  //MOVNTQ
  4216.  
  4217.                                 movxmm3(0xE7,0,tk_mmxreg);
  4218.  
  4219.                                 possiblecpu=8;
  4220.  
  4221.                                 break;
  4222.  
  4223.                         case a_pavgb:
  4224.  
  4225.                                 mmxiii(0xE0);
  4226.  
  4227.                                 break;
  4228.  
  4229.                         case a_pavgw:
  4230.  
  4231.                                 mmxiii(0xE3);
  4232.  
  4233.                                 break;
  4234.  
  4235.                         case a_pmaxub:
  4236.  
  4237.                                 mmxiii(0xDE);
  4238.  
  4239.                                 break;
  4240.  
  4241.                         case a_pmaxsw:
  4242.  
  4243.                                 mmxiii(0xEE);
  4244.  
  4245.                                 break;
  4246.  
  4247.                         case a_pminub:
  4248.  
  4249.                                 mmxiii(0xDA);
  4250.  
  4251.                                 break;
  4252.  
  4253.                         case a_pminsw:
  4254.  
  4255.                                 mmxiii(0xEA);
  4256.  
  4257.                                 break;
  4258.  
  4259.                         case a_pmulhuw:
  4260.  
  4261.                                 mmxiii(0xE4);
  4262.  
  4263.                                 break;
  4264.  
  4265.                         case a_psadbw:
  4266.  
  4267.                                 mmxiii(0xF6);
  4268.  
  4269.                                 break;
  4270.  
  4271.                         case a_prefetcht0:
  4272.  
  4273.                                 prefetch(0x18,1);
  4274.  
  4275.                                 possiblecpu=8;
  4276.  
  4277.                                 break;
  4278.  
  4279.                         case a_prefetcht1:
  4280.  
  4281.                                 prefetch(0x18,2);
  4282.  
  4283.                                 possiblecpu=8;
  4284.  
  4285.                                 break;
  4286.  
  4287.                         case a_prefetcht2:
  4288.  
  4289.                                 prefetch(0x18,3);
  4290.  
  4291.                                 possiblecpu=8;
  4292.  
  4293.                                 break;
  4294.  
  4295.                         case a_prefetchnta:
  4296.  
  4297.                                 prefetch(0x18,0);
  4298.  
  4299.                                 possiblecpu=8;
  4300.  
  4301.                                 break;
  4302.  
  4303.                         case a_pextrw:
  4304.  
  4305.                                 pextrw();
  4306.  
  4307.                                 next=0;
  4308.  
  4309.                                 break;
  4310.  
  4311.                         case a_pinsrw:
  4312.  
  4313.                                 pinsrw();
  4314.  
  4315.                                 next=0;
  4316.  
  4317.                                 break;
  4318.  
  4319.                         case a_pmovmskb:
  4320.  
  4321.                                 nexttok();
  4322.  
  4323.                                 if(tok!=tk_reg32)reg32expected(1);
  4324.  
  4325.                                 htok=itok.number;
  4326.  
  4327.                                 ClearReg(htok);
  4328.  
  4329.                                 nextexpecting2(tk_camma);
  4330.  
  4331.                                 if(tok==tk_xmmreg){
  4332.  
  4333.                                         op(0x66);
  4334.  
  4335.                                         possiblecpu=9;
  4336.  
  4337.                                 }
  4338.  
  4339.                                 else{
  4340.  
  4341.                                         possiblecpu=8;
  4342.  
  4343.                                         if(tok!=tk_mmxreg)mmxregexpected(2);
  4344.  
  4345.                                 }
  4346.  
  4347.                                 outword(0xD70F);
  4348.  
  4349.                                 op(rm_mod11+htok*8+itok.number);
  4350.  
  4351.                                 break;
  4352.  
  4353.                         case a_pshufw:
  4354.  
  4355.                                 pshufw();
  4356.  
  4357.                                 next=0;
  4358.  
  4359.                                 possiblecpu=8;
  4360.  
  4361.                                 break;
  4362.  
  4363.                         case a_pshufd:
  4364.  
  4365.                                 xmm3instr(0x70,0x66);
  4366.  
  4367.                                 possiblecpu=9;
  4368.  
  4369.                                 next=0;
  4370.  
  4371.                                 break;
  4372.  
  4373.                         case a_pshufhw:
  4374.  
  4375.                                 xmm3instr(0x70,0xf3);
  4376.  
  4377.                                 possiblecpu=9;
  4378.  
  4379.                                 next=0;
  4380.  
  4381.                                 break;
  4382.  
  4383.                         case a_pshuflw:
  4384.  
  4385.                                 xmm3instr(0x70,0xf2);
  4386.  
  4387.                                 possiblecpu=9;
  4388.  
  4389.                                 next=0;
  4390.  
  4391.                                 break;
  4392.  
  4393.                         case a_addpd:
  4394.  
  4395.                                 xmminstr(0x58,0x66);
  4396.  
  4397.                                 possiblecpu=9;
  4398.  
  4399.                                 break;
  4400.  
  4401.                         case a_addps:
  4402.  
  4403.                                 xmminstr(0x58,0);
  4404.  
  4405.                                 possiblecpu=8;
  4406.  
  4407.                                 break;
  4408.  
  4409.                         case a_addsd:
  4410.  
  4411.                                 xmminstr(0x58,0xF2);
  4412.  
  4413.                                 possiblecpu=9;
  4414.  
  4415.                                 break;
  4416.  
  4417.                         case a_addss:
  4418.  
  4419.                                 xmminstr(0x58,0xF3);
  4420.  
  4421.                                 possiblecpu=8;
  4422.  
  4423.                                 break;
  4424.  
  4425.                         case a_addsubpd:
  4426.  
  4427.                                 xmminstr(0xD0,0x66);
  4428.  
  4429.                                 possiblecpu=9;
  4430.  
  4431.                                 break;
  4432.  
  4433.                         case a_addsubps:
  4434.  
  4435.                                 xmminstr(0xD0,0xF2);
  4436.  
  4437.                                 possiblecpu=9;
  4438.  
  4439.                                 break;
  4440.  
  4441.                         case a_andnpd:
  4442.  
  4443.                                 xmminstr(0x55,0x66);
  4444.  
  4445.                                 possiblecpu=9;
  4446.  
  4447.                                 break;
  4448.  
  4449.                         case a_andnps:
  4450.  
  4451.                                 xmminstr(0x55,0);
  4452.  
  4453.                                 possiblecpu=8;
  4454.  
  4455.                                 break;
  4456.  
  4457.                         case a_andpd:
  4458.  
  4459.                                 xmminstr(0x54,0x66);
  4460.  
  4461.                                 possiblecpu=9;
  4462.  
  4463.                                 break;
  4464.  
  4465.                         case a_andps:
  4466.  
  4467.                                 xmminstr(0x54,0);
  4468.  
  4469.                                 possiblecpu=8;
  4470.  
  4471.                                 break;
  4472.  
  4473.                         case a_comisd:
  4474.  
  4475.                                 xmminstr(0x2F,0x66);
  4476.  
  4477.                                 possiblecpu=9;
  4478.  
  4479.                                 break;
  4480.  
  4481.                         case a_comiss:
  4482.  
  4483.                                 xmminstr(0x2F,0);
  4484.  
  4485.                                 possiblecpu=8;
  4486.  
  4487.                                 break;
  4488.  
  4489.                         case a_divps:
  4490.  
  4491.                                 xmminstr(0x5E,0);
  4492.  
  4493.                                 possiblecpu=8;
  4494.  
  4495.                                 break;
  4496.  
  4497.                         case a_divsd:
  4498.  
  4499.                                 xmminstr(0x5E,0xf2);
  4500.  
  4501.                                 possiblecpu=9;
  4502.  
  4503.                                 break;
  4504.  
  4505.                         case a_divss:
  4506.  
  4507.                                 xmminstr(0x5E,0xF3);
  4508.  
  4509.                                 possiblecpu=8;
  4510.  
  4511.                                 break;
  4512.  
  4513.                         case a_haddpd:
  4514.  
  4515.                                 xmminstr(0x7C,0x66);
  4516.  
  4517.                                 possiblecpu=9;
  4518.  
  4519.                                 break;
  4520.  
  4521.                         case a_haddps:
  4522.  
  4523.                                 xmminstr(0x7C,0xF2);
  4524.  
  4525.                                 possiblecpu=9;
  4526.  
  4527.                                 break;
  4528.  
  4529.                         case a_hsubpd:
  4530.  
  4531.                                 xmminstr(0x7D,0x66);
  4532.  
  4533.                                 possiblecpu=9;
  4534.  
  4535.                                 break;
  4536.  
  4537.                         case a_hsubps:
  4538.  
  4539.                                 xmminstr(0x7D,0xF2);
  4540.  
  4541.                                 possiblecpu=9;
  4542.  
  4543.                                 break;
  4544.  
  4545.                         case a_maskmovdqu:
  4546.  
  4547.                                 xmm2xmm(0xf7,0x66);
  4548.  
  4549.                                 possiblecpu=9;
  4550.  
  4551.                                 break;
  4552.  
  4553.                         case a_maxpd:
  4554.  
  4555.                                 xmminstr(0x5f,0x66);
  4556.  
  4557.                                 possiblecpu=9;
  4558.  
  4559.                                 break;
  4560.  
  4561.                         case a_maxps:
  4562.  
  4563.                                 xmminstr(0x5F,0);
  4564.  
  4565.                                 possiblecpu=8;
  4566.  
  4567.                                 break;
  4568.  
  4569.                         case a_maxsd:
  4570.  
  4571.                                 xmminstr(0x5f,0xf2);
  4572.  
  4573.                                 possiblecpu=9;
  4574.  
  4575.                                 break;
  4576.  
  4577.                         case a_maxss:
  4578.  
  4579.                                 xmminstr(0x5F,0xF3);
  4580.  
  4581.                                 possiblecpu=8;
  4582.  
  4583.                                 break;
  4584.  
  4585.                         case a_minpd:
  4586.  
  4587.                                 xmminstr(0x5d,0x66);
  4588.  
  4589.                                 possiblecpu=9;
  4590.  
  4591.                                 break;
  4592.  
  4593.                         case a_minps:
  4594.  
  4595.                                 xmminstr(0x5D,0);
  4596.  
  4597.                                 possiblecpu=8;
  4598.  
  4599.                                 break;
  4600.  
  4601.                         case a_minsd:
  4602.  
  4603.                                 xmminstr(0x5d,0xf2);
  4604.  
  4605.                                 possiblecpu=9;
  4606.  
  4607.                                 break;
  4608.  
  4609.                         case a_minss:
  4610.  
  4611.                                 xmminstr(0x5D,0xF3);
  4612.  
  4613.                                 possiblecpu=8;
  4614.  
  4615.                                 break;
  4616.  
  4617.                         case a_mulpd:
  4618.  
  4619.                                 xmminstr(0x59,0x66);
  4620.  
  4621.                                 possiblecpu=9;
  4622.  
  4623.                                 break;
  4624.  
  4625.                         case a_mulps:
  4626.  
  4627.                                 xmminstr(0x59,0);
  4628.  
  4629.                                 possiblecpu=8;
  4630.  
  4631.                                 break;
  4632.  
  4633.                         case a_mulsd:
  4634.  
  4635.                                 xmminstr(0x59,0xF2);
  4636.  
  4637.                                 possiblecpu=9;
  4638.  
  4639.                                 break;
  4640.  
  4641.                         case a_mulss:
  4642.  
  4643.                                 xmminstr(0x59,0xF3);
  4644.  
  4645.                                 possiblecpu=8;
  4646.  
  4647.                                 break;
  4648.  
  4649.                         case a_orpd:
  4650.  
  4651.                                 xmminstr(0x56,0x66);
  4652.  
  4653.                                 possiblecpu=9;
  4654.  
  4655.                                 break;
  4656.  
  4657.                         case a_orps:
  4658.  
  4659.                                 xmminstr(0x56,0);
  4660.  
  4661.                                 possiblecpu=8;
  4662.  
  4663.                                 break;
  4664.  
  4665.                         case a_rcpps:
  4666.  
  4667.                                 xmminstr(0x53,0);
  4668.  
  4669.                                 possiblecpu=8;
  4670.  
  4671.                                 break;
  4672.  
  4673.                         case a_rcpss:
  4674.  
  4675.                                 xmminstr(0x53,0xF3);
  4676.  
  4677.                                 possiblecpu=8;
  4678.  
  4679.                                 break;
  4680.  
  4681.                         case a_rsqrtps:
  4682.  
  4683.                                 xmminstr(0x52,0);
  4684.  
  4685.                                 possiblecpu=8;
  4686.  
  4687.                                 break;
  4688.  
  4689.                         case a_rsqrtss:
  4690.  
  4691.                                 xmminstr(0x52,0xF3);
  4692.  
  4693.                                 possiblecpu=8;
  4694.  
  4695.                                 break;
  4696.  
  4697.                         case a_sqrtpd:
  4698.  
  4699.                                 xmminstr(0x51,0x66);
  4700.  
  4701.                                 possiblecpu=9;
  4702.  
  4703.                                 break;
  4704.  
  4705.                         case a_sqrtps:
  4706.  
  4707.                                 xmminstr(0x51,0);
  4708.  
  4709.                                 possiblecpu=8;
  4710.  
  4711.                                 break;
  4712.  
  4713.                         case a_sqrtsd:
  4714.  
  4715.                                 xmminstr(0x51,0xf2);
  4716.  
  4717.                                 possiblecpu=9;
  4718.  
  4719.                                 break;
  4720.  
  4721.                         case a_sqrtss:
  4722.  
  4723.                                 xmminstr(0x51,0xF3);
  4724.  
  4725.                                 possiblecpu=8;
  4726.  
  4727.                                 break;
  4728.  
  4729.                         case a_subpd:
  4730.  
  4731.                                 xmminstr(0x5C,0x66);
  4732.  
  4733.                                 possiblecpu=9;
  4734.  
  4735.                                 break;
  4736.  
  4737.                         case a_subps:
  4738.  
  4739.                                 xmminstr(0x5C,0);
  4740.  
  4741.                                 possiblecpu=8;
  4742.  
  4743.                                 break;
  4744.  
  4745.                         case a_subsd:
  4746.  
  4747.                                 xmminstr(0x5C,0xF2);
  4748.  
  4749.                                 possiblecpu=9;
  4750.  
  4751.                                 break;
  4752.  
  4753.                         case a_subss:
  4754.  
  4755.                                 xmminstr(0x5C,0xF3);
  4756.  
  4757.                                 possiblecpu=8;
  4758.  
  4759.                                 break;
  4760.  
  4761.                         case a_ucomisd:
  4762.  
  4763.                                 xmminstr(0x2E,0x66);
  4764.  
  4765.                                 possiblecpu=9;
  4766.  
  4767.                                 break;
  4768.  
  4769.                         case a_ucomiss:
  4770.  
  4771.                                 xmminstr(0x2E,0);
  4772.  
  4773.                                 possiblecpu=8;
  4774.  
  4775.                                 break;
  4776.  
  4777.                         case a_unpckhpd:
  4778.  
  4779.                                 xmminstr(0x15,0x66);
  4780.  
  4781.                                 possiblecpu=9;
  4782.  
  4783.                                 break;
  4784.  
  4785.                         case a_unpckhps:
  4786.  
  4787.                                 xmminstr(0x15,0);
  4788.  
  4789.                                 possiblecpu=8;
  4790.  
  4791.                                 break;
  4792.  
  4793.                         case a_unpcklpd:
  4794.  
  4795.                                 xmminstr(0x14,0x66);
  4796.  
  4797.                                 possiblecpu=9;
  4798.  
  4799.                                 break;
  4800.  
  4801.                         case a_unpcklps:
  4802.  
  4803.                                 xmminstr(0x14,0);
  4804.  
  4805.                                 possiblecpu=8;
  4806.  
  4807.                                 break;
  4808.  
  4809.                         case a_xorpd:
  4810.  
  4811.                                 xmminstr(0x57,0x66);
  4812.  
  4813.                                 possiblecpu=9;
  4814.  
  4815.                                 break;
  4816.  
  4817.                         case a_xorps:
  4818.  
  4819.                                 xmminstr(0x57,0);
  4820.  
  4821.                                 possiblecpu=8;
  4822.  
  4823.                                 break;
  4824.  
  4825.                         case a_cmppd:
  4826.  
  4827.                                 xmm3instr(0xC2,0x66);
  4828.  
  4829.                                 possiblecpu=9;
  4830.  
  4831.                                 next=0;
  4832.  
  4833.                                 break;
  4834.  
  4835.                         case a_cmpeqpd:
  4836.  
  4837.                         case a_cmpltpd:
  4838.  
  4839.                         case a_cmplepd:
  4840.  
  4841.                         case a_cmpunordpd:
  4842.  
  4843.                         case a_cmpneqpd:
  4844.  
  4845.                         case a_cmpnltpd:
  4846.  
  4847.                         case a_cmpnlepd:
  4848.  
  4849.                         case a_cmpordpd:
  4850.  
  4851.                                 xmminstr(0xC2,0x66);
  4852.  
  4853.                                 possiblecpu=9;
  4854.  
  4855.                                 op(htok-a_cmpeqpd);
  4856.  
  4857.                                 break;
  4858.  
  4859.                         case a_cmpps:
  4860.  
  4861.                                 xmm3instr(0xC2,0);
  4862.  
  4863.                                 possiblecpu=8;
  4864.  
  4865.                                 next=0;
  4866.  
  4867.                                 break;
  4868.  
  4869.                         case a_cmpeqps:
  4870.  
  4871.                         case a_cmpltps:
  4872.  
  4873.                         case a_cmpleps:
  4874.  
  4875.                         case a_cmpunordps:
  4876.  
  4877.                         case a_cmpneqps:
  4878.  
  4879.                         case a_cmpnltps:
  4880.  
  4881.                         case a_cmpnleps:
  4882.  
  4883.                         case a_cmpordps:
  4884.  
  4885.                                 xmminstr(0xC2,0);
  4886.  
  4887.                                 possiblecpu=9;
  4888.  
  4889.                                 op(htok-a_cmpeqps);
  4890.  
  4891.                                 break;
  4892.  
  4893.                         case a_cmpss:
  4894.  
  4895.                                 xmm3instr(0xC2,0xF3);
  4896.  
  4897.                                 possiblecpu=8;
  4898.  
  4899.                                 next=0;
  4900.  
  4901.                                 break;
  4902.  
  4903.                         case a_cmpeqss:
  4904.  
  4905.                         case a_cmpltss:
  4906.  
  4907.                         case a_cmpless:
  4908.  
  4909.                         case a_cmpunordss:
  4910.  
  4911.                         case a_cmpneqss:
  4912.  
  4913.                         case a_cmpnltss:
  4914.  
  4915.                         case a_cmpnless:
  4916.  
  4917.                         case a_cmpordss:
  4918.  
  4919.                                 xmminstr(0xC2,0xF3);
  4920.  
  4921.                                 possiblecpu=9;
  4922.  
  4923.                                 op(htok-a_cmpeqss);
  4924.  
  4925.                                 break;
  4926.  
  4927.                         case a_cmpeqsd:
  4928.  
  4929.                         case a_cmpltsd:
  4930.  
  4931.                         case a_cmplesd:
  4932.  
  4933.                         case a_cmpunordsd:
  4934.  
  4935.                         case a_cmpneqsd:
  4936.  
  4937.                         case a_cmpnltsd:
  4938.  
  4939.                         case a_cmpnlesd:
  4940.  
  4941.                         case a_cmpordsd:
  4942.  
  4943.                                 xmminstr(0xC2,0xF2);
  4944.  
  4945.                                 op(htok-a_cmpeqsd);
  4946.  
  4947.                                 possiblecpu=9;
  4948.  
  4949.                                 break;
  4950.  
  4951.                         case a_shufpd:
  4952.  
  4953.                                 xmm3instr(0xC6,0x66);
  4954.  
  4955.                                 possiblecpu=9;
  4956.  
  4957.                                 next=0;
  4958.  
  4959.                                 break;
  4960.  
  4961.                         case a_shufps:
  4962.  
  4963.                                 xmm3instr(0xC6,0);
  4964.  
  4965.                                 possiblecpu=8;
  4966.  
  4967.                                 next=0;
  4968.  
  4969.                                 break;
  4970.  
  4971.                         case a_cvtdq2pd:
  4972.  
  4973.                                 xmminstr(0xE6,0xF3);
  4974.  
  4975.                                 possiblecpu=9;
  4976.  
  4977.                                 break;
  4978.  
  4979.                         case a_cvtdq2ps:
  4980.  
  4981.                                 xmminstr(0x5B,0);
  4982.  
  4983.                                 possiblecpu=9;
  4984.  
  4985.                                 break;
  4986.  
  4987.                         case a_cvtpd2dq:
  4988.  
  4989.                                 xmminstr(0xE6,0xF2);
  4990.  
  4991.                                 possiblecpu=9;
  4992.  
  4993.                                 break;
  4994.  
  4995.                         case a_cvtpd2pi:
  4996.  
  4997.                                 xmminstr(0x2d,0x66,tk_mmxreg,tk_xmmreg);
  4998.  
  4999.                                 possiblecpu=9;
  5000.  
  5001.                                 break;
  5002.  
  5003.                         case a_cvtpd2ps:
  5004.  
  5005.                                 xmminstr(0x5a,0x66);
  5006.  
  5007.                                 possiblecpu=9;
  5008.  
  5009.                                 break;
  5010.  
  5011.                         case a_cvtpi2pd:
  5012.  
  5013.                                 xmminstr(0x2a,0x66,tk_xmmreg,tk_mmxreg);
  5014.  
  5015.                                 possiblecpu=9;
  5016.  
  5017.                                 break;
  5018.  
  5019.                         case a_cvtpi2ps:
  5020.  
  5021.                                 xmminstr(0x2a,0,tk_xmmreg,tk_mmxreg);
  5022.  
  5023.                                 possiblecpu=8;
  5024.  
  5025.                                 break;
  5026.  
  5027.                         case a_cvtps2dq:
  5028.  
  5029.                                 xmminstr(0x5b,0x66);
  5030.  
  5031.                                 possiblecpu=9;
  5032.  
  5033.                                 break;
  5034.  
  5035.                         case a_cvtps2pd:
  5036.  
  5037.                                 xmminstr(0x5a,0);
  5038.  
  5039.                                 possiblecpu=9;
  5040.  
  5041.                                 break;
  5042.  
  5043.                         case a_cvtsi2ss:
  5044.  
  5045.                                 xmminstr(0x2a,0xf3,tk_xmmreg,tk_reg32);
  5046.  
  5047.                                 possiblecpu=8;
  5048.  
  5049.                                 break;
  5050.  
  5051.                         case a_cvtps2pi:
  5052.  
  5053.                                 xmminstr(0x2d,0,tk_mmxreg,tk_xmmreg);
  5054.  
  5055.                                 possiblecpu=9;
  5056.  
  5057.                                 break;
  5058.  
  5059.                         case a_cvtsd2si:
  5060.  
  5061.                                 xmminstr(0x2d,0xf2,tk_reg32,tk_xmmreg);
  5062.  
  5063.                                 possiblecpu=9;
  5064.  
  5065.                                 break;
  5066.  
  5067.                         case a_cvtsd2ss:
  5068.  
  5069.                                 xmminstr(0x5a,0xf2);
  5070.  
  5071.                                 possiblecpu=9;
  5072.  
  5073.                                 break;
  5074.  
  5075.                         case a_cvtsi2sd:
  5076.  
  5077.                                 xmminstr(0x2a,0xf2,tk_xmmreg,tk_reg32);
  5078.  
  5079.                                 possiblecpu=9;
  5080.  
  5081.                                 break;
  5082.  
  5083.                         case a_cvtss2sd:
  5084.  
  5085.                                 xmminstr(0x5a,0xf3);
  5086.  
  5087.                                 possiblecpu=9;
  5088.  
  5089.                                 break;
  5090.  
  5091.                         case a_cvtss2si:
  5092.  
  5093.                                 xmminstr(0x2d,0xf3,tk_reg32,tk_xmmreg);
  5094.  
  5095.                                 possiblecpu=8;
  5096.  
  5097.                                 break;
  5098.  
  5099.                         case a_cvttpd2pi:
  5100.  
  5101.                                 xmminstr(0x2c,0x66,tk_mmxreg,tk_xmmreg);
  5102.  
  5103.                                 possiblecpu=9;
  5104.  
  5105.                                 break;
  5106.  
  5107.                         case a_cvttpd2dq:
  5108.  
  5109.                                 xmminstr(0xE6,0x66);
  5110.  
  5111.                                 possiblecpu=9;
  5112.  
  5113.                                 break;
  5114.  
  5115.                         case a_cvttps2dq:
  5116.  
  5117.                                 xmminstr(0x5B,0xF3);
  5118.  
  5119.                                 possiblecpu=9;
  5120.  
  5121.                                 break;
  5122.  
  5123.                         case a_cvttps2pi:
  5124.  
  5125.                                 xmminstr(0x2c,0,tk_mmxreg,tk_xmmreg);
  5126.  
  5127.                                 possiblecpu=8;
  5128.  
  5129.                                 break;
  5130.  
  5131.                         case a_cvttsd2si:
  5132.  
  5133.                                 xmminstr(0x2C,0xF2,tk_reg32,tk_xmmreg);
  5134.  
  5135.                                 possiblecpu=9;
  5136.  
  5137.                                 break;
  5138.  
  5139.                         case a_cvttss2si:
  5140.  
  5141.                                 xmminstr(0x2C,0xF3,tk_reg32,tk_xmmreg);
  5142.  
  5143.                                 possiblecpu=8;
  5144.  
  5145.                                 break;
  5146.  
  5147.                         case a_divpd:
  5148.  
  5149.                                 xmminstr(0x5E,0x66);
  5150.  
  5151.                                 possiblecpu=9;
  5152.  
  5153.                                 break;
  5154.  
  5155.                         case a_punpckhqdq:
  5156.  
  5157.                                 xmminstr(0x6D,0x66);
  5158.  
  5159.                                 possiblecpu=9;
  5160.  
  5161.                                 break;
  5162.  
  5163.                         case a_punpcklqdq:
  5164.  
  5165.                                 xmminstr(0x6C,0x66);
  5166.  
  5167.                                 possiblecpu=9;
  5168.  
  5169.                                 break;
  5170.  
  5171.                         case a_fxrstor:
  5172.  
  5173.                                 prefetch(0xAE,1);
  5174.  
  5175.                                 possiblecpu=8;
  5176.  
  5177.                                 break;
  5178.  
  5179.                         case a_fxsave:
  5180.  
  5181.                                 prefetch(0xAE,0);
  5182.  
  5183.                                 possiblecpu=8;
  5184.  
  5185.                                 break;
  5186.  
  5187.                         case a_ldmxcsr:
  5188.  
  5189.                                 prefetch(0xAE,2);
  5190.  
  5191.                                 possiblecpu=8;
  5192.  
  5193.                                 break;
  5194.  
  5195.                         case a_stmxcsr:
  5196.  
  5197.                                 prefetch(0xAE,3);
  5198.  
  5199.                                 possiblecpu=8;
  5200.  
  5201.                                 break;
  5202.  
  5203.                         case a_clflush:
  5204.  
  5205.                                 prefetch(0xAE,7);
  5206.  
  5207.                                 possiblecpu=9;
  5208.  
  5209.                                 break;
  5210.  
  5211.                         case a_monitor:
  5212.  
  5213.                                 outword(0x010F);
  5214.  
  5215.                                 op(0xc8);
  5216.  
  5217.                                 possiblecpu=9;
  5218.  
  5219.                                 break;
  5220.  
  5221.                         case a_mwait:
  5222.  
  5223.                                 outword(0x010F);
  5224.  
  5225.                                 op(0xc9);
  5226.  
  5227.                                 possiblecpu=9;
  5228.  
  5229.                                 break;
  5230.  
  5231.                         case a_lddqu:
  5232.  
  5233.                                 movxmm4(0xF0,0xF2);
  5234.  
  5235.                                 possiblecpu=9;
  5236.  
  5237.                                 break;
  5238.  
  5239.                         case a_movhlps:
  5240.  
  5241.                                 xmm2xmm(0x12);
  5242.  
  5243.                                 possiblecpu=8;
  5244.  
  5245.                                 break;
  5246.  
  5247.                         case a_movlhps:
  5248.  
  5249.                                 xmm2xmm(0x16);
  5250.  
  5251.                                 possiblecpu=8;
  5252.  
  5253.                                 break;
  5254.  
  5255.                         case a_movmskps:
  5256.  
  5257.                                 xmm2xmm(0x50,0,tk_reg32);
  5258.  
  5259.                                 possiblecpu=8;
  5260.  
  5261.                                 break;
  5262.  
  5263.                         case a_movntdq:
  5264.  
  5265.                                 movxmm3(0xE7,0x66);
  5266.  
  5267.                                 possiblecpu=9;
  5268.  
  5269.                                 break;
  5270.  
  5271.                         case a_movntpd:
  5272.  
  5273.                                 movxmm3(0x2B,0x66);
  5274.  
  5275.                                 possiblecpu=9;
  5276.  
  5277.                                 break;
  5278.  
  5279.                         case a_movntps:
  5280.  
  5281.                                 movxmm3(0x2b,0);
  5282.  
  5283.                                 possiblecpu=8;
  5284.  
  5285.                                 break;
  5286.  
  5287.                         case a_movapd:
  5288.  
  5289.                                 movxmm(0x28,0x66);
  5290.  
  5291.                                 possiblecpu=9;
  5292.  
  5293.                                 break;
  5294.  
  5295.                         case a_movaps:
  5296.  
  5297.                                 movxmm(0x28,0);
  5298.  
  5299.                                 possiblecpu=8;
  5300.  
  5301.                                 break;
  5302.  
  5303.                         case a_movdqa:
  5304.  
  5305.                                 movxmm(0x6f,0x66,0x10);
  5306.  
  5307.                                 possiblecpu=9;
  5308.  
  5309.                                 break;
  5310.  
  5311.                         case a_movddup:
  5312.  
  5313.                                 xmminstr(0x12,0xF2);
  5314.  
  5315.                                 possiblecpu=9;
  5316.  
  5317.                                 break;
  5318.  
  5319.                         case a_movshdup:
  5320.  
  5321.                                 xmminstr(0x16,0xF3);
  5322.  
  5323.                                 possiblecpu=9;
  5324.  
  5325.                                 break;
  5326.  
  5327.                         case a_movsldup:
  5328.  
  5329.                                 xmminstr(0x12,0xF3);
  5330.  
  5331.                                 possiblecpu=9;
  5332.  
  5333.                                 break;
  5334.  
  5335.                         case a_movdqu:
  5336.  
  5337.                                 movxmm(0x6f,0xf3,0x10);
  5338.  
  5339.                                 possiblecpu=9;
  5340.  
  5341.                                 break;
  5342.  
  5343.                         case a_movdq2q:
  5344.  
  5345.                                 xmm2xmm(0xd6,0xf2,tk_mmxreg);
  5346.  
  5347.                                 possiblecpu=9;
  5348.  
  5349.                                 break;
  5350.  
  5351.                         case a_movhpd:
  5352.  
  5353.                                 movxmm2(0x16,0x66);
  5354.  
  5355.                                 possiblecpu=9;
  5356.  
  5357.                                 break;
  5358.  
  5359.                         case a_movlpd:
  5360.  
  5361.                                 movxmm2(0x12,0x66);
  5362.  
  5363.                                 possiblecpu=9;
  5364.  
  5365.                                 break;
  5366.  
  5367.                         case a_movmskpd:
  5368.  
  5369.                                 xmm2xmm(0x50,0x66,tk_reg32);
  5370.  
  5371.                                 possiblecpu=9;
  5372.  
  5373.                                 break;
  5374.  
  5375.                         case a_movnti:  //MOVNTI
  5376.  
  5377.                                 movxmm3(0xC3,0,tk_reg32);
  5378.  
  5379.                                 possiblecpu=9;
  5380.  
  5381.                                 break;
  5382.  
  5383.                         case a_movq2dq: //MOVQ2DQ
  5384.  
  5385.                                 nexttok();
  5386.  
  5387.                                 hnumber=itok.number;
  5388.  
  5389.                                 if(tok!=tk_xmmreg)xmmregexpected(1);
  5390.  
  5391.                                 nextexpecting2(tk_camma);
  5392.  
  5393.                                 if(tok!=tk_mmxreg)mmxregexpected(2);
  5394.  
  5395.                                 op(0xF3);
  5396.  
  5397.                                 outword(0xD60F);
  5398.  
  5399.                                 op(0xC0+hnumber+itok.number*8);
  5400.  
  5401.                                 possiblecpu=9;
  5402.  
  5403.                                 break;
  5404.  
  5405.                         case a_movupd:
  5406.  
  5407.                                 movxmm(0x10,0x66);
  5408.  
  5409.                                 possiblecpu=9;
  5410.  
  5411.                                 break;
  5412.  
  5413.                         case a_movups:
  5414.  
  5415.                                 movxmm(0x10,0);
  5416.  
  5417.                                 possiblecpu=8;
  5418.  
  5419.                                 break;
  5420.  
  5421.                         case a_movss:
  5422.  
  5423.                                 movxmm(0x10,0xF3);
  5424.  
  5425.                                 possiblecpu=8;
  5426.  
  5427.                                 break;
  5428.  
  5429.                         case a_movhps:
  5430.  
  5431.                                 movxmm2(0x16);
  5432.  
  5433.                                 possiblecpu=8;
  5434.  
  5435.                                 break;
  5436.  
  5437.                         case a_movlps:
  5438.  
  5439.                                 movxmm2(0x12);
  5440.  
  5441.                                 possiblecpu=8;
  5442.  
  5443.                                 break;
  5444.  
  5445.  
  5446.  
  5447.                         case -1: codeexpected(); break;
  5448.  
  5449.                         default:
  5450.  
  5451.                                 preerror("sorry, this instruction is not supported");
  5452.  
  5453.                                 break;
  5454.  
  5455.                 }
  5456.  
  5457.                 asmparam=FALSE;
  5458.  
  5459.                 if(cpu<possiblecpu)cpu=possiblecpu;
  5460.  
  5461.                 if(next)nexttok();
  5462.  
  5463.         }
  5464.  
  5465.         else if(tok==tk_seg){
  5466.  
  5467.                 switch((unsigned int)itok.number){
  5468.  
  5469.                         case ES: op(0x26); break;
  5470.  
  5471.                         case SS: op(0x36); break;
  5472.  
  5473.                         case CS: op(0x2E); break;
  5474.  
  5475.                         case DS: op(0x3E); break;
  5476.  
  5477.                         case FS: op(0x64);
  5478.  
  5479.                                 if(cpu<3)cpu=3;
  5480.  
  5481.                                 break;
  5482.  
  5483.                         case GS: op(0x65);
  5484.  
  5485.                                 if(cpu<3)cpu=3;
  5486.  
  5487.                                 break;
  5488.  
  5489.                         default: beep(); break;
  5490.  
  5491.                 }
  5492.  
  5493.                 nextexpecting2(tk_colon);
  5494.  
  5495.         }
  5496.  
  5497.         else if(tok==tk_locallabel)define_locallabel();
  5498.  
  5499.         else if(tok==tk_at&&ScanTok3()==tk_colon){
  5500.  
  5501.                 nexttok();
  5502.  
  5503.                 LLabel();
  5504.  
  5505.         }
  5506.  
  5507.         else codeexpected();
  5508.  
  5509.         if(tok==tk_semicolon)nexttok();
  5510.  
  5511. }
  5512.  
  5513.  
  5514.  
  5515. void cmov(int num)
  5516.  
  5517. {
  5518.  
  5519. int type=r32;
  5520.  
  5521. int reg;
  5522.  
  5523.         nexttok();
  5524.  
  5525.         if(tok==tk_reg)type=r16;
  5526.  
  5527.         else if(tok!=tk_reg32)reg32regexpected(1);
  5528.  
  5529.         reg=itok.number;
  5530.  
  5531.         ClearReg(reg);
  5532.  
  5533.         nextexpecting2(tk_camma);
  5534.  
  5535.         op66(type);
  5536.  
  5537.         switch(tok){
  5538.  
  5539.                 case tk_reg:
  5540.  
  5541.                         if(type==r32)reg32expected(2);
  5542.  
  5543.                         goto regs;
  5544.  
  5545.                 case tk_reg32:
  5546.  
  5547.                         if(type==r16)regexpected(2);
  5548.  
  5549. regs:
  5550.  
  5551.                         op(0x0F);
  5552.  
  5553.                         op(0x40+num);
  5554.  
  5555.                         op(0xC0+reg*8+itok.number);
  5556.  
  5557.                         break;
  5558.  
  5559.                 case tk_wordvar:
  5560.  
  5561.                 case tk_intvar:
  5562.  
  5563.                         if(type==r32)dwordvalexpected();
  5564.  
  5565.                         CheckAllMassiv(bufrm,2,&strinf);
  5566.  
  5567.                         goto dwords;
  5568.  
  5569.                 case tk_dwordvar:
  5570.  
  5571.                 case tk_longvar:
  5572.  
  5573.                         if(type==r16)wordvalexpected();
  5574.  
  5575.                         CheckAllMassiv(bufrm,4,&strinf);
  5576.  
  5577. dwords:
  5578.  
  5579.                         outseg(&itok,3);
  5580.  
  5581.                         op(0x0F);
  5582.  
  5583.                         op(0x40+num);
  5584.  
  5585.                         op(itok.rm+reg*8);
  5586.  
  5587.                         outaddress(&itok);
  5588.  
  5589.                         break;
  5590.  
  5591.                 default:
  5592.  
  5593.                         varexpected(2);
  5594.  
  5595.                         break;
  5596.  
  5597.         }
  5598.  
  5599. }
  5600.  
  5601.  
  5602.  
  5603. #ifdef OPTVARCONST
  5604.  
  5605. int GetOperand(int code)
  5606.  
  5607. {
  5608.  
  5609.         switch(code){
  5610.  
  5611.                 case a_inc:     //INC
  5612.  
  5613.                 case a_add: return tk_plus;
  5614.  
  5615.                 case a_or: return tk_or;
  5616.  
  5617.                 case a_and:     return tk_and;
  5618.  
  5619.                 case a_dec:     //DEC
  5620.  
  5621.                 case a_sub:     return tk_minus;
  5622.  
  5623.                 case a_xor:     return tk_xor;
  5624.  
  5625.                 case a_not:     return tk_not;
  5626.  
  5627.                 case a_neg:     return tk_numsign;
  5628.  
  5629.                 case a_shl:     return tk_ll;
  5630.  
  5631.                 case a_shr:     return tk_rr;
  5632.  
  5633.         }
  5634.  
  5635.         return tokens;
  5636.  
  5637. }
  5638.  
  5639. #endif
  5640.  
  5641.  
  5642.  
  5643. void  asmtwo1(int basecode) // used for ADD ADC SUB SBB CMP AND OR XOR.
  5644.  
  5645. {
  5646.  
  5647. unsigned long holdnumber2;
  5648.  
  5649. int htok,typet=r16;
  5650.  
  5651. long longholdnumber;
  5652.  
  5653. char *hbuf;
  5654.  
  5655. ITOK hstok;
  5656.  
  5657. unsigned char next=1;
  5658.  
  5659. SINFO hstr;
  5660.  
  5661. #ifdef OPTVARCONST
  5662.  
  5663. int initconst=FALSE;
  5664.  
  5665. int operand=GetOperand(basecode/8);
  5666.  
  5667. #endif
  5668.  
  5669.         nexttok();
  5670.  
  5671.         hstok=itok;
  5672.  
  5673.         htok=tok;
  5674.  
  5675.         hbuf=bufrm;
  5676.  
  5677.         bufrm=NULL;
  5678.  
  5679.         hstr=strinf;
  5680.  
  5681.         strinf.bufstr=NULL;
  5682.  
  5683.         nextexpecting2(tk_camma);
  5684.  
  5685. int i=tok;
  5686.  
  5687.         switch(htok){
  5688.  
  5689.                 case tk_reg:
  5690.  
  5691.                         if((basecode/8)!=a_cmp)ClearReg(hstok.number);
  5692.  
  5693.                   switch(tok){
  5694.  
  5695.                                 case tk_undefofs:
  5696.  
  5697.                                         strcpy(hstok.name,itok.name);
  5698.  
  5699.                                         tok=tk_number;
  5700.  
  5701.                                         goto wnum;
  5702.  
  5703.                                 case tk_minus:
  5704.  
  5705.                                         if(tok2!=tk_number){
  5706.  
  5707.                                                 wordvalexpected();
  5708.  
  5709.                                                 break;
  5710.  
  5711.                                         }
  5712.  
  5713.                                 case tk_number:
  5714.  
  5715. wnum:
  5716.  
  5717.                                         asmparam=FALSE;
  5718.  
  5719.                                         holdnumber2=doconstlongmath();
  5720.  
  5721.                                         next=0;
  5722.  
  5723.                                         op66(r16);
  5724.  
  5725.                                         if(hstok.number==AX){
  5726.  
  5727.                                                 op(4+1+basecode);
  5728.  
  5729.                                                 if((postnumflag&f_reloc)!=0)AddReloc();
  5730.  
  5731.                                                 if(i==tk_undefofs)AddUndefOff(2,hstok.name);
  5732.  
  5733.                                                 outword(holdnumber2);
  5734.  
  5735.                                         }
  5736.  
  5737.                                         else{
  5738.  
  5739.                                                 if((postnumflag&f_reloc)==0&&short_ok(holdnumber2)){
  5740.  
  5741.                                                         op(128+2+1);
  5742.  
  5743.                                                         op(128+64+hstok.number+basecode);
  5744.  
  5745.                                                         op(holdnumber2);
  5746.  
  5747.                                                 }
  5748.  
  5749.                                                 else{
  5750.  
  5751.                                                         op(128+1);
  5752.  
  5753.                                                         op(128+64+hstok.number+basecode);
  5754.  
  5755.                                                         if((postnumflag&f_reloc)!=0)AddReloc();
  5756.  
  5757.                                                         if(i==tk_undefofs)AddUndefOff(2,hstok.name);
  5758.  
  5759.                                                         outword(holdnumber2);
  5760.  
  5761.                                                 }
  5762.  
  5763.                                         }
  5764.  
  5765.                                         break;
  5766.  
  5767.                                 case tk_postnumber:
  5768.  
  5769.                                         op66(r16);
  5770.  
  5771.                                         if(hstok.number==AX)op(4+1+basecode);
  5772.  
  5773.                                         else{
  5774.  
  5775.                                                 op(128+1);
  5776.  
  5777.                                                 op(128+64+hstok.number+basecode);
  5778.  
  5779.                                         }
  5780.  
  5781.                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  5782.  
  5783.                                         outword((unsigned int)itok.number);
  5784.  
  5785.                                         break;
  5786.  
  5787.                                 case tk_reg:
  5788.  
  5789.                                         op66(r16);
  5790.  
  5791.                                         op(2+1+basecode);
  5792.  
  5793.                                         op(128+64+(unsigned int)itok.number+hstok.number*8);
  5794.  
  5795.                                         break;
  5796.  
  5797.                                 case tk_wordvar:
  5798.  
  5799.                                 case tk_intvar:
  5800.  
  5801.                                         CheckAllMassiv(bufrm,2,&strinf);
  5802.  
  5803.                                         op66(r16);
  5804.  
  5805.                                         outseg(&itok,2);
  5806.  
  5807.                                         op(2+1+basecode);
  5808.  
  5809.                                         op(itok.rm+hstok.number*8);
  5810.  
  5811.                                         outaddress(&itok);
  5812.  
  5813.                                         break;
  5814.  
  5815.                                 default: wordvalexpected(); break;
  5816.  
  5817.                         }
  5818.  
  5819.                         break;
  5820.  
  5821.                 case tk_reg32:
  5822.  
  5823.                         if((basecode/8)!=a_cmp)ClearReg(hstok.number);
  5824.  
  5825.                         switch(tok){
  5826.  
  5827.                                 case tk_undefofs:
  5828.  
  5829.                                         strcpy(hstok.name,itok.name);
  5830.  
  5831.                                         tok=tk_number;
  5832.  
  5833.                                         goto dnum;
  5834.  
  5835.                                 case tk_minus:
  5836.  
  5837.                                         i=tk_number;
  5838.  
  5839.                                         if(tok2!=tk_number){
  5840.  
  5841.                                                 dwordvalexpected();
  5842.  
  5843.                                                 break;
  5844.  
  5845.                                         }
  5846.  
  5847.                                 case tk_number:
  5848.  
  5849. dnum:
  5850.  
  5851.                                         op66(r32);
  5852.  
  5853.                                         asmparam=FALSE;
  5854.  
  5855.                                         longholdnumber=doconstdwordmath();
  5856.  
  5857.                                         next=0;
  5858.  
  5859.                                         if(i==tk_number&&(postnumflag&f_reloc)==0&&short_ok(longholdnumber,TRUE)){
  5860.  
  5861.                                                 op(128+2+1);
  5862.  
  5863.                                                 op(128+64+hstok.number+basecode);
  5864.  
  5865.                                                 op((int)longholdnumber);
  5866.  
  5867.                                         }
  5868.  
  5869.                                         else{
  5870.  
  5871.                                                 if(hstok.number==EAX)op(4+1+basecode);
  5872.  
  5873.                                                 else{
  5874.  
  5875.                                                         op(128+1);
  5876.  
  5877.                                                         op(128+64+hstok.number+basecode);
  5878.  
  5879.                                                 }
  5880.  
  5881.                                                 if((postnumflag&f_reloc)!=0)AddReloc();
  5882.  
  5883.                                                 if(i==tk_undefofs)AddUndefOff(2,hstok.name);
  5884.  
  5885.                                                 outdword(longholdnumber);
  5886.  
  5887.                                         }
  5888.  
  5889.                                         break;
  5890.  
  5891.                                 case tk_postnumber:
  5892.  
  5893.                                         op66(r32);
  5894.  
  5895.                                         if(hstok.number==EAX)op(4+1+basecode);
  5896.  
  5897.                                         else{
  5898.  
  5899.                                                 op(128+1);
  5900.  
  5901.                                                 op(128+64+hstok.number+basecode);
  5902.  
  5903.                                         }
  5904.  
  5905.                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  5906.  
  5907.                                         outdword(itok.number);
  5908.  
  5909.                                         break;
  5910.  
  5911.                                 case tk_reg32:
  5912.  
  5913.                                         op66(r32);
  5914.  
  5915.                                         op(2+1+basecode);
  5916.  
  5917.                                         op(128+64+(unsigned int)itok.number+hstok.number*8);
  5918.  
  5919.                                         break;
  5920.  
  5921.                                 case tk_dwordvar:
  5922.  
  5923.                                 case tk_longvar:
  5924.  
  5925.                                         CheckAllMassiv(bufrm,4,&strinf);
  5926.  
  5927.                                         op66(r32);
  5928.  
  5929.                                         outseg(&itok,2);
  5930.  
  5931.                                         op(2+1+basecode);
  5932.  
  5933.                                         op(itok.rm+hstok.number*8);
  5934.  
  5935.                                         outaddress(&itok);
  5936.  
  5937.                                         break;
  5938.  
  5939.                                 default: dwordvalexpected(); break;
  5940.  
  5941.                         }
  5942.  
  5943.                         if(cpu<3)cpu=3;
  5944.  
  5945.                         break;
  5946.  
  5947.                 case tk_beg:
  5948.  
  5949.                         if((basecode/8)!=a_cmp)ClearReg(hstok.number>3?hstok.number-4:hstok.number);
  5950.  
  5951.                         switch(tok){
  5952.  
  5953.                                 case tk_minus:
  5954.  
  5955.                                         if(tok2!=tk_number){
  5956.  
  5957.                                                 bytevalexpected(2);
  5958.  
  5959.                                                 break;
  5960.  
  5961.                                         }
  5962.  
  5963.                                 case tk_number:
  5964.  
  5965.                                         asmparam=FALSE;
  5966.  
  5967.                                         holdnumber2=doconstlongmath();
  5968.  
  5969.                                         next=0;
  5970.  
  5971.                                         if(hstok.number==AL)op(4+basecode);
  5972.  
  5973.                                         else{
  5974.  
  5975.                                                 op(128);
  5976.  
  5977.                                                 op(128+64+hstok.number+basecode);
  5978.  
  5979.                                         }
  5980.  
  5981.                                         op(holdnumber2);
  5982.  
  5983.                                         break;
  5984.  
  5985.                                 case tk_beg:
  5986.  
  5987.                                         op(2+basecode);
  5988.  
  5989.                                         op(128+64+(unsigned int)itok.number+hstok.number*8);
  5990.  
  5991.                                         break;
  5992.  
  5993.                                 case tk_bytevar:
  5994.  
  5995.                                 case tk_charvar:
  5996.  
  5997.                                         CheckAllMassiv(bufrm,1,&strinf);
  5998.  
  5999.                                         outseg(&itok,2);
  6000.  
  6001.                                         op(2+basecode);
  6002.  
  6003.                                         op(itok.rm+hstok.number*8);
  6004.  
  6005.                                         outaddress(&itok);
  6006.  
  6007.                                         break;
  6008.  
  6009.                                 default: bytevalexpected(2); break;
  6010.  
  6011.                         }
  6012.  
  6013.                         break;
  6014.  
  6015.                 case tk_dwordvar:
  6016.  
  6017.                 case tk_longvar:
  6018.  
  6019.                         typet=r32;
  6020.  
  6021.                         if(cpu<3)cpu=3;
  6022.  
  6023.                 case tk_intvar:
  6024.  
  6025.                 case tk_wordvar:
  6026.  
  6027.                         if((basecode/8)!=a_cmp)KillVar(hstok.name);
  6028.  
  6029.                         CheckAllMassiv(hbuf,typet,&hstr,&hstok);
  6030.  
  6031.                         op66(typet);
  6032.  
  6033.                         outseg(&hstok,2);
  6034.  
  6035.                         switch(tok){
  6036.  
  6037.                                 case tk_undefofs:
  6038.  
  6039.                                         strcpy(hstok.name,itok.name);
  6040.  
  6041.                                         tok=tk_number;
  6042.  
  6043.                                         goto vnum;
  6044.  
  6045.                                 case tk_minus:
  6046.  
  6047.                                         if(tok2!=tk_number)goto erval;
  6048.  
  6049.                                 case tk_number:
  6050.  
  6051. vnum:
  6052.  
  6053.                                         asmparam=FALSE;
  6054.  
  6055.                                         holdnumber2=doconstlongmath();
  6056.  
  6057. #ifdef OPTVARCONST
  6058.  
  6059.                                         if(i==tk_number&&(postnumflag&f_reloc)==0){
  6060.  
  6061.                                                 initconst=UpdVarConst(&hstok,holdnumber2,tk_dword,operand);
  6062.  
  6063.                                         }
  6064.  
  6065. #endif
  6066.  
  6067.                                         next=0;
  6068.  
  6069.                                         if(i!=tk_undefofs&&(postnumflag&f_reloc)==0&&short_ok(holdnumber2,typet/2-1)){
  6070.  
  6071.                                                 op(128+2+1);
  6072.  
  6073.                                                 op(hstok.rm+basecode);
  6074.  
  6075.                                                 outaddress(&hstok);
  6076.  
  6077.                                                 op(holdnumber2);
  6078.  
  6079.                                         }
  6080.  
  6081.                                         else{
  6082.  
  6083.                                                 op(128+1);
  6084.  
  6085.                                                 op(hstok.rm+basecode);
  6086.  
  6087.                                                 outaddress(&hstok);
  6088.  
  6089.                                                 if((postnumflag&f_reloc)!=0)AddReloc();
  6090.  
  6091.                                                 if(i==tk_undefofs)AddUndefOff(2,hstok.name);
  6092.  
  6093.                                                 if(typet==r16)outword(holdnumber2);
  6094.  
  6095.                                                 else outdword(holdnumber2);
  6096.  
  6097.                                         }
  6098.  
  6099.                                         break;
  6100.  
  6101.                                 case tk_postnumber:
  6102.  
  6103.                                         if(typet==r32)goto erval;
  6104.  
  6105.                                         op(128+1);
  6106.  
  6107.                                         op(hstok.rm+basecode);
  6108.  
  6109.                                         outaddress(&hstok);
  6110.  
  6111.                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  6112.  
  6113.                                         if(typet==r16)outword(itok.number);
  6114.  
  6115.                                         else outdword(itok.number);
  6116.  
  6117.                                         break;
  6118.  
  6119.                                 case tk_reg32:
  6120.  
  6121.                                         if(typet==r16)goto erval;
  6122.  
  6123.                                 case tk_reg:
  6124.  
  6125.                                         op(1+basecode);
  6126.  
  6127.                                         op(hstok.rm+(unsigned int)itok.number*8);
  6128.  
  6129.                                         outaddress(&hstok);
  6130.  
  6131.                                         break;
  6132.  
  6133.                                 default:
  6134.  
  6135. erval:
  6136.  
  6137.                                         if(typet==r16)wordvalexpected();
  6138.  
  6139.                                         else dwordvalexpected();
  6140.  
  6141.                                         break;
  6142.  
  6143.                         }
  6144.  
  6145. #ifdef OPTVARCONST
  6146.  
  6147.                         if(initconst==FALSE)ClearVarByNum(&hstok);
  6148.  
  6149. #endif
  6150.  
  6151.  
  6152.  
  6153.                         break;
  6154.  
  6155.                 case tk_bytevar:
  6156.  
  6157.                 case tk_charvar:
  6158.  
  6159.                         if((basecode/8)!=a_cmp)KillVar(hstok.name);
  6160.  
  6161.                         CheckAllMassiv(hbuf,1,&hstr,&hstok);
  6162.  
  6163.                         switch(tok){
  6164.  
  6165.                                 case tk_minus:
  6166.  
  6167.                                         if(tok2!=tk_number){
  6168.  
  6169.                                                 bytevalexpected(2);
  6170.  
  6171.                                                 break;
  6172.  
  6173.                                         }
  6174.  
  6175.                                 case tk_number:
  6176.  
  6177.                                         asmparam=FALSE;
  6178.  
  6179.                                         holdnumber2=doconstlongmath();
  6180.  
  6181. #ifdef OPTVARCONST
  6182.  
  6183.                                         if((postnumflag&f_reloc)==0){
  6184.  
  6185.                                                 initconst=UpdVarConst(&hstok,holdnumber2,tk_byte,operand);
  6186.  
  6187.                                         }
  6188.  
  6189. #endif
  6190.  
  6191.                                         next=0;
  6192.  
  6193.                                         outseg(&hstok,2);
  6194.  
  6195.                                         op(128);
  6196.  
  6197.                                         op(hstok.rm+basecode);
  6198.  
  6199.                                         outaddress(&hstok);
  6200.  
  6201.                                         op(holdnumber2);
  6202.  
  6203.                                         break;
  6204.  
  6205.                                 case tk_beg:
  6206.  
  6207.                                         outseg(&hstok,2);
  6208.  
  6209.                                         op(basecode);
  6210.  
  6211.                                         op(hstok.rm+(unsigned int)itok.number*8);
  6212.  
  6213.                                         outaddress(&hstok);
  6214.  
  6215.                                         break;
  6216.  
  6217.                                 default: bytevalexpected(2); break;
  6218.  
  6219.                         }
  6220.  
  6221. #ifdef OPTVARCONST
  6222.  
  6223.                         if(initconst==FALSE)ClearVarByNum(&hstok);
  6224.  
  6225. #endif
  6226.  
  6227.                         break;
  6228.  
  6229.                 default: varexpected(1);        break;
  6230.  
  6231.         }
  6232.  
  6233.         if(next)nexttok();
  6234.  
  6235. }
  6236.  
  6237.  
  6238.  
  6239. int GOTO()
  6240.  
  6241. {
  6242.  
  6243. unsigned char next=1;
  6244.  
  6245.         CheckIP();
  6246.  
  6247. #ifdef OPTVARCONST
  6248.  
  6249.         ClearLVIC();
  6250.  
  6251. #endif
  6252.  
  6253.         clearregstat();
  6254.  
  6255.         switch(tok){
  6256.  
  6257.                 case tk_proc:
  6258.  
  6259.                 case tk_interruptproc:
  6260.  
  6261.                         if(itok.segm!=NOT_DYNAMIC){
  6262.  
  6263.                                 idrec *ptr=itok.rec;
  6264.  
  6265.                                 itok.segm=ptr->recsegm=DYNAMIC_USED;
  6266.  
  6267.                                 itok.rm=tok=tk_undefofs;        //ᬥ饭¨¥ ¥é¥ ­¥ ¨§¢¥áâ­®© ¬¥âª¨
  6268.  
  6269.                                 goto undefproc;
  6270.  
  6271.                         }
  6272.  
  6273.                         jumploc(itok.number);   //­  ¯à®æ¥¤ãàë ®¯à à ­¥¥¥
  6274.  
  6275.                         break;
  6276.  
  6277.                 case tk_number:
  6278.  
  6279.                         asmparam=FALSE;
  6280.  
  6281.                         jumploc(doconstlongmath());//­  ª®­ªà¥â­ë©  ¤à¥á
  6282.  
  6283.                         next=0;
  6284.  
  6285.                         break;
  6286.  
  6287.                 case tk_ID:
  6288.  
  6289.                         addlocaljump(CALL_SHORT); //¢®§¬®¦­ãî «®ª «ì­ãî ¬¥âªã
  6290.  
  6291.                         outword(0x00EB);        // JMP SHORT
  6292.  
  6293.                         break;
  6294.  
  6295.                 case tk_id:
  6296.  
  6297.                         tobedefined(CALL_SHORT,tk_void);//¢®§¬®¦­® ®¡ì¥­ãî ¬¥âªã
  6298.  
  6299.                         outword(0x00EB);        // JMP SHORT
  6300.  
  6301.                         break;
  6302.  
  6303.                 case tk_declare:
  6304.  
  6305.                         tok=tk_undefproc;
  6306.  
  6307.                         updatetree();
  6308.  
  6309.                 case tk_locallabel:
  6310.  
  6311.                 case tk_undefproc:              //­¥®¡ê¥­ãî ¯à®æ
  6312.  
  6313. undefproc:
  6314.  
  6315.                         addacall((unsigned int)itok.number,(unsigned char)((itok.flag&f_extern)!=0?CALL_EXT:CALL_SHORT));
  6316.  
  6317.                         outword(0x00EB);        // JMP SHORT
  6318.  
  6319.                         break;
  6320.  
  6321.                 default: shortjumperror(); break;
  6322.  
  6323.         }
  6324.  
  6325.         return next;
  6326.  
  6327. }
  6328.  
  6329.  
  6330.  
  6331. unsigned char gotol(int faradd)
  6332.  
  6333. {
  6334.  
  6335. unsigned char next=1;
  6336.  
  6337. unsigned long hnumber;
  6338.  
  6339. unsigned int i=0;
  6340.  
  6341.         CheckIP();
  6342.  
  6343. #ifdef OPTVARCONST
  6344.  
  6345.         ClearLVIC();
  6346.  
  6347. #endif
  6348.  
  6349.         clearregstat();
  6350.  
  6351.         switch(tok){
  6352.  
  6353.                 case tk_declare:
  6354.  
  6355.                         if(tok2!=tk_openbracket){
  6356.  
  6357.                                 tok=tk_undefproc;
  6358.  
  6359.                                 updatetree();
  6360.  
  6361.                         }
  6362.  
  6363.                 case tk_locallabel:
  6364.  
  6365.                 case tk_undefproc:
  6366.  
  6367.                         if(tok2==tk_openbracket){
  6368.  
  6369.                                 asmparam=FALSE;
  6370.  
  6371.                                 if(doanyundefproc(TRUE)==tokens)next=0;
  6372.  
  6373.                                 break;
  6374.  
  6375.                         }
  6376.  
  6377.                         if(faradd==0){
  6378.  
  6379.                                 addacall((unsigned int)itok.number,(unsigned char)((itok.flag&f_extern)!=0?CALL_EXT:(am32==FALSE?JMP_NEAR:JMP_32)));
  6380.  
  6381.                                 jumploc0();
  6382.  
  6383.                         }                       /* JMP num */
  6384.  
  6385.                         else invalidfarjumpitem();
  6386.  
  6387.                         break;
  6388.  
  6389.                 case tk_proc:
  6390.  
  6391.                         if(tok2==tk_openbracket){
  6392.  
  6393.                                 doanyproc(TRUE);
  6394.  
  6395.                                 break;
  6396.  
  6397.                         }
  6398.  
  6399.                         if(itok.segm!=NOT_DYNAMIC){
  6400.  
  6401.                                 idrec *ptr=itok.rec;
  6402.  
  6403.                                 itok.segm=ptr->recsegm=DYNAMIC_USED;
  6404.  
  6405.                                 itok.rm=tok=tk_undefofs;        //ᬥ饭¨¥ ¥é¥ ­¥ ¨§¢¥áâ­®© ¬¥âª¨
  6406.  
  6407.                                 if(faradd==0){
  6408.  
  6409.                                         addacall((unsigned int)itok.number,(unsigned char)((itok.flag&f_extern)!=0?CALL_EXT:(am32==FALSE?JMP_NEAR:JMP_32)));
  6410.  
  6411.                                         jumploc0();
  6412.  
  6413.                                         break;
  6414.  
  6415.                                 }                       /* JMP num */
  6416.  
  6417.                         }
  6418.  
  6419.                 case tk_interruptproc:
  6420.  
  6421.                         if(faradd==0)jumploc(itok.number);
  6422.  
  6423.                         else invalidfarjumpitem();
  6424.  
  6425.                         break;
  6426.  
  6427.                 case tk_apiproc:
  6428.  
  6429.                         asmparam=FALSE;
  6430.  
  6431.                         if(tok2==tk_openbracket){
  6432.  
  6433.                                 if(doanyundefproc(TRUE)==tokens)next=0;
  6434.  
  6435.                         }
  6436.  
  6437.                         else{
  6438.  
  6439.                                 if(FastCallApi==TRUE){
  6440.  
  6441.                                         outword(0x25ff);
  6442.  
  6443.                                         AddApiToPost(itok.number);
  6444.  
  6445.                                 }
  6446.  
  6447.                                 else{
  6448.  
  6449.                                         addacall(itok.number,(unsigned char)CALL_32);
  6450.  
  6451.                                         jumploc0();
  6452.  
  6453.                                 }
  6454.  
  6455.                         }
  6456.  
  6457.                         break;
  6458.  
  6459.                 case tk_minus:
  6460.  
  6461.                         if(tok2!=tk_number)goto err;
  6462.  
  6463.                 case tk_number:
  6464.  
  6465.                         asmparam=FALSE;
  6466.  
  6467.                         hnumber=doconstdwordmath();
  6468.  
  6469.                         if(faradd==0)jumploc(hnumber);
  6470.  
  6471.                         else{
  6472.  
  6473.                                 op(0xEA);
  6474.  
  6475.                                 expecting2(tk_colon);
  6476.  
  6477.                                 int htok=tok;
  6478.  
  6479.                                 char name[IDLENGTH];
  6480.  
  6481.                                 if(tok==tk_undefofs){
  6482.  
  6483.                                         tok=tk_number;
  6484.  
  6485.                                         strcpy(name,itok.name);
  6486.  
  6487.                                 }
  6488.  
  6489.                                 unsigned long tempi=doconstdwordmath();
  6490.  
  6491.                                 if(postnumflag&f_reloc)AddReloc();
  6492.  
  6493.                                 if(htok==tk_undefofs)AddUndefOff(2,name);
  6494.  
  6495.                                 if(am32==FALSE)outword((unsigned int)tempi);
  6496.  
  6497.                                 else outdword(tempi);
  6498.  
  6499.                                 outword((unsigned int)hnumber);
  6500.  
  6501.                         }
  6502.  
  6503.                         next=0;
  6504.  
  6505.                         break;   /* JMP num */
  6506.  
  6507.                 case tk_postnumber:
  6508.  
  6509.                         if(faradd==0){
  6510.  
  6511.                                 op(0xE9);
  6512.  
  6513.                                 (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  6514.  
  6515.                                 if(am32==FALSE)outword((unsigned int)itok.number);
  6516.  
  6517.                                 else outdword(itok.number);
  6518.  
  6519.                         }
  6520.  
  6521.                         else invalidfarjumpitem();
  6522.  
  6523.                         break;
  6524.  
  6525.                 case tk_reg32:
  6526.  
  6527.                         op66(r32);
  6528.  
  6529.                         goto jmpreg;
  6530.  
  6531.                 case tk_reg:
  6532.  
  6533.                         op66(r16);
  6534.  
  6535. jmpreg:
  6536.  
  6537.                         if(faradd==0){
  6538.  
  6539.                                 op(0xFF);
  6540.  
  6541.                                 op(0xE0+(unsigned int)itok.number);
  6542.  
  6543.                         }        /* JMP reg */
  6544.  
  6545.                         else invalidfarjumpitem();
  6546.  
  6547.                         break;
  6548.  
  6549.                 case tk_ID:
  6550.  
  6551.                         if(faradd==0){
  6552.  
  6553.                                 addlocaljump(am32==FALSE?JMP_NEAR:JMP_32);
  6554.  
  6555.                                 jumploc0();
  6556.  
  6557.                         }                /* JMP num */
  6558.  
  6559.                         else invalidfarjumpitem();
  6560.  
  6561.                         break;
  6562.  
  6563.                 case tk_id:
  6564.  
  6565.                         if(faradd==0){
  6566.  
  6567.                                 tobedefined(am32==FALSE?JMP_NEAR:JMP_32,tk_void);
  6568.  
  6569.                                 jumploc0();
  6570.  
  6571.                         }                /* JMP num */
  6572.  
  6573.                         else invalidfarjumpitem();
  6574.  
  6575.                         break;
  6576.  
  6577.                 case tk_dwordvar:
  6578.  
  6579.                 case tk_longvar:
  6580.  
  6581.                         i=2;
  6582.  
  6583.                 case tk_intvar:
  6584.  
  6585.                 case tk_wordvar:
  6586.  
  6587.                         i+=2;
  6588.  
  6589.                         CheckAllMassiv(bufrm,i,&strinf);
  6590.  
  6591.                         outseg(&itok,2);
  6592.  
  6593.                         op(0xFF);  op(0x20+itok.rm+(faradd==0?(i==4&&am32==0?8:0):8));
  6594.  
  6595.                         outaddress(&itok);
  6596.  
  6597.                         break;
  6598.  
  6599.                 default:
  6600.  
  6601. err:
  6602.  
  6603.                         preerror("Invalid item for JMP");
  6604.  
  6605.                         break;
  6606.  
  6607.         }
  6608.  
  6609.         return next;
  6610.  
  6611. }
  6612.  
  6613.  
  6614.  
  6615. void  asmregmem(int out1,int out2) // used for LEA LDS LES LFS LGS LSS.
  6616.  
  6617. {
  6618.  
  6619. int holdreg;
  6620.  
  6621.         nexttok();
  6622.  
  6623.         op66(tok==tk_reg?r16:r32);
  6624.  
  6625.         if(tok!=tk_reg32&&tok!=tk_reg)reg32regexpected(1);
  6626.  
  6627.         holdreg=(unsigned int)itok.number;
  6628.  
  6629.         ClearReg(itok.number);
  6630.  
  6631.         nextexpecting2(tk_camma);
  6632.  
  6633.         switch(tok){
  6634.  
  6635.                 case tk_intvar:
  6636.  
  6637.                 case tk_wordvar:
  6638.  
  6639.                 case tk_charvar:
  6640.  
  6641.                 case tk_bytevar:
  6642.  
  6643.                 case tk_longvar:
  6644.  
  6645.                 case tk_dwordvar:
  6646.  
  6647.                         break;
  6648.  
  6649.                 default: varexpected(2);
  6650.  
  6651.         }
  6652.  
  6653.         CheckAllMassiv(bufrm,2,&strinf);
  6654.  
  6655.         if(out2==0)outseg(&itok,2);
  6656.  
  6657.         else outseg(&itok,3);
  6658.  
  6659.         op(out1);
  6660.  
  6661.         if(out2!=0)op(out2);
  6662.  
  6663.         op(itok.rm+holdreg*8);
  6664.  
  6665.         outaddress(&itok);
  6666.  
  6667. }
  6668.  
  6669.  
  6670.  
  6671. void Scanbit(int basecode)
  6672.  
  6673. {
  6674.  
  6675. unsigned long hnumber;
  6676.  
  6677. int htok,typet=r16;
  6678.  
  6679.         nexttok();
  6680.  
  6681.         hnumber=itok.number;
  6682.  
  6683.         ClearReg(itok.number);
  6684.  
  6685.         htok=tok;
  6686.  
  6687.         nextexpecting2(tk_camma);
  6688.  
  6689.         switch(htok){
  6690.  
  6691.                 case tk_reg32:
  6692.  
  6693.                         typet=r32;
  6694.  
  6695.                         if(tok==tk_reg||tok==tk_wordvar||tok==tk_intvar)goto erval;
  6696.  
  6697.                 case tk_reg:
  6698.  
  6699.                   switch(tok){
  6700.  
  6701.                                 case tk_reg32:
  6702.  
  6703.                                         if(typet==r16)goto erval;
  6704.  
  6705.                                 case tk_reg:
  6706.  
  6707.                                         op66(typet);
  6708.  
  6709.                                         op(0xf);
  6710.  
  6711.                                         op(basecode);
  6712.  
  6713.                                         op(0xc0+(unsigned int)itok.number+hnumber*8);
  6714.  
  6715.                                         break;
  6716.  
  6717.                                 case tk_dwordvar:
  6718.  
  6719.                                 case tk_longvar:
  6720.  
  6721.                                         if(typet==r16)goto erval;
  6722.  
  6723.                                 case tk_wordvar:
  6724.  
  6725.                                 case tk_intvar:
  6726.  
  6727.                                         CheckAllMassiv(bufrm,typet,&strinf);
  6728.  
  6729.                                         op66(typet);
  6730.  
  6731.                                         outseg(&itok,3);
  6732.  
  6733.                                         op(0xf);
  6734.  
  6735.                                         op(basecode);
  6736.  
  6737.                                         op(itok.rm+hnumber*8);
  6738.  
  6739.                                         outaddress(&itok);
  6740.  
  6741.                                         break;
  6742.  
  6743.                                 default:
  6744.  
  6745. erval:
  6746.  
  6747.                                         if(typet==r16)wordvalexpected();
  6748.  
  6749.                                         else dwordvalexpected();
  6750.  
  6751.                                         break;
  6752.  
  6753.                         }
  6754.  
  6755.                         break;
  6756.  
  6757.                 default: reg32regexpected(1);
  6758.  
  6759.         }
  6760.  
  6761.         if(cpu<3)cpu=3;
  6762.  
  6763. }
  6764.  
  6765.  
  6766.  
  6767. void CheckBit(int code)
  6768.  
  6769. {
  6770.  
  6771. unsigned long holdnumber2;
  6772.  
  6773. int htok;
  6774.  
  6775. ITOK hstok;
  6776.  
  6777. unsigned char next=1;
  6778.  
  6779. char *hbuf;
  6780.  
  6781. SINFO hstr;
  6782.  
  6783.         nexttok();
  6784.  
  6785.         hstok=itok;
  6786.  
  6787.         htok=tok;
  6788.  
  6789.         hbuf=bufrm;
  6790.  
  6791.         bufrm=NULL;
  6792.  
  6793.         hstr=strinf;
  6794.  
  6795.         strinf.bufstr=NULL;
  6796.  
  6797.         nextexpecting2(tk_camma);
  6798.  
  6799.         switch(htok){
  6800.  
  6801.                 case tk_reg32:
  6802.  
  6803.                 case tk_reg:
  6804.  
  6805.                         op66(htok==tk_reg?r16:r32);
  6806.  
  6807.                         if(code)ClearReg(hstok.number);
  6808.  
  6809.                   switch(tok){
  6810.  
  6811.                                 case tk_number:
  6812.  
  6813.                                         asmparam=FALSE;
  6814.  
  6815.                                         holdnumber2=doconstlongmath();
  6816.  
  6817.                                         next=0;
  6818.  
  6819.                                         outword(0xba0f);
  6820.  
  6821.                                         op(0xe0+code+hstok.number);
  6822.  
  6823.                                         op(holdnumber2);
  6824.  
  6825.                                         break;
  6826.  
  6827.                                 case tk_reg32:
  6828.  
  6829.                                         if(tok!=htok){
  6830.  
  6831.                                                 dwordvalexpected();
  6832.  
  6833.                                                 break;
  6834.  
  6835.                                         }
  6836.  
  6837.                                 case tk_reg:
  6838.  
  6839.                                         if(tok!=htok)wordvalexpected();
  6840.  
  6841.                                         op(0xf);
  6842.  
  6843.                                         op(0xa3+code);
  6844.  
  6845.                                         op(0xc0+hstok.number+(unsigned int)itok.number*8);
  6846.  
  6847.                                         break;
  6848.  
  6849.                                 default: wordvalexpected(); break;
  6850.  
  6851.                         }
  6852.  
  6853.                         break;
  6854.  
  6855.                 case tk_intvar:
  6856.  
  6857.                 case tk_wordvar:
  6858.  
  6859.                         CheckAllMassiv(hbuf,2,&hstr,&hstok);
  6860.  
  6861.                         if(code)KillVar(hstok.name);
  6862.  
  6863.                         op66(r16);
  6864.  
  6865.                         switch(tok){
  6866.  
  6867.                                 case tk_number:
  6868.  
  6869. varc:
  6870.  
  6871.                                         asmparam=FALSE;
  6872.  
  6873.                                         holdnumber2=doconstlongmath();
  6874.  
  6875.                                         next=0;
  6876.  
  6877.                                         outseg(&hstok,3);
  6878.  
  6879.                                         outword(0xba0f);
  6880.  
  6881.                                         op(hstok.rm+code+0x20);
  6882.  
  6883.                                         outaddress(&hstok);
  6884.  
  6885.                                         op(holdnumber2);
  6886.  
  6887.                                         break;
  6888.  
  6889.                                 case tk_reg:
  6890.  
  6891. varreg:
  6892.  
  6893.                                         outseg(&hstok,3);
  6894.  
  6895.                                         op(0xf);
  6896.  
  6897.                                         op(0xa3+code);
  6898.  
  6899.                                         op(hstok.rm+(unsigned int)itok.number*8);
  6900.  
  6901.                                         outaddress(&hstok);
  6902.  
  6903.                                         break;
  6904.  
  6905.                                 default: wordvalexpected(); break;
  6906.  
  6907.                         }
  6908.  
  6909. #ifdef OPTVARCONST
  6910.  
  6911.                         if(code)ClearVarByNum(&hstok);
  6912.  
  6913. #endif
  6914.  
  6915.                         break;
  6916.  
  6917.                 case tk_dwordvar:
  6918.  
  6919.                 case tk_longvar:
  6920.  
  6921.                         CheckAllMassiv(hbuf,4,&hstr,&hstok);
  6922.  
  6923.                         if(code)KillVar(hstok.name);
  6924.  
  6925.                         op66(r32);
  6926.  
  6927.                         if(tok==tk_number)goto varc;
  6928.  
  6929.                         if(tok==tk_reg32)goto varreg;
  6930.  
  6931.                         dwordvalexpected();
  6932.  
  6933.                         break;
  6934.  
  6935.                 default: varexpected(1);
  6936.  
  6937.         }
  6938.  
  6939.         if(cpu<3)cpu=3;
  6940.  
  6941.         if(next)nexttok();
  6942.  
  6943. }
  6944.  
  6945.  
  6946.  
  6947. void asmone1(int basecode)                       // used for INC and DEC.
  6948.  
  6949. {
  6950.  
  6951. int razr=r16;
  6952.  
  6953. #ifdef OPTVARCONST
  6954.  
  6955. int operand=GetOperand(basecode/8+a_inc);
  6956.  
  6957. #endif
  6958.  
  6959.         nexttok();
  6960.  
  6961.         switch(tok){
  6962.  
  6963.                 case tk_reg32:
  6964.  
  6965.                         if(cpu<3)cpu=3;
  6966.  
  6967.                         razr=r32;
  6968.  
  6969.                 case tk_reg:
  6970.  
  6971.                         ClearReg(itok.number);
  6972.  
  6973.                         op66(razr);
  6974.  
  6975.                   op(64+basecode+(unsigned int)itok.number);
  6976.  
  6977.                         break;
  6978.  
  6979.                 case tk_beg:
  6980.  
  6981.                         ClearReg(itok.number);
  6982.  
  6983.                         op(254); op(128+64+basecode+(unsigned int)itok.number);
  6984.  
  6985.                         break;
  6986.  
  6987.                 case tk_charvar:
  6988.  
  6989.                 case tk_bytevar:
  6990.  
  6991. #ifdef OPTVARCONST
  6992.  
  6993.                         UpdVarConst(&itok,1,tk_byte,operand);
  6994.  
  6995. #endif
  6996.  
  6997.                         CheckAllMassiv(bufrm,1,&strinf);
  6998.  
  6999.                         KillVar(itok.name);
  7000.  
  7001.                         outseg(&itok,2);
  7002.  
  7003.                         op(254);
  7004.  
  7005.                         op(itok.rm+basecode);
  7006.  
  7007.                         outaddress(&itok);
  7008.  
  7009.                         break;
  7010.  
  7011.                 case tk_longvar:
  7012.  
  7013.                 case tk_dwordvar:
  7014.  
  7015.                         CheckAllMassiv(bufrm,4,&strinf);
  7016.  
  7017.                         if(cpu<3)cpu=3;
  7018.  
  7019.                         razr=r32;
  7020.  
  7021.                         goto dec;
  7022.  
  7023.                 case tk_intvar:
  7024.  
  7025.                 case tk_wordvar:
  7026.  
  7027.                         CheckAllMassiv(bufrm,2,&strinf);
  7028.  
  7029. dec:
  7030.  
  7031. #ifdef OPTVARCONST
  7032.  
  7033.                         UpdVarConst(&itok,1,tk_dword,operand);
  7034.  
  7035. #endif
  7036.  
  7037.                         KillVar(itok.name);
  7038.  
  7039.                         op66(razr);
  7040.  
  7041.                         outseg(&itok,2);
  7042.  
  7043.                         op(255);
  7044.  
  7045.                         op(itok.rm+basecode);
  7046.  
  7047.                         outaddress(&itok);
  7048.  
  7049.                         break;
  7050.  
  7051.                 default: varexpected(0);        break;
  7052.  
  7053.         }
  7054.  
  7055. }
  7056.  
  7057.  
  7058.  
  7059. void asmone2(int basecode)                       // used for NEG NOT MUL IMUL DIV IDIV.
  7060.  
  7061. {
  7062.  
  7063. int razr=r16;
  7064.  
  7065. #ifdef OPTVARCONST
  7066.  
  7067. int operand=GetOperand((basecode-16)/8+a_not);
  7068.  
  7069. #endif
  7070.  
  7071.         nexttok();
  7072.  
  7073.         switch(tok){
  7074.  
  7075.                 case tk_reg32:
  7076.  
  7077.                         if(cpu<3)cpu=3;
  7078.  
  7079.                         razr=r32;
  7080.  
  7081.                 case tk_reg:
  7082.  
  7083.                         ClearReg(itok.number);
  7084.  
  7085.                         op66(razr);
  7086.  
  7087.                   op(246+1); op(128+64+basecode+(unsigned int)itok.number); break;
  7088.  
  7089.                 case tk_beg:
  7090.  
  7091.                         ClearReg(itok.number);
  7092.  
  7093.                         op(246); op(128+64+basecode+(unsigned int)itok.number); break;
  7094.  
  7095.                         razr=r8;
  7096.  
  7097.                 case tk_charvar:
  7098.  
  7099.                 case tk_bytevar:
  7100.  
  7101. #ifdef OPTVARCONST
  7102.  
  7103.                         UpdVarConst(&itok,0,tk_dword,operand);
  7104.  
  7105. #endif
  7106.  
  7107.                         CheckAllMassiv(bufrm,1,&strinf);
  7108.  
  7109.                         KillVar(itok.name);
  7110.  
  7111.                         outseg(&itok,2);
  7112.  
  7113.                         op(246);
  7114.  
  7115.                         op(itok.rm+basecode);
  7116.  
  7117.                         outaddress(&itok);
  7118.  
  7119.                         razr=r8;
  7120.  
  7121.                         break;
  7122.  
  7123.                 case tk_longvar:
  7124.  
  7125.                 case tk_dwordvar:
  7126.  
  7127.                         CheckAllMassiv(bufrm,4,&strinf);
  7128.  
  7129.                         if(cpu<3)cpu=3;
  7130.  
  7131.                         razr=r32;
  7132.  
  7133.                         goto neg;
  7134.  
  7135.                 case tk_intvar:
  7136.  
  7137.                 case tk_wordvar:
  7138.  
  7139.                         CheckAllMassiv(bufrm,2,&strinf);
  7140.  
  7141. neg:
  7142.  
  7143. #ifdef OPTVARCONST
  7144.  
  7145.                         UpdVarConst(&itok,0,tk_dword,operand);
  7146.  
  7147. #endif
  7148.  
  7149.                         KillVar(itok.name);
  7150.  
  7151.                         op66(razr);
  7152.  
  7153.                         outseg(&itok,2);
  7154.  
  7155.                         op(247);
  7156.  
  7157.                         op(itok.rm+basecode);
  7158.  
  7159.                         outaddress(&itok);
  7160.  
  7161.                         break;
  7162.  
  7163.                 default: varexpected(0);        break;
  7164.  
  7165.         }
  7166.  
  7167.         if(basecode!=16&&basecode!=24){
  7168.  
  7169.                 ClearReg(AX);
  7170.  
  7171.                 if(razr!=r8)ClearReg(DX);
  7172.  
  7173.         }
  7174.  
  7175. }
  7176.  
  7177.  
  7178.  
  7179. void  asmshortjump(int shortcode,int nearcode)
  7180.  
  7181. {
  7182.  
  7183. unsigned char next=1,shortjump=1;
  7184.  
  7185. unsigned int address;
  7186.  
  7187. #ifdef OPTVARCONST
  7188.  
  7189.         ClearLVIC();
  7190.  
  7191. #endif
  7192.  
  7193.         nexttok();
  7194.  
  7195.         if(stricmp("FAR",itok.name)==0){         // case insensitive
  7196.  
  7197.                 preerror("FAR jump not available for this instruction");
  7198.  
  7199.                 nexttok();
  7200.  
  7201.         }
  7202.  
  7203.         else if(stricmp("NEAR",itok.name)==0){  // case insensitive
  7204.  
  7205.                 shortjump=0;
  7206.  
  7207.                 nexttok();
  7208.  
  7209.         }
  7210.  
  7211.         else if(stricmp("SHORT",itok.name)==0)nexttok();  // case insensitive
  7212.  
  7213.         if(shortjump){
  7214.  
  7215.                 CheckIP();
  7216.  
  7217.                 switch(tok){
  7218.  
  7219.                         case tk_proc:
  7220.  
  7221.                                 *(unsigned int *)&itok.number-=outptr+2;
  7222.  
  7223.                                 if(short_ok(itok.number)){
  7224.  
  7225.                                         op(shortcode);
  7226.  
  7227.                                         op((unsigned int)itok.number);
  7228.  
  7229.                                 }
  7230.  
  7231.                                 else shortjumptoolarge();
  7232.  
  7233.                                 break;
  7234.  
  7235.                         case tk_number:
  7236.  
  7237.                                 asmparam=FALSE;
  7238.  
  7239.                                 address=doconstdwordmath()-(outptr+2);
  7240.  
  7241.                                 if(short_ok(address)){
  7242.  
  7243.                                         op(shortcode);
  7244.  
  7245.                                         op(address);
  7246.  
  7247.                                 }
  7248.  
  7249.                                 else shortjumptoolarge();
  7250.  
  7251.                                 next=0;
  7252.  
  7253.                                 break;
  7254.  
  7255.                         case tk_ID:
  7256.  
  7257.                                 addlocaljump(CALL_SHORT);
  7258.  
  7259.                                 op(shortcode); op(0x00);         /* JXX SHORT */
  7260.  
  7261.                                 break;
  7262.  
  7263.                         case tk_id:
  7264.  
  7265.                                 tobedefined(CALL_SHORT,tk_void);
  7266.  
  7267.                                 op(shortcode); op(0x00);         /* JXX SHORT */
  7268.  
  7269.                                 break;
  7270.  
  7271.                         case tk_declare:
  7272.  
  7273.                                 tok=tk_undefproc;
  7274.  
  7275.                                 updatetree();
  7276.  
  7277.                         case tk_locallabel:
  7278.  
  7279.                         case tk_undefproc:
  7280.  
  7281.                                 addacall((unsigned int)itok.number,(unsigned char)((itok.flag&f_extern)!=0?CALL_EXT:CALL_SHORT));
  7282.  
  7283.                                 op(shortcode); op(0x00);                /* JXX SHORT */
  7284.  
  7285.                                 break;
  7286.  
  7287.                         default: shortjumperror(); break;
  7288.  
  7289.                 }
  7290.  
  7291.         }
  7292.  
  7293.         else if(nearcode!=0){
  7294.  
  7295. unsigned long numlong;
  7296.  
  7297.                 asmparam=FALSE;
  7298.  
  7299.                 switch(tok){
  7300.  
  7301.                         case tk_proc:
  7302.  
  7303.                                 op(0xF); op(nearcode);
  7304.  
  7305.                                 numlong=itok.number-outptr-2;
  7306.  
  7307.                                 if(am32==FALSE)outword((unsigned int)numlong);
  7308.  
  7309.                                 else outdword(numlong-2);
  7310.  
  7311.                                 break;
  7312.  
  7313.                         case tk_number:
  7314.  
  7315.                                 op(0xF); op(nearcode);
  7316.  
  7317.                                 numlong=doconstdwordmath()-outptr-2;
  7318.  
  7319.                                 if(am32==FALSE)outword((unsigned int)numlong);
  7320.  
  7321.                                 else outdword(numlong-2);
  7322.  
  7323.                                 next=0;
  7324.  
  7325.                                 break;
  7326.  
  7327.                         case tk_undefofs:       // ???? 32 ¡¨â­ë© ०¨¬
  7328.  
  7329.                                 op(0xF); op(nearcode);
  7330.  
  7331.                                 AddUndefOff(2,itok.name);
  7332.  
  7333.                                 outword(-(int)(outptr-2));
  7334.  
  7335.                                 if(am32!=FALSE)outword(0x0000);
  7336.  
  7337.                                 break;
  7338.  
  7339.                         case tk_postnumber:
  7340.  
  7341.                                 op(0xF); op(nearcode);
  7342.  
  7343.                                 (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  7344.  
  7345.                                 numlong=itok.number-outptr-2;
  7346.  
  7347.                                 if(am32==FALSE)outword((unsigned int)numlong);
  7348.  
  7349.                                 else outdword(numlong-2);
  7350.  
  7351.                                 break;
  7352.  
  7353.                         case tk_ID:
  7354.  
  7355.                                 op(0xF);         // must go before tobedefined()
  7356.  
  7357.                                 addlocaljump(am32==FALSE?CALL_NEAR:CALL_32);
  7358.  
  7359.                                 op(nearcode); outword(0x0000);                  /* JXX NEAR */
  7360.  
  7361.                                 if(am32!=FALSE)outword(0x0000);
  7362.  
  7363.                                 break;
  7364.  
  7365.                         case tk_id:
  7366.  
  7367.                                 op(0xF);         // must go before tobedefined()
  7368.  
  7369.                                 tobedefined(am32==FALSE?CALL_NEAR:CALL_32,tk_void);
  7370.  
  7371.                                 op(nearcode); outword(0x0000);                  /* JXX NEAR */
  7372.  
  7373.                                 if(am32!=FALSE)outword(0x0000);
  7374.  
  7375.                                 break;
  7376.  
  7377.                         case tk_declare:
  7378.  
  7379.                                 tok=tk_undefproc;
  7380.  
  7381.                                 updatetree();
  7382.  
  7383.                         case tk_locallabel:
  7384.  
  7385.                         case tk_undefproc:
  7386.  
  7387.                                 op(0xF);         // must go before addacall()
  7388.  
  7389.                                 addacall((unsigned int)itok.number,(unsigned char)((itok.flag&f_extern)!=0?CALL_EXT:(am32==FALSE?CALL_NEAR:CALL_32)));
  7390.  
  7391.                                 op(nearcode); outword(0x0000);  /* JXX NEAR */
  7392.  
  7393.                                 if(am32!=FALSE)outword(0x0000);
  7394.  
  7395.                                 break;
  7396.  
  7397.                         default: preerror("Invalid operand for NEAR jump"); break;
  7398.  
  7399.                 }
  7400.  
  7401.                 if(cpu<3)cpu=3;
  7402.  
  7403.         }
  7404.  
  7405.         else preerror("NEAR jump not available for this instruction");
  7406.  
  7407.         if(next)nexttok();
  7408.  
  7409. }
  7410.  
  7411.  
  7412.  
  7413. void lar_lsl(int code)
  7414.  
  7415. {
  7416.  
  7417. unsigned char possiblecpu=0;
  7418.  
  7419. int razr=r16;
  7420.  
  7421.         nexttok();
  7422.  
  7423.         if(tok!=tk_reg&&tok!=tk_reg32)reg32regexpected(1);
  7424.  
  7425.         int htok=tok;
  7426.  
  7427.         int hnumber=(unsigned int)itok.number;
  7428.  
  7429.         ClearReg(itok.number);
  7430.  
  7431.         nextexpecting2(tk_camma);
  7432.  
  7433.         switch(tok){
  7434.  
  7435.                 case tk_reg32:
  7436.  
  7437.                         if(htok==tk_reg)reg32expected(1);
  7438.  
  7439.                         possiblecpu=3;
  7440.  
  7441.                         razr=r32;
  7442.  
  7443.                         goto lar;
  7444.  
  7445.                 case tk_reg:
  7446.  
  7447.                         if(htok==tk_reg32)regexpected(1);
  7448.  
  7449.                         possiblecpu=2;
  7450.  
  7451. lar:
  7452.  
  7453.                         op66(razr);
  7454.  
  7455.                         op(0x0f);
  7456.  
  7457.                         op(code);
  7458.  
  7459.                         op(0xc0+(unsigned int)itok.number+hnumber*8);
  7460.  
  7461.                         break;
  7462.  
  7463.                 case tk_longvar:
  7464.  
  7465.                 case tk_dwordvar:
  7466.  
  7467.                         if(htok==tk_reg)reg32expected(1);
  7468.  
  7469.                         CheckAllMassiv(bufrm,4,&strinf);
  7470.  
  7471.                         possiblecpu=3;
  7472.  
  7473.                         razr=r32;
  7474.  
  7475.                         goto lar1;
  7476.  
  7477.                 case tk_intvar:
  7478.  
  7479.                 case tk_wordvar:
  7480.  
  7481.                         if(htok==tk_reg32)regexpected(1);
  7482.  
  7483.                         possiblecpu=2;
  7484.  
  7485.                         CheckAllMassiv(bufrm,2,&strinf);
  7486.  
  7487. lar1:
  7488.  
  7489.                         op66(razr);
  7490.  
  7491.                         outseg(&itok,3);
  7492.  
  7493.                         op(0x0f);
  7494.  
  7495.                         op(code);
  7496.  
  7497.                         op(itok.rm+hnumber*8);
  7498.  
  7499.                         outaddress(&itok);
  7500.  
  7501.                         break;
  7502.  
  7503.                 default: invalidoperand(2); break;
  7504.  
  7505.         }
  7506.  
  7507.         if(possiblecpu>cpu)cpu=possiblecpu;
  7508.  
  7509. }
  7510.  
  7511.  
  7512.  
  7513. unsigned char tabldeckr(int code)
  7514.  
  7515. {
  7516.  
  7517. unsigned int i=0;
  7518.  
  7519. int htok;
  7520.  
  7521. unsigned char next=1;
  7522.  
  7523. char name[IDLENGTH];
  7524.  
  7525.         nexttok();
  7526.  
  7527.         htok=tok;
  7528.  
  7529.         KillVar(itok.name);
  7530.  
  7531.         switch(tok){
  7532.  
  7533.                 case tk_longvar:
  7534.  
  7535.                 case tk_dwordvar:
  7536.  
  7537.                         i=2;
  7538.  
  7539.                 case tk_intvar:
  7540.  
  7541.                 case tk_wordvar:
  7542.  
  7543.                         i++;
  7544.  
  7545.                 case tk_charvar:
  7546.  
  7547.                 case tk_bytevar:
  7548.  
  7549.                         i++;
  7550.  
  7551.                         CheckAllMassiv(bufrm,i,&strinf);
  7552.  
  7553.                         outseg(&itok,3);
  7554.  
  7555.                         outword(0x010f);
  7556.  
  7557.                         op(itok.rm+code);
  7558.  
  7559.                         outaddress(&itok);
  7560.  
  7561.                         break;
  7562.  
  7563.                 case tk_undefofs:
  7564.  
  7565.                         strcpy(name,itok.name);
  7566.  
  7567.                         tok=tk_number;
  7568.  
  7569.                 case tk_number:
  7570.  
  7571.                         i=doconstdwordmath();
  7572.  
  7573.                         outword(0x010f);
  7574.  
  7575.                         op((am32==FALSE?rm_d16:rm_d32)+code);
  7576.  
  7577.                         if(postnumflag&f_reloc)AddReloc();
  7578.  
  7579.                         if(htok==tk_undefofs)AddUndefOff(2,name);
  7580.  
  7581.                         if(am32)outdword(i);
  7582.  
  7583.                         else outword(i);
  7584.  
  7585.                         next=0;
  7586.  
  7587.                         break;
  7588.  
  7589.                 default: varexpected(0);
  7590.  
  7591.         }
  7592.  
  7593.         if(cpu<2)cpu=2;
  7594.  
  7595.         return next;
  7596.  
  7597. }
  7598.  
  7599.  
  7600.  
  7601. void  protectinstr(int code,int code2)
  7602.  
  7603. {
  7604.  
  7605. int i=0;
  7606.  
  7607.         nexttok();
  7608.  
  7609.         switch(tok){
  7610.  
  7611.                 case tk_longvar:
  7612.  
  7613.                 case tk_dwordvar:
  7614.  
  7615.                         i=2;
  7616.  
  7617.                 case tk_intvar:
  7618.  
  7619.                 case tk_wordvar:
  7620.  
  7621.                         i++;
  7622.  
  7623.                 case tk_charvar:
  7624.  
  7625.                 case tk_bytevar:
  7626.  
  7627.                         i++;
  7628.  
  7629. #ifdef OPTVARCONST
  7630.  
  7631.                         ClearVarByNum(&itok);
  7632.  
  7633. #endif
  7634.  
  7635.                         CheckAllMassiv(bufrm,i,&strinf);
  7636.  
  7637.                         KillVar(itok.name);
  7638.  
  7639.                         outseg(&itok,3);
  7640.  
  7641.                         op(0x0f);
  7642.  
  7643.                         op(code);
  7644.  
  7645.                         op(itok.rm+code2);
  7646.  
  7647.                         outaddress(&itok);
  7648.  
  7649.                         break;
  7650.  
  7651.                 case tk_reg32:
  7652.  
  7653.                 case tk_reg:
  7654.  
  7655.                         ClearReg(itok.number);
  7656.  
  7657.                         op(0x0f);
  7658.  
  7659.                         op(code);
  7660.  
  7661.                         op(0xc0+code2+(unsigned int)itok.number);
  7662.  
  7663.                         break;
  7664.  
  7665.                 default: wordvalexpected();
  7666.  
  7667.         }
  7668.  
  7669.         if(cpu<2)cpu=2;
  7670.  
  7671. }
  7672.  
  7673.  
  7674.  
  7675. void doasmmov()                 // do MOV
  7676.  
  7677. {
  7678.  
  7679. unsigned char next=1,possiblecpu=0;
  7680.  
  7681. int htok,typet;
  7682.  
  7683. ITOK hstok;
  7684.  
  7685. char *hbuf;
  7686.  
  7687. SINFO hstr;
  7688.  
  7689. #ifdef OPTVARCONST
  7690.  
  7691. int initconst=FALSE;
  7692.  
  7693. #endif
  7694.  
  7695.         nexttok();
  7696.  
  7697.         hstok=itok;
  7698.  
  7699.         htok=tok;
  7700.  
  7701.         hbuf=bufrm;
  7702.  
  7703.         bufrm=NULL;
  7704.  
  7705.         hstr=strinf;
  7706.  
  7707.         strinf.bufstr=NULL;
  7708.  
  7709.         nextexpecting2(tk_camma);
  7710.  
  7711.         typet=r16;
  7712.  
  7713. int i=tok;
  7714.  
  7715.         switch(htok){
  7716.  
  7717.                 case tk_reg32:
  7718.  
  7719.                         possiblecpu=3;
  7720.  
  7721.                         typet=r32;
  7722.  
  7723.                 case tk_reg:
  7724.  
  7725.                         switch(tok){
  7726.  
  7727.                                 case tk_debugreg:
  7728.  
  7729.                                         ClearReg(hstok.number);
  7730.  
  7731.                                         if(typet==r16)goto erreg;
  7732.  
  7733.                                         outword(0x210F);
  7734.  
  7735.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  7736.  
  7737.                                         possiblecpu=4;
  7738.  
  7739.                                         if((unsigned int)itok.number<=DR3||(unsigned int)itok.number==DR6
  7740.  
  7741.                                            ||(unsigned int)itok.number==DR7)possiblecpu=3;
  7742.  
  7743.                                         break;
  7744.  
  7745.                                 case tk_controlreg:
  7746.  
  7747.                                         ClearReg(hstok.number);
  7748.  
  7749.                                         if(typet==r16)goto erreg;
  7750.  
  7751.                                         outword(0x200F);
  7752.  
  7753.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  7754.  
  7755.                                         possiblecpu=4;
  7756.  
  7757.                                         if((unsigned int)itok.number<=CR3)possiblecpu=3;
  7758.  
  7759.                                         break;
  7760.  
  7761.                                 case tk_testreg:
  7762.  
  7763.                                         ClearReg(hstok.number);
  7764.  
  7765.                                         if(typet==r16)goto erreg;
  7766.  
  7767.                                         outword(0x240F);
  7768.  
  7769.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  7770.  
  7771.                                         possiblecpu=4;
  7772.  
  7773.                                         if((unsigned int)itok.number==TR6||(unsigned int)itok.number==TR7)possiblecpu=3;
  7774.  
  7775.                                         break;
  7776.  
  7777.                                 case tk_reg32:
  7778.  
  7779.                                         if(typet==r16)goto erreg;
  7780.  
  7781.                                 case tk_reg:
  7782.  
  7783.                                         RegToReg(hstok.number,itok.number,typet);
  7784.  
  7785.                                         op66(typet);
  7786.  
  7787.                                         op(0x89);
  7788.  
  7789.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  7790.  
  7791.                                         break;
  7792.  
  7793.                                 case tk_undefofs:
  7794.  
  7795.                                         strcpy(hstok.name,itok.name);
  7796.  
  7797.                                         tok=tk_number;
  7798.  
  7799.                                         goto wnum;
  7800.  
  7801.                                 case tk_minus:
  7802.  
  7803.                                         if(tok2!=tk_number){
  7804.  
  7805.                                                 wordvalexpected();
  7806.  
  7807.                                                 break;
  7808.  
  7809.                                         }
  7810.  
  7811.                                 case tk_number:
  7812.  
  7813. wnum:
  7814.  
  7815.                                         op66(typet);
  7816.  
  7817.                                         op(0xB8+hstok.number);
  7818.  
  7819.                                         ClearReg(hstok.number);
  7820.  
  7821.                                         asmparam=FALSE;
  7822.  
  7823.                                         SaveNumber(typet,i,hstok.name);
  7824.  
  7825.                                         next=0;
  7826.  
  7827.                                         break;
  7828.  
  7829.                                 case tk_postnumber:
  7830.  
  7831.                                         ClearReg(hstok.number);
  7832.  
  7833.                                         op66(typet);
  7834.  
  7835.                                         op(0xB8+hstok.number);
  7836.  
  7837.                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  7838.  
  7839.                                         if(typet==r32)outdword(itok.number);
  7840.  
  7841.                                         else outword((unsigned int)itok.number);
  7842.  
  7843.                                         break;
  7844.  
  7845.                                 case tk_dwordvar:
  7846.  
  7847.                                 case tk_longvar:
  7848.  
  7849.                                         if(typet==r16)goto erreg;
  7850.  
  7851.                                 case tk_wordvar:
  7852.  
  7853.                                 case tk_intvar:
  7854.  
  7855.                                         CheckAllMassiv(bufrm,typet,&strinf);
  7856.  
  7857.                                         IDZToReg(itok.name,hstok.number,typet);
  7858.  
  7859.                                         op66(typet);
  7860.  
  7861.                                         if(hstok.number==0&&((itok.rm==rm_d16&&itok.sib==CODE16)||(itok.rm==rm_d32&&(itok.sib==CODE32||itok.sib==0)))){
  7862.  
  7863.                                                 outseg(&itok,1);
  7864.  
  7865.                                                 op(0xA1);
  7866.  
  7867.                                         }
  7868.  
  7869.                                         else{
  7870.  
  7871.                                                 outseg(&itok,2);
  7872.  
  7873.                                                 op(0x8B);
  7874.  
  7875.                                                 op(itok.rm+hstok.number*8);
  7876.  
  7877.                                         }
  7878.  
  7879.                                         outaddress(&itok);
  7880.  
  7881.                                         break;
  7882.  
  7883.                                 case tk_seg:
  7884.  
  7885.                                         if(typet==r32)goto erreg;
  7886.  
  7887.                                         IDZToReg(itok.name,hstok.number,typet);
  7888.  
  7889.                                         op66(r16);
  7890.  
  7891.                                         op(0x8C);
  7892.  
  7893.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  7894.  
  7895.                                         if((unsigned int)itok.number==FS||(unsigned int)itok.number==GS)possiblecpu=3;
  7896.  
  7897.                                         break;
  7898.  
  7899.                                 default:
  7900.  
  7901. erreg:
  7902.  
  7903.                                         invalidoperand(2); break;
  7904.  
  7905.                         }
  7906.  
  7907.                         break;
  7908.  
  7909.                 case tk_beg:
  7910.  
  7911.                         ClearReg(hstok.number%4);
  7912.  
  7913.                         switch(tok){
  7914.  
  7915.                                 case tk_beg:
  7916.  
  7917.                                                 op(0x88);
  7918.  
  7919.                                                 op(128+64+(unsigned int)itok.number*8+hstok.number);
  7920.  
  7921.                                         break;
  7922.  
  7923.                                 case tk_number:
  7924.  
  7925.                                         op(0xB0+hstok.number);
  7926.  
  7927.                                         asmparam=FALSE;
  7928.  
  7929.                                         op((int)doconstlongmath());
  7930.  
  7931.                                         next=0;
  7932.  
  7933.                                         break;
  7934.  
  7935.                                 case tk_bytevar:
  7936.  
  7937.                                 case tk_charvar:
  7938.  
  7939.                                         CheckAllMassiv(bufrm,1,&strinf);
  7940.  
  7941.                                         if(hstok.number==0&&((itok.rm==rm_d16&&itok.sib==CODE16)||(itok.rm==rm_d32&&(itok.sib==CODE32||itok.sib==0)))){
  7942.  
  7943.                                                 outseg(&itok,1);
  7944.  
  7945.                                                 op(0xA0);
  7946.  
  7947.                                         }
  7948.  
  7949.                                         else{
  7950.  
  7951.                                                 outseg(&itok,2);
  7952.  
  7953.                                                 op(0x8A);
  7954.  
  7955.                                                 op(itok.rm+hstok.number*8);
  7956.  
  7957.                                         }
  7958.  
  7959.                                         outaddress(&itok);
  7960.  
  7961.                                         break;
  7962.  
  7963.                                 default: invalidoperand(2); break;
  7964.  
  7965.                         }
  7966.  
  7967.                         break;
  7968.  
  7969.                 case tk_seg:
  7970.  
  7971.                         if(hstok.number==CS){
  7972.  
  7973.                                 invalidoperand(1); break;
  7974.  
  7975.                         }
  7976.  
  7977.                         switch(tok){
  7978.  
  7979.                                 case tk_reg:
  7980.  
  7981.                                         op66(r16);
  7982.  
  7983.                                   op(0x8E);
  7984.  
  7985.                                         op(128+64+hstok.number*8+(unsigned int)itok.number);
  7986.  
  7987.                                         if(hstok.number==FS||hstok.number==GS)possiblecpu=3;
  7988.  
  7989.                                         break;
  7990.  
  7991.                                 case tk_wordvar:
  7992.  
  7993.                                 case tk_intvar:
  7994.  
  7995.                                         CheckAllMassiv(bufrm,2,&strinf);
  7996.  
  7997.                                         op66(r16);
  7998.  
  7999.                                         outseg(&itok,2);
  8000.  
  8001.                                         op(0x8E);
  8002.  
  8003.                                         op(itok.rm+hstok.number*8);
  8004.  
  8005.                                         outaddress(&itok);
  8006.  
  8007.                                         if(hstok.number==FS||hstok.number==GS)possiblecpu=3;
  8008.  
  8009.                                         break;
  8010.  
  8011.                                 default: invalidoperand(2); break;
  8012.  
  8013.                         }
  8014.  
  8015.                         break;
  8016.  
  8017.                 case tk_dwordvar:
  8018.  
  8019.                 case tk_longvar:
  8020.  
  8021.                         possiblecpu=3;
  8022.  
  8023.                         typet=r32;
  8024.  
  8025.                 case tk_wordvar:
  8026.  
  8027.                 case tk_intvar:
  8028.  
  8029.                         KillVar(itok.name);
  8030.  
  8031.                         CheckAllMassiv(hbuf,typet,&hstr,&hstok);
  8032.  
  8033.                         op66(typet);
  8034.  
  8035.                         switch(tok){
  8036.  
  8037.                                 case tk_reg32:
  8038.  
  8039.                                         if(typet==r16)goto ervar;
  8040.  
  8041.                                 case tk_reg:
  8042.  
  8043.                         /*if((tok==tk_reg||tok==tk_reg32)&&hbuf==NULL&&hstr.bufstr==NULL)*/
  8044.  
  8045.                                         AddRegVar(itok.number,typet,&hstok);
  8046.  
  8047.                                         if(itok.number==0&&((hstok.rm==rm_d16&&hstok.sib==CODE16)||(hstok.rm==rm_d32&&(hstok.sib==CODE32||hstok.sib==0)))){
  8048.  
  8049.                                                 outseg(&hstok,1);
  8050.  
  8051.                                                 op(0xA3);
  8052.  
  8053.                                                 outaddress(&hstok);
  8054.  
  8055.                                         }
  8056.  
  8057.                                         else{
  8058.  
  8059.                                                 outseg(&hstok,2);
  8060.  
  8061.                                                 op(0x89);
  8062.  
  8063.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  8064.  
  8065.                                                 outaddress(&hstok);
  8066.  
  8067.                                         }
  8068.  
  8069.                                         break;
  8070.  
  8071.                                 case tk_undefofs:
  8072.  
  8073.                                         strcpy(hstok.name,itok.name);
  8074.  
  8075.                                         tok=tk_number;
  8076.  
  8077.                                         goto vnum;
  8078.  
  8079.                                 case tk_minus:
  8080.  
  8081.                                         if(tok2!=tk_number){
  8082.  
  8083.                                                 wordvalexpected();
  8084.  
  8085.                                                 break;
  8086.  
  8087.                                         }
  8088.  
  8089.                                 case tk_number:
  8090.  
  8091. vnum:
  8092.  
  8093.                                         outseg(&hstok,2);
  8094.  
  8095.                                         op(0xC7);
  8096.  
  8097.                                         op(hstok.rm);
  8098.  
  8099.                                         outaddress(&hstok);
  8100.  
  8101.                                         asmparam=FALSE;
  8102.  
  8103. #ifdef OPTVARCONST
  8104.  
  8105.                                         unsigned long t;
  8106.  
  8107.                                         t=SaveNumber(typet,i,hstok.name);
  8108.  
  8109.                                         if(typet==r16)t&=0xffff;
  8110.  
  8111.                                         else t&=0xffffffff;
  8112.  
  8113.                                         if((i==tk_number||i==tk_minus)&&(postnumflag&f_reloc)){
  8114.  
  8115.                                                 Const2Var(&hstok,t,tk_dword);
  8116.  
  8117.                                                 initconst=TRUE;
  8118.  
  8119.                                         }
  8120.  
  8121. #else
  8122.  
  8123.                                         SaveNumber(typet,i,hstok.name);
  8124.  
  8125. #endif
  8126.  
  8127.                                         next=0;
  8128.  
  8129.                                         break;
  8130.  
  8131.                                 case tk_postnumber:
  8132.  
  8133.                                         outseg(&hstok,2);
  8134.  
  8135.                                         op(0xC7);
  8136.  
  8137.                                         op(hstok.rm);
  8138.  
  8139.                                         outaddress(&hstok);
  8140.  
  8141.                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  8142.  
  8143.                                         if(typet==r16)outword((unsigned int)itok.number);
  8144.  
  8145.                                         else outdword(itok.number);
  8146.  
  8147.                                         break;
  8148.  
  8149.                                 case tk_seg:
  8150.  
  8151.                                         outseg(&hstok,2);
  8152.  
  8153.                                         if(typet==r32)goto ervar;
  8154.  
  8155.                                         op(0x8C);
  8156.  
  8157.                                         op(hstok.rm+(unsigned int)itok.number*8);
  8158.  
  8159.                                         outaddress(&hstok);
  8160.  
  8161.                                         if(hstok.number==FS||hstok.number==GS)possiblecpu=3;
  8162.  
  8163.                                         break;
  8164.  
  8165.                                 default:
  8166.  
  8167. ervar:
  8168.  
  8169.                                         invalidoperand(2); break;
  8170.  
  8171.                         }
  8172.  
  8173. #ifdef OPTVARCONST
  8174.  
  8175.                         if(initconst==FALSE)ClearVarByNum(&hstok);
  8176.  
  8177. #endif
  8178.  
  8179.                         break;
  8180.  
  8181.                 case tk_charvar:
  8182.  
  8183.                 case tk_bytevar:
  8184.  
  8185.                         KillVar(itok.name);
  8186.  
  8187.                         CheckAllMassiv(hbuf,1,&hstr,&hstok);
  8188.  
  8189.                         switch(tok){
  8190.  
  8191.                                 case tk_beg:
  8192.  
  8193.                         /*if(tok==tk_beg&&hbuf==NULL&&hstr.bufstr==NULL)*/
  8194.  
  8195.                                         AddRegVar(itok.number,r8,&hstok);
  8196.  
  8197.                                         if(itok.number==0&&((hstok.rm==rm_d16&&hstok.sib==CODE16)||(hstok.rm==rm_d32&&(hstok.sib==CODE32||hstok.sib==0)))){
  8198.  
  8199.                                                 outseg(&hstok,1);
  8200.  
  8201.                                                 op(0xA2);
  8202.  
  8203.                                                 outaddress(&hstok);
  8204.  
  8205.                                         }
  8206.  
  8207.                                         else{
  8208.  
  8209.                                                 outseg(&hstok,2);
  8210.  
  8211.                                                 op(0x88);
  8212.  
  8213.                                                 op(hstok.rm+(unsigned int)itok.number*8);
  8214.  
  8215.                                                 outaddress(&hstok);
  8216.  
  8217.                                         }
  8218.  
  8219.                                         break;
  8220.  
  8221.                                 case tk_number:
  8222.  
  8223.                                         outseg(&hstok,2);
  8224.  
  8225.                                         op(0xC6);
  8226.  
  8227.                                         op(hstok.rm);
  8228.  
  8229.                                         outaddress(&hstok);
  8230.  
  8231.                                         asmparam=FALSE;
  8232.  
  8233. #ifdef OPTVARCONST
  8234.  
  8235.                                         long t;
  8236.  
  8237.                                         t=doconstlongmath()&0xff;
  8238.  
  8239.                                         op(t);
  8240.  
  8241.                                         if((postnumflag&f_reloc)){
  8242.  
  8243.                                                 initconst=TRUE;
  8244.  
  8245.                                                 Const2Var(&hstok,t,tk_byte);
  8246.  
  8247.                                         }
  8248.  
  8249. #else
  8250.  
  8251.                                         op((int)doconstlongmath());
  8252.  
  8253. #endif
  8254.  
  8255.                                         next=0;
  8256.  
  8257.                                         break;
  8258.  
  8259.                                 default: invalidoperand(2); break;
  8260.  
  8261.                         }
  8262.  
  8263. #ifdef OPTVARCONST
  8264.  
  8265.                         if(initconst==FALSE)ClearVarByNum(&hstok);
  8266.  
  8267. #endif
  8268.  
  8269.                         break;
  8270.  
  8271.                 case tk_debugreg:
  8272.  
  8273.                         if(tok==tk_reg32){
  8274.  
  8275.                                 outword(0x230F);
  8276.  
  8277.                                 op(128+64+hstok.number*8+(unsigned int)itok.number);
  8278.  
  8279.                                 possiblecpu=4;
  8280.  
  8281.                                 if(hstok.number<=DR3||hstok.number==DR6||hstok.number==DR7)possiblecpu=3;
  8282.  
  8283.                         }
  8284.  
  8285.                         else invalidoperand(2);
  8286.  
  8287.                         break;
  8288.  
  8289.                 case tk_controlreg:
  8290.  
  8291.                         if(tok==tk_reg32){
  8292.  
  8293.                                 outword(0x220F);
  8294.  
  8295.                                 op(128+64+hstok.number*8+(unsigned int)itok.number);
  8296.  
  8297.                                 possiblecpu=4;
  8298.  
  8299.                                 if(hstok.number<=CR3)possiblecpu=3;
  8300.  
  8301.                         }
  8302.  
  8303.                         else invalidoperand(2);
  8304.  
  8305.                         break;
  8306.  
  8307.                 case tk_testreg:
  8308.  
  8309.                         if(tok==tk_reg32){
  8310.  
  8311.                                 outword(0x260F);
  8312.  
  8313.                                 op(128+64+hstok.number*8+(unsigned int)itok.number);
  8314.  
  8315.                                 possiblecpu=4;
  8316.  
  8317.                                 if(hstok.number==TR6||hstok.number==TR7)possiblecpu=3;
  8318.  
  8319.                         }
  8320.  
  8321.                         else invalidoperand(2);
  8322.  
  8323.                         break;
  8324.  
  8325.                 default: invalidoperand(1); break;
  8326.  
  8327.         }
  8328.  
  8329.         asmparam=FALSE;
  8330.  
  8331.         if(possiblecpu>cpu)cpu=possiblecpu;
  8332.  
  8333.         if(next)nexttok();
  8334.  
  8335. }
  8336.  
  8337.  
  8338.  
  8339. void asmextend(int basecode)     // procedure MOVSX and MOVZX
  8340.  
  8341. {
  8342.  
  8343. int regnum;
  8344.  
  8345. int razr=r16;
  8346.  
  8347.         nexttok();
  8348.  
  8349.         if(tok==tk_reg32)razr=r32;
  8350.  
  8351.         if(tok!=tk_reg32&&tok!=tk_reg)reg32regexpected(1);
  8352.  
  8353.         regnum=(unsigned int)itok.number*8;
  8354.  
  8355.         ClearReg(itok.number);
  8356.  
  8357.         nextexpecting2(tk_camma);
  8358.  
  8359.         switch(tok){
  8360.  
  8361.                 case tk_reg:
  8362.  
  8363.                         op66(razr);
  8364.  
  8365.                         op(0xF); op(basecode|1);
  8366.  
  8367.                         op(128+64+regnum+(unsigned int)itok.number);
  8368.  
  8369.                         break;
  8370.  
  8371.                 case tk_beg:
  8372.  
  8373.                         op66(razr);
  8374.  
  8375.                         op(0xF); op(basecode);
  8376.  
  8377.                         op(128+64+regnum+(unsigned int)itok.number);
  8378.  
  8379.                         break;
  8380.  
  8381.                 case tk_wordvar:
  8382.  
  8383.                 case tk_intvar:
  8384.  
  8385.                         CheckAllMassiv(bufrm,2,&strinf);
  8386.  
  8387.                         op66(razr);
  8388.  
  8389.                         outseg(&itok,3);
  8390.  
  8391.                         op(0xF); op(basecode|1);
  8392.  
  8393.                         op(itok.rm+regnum);
  8394.  
  8395.                         outaddress(&itok);
  8396.  
  8397.                         break;
  8398.  
  8399.                 case tk_bytevar:
  8400.  
  8401.                 case tk_charvar:
  8402.  
  8403.                         CheckAllMassiv(bufrm,1,&strinf);
  8404.  
  8405.                         op66(razr);
  8406.  
  8407.                         outseg(&itok,3);
  8408.  
  8409.                         op(0xF); op(basecode);
  8410.  
  8411.                         op(itok.rm+regnum);
  8412.  
  8413.                         outaddress(&itok);
  8414.  
  8415.                         break;
  8416.  
  8417.                 default: varexpected(2); break;
  8418.  
  8419.         }
  8420.  
  8421.         if(cpu<3)cpu=3;
  8422.  
  8423. }
  8424.  
  8425.  
  8426.  
  8427. void movd()
  8428.  
  8429. {
  8430.  
  8431. ITOK hstok;
  8432.  
  8433. int htok;
  8434.  
  8435. char *hbuf;
  8436.  
  8437. SINFO hstr;
  8438.  
  8439. int i=0;
  8440.  
  8441.         nexttok();
  8442.  
  8443.         hstok=itok;
  8444.  
  8445.         htok=tok;
  8446.  
  8447.         hbuf=bufrm;
  8448.  
  8449.         bufrm=NULL;
  8450.  
  8451.         hstr=strinf;
  8452.  
  8453.         strinf.bufstr=NULL;
  8454.  
  8455.         nextexpecting2(tk_camma);
  8456.  
  8457.         if(tok==tk_xmmreg)i++;
  8458.  
  8459.         switch(htok){
  8460.  
  8461.                 case tk_reg32:
  8462.  
  8463.                         ClearReg(hstok.number);
  8464.  
  8465.                         if(tok==tk_mmxreg||i){  //MOVD EAX,MM0
  8466.  
  8467.                                 if(i)op(0x66);
  8468.  
  8469.                                 outword(0x7E0F);
  8470.  
  8471.                                 op(0xc0+hstok.number+(unsigned int)itok.number*8);
  8472.  
  8473.                         }
  8474.  
  8475.                         else mmxregexpected(2);
  8476.  
  8477.                         break;
  8478.  
  8479.                 case tk_dwordvar:
  8480.  
  8481.                 case tk_longvar:
  8482.  
  8483.                         if(tok==tk_mmxreg||i){  //MOVD mem,MM0
  8484.  
  8485. #ifdef OPTVARCONST
  8486.  
  8487.                                 ClearVarByNum(&hstok);
  8488.  
  8489. #endif
  8490.  
  8491.                                 CheckAllMassiv(hbuf,4,&hstr,&hstok);
  8492.  
  8493.                                 KillVar(hstok.name);
  8494.  
  8495.                                 outseg(&hstok,i==0?3:4);
  8496.  
  8497.                                 if(i)op(0x66);
  8498.  
  8499.                                 outword(0x7E0F);
  8500.  
  8501.                                 op(hstok.rm+(unsigned int)itok.number*8);
  8502.  
  8503.                                 outaddress(&hstok);
  8504.  
  8505.                         }
  8506.  
  8507.                         else mmxregexpected(2);
  8508.  
  8509.                         break;
  8510.  
  8511.                 case tk_xmmreg:
  8512.  
  8513.                         i++;
  8514.  
  8515.                 case tk_mmxreg:
  8516.  
  8517.                         switch(tok){
  8518.  
  8519.                                 case tk_reg32:  //MOVD MM0,EAX
  8520.  
  8521.                                         if(i)op(0x66);
  8522.  
  8523.                                         outword(0x6E0F);
  8524.  
  8525.                                         op(0xc0+hstok.number*8+(unsigned int)itok.number);
  8526.  
  8527.                                         break;
  8528.  
  8529.                                 case tk_dwordvar:       //MOVD MMO,mem
  8530.  
  8531.                                 case tk_longvar:
  8532.  
  8533.                                         CheckAllMassiv(bufrm,4,&strinf);
  8534.  
  8535.                                         outseg(&itok,i==0?3:4);
  8536.  
  8537.                                         if(i)op(0x66);
  8538.  
  8539.                                         outword(0x6E0F);
  8540.  
  8541.                                         op(itok.rm+hstok.number*8);
  8542.  
  8543.                                         outaddress(&itok);
  8544.  
  8545.                                         break;
  8546.  
  8547.                                 default: dwordvalexpected();
  8548.  
  8549.                         }
  8550.  
  8551.                         break;
  8552.  
  8553.                 default: mmxregordwordexpected(1);
  8554.  
  8555.         }
  8556.  
  8557.         if(cpu<6)cpu=6;
  8558.  
  8559.         if(i&&cpu<9)cpu=9;
  8560.  
  8561. }
  8562.  
  8563.  
  8564.  
  8565. void movq()
  8566.  
  8567. {
  8568.  
  8569. int htok;
  8570.  
  8571. ITOK hstok;
  8572.  
  8573. char *hbuf;
  8574.  
  8575. SINFO hstr;
  8576.  
  8577. int i=1,xmm=0;
  8578.  
  8579.         nexttok();
  8580.  
  8581.         hstok=itok;
  8582.  
  8583.         htok=tok;
  8584.  
  8585.         hbuf=bufrm;
  8586.  
  8587.         bufrm=NULL;
  8588.  
  8589.         hstr=strinf;
  8590.  
  8591.         strinf.bufstr=NULL;
  8592.  
  8593.         nextexpecting2(tk_camma);
  8594.  
  8595.         if(tok==tk_xmmreg)xmm++;
  8596.  
  8597.         switch(htok){
  8598.  
  8599.                 case tk_qwordvar:
  8600.  
  8601.                 case tk_doublevar:
  8602.  
  8603.                         i+=4;
  8604.  
  8605.                 case tk_longvar:
  8606.  
  8607.                 case tk_dwordvar:
  8608.  
  8609.                 case tk_floatvar:
  8610.  
  8611.                         i+=2;
  8612.  
  8613.                 case tk_wordvar:
  8614.  
  8615.                 case tk_intvar:
  8616.  
  8617.                         i++;
  8618.  
  8619.                 case tk_charvar:
  8620.  
  8621.                 case tk_bytevar:
  8622.  
  8623.                         if(tok==tk_mmxreg||xmm){        //MOVQ mem,MM0
  8624.  
  8625. #ifdef OPTVARCONST
  8626.  
  8627.                                 ClearVarByNum(&hstok);
  8628.  
  8629. #endif
  8630.  
  8631.                                 KillVar(hstok.name);
  8632.  
  8633.                                 CheckAllMassiv(hbuf,i,&hstr,&hstok);
  8634.  
  8635.                                 outseg(&hstok,xmm==0?3:4);
  8636.  
  8637.                                 if(xmm){
  8638.  
  8639.                                         op(0x66);
  8640.  
  8641.                                         outword(0xD60f);
  8642.  
  8643.                                 }
  8644.  
  8645.                                 else outword(0x7F0F);
  8646.  
  8647.                                 op(hstok.rm+(unsigned int)itok.number*8);
  8648.  
  8649.                                 outaddress(&hstok);
  8650.  
  8651.                         }
  8652.  
  8653.                         else mmxregexpected(2);
  8654.  
  8655.                         break;
  8656.  
  8657.                 case tk_mmxreg:
  8658.  
  8659.                         switch(tok){
  8660.  
  8661.                                 case tk_mmxreg: //MOVQ MM0,MM1
  8662.  
  8663.                                         outword(0x6F0F);
  8664.  
  8665.                                         op(0xc0+hstok.number*8+(unsigned int)itok.number);
  8666.  
  8667.                                         break;
  8668.  
  8669.                                 case tk_qwordvar:
  8670.  
  8671.                                 case tk_doublevar:
  8672.  
  8673.                                         i+=4;
  8674.  
  8675.                                 case tk_longvar:
  8676.  
  8677.                                 case tk_dwordvar:
  8678.  
  8679.                                 case tk_floatvar:
  8680.  
  8681.                                         i+=2;
  8682.  
  8683.                                 case tk_wordvar:
  8684.  
  8685.                                 case tk_intvar:
  8686.  
  8687.                                         i++;
  8688.  
  8689.                                 case tk_charvar:
  8690.  
  8691.                                 case tk_bytevar:
  8692.  
  8693.                                         CheckAllMassiv(bufrm,i,&strinf);
  8694.  
  8695.                                         outseg(&itok,3);
  8696.  
  8697.                                         outword(0x6F0F);
  8698.  
  8699.                                         op(itok.rm+hstok.number*8);
  8700.  
  8701.                                         outaddress(&itok);
  8702.  
  8703.                                         break;
  8704.  
  8705.                                 default: mmxregordwordexpected(2);
  8706.  
  8707.                         }
  8708.  
  8709.                         break;
  8710.  
  8711.                 case tk_xmmreg:
  8712.  
  8713.                         switch(tok){
  8714.  
  8715.                                 case tk_xmmreg:
  8716.  
  8717.                                         op(0xF3);
  8718.  
  8719.                                         outword(0x7e0F);
  8720.  
  8721.                                         op(0xc0+hstok.number*8+(unsigned int)itok.number);
  8722.  
  8723.                                         break;
  8724.  
  8725.                                 case tk_qwordvar:
  8726.  
  8727.                                 case tk_doublevar:
  8728.  
  8729.                                         i+=4;
  8730.  
  8731.                                 case tk_longvar:
  8732.  
  8733.                                 case tk_dwordvar:
  8734.  
  8735.                                 case tk_floatvar:
  8736.  
  8737.                                         i+=2;
  8738.  
  8739.                                 case tk_wordvar:
  8740.  
  8741.                                 case tk_intvar:
  8742.  
  8743.                                         i++;
  8744.  
  8745.                                 case tk_charvar:
  8746.  
  8747.                                 case tk_bytevar:
  8748.  
  8749.                                         CheckAllMassiv(bufrm,i,&strinf);
  8750.  
  8751.                                         outseg(&itok,4);
  8752.  
  8753.                                         op(0xF3);
  8754.  
  8755.                                         outword(0x7E0F);
  8756.  
  8757.                                         op(itok.rm+hstok.number*8);
  8758.  
  8759.                                         outaddress(&itok);
  8760.  
  8761.                                         xmm++;
  8762.  
  8763.                                         break;
  8764.  
  8765.                                 default: xmmregorvarexpected(2);
  8766.  
  8767.                         }
  8768.  
  8769.                         break;
  8770.  
  8771.                 default: mmxregordwordexpected(1);
  8772.  
  8773.         }
  8774.  
  8775.         if(cpu<6)cpu=6;
  8776.  
  8777.         if(xmm&&cpu<9)cpu=9;
  8778.  
  8779. }
  8780.  
  8781.  
  8782.  
  8783. void packMMX(int code,int code1,int code2)
  8784.  
  8785. {
  8786.  
  8787. unsigned int hnumber;
  8788.  
  8789. int htok,next=TRUE;
  8790.  
  8791. int i=1;
  8792.  
  8793. int xmm=FALSE;
  8794.  
  8795.         nexttok();
  8796.  
  8797.         hnumber=(unsigned int)itok.number;
  8798.  
  8799.         htok=tok;
  8800.  
  8801.         nextexpecting2(tk_camma);
  8802.  
  8803.         if(htok==tk_xmmreg)xmm=TRUE;
  8804.  
  8805.         else if(htok!=tk_mmxreg)mmxregexpected(1);
  8806.  
  8807.         switch(tok){
  8808.  
  8809.                 case tk_mmxreg:
  8810.  
  8811.                         if(xmm)xmmregexpected(2);
  8812.  
  8813.                         op(0x0f);
  8814.  
  8815.                         op(code);
  8816.  
  8817.                         op(0xc0+hnumber*8+(unsigned int)itok.number);
  8818.  
  8819.                         break;
  8820.  
  8821.                 case tk_xmmreg:
  8822.  
  8823.                         if(!xmm)mmxregexpected(2);
  8824.  
  8825.                         else op(0x66);
  8826.  
  8827.                         op(0x0f);
  8828.  
  8829.                         op(code);
  8830.  
  8831.                         op(0xc0+hnumber*8+(unsigned int)itok.number);
  8832.  
  8833.                         break;
  8834.  
  8835.                 case tk_number:
  8836.  
  8837.                         if(xmm)op(0x66);
  8838.  
  8839.                         op(0x0f);
  8840.  
  8841.                         op(code1);
  8842.  
  8843.                         op(code2+hnumber);
  8844.  
  8845.                         asmparam=FALSE;
  8846.  
  8847.                         op((unsigned int)doconstlongmath());
  8848.  
  8849.                         next=FALSE;
  8850.  
  8851.                         break;
  8852.  
  8853.                 case tk_qwordvar:
  8854.  
  8855.                         i+=4;
  8856.  
  8857.                 case tk_longvar:
  8858.  
  8859.                 case tk_dwordvar:
  8860.  
  8861.                 case tk_floatvar:
  8862.  
  8863.                         i+=2;
  8864.  
  8865.                 case tk_wordvar:
  8866.  
  8867.                 case tk_intvar:
  8868.  
  8869.                         i++;
  8870.  
  8871.                 case tk_charvar:
  8872.  
  8873.                 case tk_bytevar:
  8874.  
  8875.                         CheckAllMassiv(bufrm,i,&strinf);
  8876.  
  8877.                         outseg(&itok,xmm==FALSE?3:4);
  8878.  
  8879.                         if(xmm)op(0x66);
  8880.  
  8881.                         op(0x0f);
  8882.  
  8883.                         op(code);
  8884.  
  8885.                         op(itok.rm+hnumber*8);
  8886.  
  8887.                         outaddress(&itok);
  8888.  
  8889.                         break;
  8890.  
  8891.                 default:
  8892.  
  8893.                         mmxregordwordexpected(2);
  8894.  
  8895.                         break;
  8896.  
  8897.         }
  8898.  
  8899.         if(cpu<6)cpu=6;
  8900.  
  8901.         if(xmm&&cpu<9)cpu=9;
  8902.  
  8903.         if(next==TRUE)nexttok();
  8904.  
  8905. }
  8906.  
  8907.  
  8908.  
  8909. void asmshift(int basecode)              // used for ROL ROR RCL RCR SHL SAL SHR SAR.
  8910.  
  8911. {
  8912.  
  8913. int htok,precode;
  8914.  
  8915. unsigned char holdbyte;
  8916.  
  8917. int usenumsh=TRUE;
  8918.  
  8919. ITOK hstok;
  8920.  
  8921. char *hbuf;
  8922.  
  8923. char next=1;
  8924.  
  8925. SINFO hstr;
  8926.  
  8927. int razr=r16;
  8928.  
  8929. #ifdef OPTVARCONST
  8930.  
  8931. int operand=GetOperand(basecode/8+a_rol);
  8932.  
  8933. #endif
  8934.  
  8935.         nexttok();
  8936.  
  8937.         htok=tok;
  8938.  
  8939.         hstok=itok;
  8940.  
  8941.         hbuf=bufrm;
  8942.  
  8943.         bufrm=NULL;
  8944.  
  8945.         hstr=strinf;
  8946.  
  8947.         strinf.bufstr=NULL;
  8948.  
  8949.         nextexpecting2(tk_camma);
  8950.  
  8951.         if(tok==tk_beg&&(unsigned int)itok.number==CL){
  8952.  
  8953.                 precode=0xD2;
  8954.  
  8955.                 usenumsh=FALSE;
  8956.  
  8957.         }
  8958.  
  8959.         else if(tok==tk_number){
  8960.  
  8961.                 asmparam=FALSE;
  8962.  
  8963.                 holdbyte=(unsigned char)doconstlongmath();
  8964.  
  8965.                 if(holdbyte==1){
  8966.  
  8967.                         precode=0xD0;
  8968.  
  8969.                         usenumsh=FALSE;
  8970.  
  8971.                 }
  8972.  
  8973.                 else /*if(holdbyte!=0)*/{
  8974.  
  8975.                         precode=0xC0;
  8976.  
  8977.                         if(cpu<2)cpu=2;
  8978.  
  8979.                 }
  8980.  
  8981.                 next=0;
  8982.  
  8983.         }
  8984.  
  8985.         else clornumberexpected();
  8986.  
  8987. //      if(precode!=0){
  8988.  
  8989.                 switch(htok){
  8990.  
  8991.                         case tk_reg32:
  8992.  
  8993.                                 if(cpu<3)cpu=3;
  8994.  
  8995.                                 razr=r32;
  8996.  
  8997.                         case tk_reg:
  8998.  
  8999.                                 ClearReg(hstok.number);
  9000.  
  9001.                                 op66(razr);
  9002.  
  9003.                           op(precode+1); op(128+64+basecode+hstok.number);
  9004.  
  9005.                                 break;
  9006.  
  9007.                         case tk_beg:
  9008.  
  9009.                                 ClearReg(hstok.number);
  9010.  
  9011.                                 op(precode); op(128+64+basecode+hstok.number);
  9012.  
  9013.                                 break;
  9014.  
  9015.                         case tk_charvar:
  9016.  
  9017.                         case tk_bytevar:
  9018.  
  9019. #ifdef OPTVARCONST
  9020.  
  9021.                                 if(precode==0xD0||precode==0xc0)UpdVarConst(&hstok,holdbyte,tk_byte,operand);
  9022.  
  9023.                                 else ClearVarByNum(&hstok);
  9024.  
  9025. #endif
  9026.  
  9027.                                 CheckAllMassiv(hbuf,1,&hstr,&hstok);
  9028.  
  9029.                                 KillVar(hstok.name);
  9030.  
  9031.                                 outseg(&hstok,2);
  9032.  
  9033.                                 op(precode);
  9034.  
  9035.                                 op(hstok.rm+basecode);
  9036.  
  9037.                                 outaddress(&hstok);
  9038.  
  9039.                                 break;
  9040.  
  9041.                         case tk_dwordvar:
  9042.  
  9043.                         case tk_longvar:
  9044.  
  9045.                                 CheckAllMassiv(hbuf,4,&hstr,&hstok);
  9046.  
  9047.                                 if(cpu<3)cpu=3;
  9048.  
  9049.                                 razr=r32;
  9050.  
  9051.                                 goto rol;
  9052.  
  9053.                         case tk_wordvar:
  9054.  
  9055.                         case tk_intvar:
  9056.  
  9057.                                 CheckAllMassiv(hbuf,2,&hstr,&hstok);
  9058.  
  9059. rol:
  9060.  
  9061. #ifdef OPTVARCONST
  9062.  
  9063.                                 if(precode==0xD0||precode==0xc0)UpdVarConst(&hstok,holdbyte,tk_byte,operand);
  9064.  
  9065.                                 else ClearVarByNum(&hstok);
  9066.  
  9067. #endif
  9068.  
  9069.                                 KillVar(hstok.name);
  9070.  
  9071.                                 op66(razr);
  9072.  
  9073.                                 outseg(&hstok,2);
  9074.  
  9075.                                 op(precode+1);
  9076.  
  9077.                                 op(hstok.rm+basecode);
  9078.  
  9079.                                 outaddress(&hstok);
  9080.  
  9081.                                 break;
  9082.  
  9083.                         default: varexpected(1); break;
  9084.  
  9085.                 }
  9086.  
  9087.                 if(usenumsh)op(holdbyte);
  9088.  
  9089.         if(next)nexttok();
  9090.  
  9091. }
  9092.  
  9093.  
  9094.  
  9095. void CheckCl(int code)
  9096.  
  9097. {
  9098.  
  9099.         op(0xf);
  9100.  
  9101.         if(tok==tk_beg){
  9102.  
  9103.                 if(itok.number==CL)code++;
  9104.  
  9105.                 else clornumberexpected();
  9106.  
  9107.         }
  9108.  
  9109.         else if(tok!=tk_number)clornumberexpected();
  9110.  
  9111.         op(code);
  9112.  
  9113. }
  9114.  
  9115.  
  9116.  
  9117. void Shxd(int code)
  9118.  
  9119. {
  9120.  
  9121. unsigned int h2number;
  9122.  
  9123. int htok,h2tok;
  9124.  
  9125. ITOK hstok;
  9126.  
  9127. char *hbuf;
  9128.  
  9129. unsigned char next=1;
  9130.  
  9131. SINFO hstr;
  9132.  
  9133.         nexttok();
  9134.  
  9135.         hstok=itok;
  9136.  
  9137.         htok=tok;
  9138.  
  9139.         hbuf=bufrm;
  9140.  
  9141.         bufrm=NULL;
  9142.  
  9143.         hstr=strinf;
  9144.  
  9145.         strinf.bufstr=NULL;
  9146.  
  9147.         nextexpecting2(tk_camma);
  9148.  
  9149.         h2number=(unsigned int)itok.number;
  9150.  
  9151.         ClearReg(itok.number);
  9152.  
  9153.         h2tok=tok;
  9154.  
  9155.         nextexpecting2(tk_camma);
  9156.  
  9157.         switch(htok){
  9158.  
  9159.                 case tk_reg:
  9160.  
  9161.                         if(h2tok==tk_reg){
  9162.  
  9163.                                 op66(r16);
  9164.  
  9165. regreg:
  9166.  
  9167.                                 ClearReg(hstok.number);
  9168.  
  9169.                                 CheckCl(code);
  9170.  
  9171.                                 op(0xc0+hstok.number+(unsigned int)h2number*8);
  9172.  
  9173.                                 if(tok==tk_number){
  9174.  
  9175.                                         asmparam=FALSE;
  9176.  
  9177.                                         op(doconstlongmath());
  9178.  
  9179.                                         next=0;
  9180.  
  9181.                                 }
  9182.  
  9183.                         }
  9184.  
  9185.                         else regexpected(2);
  9186.  
  9187.                         break;
  9188.  
  9189.                 case tk_reg32:
  9190.  
  9191.                         if(h2tok==tk_reg32){
  9192.  
  9193.                                 op66(r32);
  9194.  
  9195.                                 goto regreg;
  9196.  
  9197.                         }
  9198.  
  9199.                         else reg32expected(2);
  9200.  
  9201.                         break;
  9202.  
  9203.                 case tk_intvar:
  9204.  
  9205.                 case tk_wordvar:
  9206.  
  9207.                         if(h2tok==tk_reg){
  9208.  
  9209.                                 CheckAllMassiv(hbuf,2,&hstr,&hstok);
  9210.  
  9211.                                 op66(r16);
  9212.  
  9213. varreg:
  9214.  
  9215. #ifdef OPTVARCONST
  9216.  
  9217.                         ClearVarByNum(&hstok);
  9218.  
  9219. #endif
  9220.  
  9221.  
  9222.  
  9223.                         KillVar(hstok.name);
  9224.  
  9225.                                 outseg(&hstok,3);
  9226.  
  9227.                                 CheckCl(code);
  9228.  
  9229.                                 op(hstok.rm+h2number*8);
  9230.  
  9231.                                 outaddress(&hstok);
  9232.  
  9233.                                 if(tok==tk_number){
  9234.  
  9235.                                         asmparam=FALSE;
  9236.  
  9237.                                         op(doconstlongmath());
  9238.  
  9239.                                         next=0;
  9240.  
  9241.                                 }
  9242.  
  9243.                         }
  9244.  
  9245.                         else regexpected(2);
  9246.  
  9247.                         break;
  9248.  
  9249.                 case tk_dwordvar:
  9250.  
  9251.                 case tk_longvar:
  9252.  
  9253.                         if(h2tok==tk_reg32){
  9254.  
  9255.                                 CheckAllMassiv(hbuf,4,&hstr,&hstok);
  9256.  
  9257.                                 op66(r32);
  9258.  
  9259.                                 goto varreg;
  9260.  
  9261.                         }
  9262.  
  9263.                         else reg32expected(2);
  9264.  
  9265.                         break;
  9266.  
  9267.                 default: valueexpected();
  9268.  
  9269.         }
  9270.  
  9271.         if(cpu<3)cpu=3;
  9272.  
  9273.         if(next)nexttok();
  9274.  
  9275. }
  9276.  
  9277.  
  9278.  
  9279. void FpuType1(unsigned int addrm)
  9280.  
  9281. {
  9282.  
  9283. int opcode=0xd8;
  9284.  
  9285. int oscan=scanlexmode;
  9286.  
  9287.         scanlexmode=ASMLEX;
  9288.  
  9289.         nexttok();
  9290.  
  9291.         retoldscanmode(oscan);
  9292.  
  9293.         if(tok==tk_endline||tok==tk_semicolon){
  9294.  
  9295.                 op(0xD8);
  9296.  
  9297.                 op(0xC1+addrm);
  9298.  
  9299.                 return;
  9300.  
  9301.         }
  9302.  
  9303.         if(tok==tk_double){
  9304.  
  9305.                 opcode=0xdc;
  9306.  
  9307.                 nexttok();
  9308.  
  9309.         }
  9310.  
  9311.         switch(tok){
  9312.  
  9313.                 case tk_fpust:
  9314.  
  9315.                         op(0xD8);
  9316.  
  9317.                         op(0xC0+(unsigned int)itok.number+addrm);
  9318.  
  9319.                         break;
  9320.  
  9321.                 case tk_longvar:
  9322.  
  9323.                 case tk_dwordvar:
  9324.  
  9325.                 case tk_floatvar:
  9326.  
  9327.                         CheckAllMassiv(bufrm,4,&strinf);
  9328.  
  9329.                         outseg(&itok,2);
  9330.  
  9331.                         op(opcode);
  9332.  
  9333.                         op(itok.rm+addrm);
  9334.  
  9335.                         outaddress(&itok);
  9336.  
  9337.                         break;
  9338.  
  9339.                 case tk_doublevar:
  9340.  
  9341.                         CheckAllMassiv(bufrm,8,&strinf);
  9342.  
  9343.                         outseg(&itok,2);
  9344.  
  9345.                         op(0xDC);
  9346.  
  9347.                         op(itok.rm+addrm);
  9348.  
  9349.                         outaddress(&itok);
  9350.  
  9351.                         break;
  9352.  
  9353.                 default: fpuvarexpected(0);
  9354.  
  9355.         }
  9356.  
  9357. }
  9358.  
  9359.  
  9360.  
  9361. void FpuType2(unsigned int addrm,unsigned int addrm2)
  9362.  
  9363. {
  9364.  
  9365. long hnum;
  9366.  
  9367. int opcode=0xd8;
  9368.  
  9369. int oscan=scanlexmode;
  9370.  
  9371.         scanlexmode=ASMLEX;
  9372.  
  9373.         nexttok();
  9374.  
  9375.         retoldscanmode(oscan);
  9376.  
  9377.         if(tok==tk_endline||tok==tk_semicolon){
  9378.  
  9379.                 op(0xDE);
  9380.  
  9381.                 op(0xC1+addrm);
  9382.  
  9383.                 return;
  9384.  
  9385.         }
  9386.  
  9387.         if(tok==tk_double){
  9388.  
  9389.                 opcode=0xdc;
  9390.  
  9391.                 nexttok();
  9392.  
  9393.         }
  9394.  
  9395.         switch(tok){
  9396.  
  9397.                 case tk_fpust:
  9398.  
  9399.                         hnum=itok.number;
  9400.  
  9401.                         nextexpecting2(tk_camma);
  9402.  
  9403.                         if(hnum==0){
  9404.  
  9405.                                 if(tok==tk_fpust){
  9406.  
  9407.                                         op(0xD8);
  9408.  
  9409.                                         op(0xC0+addrm2+(unsigned int)itok.number);
  9410.  
  9411.                                 }
  9412.  
  9413.                                 else fpustakexpected(2);
  9414.  
  9415.                         }
  9416.  
  9417.                         else{
  9418.  
  9419.                                 if(tok==tk_fpust){
  9420.  
  9421.                                         if(itok.number!=0)fpu0expected();
  9422.  
  9423.                                         op(0xDC);
  9424.  
  9425.                                         op(0xC0+(unsigned int)hnum+addrm);
  9426.  
  9427.                                 }
  9428.  
  9429.                                 else fpustakexpected(2);
  9430.  
  9431.                         }
  9432.  
  9433.                         break;
  9434.  
  9435.                 case tk_longvar:
  9436.  
  9437.                 case tk_dwordvar:
  9438.  
  9439.                 case tk_floatvar:
  9440.  
  9441.                         CheckAllMassiv(bufrm,4,&strinf);
  9442.  
  9443.                         outseg(&itok,2);
  9444.  
  9445.                         op(opcode);
  9446.  
  9447.                         op(addrm2+itok.rm);
  9448.  
  9449.                         outaddress(&itok);
  9450.  
  9451.                         break;
  9452.  
  9453.                 case tk_doublevar:
  9454.  
  9455.                         CheckAllMassiv(bufrm,8,&strinf);
  9456.  
  9457.                         outseg(&itok,2);
  9458.  
  9459.                         op(0xDC);
  9460.  
  9461.                         op(addrm2+itok.rm);
  9462.  
  9463.                         outaddress(&itok);
  9464.  
  9465.                         break;
  9466.  
  9467.                 default: fpuvarexpected(1);
  9468.  
  9469.         }
  9470.  
  9471. }
  9472.  
  9473.  
  9474.  
  9475. void FpuType3(unsigned int opcode,unsigned int addrm)
  9476.  
  9477. {
  9478.  
  9479. int oscan=scanlexmode;
  9480.  
  9481.  
  9482.  
  9483.         scanlexmode=ASMLEX;
  9484.  
  9485.         nexttok();
  9486.  
  9487. //      scanlexmode=oscan;
  9488.  
  9489.         retoldscanmode(oscan);
  9490.  
  9491.         if((tok==tk_endline||tok==tk_semicolon)&&opcode!=0xDD){
  9492.  
  9493.                 op(opcode);
  9494.  
  9495.                 op(0xC1+addrm);
  9496.  
  9497.         }
  9498.  
  9499.         else if(tok==tk_fpust){
  9500.  
  9501.                 op(opcode);
  9502.  
  9503.                 op(0xC0+(unsigned int)itok.number+addrm);
  9504.  
  9505.         }
  9506.  
  9507.         else fpustakexpected(1);
  9508.  
  9509.         if(opcode==0xDE&&tok2==tk_camma){
  9510.  
  9511.                 nexttok();
  9512.  
  9513.                 nexttok();
  9514.  
  9515.                 if(tok!=tk_fpust||itok.number!=0)fpu0expected();
  9516.  
  9517.  
  9518.  
  9519.         }
  9520.  
  9521. }
  9522.  
  9523.  
  9524.  
  9525. void FpuType4(unsigned int opcode,unsigned int addrm)
  9526.  
  9527. {
  9528.  
  9529.         nexttok();
  9530.  
  9531.         if(opcode==1&&(addrm==0x18||addrm==0)&&tok==tk_qwordvar){
  9532.  
  9533.                 if(addrm==0)addrm=0x28;
  9534.  
  9535.                 else addrm=0x38;
  9536.  
  9537.                 CheckAllMassiv(bufrm,8,&strinf);
  9538.  
  9539.                 KillVar(itok.name);
  9540.  
  9541.                 outseg(&itok,2);
  9542.  
  9543.                 op(0xDF);
  9544.  
  9545.                 op(itok.rm+addrm);
  9546.  
  9547.                 outaddress(&itok);
  9548.  
  9549.                 return;
  9550.  
  9551.         }
  9552.  
  9553.         switch(tok){
  9554.  
  9555.                 case tk_wordvar:
  9556.  
  9557.                 case tk_intvar:
  9558.  
  9559.                         CheckAllMassiv(bufrm,2,&strinf);
  9560.  
  9561.                         KillVar(itok.name);
  9562.  
  9563.                         outseg(&itok,2);
  9564.  
  9565.                         op(0xDE + opcode);
  9566.  
  9567.                         op(itok.rm+addrm);
  9568.  
  9569.                         outaddress(&itok);
  9570.  
  9571.                         break;
  9572.  
  9573.                 case tk_longvar:
  9574.  
  9575.                 case tk_dwordvar:
  9576.  
  9577.                 case tk_floatvar:
  9578.  
  9579.                         CheckAllMassiv(bufrm,4,&strinf);
  9580.  
  9581.                         KillVar(itok.name);
  9582.  
  9583.                         outseg(&itok,2);
  9584.  
  9585.                         op(0xDA+opcode);
  9586.  
  9587.                         op(itok.rm+addrm);
  9588.  
  9589.                         outaddress(&itok);
  9590.  
  9591.                         break;
  9592.  
  9593.                 default: fpuvarexpected(0);
  9594.  
  9595.         }
  9596.  
  9597. }
  9598.  
  9599.  
  9600.  
  9601. void  FpuType5(unsigned int opcode,unsigned int addrm)
  9602.  
  9603. {
  9604.  
  9605. int opc=0xd9;
  9606.  
  9607. int i=4;
  9608.  
  9609.         nexttok();
  9610.  
  9611.         if(tok==tk_qword||tok==tk_double){
  9612.  
  9613.                 nexttok();
  9614.  
  9615.                 tok=tk_qwordvar;
  9616.  
  9617.         }
  9618.  
  9619.         else if((strcmp(itok.name,"tbyte")==0||strcmp(itok.name,"ldouble")==0)&&addrm!=0x10){
  9620.  
  9621.                 opc=0xdb;
  9622.  
  9623.                 i=10;
  9624.  
  9625.                 if(addrm==0)addrm=40;
  9626.  
  9627.                 else addrm=56;
  9628.  
  9629.                 nexttok();
  9630.  
  9631.                 if(tok>=tk_charvar&&tok<=tk_wordvar)tok=tk_dwordvar;
  9632.  
  9633.         }
  9634.  
  9635.         switch(tok){
  9636.  
  9637.                 case tk_fpust:
  9638.  
  9639.                         op(opcode);
  9640.  
  9641.                         op(0xC0+(unsigned int)itok.number+addrm);
  9642.  
  9643.                         break;
  9644.  
  9645.                 case tk_qwordvar:
  9646.  
  9647.                 case tk_doublevar:
  9648.  
  9649.                         opc=0xdd;
  9650.  
  9651.                         i=8;
  9652.  
  9653.                 case tk_longvar:
  9654.  
  9655.                 case tk_dwordvar:
  9656.  
  9657.                 case tk_floatvar:
  9658.  
  9659.                         CheckAllMassiv(bufrm,i,&strinf);
  9660.  
  9661.                         if(opcode!=0xD9)KillVar(itok.name);
  9662.  
  9663.                         outseg(&itok,2);
  9664.  
  9665.                         op(opc);
  9666.  
  9667.                         op(itok.rm+addrm);
  9668.  
  9669.                         outaddress(&itok);
  9670.  
  9671.                         break;
  9672.  
  9673.                 default: fpuvarexpected(0);
  9674.  
  9675.         }
  9676.  
  9677. }
  9678.  
  9679.  
  9680.  
  9681. void FpuType6(unsigned int opcode,unsigned int addrm)
  9682.  
  9683. {
  9684.  
  9685. int i=0;
  9686.  
  9687.         nexttok();
  9688.  
  9689.         if(opcode==0xDF){
  9690.  
  9691.                 if(tok==tk_qword){
  9692.  
  9693.                         nexttok();
  9694.  
  9695.                         tok=tk_qwordvar;
  9696.  
  9697.                 }
  9698.  
  9699.                 if(strcmp(itok.name,"tbyte")==0){
  9700.  
  9701.                         i=2;
  9702.  
  9703.                         nexttok();
  9704.  
  9705.                         tok=tk_qwordvar;
  9706.  
  9707.                 }
  9708.  
  9709.         }
  9710.  
  9711.         switch(tok){
  9712.  
  9713.                 case tk_qwordvar:
  9714.  
  9715.                 if(opcode!=0xDF)wordvalexpected();
  9716.  
  9717.                         i=+4;
  9718.  
  9719.                 case tk_longvar:
  9720.  
  9721.                 case tk_dwordvar:
  9722.  
  9723.                 case tk_floatvar:
  9724.  
  9725.                         i+=2;
  9726.  
  9727.                 case tk_wordvar:
  9728.  
  9729.                 case tk_intvar:
  9730.  
  9731.                         i+=2;
  9732.  
  9733.                         CheckAllMassiv(bufrm,i,&strinf);
  9734.  
  9735.                         KillVar(itok.name);
  9736.  
  9737.                         outseg(&itok,2);
  9738.  
  9739.                         op(opcode);
  9740.  
  9741.                         op(itok.rm+addrm);
  9742.  
  9743.                         outaddress(&itok);
  9744.  
  9745.                         break;
  9746.  
  9747.                 default: wordvalexpected();
  9748.  
  9749.         }
  9750.  
  9751. }
  9752.  
  9753.  
  9754.  
  9755. void FpuType7(unsigned int addrm)
  9756.  
  9757. {
  9758.  
  9759.         nexttok();
  9760.  
  9761.         switch(tok){
  9762.  
  9763.                 case tk_wordvar:
  9764.  
  9765.                 case tk_intvar:
  9766.  
  9767.                         CheckAllMassiv(bufrm,2,&strinf);
  9768.  
  9769.                         if(addrm!=0x28)KillVar(itok.name);
  9770.  
  9771.                         outseg(&itok,2);
  9772.  
  9773.                         op(0xD9);
  9774.  
  9775.                         op(itok.rm+addrm);
  9776.  
  9777.                         outaddress(&itok);
  9778.  
  9779.                         break;
  9780.  
  9781.                 default: wordvalexpected();
  9782.  
  9783.         }
  9784.  
  9785. }
  9786.  
  9787.  
  9788.  
  9789. void FpuType8(unsigned int opcode,unsigned int addrm)
  9790.  
  9791. {
  9792.  
  9793.         nexttok();
  9794.  
  9795.         if(tok==tk_fpust&&itok.number==0&&tok2==tk_camma){
  9796.  
  9797.                 nexttok();
  9798.  
  9799.                 nexttok();
  9800.  
  9801.         }
  9802.  
  9803.         if(tok==tk_fpust){
  9804.  
  9805.                 op(opcode);
  9806.  
  9807.                 op(0xC0+(unsigned int)itok.number+addrm);
  9808.  
  9809.                 if(cpu<7)cpu=7;
  9810.  
  9811.         }
  9812.  
  9813.         else fpustakexpected(1);
  9814.  
  9815. }
  9816.  
  9817.  
  9818.  
  9819. /* ***************** start of some quick codes ****************** */
  9820.  
  9821.  
  9822.  
  9823. int  short_ok(long thenumber,int reg32)
  9824.  
  9825. {
  9826.  
  9827.         if(reg32==TRUE){
  9828.  
  9829.                 if(thenumber<=SHORTMAX&&thenumber>=SHORTMIN)return(1);
  9830.  
  9831.         }
  9832.  
  9833.         else{
  9834.  
  9835.                 if((short)thenumber<=SHORTMAX&&(short)thenumber>=SHORTMIN)return(1);
  9836.  
  9837.         }
  9838.  
  9839.         return(0);
  9840.  
  9841. }
  9842.  
  9843.  
  9844.  
  9845. void cbw()
  9846.  
  9847. {
  9848.  
  9849.         if(optimizespeed&&(chip==5||chip==6)){
  9850.  
  9851.                 outdword(0xFCC0C488);   //mov ah,al     sar AH,7
  9852.  
  9853.                 op(7);
  9854.  
  9855.         }
  9856.  
  9857.         else{
  9858.  
  9859.                 op66(r16);
  9860.  
  9861.                 op(0x98);
  9862.  
  9863.         }
  9864.  
  9865.         ClearReg(AX);
  9866.  
  9867. }
  9868.  
  9869.  
  9870.  
  9871. void stosb()
  9872.  
  9873. {
  9874.  
  9875.         op(0xAA);
  9876.  
  9877.         ClearReg(DI);
  9878.  
  9879. }
  9880.  
  9881.  
  9882.  
  9883. void stosw()
  9884.  
  9885. {
  9886.  
  9887.         op66(r16);
  9888.  
  9889.         op(0xAB);
  9890.  
  9891.         ClearReg(DI);
  9892.  
  9893. }
  9894.  
  9895.  
  9896.  
  9897. void stosd()
  9898.  
  9899. {
  9900.  
  9901.         op66(r32);
  9902.  
  9903.         op(0xAB);
  9904.  
  9905.         if(cpu<3)cpu=3;
  9906.  
  9907.         ClearReg(DI);
  9908.  
  9909. }
  9910.  
  9911.  
  9912.  
  9913. void movsb()
  9914.  
  9915. {
  9916.  
  9917.         op(0xA4);
  9918.  
  9919.         ClearReg(DI);
  9920.  
  9921.         ClearReg(SI);
  9922.  
  9923. }
  9924.  
  9925.  
  9926.  
  9927. void movsw()
  9928.  
  9929. {
  9930.  
  9931.         op66(r16);
  9932.  
  9933.         op(0xA5);
  9934.  
  9935.         ClearReg(DI);
  9936.  
  9937.         ClearReg(SI);
  9938.  
  9939. }
  9940.  
  9941.  
  9942.  
  9943. void movsd()
  9944.  
  9945. {
  9946.  
  9947.         op66(r32);
  9948.  
  9949.         op(0xA5);
  9950.  
  9951.         if(cpu<3)cpu=3;
  9952.  
  9953.         ClearReg(DI);
  9954.  
  9955.         ClearReg(SI);
  9956.  
  9957. }
  9958.  
  9959.  
  9960.  
  9961. void pushds()  /* produce PUSH DS */
  9962.  
  9963. {
  9964.  
  9965.         RestoreStack();
  9966.  
  9967.         op(0x1E);
  9968.  
  9969. }
  9970.  
  9971.  
  9972.  
  9973. void pushss()
  9974.  
  9975. {
  9976.  
  9977.         RestoreStack();
  9978.  
  9979.         op(0x16);                       /* PUSH SS */
  9980.  
  9981. }
  9982.  
  9983.  
  9984.  
  9985. void popes()     /* produce POP ES */
  9986.  
  9987. {
  9988.  
  9989.         RestoreStack();
  9990.  
  9991.         op(0x07);
  9992.  
  9993. }
  9994.  
  9995.  
  9996.  
  9997. void ret()              /* produce RET */
  9998.  
  9999. {
  10000.  
  10001.         RestoreStack();
  10002.  
  10003.         op(0xC3);
  10004.  
  10005. }
  10006.  
  10007.  
  10008.  
  10009. void retf()     /* produce RETF */
  10010.  
  10011. {
  10012.  
  10013.         RestoreStack();
  10014.  
  10015.         op(0xCB);
  10016.  
  10017. }
  10018.  
  10019.  
  10020.  
  10021. void jumploc(long loc)           /* produce JUMP # */
  10022.  
  10023. {
  10024.  
  10025.  
  10026.  
  10027.         loc=loc-outptr-3;
  10028.  
  10029.         if(loc>-130&&loc<127){
  10030.  
  10031.                 loc++;
  10032.  
  10033.                 op(0xEB);
  10034.  
  10035.                 op(loc);
  10036.  
  10037.                 if(loc==0)notunreach=TRUE;
  10038.  
  10039.         }
  10040.  
  10041.         else{
  10042.  
  10043.                 if(am32==FALSE){
  10044.  
  10045.                         op(0xE9);
  10046.  
  10047.                         outword(loc);
  10048.  
  10049.                 }
  10050.  
  10051.                 else{
  10052.  
  10053.                         if(!optimizespeed&&(loc>126&&loc<65533)){
  10054.  
  10055.                                 outword(0xE966);
  10056.  
  10057.                                 outword(loc-1);
  10058.  
  10059.                         }
  10060.  
  10061.                         else{
  10062.  
  10063.                                 op(0xE9);
  10064.  
  10065.                                 outdword(loc-2);
  10066.  
  10067.                         }
  10068.  
  10069.                 }
  10070.  
  10071.         }
  10072.  
  10073. }
  10074.  
  10075.  
  10076.  
  10077. void callloc(long loc)   /* produce CALL # */
  10078.  
  10079. {
  10080.  
  10081.         loc=loc-outptr-3;
  10082.  
  10083.         op(0xE8);
  10084.  
  10085.         if(am32==FALSE) outword(loc);
  10086.  
  10087.         else outdword(loc-2);
  10088.  
  10089. }
  10090.  
  10091.  
  10092.  
  10093. void xorAHAH()   /* produce XOR AH,AH */
  10094.  
  10095. {
  10096.  
  10097.         outword(0xE430);
  10098.  
  10099.         ConstToReg(0,AH,r8);
  10100.  
  10101. }
  10102.  
  10103.  
  10104.  
  10105. void xorAXAX()   /* produce XOR AX,AX */
  10106.  
  10107. {
  10108.  
  10109.         op66(r16);
  10110.  
  10111.         outword(0xC031);
  10112.  
  10113.         ConstToReg(0,AX,r16);
  10114.  
  10115. }
  10116.  
  10117.  
  10118.  
  10119. void xorEAXEAX()         /* produce XOR EAX,EAX */
  10120.  
  10121. {
  10122.  
  10123.         op66(r32);
  10124.  
  10125.         outword(0xC031);
  10126.  
  10127.         if(cpu<3)cpu=3;
  10128.  
  10129.         ConstToReg(0,AX,r32);
  10130.  
  10131. }
  10132.  
  10133.  
  10134.  
  10135. void ZeroReg(int reg, int razr)
  10136.  
  10137. {
  10138.  
  10139.         op66(razr);
  10140.  
  10141.         op(0x31);
  10142.  
  10143.         op(0xc0+9*reg); //xor reg,reg
  10144.  
  10145.         ConstToReg(0,reg,razr);
  10146.  
  10147. }
  10148.  
  10149.  
  10150.  
  10151. void fwait()
  10152.  
  10153. {
  10154.  
  10155.         op(0x9B);
  10156.  
  10157. }
  10158.  
  10159.  
  10160.  
  10161. void cwdq(int razr)
  10162.  
  10163. {
  10164.  
  10165.         op66(razr);
  10166.  
  10167.         if(optimizespeed&&(chip==5||chip==6)){
  10168.  
  10169.                 outword(0xC289);        //mov dx,ax
  10170.  
  10171.                 op66(razr);
  10172.  
  10173.                 outword(0xFAC1);        //sar dx,15
  10174.  
  10175.                 op(razr==r16?15:31);
  10176.  
  10177.         }
  10178.  
  10179.         else op(0x99);
  10180.  
  10181.         ClearReg(DX);
  10182.  
  10183. }
  10184.  
  10185.  
  10186.  
  10187. void  nextexpecting2(int want)
  10188.  
  10189. {
  10190.  
  10191.         nexttok();
  10192.  
  10193.         expecting2(want);
  10194.  
  10195. }
  10196.  
  10197.  
  10198.  
  10199. void expecting2(int want)
  10200.  
  10201. {
  10202.  
  10203.         if(want!=tok)SwTok(want);
  10204.  
  10205.         nexttok();
  10206.  
  10207. }
  10208.  
  10209.  
  10210.  
  10211. void CheckIP()
  10212.  
  10213. {
  10214.  
  10215.         if(tok==tk_dollar){
  10216.  
  10217.                 tok=tk_number;
  10218.  
  10219.                 itok.number=outptr;
  10220.  
  10221.         }
  10222.  
  10223. }
  10224.  
  10225.  
  10226.  
  10227. void jumploc0()
  10228.  
  10229. {
  10230.  
  10231.         op(0xE9);
  10232.  
  10233.         outword(0);     /* the large jump */
  10234.  
  10235.         if(am32!=FALSE)outword(0);
  10236.  
  10237. }
  10238.  
  10239.  
  10240.  
  10241. void callloc0()
  10242.  
  10243. {
  10244.  
  10245.         op(0xE8);
  10246.  
  10247.         outword(0);
  10248.  
  10249.         if(am32!=FALSE)outword(0);
  10250.  
  10251. }
  10252.  
  10253.  
  10254.  
  10255. void Leave()
  10256.  
  10257. {
  10258.  
  10259.         if((optimizespeed&&chip>3&&chip<7)||chip==0){
  10260.  
  10261.                 outword(0xEC89);        // MOV SP,BP
  10262.  
  10263.                 op(0x5D);
  10264.  
  10265.         }
  10266.  
  10267.         else op(0xC9);
  10268.  
  10269. }
  10270.  
  10271.  
  10272.  
  10273. void  tobedefined(int callkind,int expectedreturn)
  10274.  
  10275. {
  10276.  
  10277. //      strcpy(itok.name,(char *)string);
  10278.  
  10279.         string[0]=0;
  10280.  
  10281.         itok.flag=(unsigned char)(tok==tk_ID?tp_fastcall:(comfile==file_w32?tp_stdcall:tp_pascal));
  10282.  
  10283.         tok=tk_undefproc;
  10284.  
  10285.         itok.number=secondcallnum;
  10286.  
  10287.         itok.segm=NOT_DYNAMIC;
  10288.  
  10289.         itok.rm=expectedreturn;
  10290.  
  10291.         itok.post=0;
  10292.  
  10293.         addtotree(itok.name);
  10294.  
  10295.         addacall(secondcallnum++,(unsigned char)callkind);
  10296.  
  10297. }
  10298.  
  10299.  
  10300.  
  10301. void  addlocaljump(int callkind)
  10302.  
  10303. {
  10304.  
  10305.         addlocalvar((char *)string,tk_locallabel,secondcallnum,TRUE);
  10306.  
  10307.         addacall(secondcallnum++,(char)callkind);
  10308.  
  10309. }
  10310.  
  10311.  
  10312.  
  10313. unsigned long SaveNumber(int type,int tok4,char *name)
  10314.  
  10315. {
  10316.  
  10317.         unsigned long t=doconstdwordmath();
  10318.  
  10319.         if(tok4==tk_undefofs)AddUndefOff(0,name);
  10320.  
  10321.         else if((postnumflag&f_reloc)!=0)AddReloc();
  10322.  
  10323.         if(type==r16)outword((unsigned int)t);
  10324.  
  10325.         else outdword(t);
  10326.  
  10327.         return t;
  10328.  
  10329. }
  10330.  
  10331.  
  10332.  
  10333. void Swap2tok(int *tok4, ITOK *itok4, char **buf4, SINFO *strinf4, int *tok6,
  10334.  
  10335.          ITOK *itok6, char **buf6, SINFO *strinf6)
  10336.  
  10337. {
  10338.  
  10339. int htok;
  10340.  
  10341. ITOK hstok;
  10342.  
  10343. char *hbuf;
  10344.  
  10345. SINFO hstr;
  10346.  
  10347.         htok=*tok4;
  10348.  
  10349.         *tok4=*tok6;
  10350.  
  10351.         *tok6=htok;
  10352.  
  10353.         hstok=*itok4;
  10354.  
  10355.         *itok4=*itok6;
  10356.  
  10357.         *itok6=hstok;
  10358.  
  10359.         hbuf=*buf4;
  10360.  
  10361.         *buf4=*buf6;
  10362.  
  10363.         *buf6=hbuf;
  10364.  
  10365.         hstr=*strinf4;
  10366.  
  10367.         *strinf4=*strinf6;
  10368.  
  10369.         *strinf6=hstr;
  10370.  
  10371. }
  10372.  
  10373.  
  10374.  
  10375. int iTest(int mode)
  10376.  
  10377. {
  10378.  
  10379. int htok,i;
  10380.  
  10381. ITOK hstok;
  10382.  
  10383. char *hbuf;
  10384.  
  10385. SINFO hstr;
  10386.  
  10387. unsigned char possiblecpu=0,next=1;
  10388.  
  10389. unsigned long num;
  10390.  
  10391.         asmparam=TRUE;
  10392.  
  10393.         nexttok();
  10394.  
  10395.         htok=tok;
  10396.  
  10397.         hstok=itok;
  10398.  
  10399.         hbuf=bufrm;
  10400.  
  10401.         bufrm=NULL;
  10402.  
  10403.         hstr=strinf;
  10404.  
  10405.         strinf.bufstr=NULL;
  10406.  
  10407.         if(tok==tk_number)hstok.number=doconstlongmath();
  10408.  
  10409.         else nexttok();
  10410.  
  10411.         expecting2(tk_camma);
  10412.  
  10413.         i=r16;
  10414.  
  10415. //      printf("tok=%d itok.number=%u bufrm=%s htok=%d hstok.number=%u nbuf=%s\n",
  10416.  
  10417. //       tok,itok.number,bufrm,htok,hstok.number,hbuf);
  10418.  
  10419.         if(htok==tk_number||htok==tk_postnumber)Swap2tok(&tok,&itok,&bufrm,&strinf,
  10420.  
  10421.                         &htok,&hstok,&hbuf,&hstr);
  10422.  
  10423. //      printf("tok=%d itok.number=%u bufrm=%s htok=%d hstok.number=%u nbuf=%s\n",
  10424.  
  10425. //       tok,itok.number,bufrm,htok,hstok.number,hbuf);
  10426.  
  10427.         switch(htok){
  10428.  
  10429.                 case tk_reg32:
  10430.  
  10431.                         i=r32;
  10432.  
  10433.                         possiblecpu=3;
  10434.  
  10435.                 case tk_reg:
  10436.  
  10437.                         switch(tok){
  10438.  
  10439.                                 case tk_reg32:
  10440.  
  10441.                                         if(i==r16){
  10442.  
  10443.                                                 reg32expected(1);
  10444.  
  10445.                                                 return FALSE;
  10446.  
  10447.                                         }
  10448.  
  10449.                                         op66(i);
  10450.  
  10451.                                         op(0x85);
  10452.  
  10453.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  10454.  
  10455.                                         break;
  10456.  
  10457.                                 case tk_reg:
  10458.  
  10459.                                         if(i==r32){
  10460.  
  10461.                                                 reg32expected(2);
  10462.  
  10463.                                                 return FALSE;
  10464.  
  10465.                                         }
  10466.  
  10467.                                         op66(i);
  10468.  
  10469.                                         op(0x85);
  10470.  
  10471.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  10472.  
  10473.                                         break;
  10474.  
  10475.                                 case tk_number:
  10476.  
  10477.                                         asmparam=FALSE;
  10478.  
  10479.                                         num=doconstdwordmath();
  10480.  
  10481.                                         if(mode){
  10482.  
  10483.                                                 if(num<256&&hstok.number<4)goto testal;
  10484.  
  10485.                                                 if(num<65536)i=r16;
  10486.  
  10487.                                         }
  10488.  
  10489.                                         op66(i);
  10490.  
  10491.                                         if(hstok.number==AX)op(0xA9);
  10492.  
  10493.                                         else{
  10494.  
  10495.                                                 op(0xF7);
  10496.  
  10497.                                                 op(128+64+hstok.number);
  10498.  
  10499.                                         }
  10500.  
  10501.                                         if(i==r16)outword((unsigned int)num);
  10502.  
  10503.                                         else outdword(num);
  10504.  
  10505.                                         next=0;
  10506.  
  10507.                                         break;
  10508.  
  10509.                                 case tk_postnumber:
  10510.  
  10511.                                         if(i==r32)return FALSE;
  10512.  
  10513.                                         op66(r16);
  10514.  
  10515.                                         if(hstok.number==AX)op(0xA9);
  10516.  
  10517.                                         else{
  10518.  
  10519.                                                 op(0xF7);
  10520.  
  10521.                                                 op(128+64+hstok.number);
  10522.  
  10523.                                         }
  10524.  
  10525.                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  10526.  
  10527.                                         outword(itok.number);   //¡ë«® 0
  10528.  
  10529.                                         break;
  10530.  
  10531.                                 case tk_dwordvar:
  10532.  
  10533.                                 case tk_longvar:
  10534.  
  10535.                                         if(i==r16){
  10536.  
  10537.                                                 reg32expected(1);
  10538.  
  10539.                                                 return FALSE;
  10540.  
  10541.                                         }
  10542.  
  10543.                                         CheckAllMassiv(bufrm,i,&strinf);
  10544.  
  10545.                                         op66(i);
  10546.  
  10547.                                         outseg(&itok,2);
  10548.  
  10549.                                         op(0x85);
  10550.  
  10551.                                         op(hstok.number*8+itok.rm);
  10552.  
  10553.                                         outaddress(&itok);
  10554.  
  10555.                                         break;
  10556.  
  10557.                                 case tk_wordvar:
  10558.  
  10559.                                 case tk_intvar:
  10560.  
  10561.                                         if(i==r32){
  10562.  
  10563.                                                 regexpected(1);
  10564.  
  10565.                                                 return FALSE;
  10566.  
  10567.                                         }
  10568.  
  10569.                                         CheckAllMassiv(bufrm,i,&strinf);
  10570.  
  10571.                                         op66(i);
  10572.  
  10573.                                         outseg(&itok,2);
  10574.  
  10575.                                         op(0x85);
  10576.  
  10577.                                         op(hstok.number*8+itok.rm);
  10578.  
  10579.                                         outaddress(&itok);
  10580.  
  10581.                                         break;
  10582.  
  10583.                                 default: return FALSE;
  10584.  
  10585.                         }
  10586.  
  10587.                         break;
  10588.  
  10589.                 case tk_beg:
  10590.  
  10591.                         switch(tok){
  10592.  
  10593.                                 case tk_beg:
  10594.  
  10595.                                         op(0x84);
  10596.  
  10597.                                         op(128+64+(unsigned int)itok.number*8+hstok.number);
  10598.  
  10599.                                         break;
  10600.  
  10601.                                 case tk_number:
  10602.  
  10603.                                         asmparam=FALSE;
  10604.  
  10605.                                         num=doconstdwordmath();
  10606.  
  10607. testal:
  10608.  
  10609.                                         if(hstok.number==AL)op(0xA8);
  10610.  
  10611.                                         else{
  10612.  
  10613.                                                 op(0xF6);
  10614.  
  10615.                                                 op(128+64+hstok.number);
  10616.  
  10617.                                         }
  10618.  
  10619.                                         op(num);
  10620.  
  10621.                                         next=0;
  10622.  
  10623.                                         break;
  10624.  
  10625.                                 case tk_charvar:
  10626.  
  10627.                                 case tk_bytevar:
  10628.  
  10629.                                         CheckAllMassiv(bufrm,1,&strinf);
  10630.  
  10631.                                         outseg(&itok,2);
  10632.  
  10633.                                         op(0x84);
  10634.  
  10635.                                         op(hstok.number*8+itok.rm);
  10636.  
  10637.                                         outaddress(&itok);
  10638.  
  10639.                                         break;
  10640.  
  10641.                                 default: return FALSE;
  10642.  
  10643.                         }
  10644.  
  10645.                         break;
  10646.  
  10647.                 case tk_dwordvar:
  10648.  
  10649.                 case tk_longvar:
  10650.  
  10651.                         i=r32;
  10652.  
  10653.                         possiblecpu=3;
  10654.  
  10655.                 case tk_wordvar:
  10656.  
  10657.                 case tk_intvar:
  10658.  
  10659.                         CheckAllMassiv(hbuf,i,&hstr,&hstok);
  10660.  
  10661.                         switch(tok){
  10662.  
  10663.                                 case tk_reg32:
  10664.  
  10665.                                         if(i==r16){
  10666.  
  10667.                                                 regexpected(2);
  10668.  
  10669.                                                 return FALSE;
  10670.  
  10671.                                         }
  10672.  
  10673.                                         op66(i);
  10674.  
  10675.                                         outseg(&hstok,2);
  10676.  
  10677.                                         op(0x85);
  10678.  
  10679.                                         op((unsigned int)itok.number*8+hstok.rm);
  10680.  
  10681.                                         outaddress(&hstok);
  10682.  
  10683.                                         break;
  10684.  
  10685.                                 case tk_reg:
  10686.  
  10687.                                         if(i==r32){
  10688.  
  10689.                                                 reg32expected(2);
  10690.  
  10691.                                                 return FALSE;
  10692.  
  10693.                                         }
  10694.  
  10695.                                         op66(i);
  10696.  
  10697.                                         outseg(&hstok,2);
  10698.  
  10699.                                         op(0x85);
  10700.  
  10701.                                         op((unsigned int)itok.number*8+hstok.rm);
  10702.  
  10703.                                         outaddress(&hstok);
  10704.  
  10705.                                         break;
  10706.  
  10707.                                 case tk_number:
  10708.  
  10709.                                         asmparam=FALSE;
  10710.  
  10711.                                         num=doconstdwordmath();
  10712.  
  10713.                                         if(mode){
  10714.  
  10715.                                                 if(num<256)goto testbyte;
  10716.  
  10717.                                                 if(num<65536)i=r16;
  10718.  
  10719.                                         }
  10720.  
  10721.                                         op66(i);
  10722.  
  10723.                                         outseg(&hstok,2);
  10724.  
  10725.                                         op(0xF7);
  10726.  
  10727.                                         op(hstok.rm);
  10728.  
  10729.                                         outaddress(&hstok);
  10730.  
  10731.                                         if(i==r32)outdword(num);
  10732.  
  10733.                                         else outword((unsigned int)num);
  10734.  
  10735.                                         next=0;
  10736.  
  10737.                                         break;
  10738.  
  10739.                                 case tk_postnumber:
  10740.  
  10741.                                         op66(i);
  10742.  
  10743.                                         outseg(&hstok,2);
  10744.  
  10745.                                         if(i==r32)return FALSE;
  10746.  
  10747.                                         op(0xF7);
  10748.  
  10749.                                         op(hstok.rm);
  10750.  
  10751.                                         outaddress(&hstok);
  10752.  
  10753.                                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  10754.  
  10755.                                         outword((unsigned int)itok.number);
  10756.  
  10757.                                         break;
  10758.  
  10759.                                 default: return FALSE;
  10760.  
  10761.                         }
  10762.  
  10763.                         break;
  10764.  
  10765.                 case tk_charvar:
  10766.  
  10767.                 case tk_bytevar:
  10768.  
  10769.                         CheckAllMassiv(hbuf,1,&hstr,&hstok);
  10770.  
  10771.                         switch(tok){
  10772.  
  10773.                                 case tk_beg:
  10774.  
  10775.                                         outseg(&hstok,2);
  10776.  
  10777.                                         op(0x84);
  10778.  
  10779.                                         op((unsigned int)itok.number*8+hstok.rm);
  10780.  
  10781.                                         outaddress(&hstok);
  10782.  
  10783.                                         break;
  10784.  
  10785.                                 case tk_number:
  10786.  
  10787.                                         asmparam=FALSE;
  10788.  
  10789.                                         num=doconstdwordmath();
  10790.  
  10791. testbyte:
  10792.  
  10793.                                         outseg(&hstok,2);
  10794.  
  10795.                                         op(0xF6);
  10796.  
  10797.                                         op(hstok.rm);
  10798.  
  10799.                                         outaddress(&hstok);
  10800.  
  10801.                                         op(num);
  10802.  
  10803.                                         next=0;
  10804.  
  10805.                                         break;
  10806.  
  10807.                                 default: return FALSE;
  10808.  
  10809.                         }
  10810.  
  10811.                         break;
  10812.  
  10813.                 default: return FALSE;
  10814.  
  10815.         }
  10816.  
  10817.         if(cpu<possiblecpu)cpu=possiblecpu;
  10818.  
  10819.         if(next)nexttok();
  10820.  
  10821.         return TRUE;
  10822.  
  10823. }
  10824.  
  10825.  
  10826.  
  10827. void mmxiii(int type)
  10828.  
  10829. {
  10830.  
  10831. int num1,i=1;
  10832.  
  10833. int xmm=FALSE;
  10834.  
  10835.         nexttok();
  10836.  
  10837.         if(tok==tk_xmmreg)xmm=TRUE;
  10838.  
  10839.         else if(tok!=tk_mmxreg)mmxregexpected(1);
  10840.  
  10841.         num1=itok.number;
  10842.  
  10843.         nextexpecting2(tk_camma);
  10844.  
  10845.         switch(tok){
  10846.  
  10847.                 case tk_mmxreg:
  10848.  
  10849.                         if(xmm)xmmregorvarexpected(2);
  10850.  
  10851.                         op(0x0F);
  10852.  
  10853.                         op(type);
  10854.  
  10855.                         op(rm_mod11+itok.number+num1*8);
  10856.  
  10857.                         break;
  10858.  
  10859.                 case tk_xmmreg:
  10860.  
  10861.                         if(xmm==FALSE)mmxormem(2);
  10862.  
  10863.                         outword(0x0F66);
  10864.  
  10865.                         op(type);
  10866.  
  10867.                         op(rm_mod11+itok.number+num1*8);
  10868.  
  10869.                         break;
  10870.  
  10871.                 case tk_qwordvar:
  10872.  
  10873.                         i+=4;
  10874.  
  10875.                 case tk_longvar:
  10876.  
  10877.                 case tk_dwordvar:
  10878.  
  10879.                 case tk_floatvar:
  10880.  
  10881.                         i+=2;
  10882.  
  10883.                 case tk_wordvar:
  10884.  
  10885.                 case tk_intvar:
  10886.  
  10887.                         i++;
  10888.  
  10889.                 case tk_charvar:
  10890.  
  10891.                 case tk_bytevar:
  10892.  
  10893.                         CheckAllMassiv(bufrm,i,&strinf);
  10894.  
  10895.                         outseg(&itok,xmm==FALSE?3:4);
  10896.  
  10897.                         if(xmm)op(0x66);
  10898.  
  10899.                         op(0x0F);
  10900.  
  10901.                         op(type);
  10902.  
  10903.                         op(itok.rm+num1*8);
  10904.  
  10905.                         outaddress(&itok);
  10906.  
  10907.                         break;
  10908.  
  10909.                 default:
  10910.  
  10911.                         mmxormem(2);
  10912.  
  10913.                         break;
  10914.  
  10915.         }
  10916.  
  10917.         if(cpu<8)cpu=8;
  10918.  
  10919.         if(xmm&&cpu<9)cpu=9;
  10920.  
  10921. }
  10922.  
  10923.  
  10924.  
  10925. void prefetch(int code,int type)
  10926.  
  10927. {
  10928.  
  10929. int i=1;
  10930.  
  10931.         nexttok();
  10932.  
  10933.         switch(tok){
  10934.  
  10935.                 case tk_qwordvar:
  10936.  
  10937.                         i+=4;
  10938.  
  10939.                 case tk_longvar:
  10940.  
  10941.                 case tk_dwordvar:
  10942.  
  10943.                 case tk_floatvar:
  10944.  
  10945.                         i+=2;
  10946.  
  10947.                 case tk_wordvar:
  10948.  
  10949.                 case tk_intvar:
  10950.  
  10951.                         i++;
  10952.  
  10953.                 case tk_charvar:
  10954.  
  10955.                 case tk_bytevar:
  10956.  
  10957.                         CheckAllMassiv(bufrm,i,&strinf);
  10958.  
  10959.                         KillVar(itok.name);
  10960.  
  10961.                         outseg(&itok,3);
  10962.  
  10963.                         op(0x0f);
  10964.  
  10965.                         op(code);
  10966.  
  10967.                         op(itok.rm+type*8);
  10968.  
  10969.                         outaddress(&itok);
  10970.  
  10971.                         break;
  10972.  
  10973.                 default:
  10974.  
  10975.                         datatype_expected(1);
  10976.  
  10977.                         break;
  10978.  
  10979.         }
  10980.  
  10981. }
  10982.  
  10983.  
  10984.  
  10985. void pextrw()
  10986.  
  10987. {
  10988.  
  10989. int num1,num2;
  10990.  
  10991. int xmm=FALSE;
  10992.  
  10993.         nexttok();
  10994.  
  10995.         if(tok!=tk_reg32)reg32expected(1);
  10996.  
  10997.         num1=itok.number;
  10998.  
  10999.         ClearReg(num1);
  11000.  
  11001.         nextexpecting2(tk_camma);
  11002.  
  11003.         if(tok==tk_xmmreg)xmm=TRUE;
  11004.  
  11005.         else if(tok!=tk_mmxreg)mmxregexpected(2);
  11006.  
  11007.         num2=itok.number;
  11008.  
  11009.         nextexpecting2(tk_camma);
  11010.  
  11011.         if(tok!=tk_number)numexpected(3);
  11012.  
  11013.         if(xmm)op(0x66);
  11014.  
  11015.         outword(0xC50F);
  11016.  
  11017.         op(rm_mod11+num1+num2*8);
  11018.  
  11019.         op(doconstdwordmath());
  11020.  
  11021.         if(cpu<8)cpu=8;
  11022.  
  11023.         if(xmm&&cpu<9)cpu=9;
  11024.  
  11025. }
  11026.  
  11027.  
  11028.  
  11029. void pinsrw()
  11030.  
  11031. {
  11032.  
  11033. int num1,htok;
  11034.  
  11035. ITOK hstok;
  11036.  
  11037. char *hbuf;
  11038.  
  11039. SINFO hstr;
  11040.  
  11041. int xmm=FALSE;
  11042.  
  11043.         nexttok();
  11044.  
  11045.         if(tok==tk_xmmreg)xmm=TRUE;
  11046.  
  11047.         else if(tok!=tk_mmxreg)mmxregexpected(1);
  11048.  
  11049.         num1=itok.number;
  11050.  
  11051.         nextexpecting2(tk_camma);
  11052.  
  11053.         htok=tok;
  11054.  
  11055.         hstok=itok;
  11056.  
  11057.         hbuf=bufrm;
  11058.  
  11059.         bufrm=NULL;
  11060.  
  11061.         hstr=strinf;
  11062.  
  11063.         strinf.bufstr=NULL;
  11064.  
  11065.         nextexpecting2(tk_camma);
  11066.  
  11067.         if(tok!=tk_number)numexpected(3);
  11068.  
  11069.         switch(htok){
  11070.  
  11071.                 case tk_reg32:
  11072.  
  11073.                         if(xmm)op(0x66);
  11074.  
  11075.                         outword(0xC40F);
  11076.  
  11077.                         op(rm_mod11+num1+hstok.number*8);
  11078.  
  11079.                         break;
  11080.  
  11081.                 case tk_wordvar:
  11082.  
  11083.                 case tk_intvar:
  11084.  
  11085.                         CheckAllMassiv(hbuf,2,&hstr);
  11086.  
  11087.                         outseg(&hstok,xmm==FALSE?3:4);
  11088.  
  11089.                         if(xmm)op(0x66);
  11090.  
  11091.                         outword(0xC40F);
  11092.  
  11093.                         op(hstok.rm+num1*8);
  11094.  
  11095.                         outaddress(&hstok);
  11096.  
  11097.                         break;
  11098.  
  11099.                 default:
  11100.  
  11101.                         reg32orword(2);
  11102.  
  11103.                         break;
  11104.  
  11105.         }
  11106.  
  11107.         op(doconstdwordmath());
  11108.  
  11109.         if(cpu<8)cpu=8;
  11110.  
  11111.         if(xmm&&cpu<9)cpu=9;
  11112.  
  11113. }
  11114.  
  11115.  
  11116.  
  11117. void pshufw()
  11118.  
  11119. {
  11120.  
  11121. int num1,htok;
  11122.  
  11123. ITOK hstok;
  11124.  
  11125. char *hbuf;
  11126.  
  11127. SINFO hstr;
  11128.  
  11129. int i=1;
  11130.  
  11131.         nexttok();
  11132.  
  11133.         if(tok!=tk_mmxreg)mmxregexpected(1);
  11134.  
  11135.         num1=itok.number;
  11136.  
  11137.         nextexpecting2(tk_camma);
  11138.  
  11139.         htok=tok;
  11140.  
  11141.         hstok=itok;
  11142.  
  11143.         hbuf=bufrm;
  11144.  
  11145.         bufrm=NULL;
  11146.  
  11147.         hstr=strinf;
  11148.  
  11149.         strinf.bufstr=NULL;
  11150.  
  11151.         nextexpecting2(tk_camma);
  11152.  
  11153.         if(tok!=tk_number)numexpected(3);
  11154.  
  11155.         switch(htok){
  11156.  
  11157.                 case tk_mmxreg:
  11158.  
  11159.                         outword(0x700F);
  11160.  
  11161.                         op(rm_mod11+num1+hstok.number*8);
  11162.  
  11163.                         break;
  11164.  
  11165.                 case tk_longvar:
  11166.  
  11167.                 case tk_dwordvar:
  11168.  
  11169.                 case tk_floatvar:
  11170.  
  11171.                         i+=2;
  11172.  
  11173.                 case tk_wordvar:
  11174.  
  11175.                 case tk_intvar:
  11176.  
  11177.                         i++;
  11178.  
  11179.                 case tk_charvar:
  11180.  
  11181.                 case tk_bytevar:
  11182.  
  11183.                         CheckAllMassiv(hbuf,i,&hstr);
  11184.  
  11185.                         KillVar(hstok.name);
  11186.  
  11187.                         outseg(&hstok,3);
  11188.  
  11189.                         outword(0x700F);
  11190.  
  11191.                         op(hstok.rm+num1*8);
  11192.  
  11193.                         outaddress(&hstok);
  11194.  
  11195.                         break;
  11196.  
  11197.                 default:
  11198.  
  11199.                         mmxregordwordexpected(2);
  11200.  
  11201.                         break;
  11202.  
  11203.         }
  11204.  
  11205.         op(doconstdwordmath());
  11206.  
  11207. }
  11208.  
  11209.  
  11210.  
  11211. void xmminstr(int type,int sec,int op1,int op2)
  11212.  
  11213. {
  11214.  
  11215. int num1,i=1;
  11216.  
  11217.         nexttok();
  11218.  
  11219.         if(tok!=op1){
  11220.  
  11221.                 if(op1==tk_mmxreg)mmxregexpected(1);
  11222.  
  11223.                 else if(op1==tk_reg32)reg32expected(1);
  11224.  
  11225.                 else xmmregexpected(1);
  11226.  
  11227.         }
  11228.  
  11229.         if(tok==tk_reg32)ClearReg(itok.number);
  11230.  
  11231.         num1=itok.number;
  11232.  
  11233.         nextexpecting2(tk_camma);
  11234.  
  11235.         switch ( tok ) {
  11236.  
  11237.                 case tk_reg32:
  11238.  
  11239.                 case tk_mmxreg:
  11240.  
  11241.                 case tk_xmmreg:
  11242.  
  11243.                         if(tok!=op2){
  11244.  
  11245.                                 if(op2==tk_mmxreg)mmxregexpected(2);
  11246.  
  11247.                                 else if(op2==tk_reg32)reg32expected(2);
  11248.  
  11249.                                 else xmmregexpected(2);
  11250.  
  11251.                         }
  11252.  
  11253.                         if(sec)op(sec);
  11254.  
  11255.                         op(0x0F);
  11256.  
  11257.                         op(type);
  11258.  
  11259.                         op(rm_mod11+itok.number+num1*8);
  11260.  
  11261.                         break;
  11262.  
  11263.                 case tk_qwordvar:
  11264.  
  11265.                         i+=4;
  11266.  
  11267.                 case tk_longvar:
  11268.  
  11269.                 case tk_dwordvar:
  11270.  
  11271.                 case tk_floatvar:
  11272.  
  11273.                         i+=2;
  11274.  
  11275.                 case tk_wordvar:
  11276.  
  11277.                 case tk_intvar:
  11278.  
  11279.                         i++;
  11280.  
  11281.                 case tk_charvar:
  11282.  
  11283.                 case tk_bytevar:
  11284.  
  11285.                         CheckAllMassiv(bufrm,i,&strinf);
  11286.  
  11287.                         outseg(&itok,sec==0?3:4);
  11288.  
  11289.                         if(sec)op(sec);
  11290.  
  11291.                         op(0x0F);
  11292.  
  11293.                         op(type);
  11294.  
  11295.                         op(itok.rm+num1*8);
  11296.  
  11297.                         outaddress(&itok);
  11298.  
  11299.                         break;
  11300.  
  11301.                 default:
  11302.  
  11303.                         if(op2==tk_mmxreg)mmxregordwordexpected(2);
  11304.  
  11305.                         else if(op2==tk_reg32)reg32orword(2);
  11306.  
  11307.                         else xmmregorvarexpected(2);
  11308.  
  11309.                         break;
  11310.  
  11311.         }
  11312.  
  11313. }
  11314.  
  11315.  
  11316.  
  11317. void xmm3instr(int type,int sec)        //xmm,xmm/mem,i8
  11318.  
  11319. {
  11320.  
  11321. int num1,i=1,htok;
  11322.  
  11323. ITOK hstok;
  11324.  
  11325. char *hbuf;
  11326.  
  11327. SINFO hstr;
  11328.  
  11329.         nexttok();
  11330.  
  11331.         if(tok!=tk_xmmreg)xmmregexpected(1);
  11332.  
  11333.         num1=itok.number;
  11334.  
  11335.         nextexpecting2(tk_camma);
  11336.  
  11337.         htok=tok;
  11338.  
  11339.         hstok=itok;
  11340.  
  11341.         hbuf=bufrm;
  11342.  
  11343.         bufrm=NULL;
  11344.  
  11345.         hstr=strinf;
  11346.  
  11347.         strinf.bufstr=NULL;
  11348.  
  11349.         nextexpecting2(tk_camma);
  11350.  
  11351.         if(tok!=tk_number)numexpected(3);
  11352.  
  11353.         switch(htok){
  11354.  
  11355.                 case tk_xmmreg:
  11356.  
  11357.                         if(sec)op(sec);
  11358.  
  11359.                         op(0x0F);
  11360.  
  11361.                         op(type);
  11362.  
  11363.                         op(rm_mod11+hstok.number+num1*8);
  11364.  
  11365.                         break;
  11366.  
  11367.                 case tk_qwordvar:
  11368.  
  11369.                         i+=4;
  11370.  
  11371.                 case tk_longvar:
  11372.  
  11373.                 case tk_dwordvar:
  11374.  
  11375.                 case tk_floatvar:
  11376.  
  11377.                         i+=2;
  11378.  
  11379.                 case tk_wordvar:
  11380.  
  11381.                 case tk_intvar:
  11382.  
  11383.                         i++;
  11384.  
  11385.                 case tk_charvar:
  11386.  
  11387.                 case tk_bytevar:
  11388.  
  11389.                         CheckAllMassiv(hbuf,i,&hstr);
  11390.  
  11391.                         outseg(&hstok,sec==0?3:4);
  11392.  
  11393.                         if(sec)op(sec);
  11394.  
  11395.                         op(0x0F);
  11396.  
  11397.                         op(type);
  11398.  
  11399.                         op(hstok.rm+num1*8);
  11400.  
  11401.                         outaddress(&hstok);
  11402.  
  11403.                         break;
  11404.  
  11405.                 default:
  11406.  
  11407.                         xmmregorvarexpected(2);
  11408.  
  11409.                         break;
  11410.  
  11411.         }
  11412.  
  11413.         op(doconstdwordmath());
  11414.  
  11415. }
  11416.  
  11417.  
  11418.  
  11419. void xmm2xmm(int code,int code2,int type)
  11420.  
  11421. {
  11422.  
  11423. int num;
  11424.  
  11425.         nexttok();
  11426.  
  11427.         if(tok!=type){
  11428.  
  11429.                 if(type==tk_mmxreg)mmxregexpected(1);
  11430.  
  11431.                 else if(type==tk_reg32)reg32expected(1);
  11432.  
  11433.                 else xmmregexpected(1);
  11434.  
  11435.         }
  11436.  
  11437.         if(tok==tk_reg32)ClearReg(itok.number);
  11438.  
  11439.         num=itok.number;
  11440.  
  11441.         nextexpecting2(tk_camma);
  11442.  
  11443.         if(tok!=tk_xmmreg)xmmregexpected(2);
  11444.  
  11445.         if(code2)op(code2);
  11446.  
  11447.         op(0x0F);
  11448.  
  11449.         op(code);
  11450.  
  11451.         op(rm_mod11+itok.number+num*8);
  11452.  
  11453. }
  11454.  
  11455.  
  11456.  
  11457. void movxmm3(int code,int code2,int type)
  11458.  
  11459. {
  11460.  
  11461. int i=1,htok;
  11462.  
  11463. ITOK hstok;
  11464.  
  11465. char *hbuf;
  11466.  
  11467. SINFO hstr;
  11468.  
  11469.         nexttok();
  11470.  
  11471.         htok=tok;
  11472.  
  11473.         hstok=itok;
  11474.  
  11475.         hbuf=bufrm;
  11476.  
  11477.         bufrm=NULL;
  11478.  
  11479.         hstr=strinf;
  11480.  
  11481.         strinf.bufstr=NULL;
  11482.  
  11483.         nextexpecting2(tk_camma);
  11484.  
  11485.         if(tok!=type){
  11486.  
  11487.                 if(type==tk_mmxreg)mmxregexpected(2);
  11488.  
  11489.                 else if(type==tk_xmmreg)xmmregexpected(2);
  11490.  
  11491.                 else reg32expected(2);
  11492.  
  11493.         }
  11494.  
  11495.         switch(htok){
  11496.  
  11497.                 case tk_qwordvar:
  11498.  
  11499.                         i+=4;
  11500.  
  11501.                 case tk_longvar:
  11502.  
  11503.                 case tk_dwordvar:
  11504.  
  11505.                 case tk_floatvar:
  11506.  
  11507.                         i+=2;
  11508.  
  11509.                 case tk_wordvar:
  11510.  
  11511.                 case tk_intvar:
  11512.  
  11513.                         i+=1;
  11514.  
  11515.                 case tk_charvar:
  11516.  
  11517.                 case tk_bytevar:
  11518.  
  11519.                         CheckAllMassiv(hbuf,i,&hstr);
  11520.  
  11521.                         KillVar(hstok.name);
  11522.  
  11523.                         outseg(&hstok,code2==0?3:4);
  11524.  
  11525.                         if(code2)op(code2);
  11526.  
  11527.                         op(0x0F);
  11528.  
  11529.                         op(code);
  11530.  
  11531.                         op(hstok.rm+itok.number*8);
  11532.  
  11533.                         outaddress(&hstok);
  11534.  
  11535.                         break;
  11536.  
  11537.                 default: varexpected(1);
  11538.  
  11539.         }
  11540.  
  11541. }
  11542.  
  11543.  
  11544.  
  11545. void movxmm4(int code,int code2)
  11546.  
  11547. {
  11548.  
  11549. int i=1;
  11550.  
  11551. int num;
  11552.  
  11553.         nexttok();
  11554.  
  11555.         num=itok.number;
  11556.  
  11557.         if(tok!=tk_xmmreg)xmmregexpected(1);
  11558.  
  11559.         nextexpecting2(tk_camma);
  11560.  
  11561.         switch(tok){
  11562.  
  11563.                 case tk_qwordvar:
  11564.  
  11565.                         i+=4;
  11566.  
  11567.                 case tk_longvar:
  11568.  
  11569.                 case tk_dwordvar:
  11570.  
  11571.                 case tk_floatvar:
  11572.  
  11573.                         i+=2;
  11574.  
  11575.                 case tk_wordvar:
  11576.  
  11577.                 case tk_intvar:
  11578.  
  11579.                         i+=1;
  11580.  
  11581.                 case tk_charvar:
  11582.  
  11583.                 case tk_bytevar:
  11584.  
  11585.                         CheckAllMassiv(bufrm,i,&strinf);
  11586.  
  11587.                         outseg(&itok,(code2==0?3:4));
  11588.  
  11589.                         if(code2)op(code2);
  11590.  
  11591.                         op(0x0F);
  11592.  
  11593.                         op(code);
  11594.  
  11595.                         op(itok.rm+num*8);
  11596.  
  11597.                         outaddress(&itok);
  11598.  
  11599.                         break;
  11600.  
  11601.                 default: varexpected(2);
  11602.  
  11603.         }
  11604.  
  11605. }
  11606.  
  11607.  
  11608.  
  11609. void movxmm(int code,int code2,int addc)
  11610.  
  11611. {
  11612.  
  11613. int i=1,htok;
  11614.  
  11615. ITOK hstok;
  11616.  
  11617. char *hbuf;
  11618.  
  11619. SINFO hstr;
  11620.  
  11621.         nexttok();
  11622.  
  11623.         htok=tok;
  11624.  
  11625.         hstok=itok;
  11626.  
  11627.         hbuf=bufrm;
  11628.  
  11629.         bufrm=NULL;
  11630.  
  11631.         hstr=strinf;
  11632.  
  11633.         strinf.bufstr=NULL;
  11634.  
  11635.         nextexpecting2(tk_camma);
  11636.  
  11637.         switch(htok){
  11638.  
  11639.                 case tk_xmmreg:
  11640.  
  11641.                         switch(tok){
  11642.  
  11643.                                 case tk_xmmreg:
  11644.  
  11645.                                         if(code2)op(code2);
  11646.  
  11647.                                         op(0x0F);
  11648.  
  11649.                                         op(code);
  11650.  
  11651.                                         op(rm_mod11+itok.number+hstok.number*8);
  11652.  
  11653.                                         break;
  11654.  
  11655.                                 case tk_qwordvar:
  11656.  
  11657.                                         i+=4;
  11658.  
  11659.                                 case tk_longvar:
  11660.  
  11661.                                 case tk_dwordvar:
  11662.  
  11663.                                 case tk_floatvar:
  11664.  
  11665.                                         i+=2;
  11666.  
  11667.                                 case tk_wordvar:
  11668.  
  11669.                                 case tk_intvar:
  11670.  
  11671.                                         i++;
  11672.  
  11673.                                 case tk_charvar:
  11674.  
  11675.                                 case tk_bytevar:
  11676.  
  11677.                                         CheckAllMassiv(bufrm,i,&strinf);
  11678.  
  11679.                                         outseg(&itok,(code2==0?3:4));
  11680.  
  11681.                                         if(code2)op(code2);
  11682.  
  11683.                                         op(0x0F);
  11684.  
  11685.                                         op(code);
  11686.  
  11687.                                         op(itok.rm+hstok.number*8);
  11688.  
  11689.                                         outaddress(&itok);
  11690.  
  11691.                                         break;
  11692.  
  11693.                                 default:
  11694.  
  11695.                                         xmmregorvarexpected(2);
  11696.  
  11697.                                         break;
  11698.  
  11699.                         }
  11700.  
  11701.                         break;
  11702.  
  11703.                 case tk_qwordvar:
  11704.  
  11705.                         i+=4;
  11706.  
  11707.                 case tk_longvar:
  11708.  
  11709.                 case tk_dwordvar:
  11710.  
  11711.                 case tk_floatvar:
  11712.  
  11713.                         i+=2;
  11714.  
  11715.                 case tk_wordvar:
  11716.  
  11717.                 case tk_intvar:
  11718.  
  11719.                         i++;
  11720.  
  11721.                 case tk_charvar:
  11722.  
  11723.                 case tk_bytevar:
  11724.  
  11725.                         if(tok!=tk_xmmreg)xmmregexpected(2);
  11726.  
  11727.                         CheckAllMassiv(hbuf,i,&hstr);
  11728.  
  11729.                         KillVar(hstok.name);
  11730.  
  11731.                         outseg(&hstok,code2==0?3:4);
  11732.  
  11733.                         if(code2)op(code2);
  11734.  
  11735.                         op(0x0F);
  11736.  
  11737.                         op(code+addc);
  11738.  
  11739.                         op(hstok.rm+itok.number*8);
  11740.  
  11741.                         outaddress(&hstok);
  11742.  
  11743.                         break;
  11744.  
  11745.                 default:
  11746.  
  11747.                         xmmregorvarexpected(1);
  11748.  
  11749.                         break;
  11750.  
  11751.         }
  11752.  
  11753. }
  11754.  
  11755.  
  11756.  
  11757. void movxmm2(int code,int code2)
  11758.  
  11759. {
  11760.  
  11761. int i=1,htok;
  11762.  
  11763. ITOK hstok;
  11764.  
  11765. char *hbuf;
  11766.  
  11767. SINFO hstr;
  11768.  
  11769.         nexttok();
  11770.  
  11771.         htok=tok;
  11772.  
  11773.         hstok=itok;
  11774.  
  11775.         hbuf=bufrm;
  11776.  
  11777.         bufrm=NULL;
  11778.  
  11779.         hstr=strinf;
  11780.  
  11781.         strinf.bufstr=NULL;
  11782.  
  11783.         nextexpecting2(tk_camma);
  11784.  
  11785.         switch(htok){
  11786.  
  11787.                 case tk_xmmreg:
  11788.  
  11789.                         switch(tok){
  11790.  
  11791.                                 case tk_qwordvar:
  11792.  
  11793.                                         i+=4;
  11794.  
  11795.                                 case tk_longvar:
  11796.  
  11797.                                 case tk_dwordvar:
  11798.  
  11799.                                 case tk_floatvar:
  11800.  
  11801.                                         i+=2;
  11802.  
  11803.                                 case tk_wordvar:
  11804.  
  11805.                                 case tk_intvar:
  11806.  
  11807.                                         i++;
  11808.  
  11809.                                 case tk_charvar:
  11810.  
  11811.                                 case tk_bytevar:
  11812.  
  11813.                                         CheckAllMassiv(bufrm,i,&strinf);
  11814.  
  11815.                                         outseg(&itok,(code2==0?3:4));
  11816.  
  11817.                                         if(code2)op(code2);
  11818.  
  11819.                                         op(0x0F);
  11820.  
  11821.                                         op(code);
  11822.  
  11823.                                         op(itok.rm+hstok.number*8);
  11824.  
  11825.                                         outaddress(&itok);
  11826.  
  11827.                                         break;
  11828.  
  11829.                                 default:
  11830.  
  11831.                                         datatype_expected(2);
  11832.  
  11833.                                         break;
  11834.  
  11835.                         }
  11836.  
  11837.                         break;
  11838.  
  11839.                 case tk_qwordvar:
  11840.  
  11841.                         i+=4;
  11842.  
  11843.                 case tk_longvar:
  11844.  
  11845.                 case tk_dwordvar:
  11846.  
  11847.                 case tk_floatvar:
  11848.  
  11849.                         i+=2;
  11850.  
  11851.                 case tk_wordvar:
  11852.  
  11853.                 case tk_intvar:
  11854.  
  11855.                         i++;
  11856.  
  11857.                 case tk_charvar:
  11858.  
  11859.                 case tk_bytevar:
  11860.  
  11861.                         if(tok!=tk_xmmreg)xmmregexpected(2);
  11862.  
  11863.                         CheckAllMassiv(hbuf,i,&hstr);
  11864.  
  11865.                         KillVar(hstok.name);
  11866.  
  11867.                         outseg(&hstok,code2==0?3:4);
  11868.  
  11869.                         if(code2)op(code2);
  11870.  
  11871.                         op(0x0F);
  11872.  
  11873.                         op(code+1);
  11874.  
  11875.                         op(hstok.rm+itok.number*8);
  11876.  
  11877.                         outaddress(&hstok);
  11878.  
  11879.                         break;
  11880.  
  11881.                 default:
  11882.  
  11883.                         xmmregorvarexpected(1);
  11884.  
  11885.                         break;
  11886.  
  11887.         }
  11888.  
  11889. }
  11890.  
  11891.  
  11892.  
  11893. void shiftxmm(int rm)   //rxmm,i8
  11894.  
  11895. {
  11896.  
  11897. int num;
  11898.  
  11899.         nexttok();
  11900.  
  11901.         if(tok!=tk_xmmreg)xmmregexpected(1);
  11902.  
  11903.         num=itok.number;
  11904.  
  11905.         nextexpecting2(tk_camma);
  11906.  
  11907.         if(tok!=tk_number)numexpected(2);
  11908.  
  11909.         op(0x66);
  11910.  
  11911.         op(0x0F);
  11912.  
  11913.         op(0x73);
  11914.  
  11915.         op(rm*8+num+rm_mod11);
  11916.  
  11917.         op(doconstdwordmath());
  11918.  
  11919. }
  11920.  
  11921.  
  11922.  
  11923. void DDDW(int faradd)
  11924.  
  11925. {
  11926.  
  11927. int htok,i;
  11928.  
  11929. char name[IDLENGTH];
  11930.  
  11931. unsigned long hnumber;
  11932.  
  11933.         if(dbg&2)AddDataNullLine(faradd==0?2:4);
  11934.  
  11935.         dbgact++;
  11936.  
  11937.         asmparam=FALSE;
  11938.  
  11939.         do{
  11940.  
  11941.                 i=1;
  11942.  
  11943.                 nexttok();
  11944.  
  11945.                 CheckIP();
  11946.  
  11947.                 htok=tok;
  11948.  
  11949.                 switch(tok){
  11950.  
  11951.                         case tk_undefofs:
  11952.  
  11953.                                 tok=tk_number;
  11954.  
  11955.                                 strcpy(name,itok.name);
  11956.  
  11957.                         case tk_number:
  11958.  
  11959.                                 hnumber=doconstdwordmath();
  11960.  
  11961.                                 if(tok==tk_id&&strcmp((char *)string,"dup")==0){
  11962.  
  11963.                                         i=hnumber;
  11964.  
  11965.                                         nexttok();
  11966.  
  11967.                                         CheckMinusNum();
  11968.  
  11969.                                         htok=tok;
  11970.  
  11971.                                         if(tok==tk_undefofs){
  11972.  
  11973.                                                 tok=tk_number;
  11974.  
  11975.                                                 strcpy(name,itok.name);
  11976.  
  11977.                                         }
  11978.  
  11979.                                         if(tok==tk_number)hnumber=doconstdwordmath();
  11980.  
  11981.                                         else numexpected();
  11982.  
  11983.                                 }
  11984.  
  11985.                                 for(;i!=0;i--){
  11986.  
  11987.                                         if(postnumflag&f_reloc)AddReloc();
  11988.  
  11989.                                         if(htok==tk_undefofs)AddUndefOff(2,name);
  11990.  
  11991.                                         if(faradd)outdword(hnumber);
  11992.  
  11993.                                         else outword(hnumber);
  11994.  
  11995.                                 }
  11996.  
  11997.                                 break;
  11998.  
  11999.                         case tk_postnumber:
  12000.  
  12001.                                 setwordpost(&itok);
  12002.  
  12003.                                 if(faradd)outdword(itok.number);
  12004.  
  12005.                                 else outword(itok.number);
  12006.  
  12007.                                 nexttok();
  12008.  
  12009.                                 break;
  12010.  
  12011.                         default:
  12012.  
  12013.                                 numexpected();
  12014.  
  12015.                                 nexttok();
  12016.  
  12017.                                 break;
  12018.  
  12019.                 }
  12020.  
  12021.         }while(tok==tk_camma);
  12022.  
  12023.         dbgact--;
  12024.  
  12025. }
  12026.  
  12027.  
  12028.  
  12029. void AADM(int code)
  12030.  
  12031. {
  12032.  
  12033.         op(code);
  12034.  
  12035.         itok.number=10;
  12036.  
  12037.         if(tok2==tk_number)nexttok();
  12038.  
  12039.         op(itok.number);        //AAD
  12040.  
  12041.         ClearReg(AX);
  12042.  
  12043. }
  12044.  
  12045.  
  12046.  
  12047. int Push(ITOK *wtok)
  12048.  
  12049. {
  12050.  
  12051. int i;
  12052.  
  12053. int razr;
  12054.  
  12055. ITOK hstok;
  12056.  
  12057. unsigned long hnumber;
  12058.  
  12059. int possiblecpu=0;
  12060.  
  12061. int next=1;
  12062.  
  12063.         i=(am32+1)*2;
  12064.  
  12065.         razr=r16;
  12066.  
  12067.         switch(tok){
  12068.  
  12069.                 case tk_id:
  12070.  
  12071.                 case tk_ID:
  12072.  
  12073.                         if((stricmp("dword",(char *)string)==0)||(stricmp("long",(char *)string)==0))i=r32;
  12074.  
  12075.                         else if((stricmp("word",(char *)string)==0)||(stricmp("int",(char *)string)==0))i=r16;
  12076.  
  12077.                         else return FALSE;
  12078.  
  12079.                         goto swpushpar;
  12080.  
  12081.                 case tk_dword:
  12082.  
  12083.                 case tk_long:
  12084.  
  12085.                         i=r32;
  12086.  
  12087.                         goto swpushpar;
  12088.  
  12089.                 case tk_int:
  12090.  
  12091.                 case tk_word:
  12092.  
  12093.                         i=r16;
  12094.  
  12095. swpushpar:
  12096.  
  12097.                         nexttok();
  12098.  
  12099.                         CheckMinusNum();
  12100.  
  12101.                         if(tok==tk_number)goto pushnum;
  12102.  
  12103.                         if(tok==tk_undefofs)goto pushundef;
  12104.  
  12105.                         return FALSE;
  12106.  
  12107.                 case tk_reg32:
  12108.  
  12109.                         possiblecpu=3;
  12110.  
  12111.                 case tk_reg:
  12112.  
  12113.                         op66(tok==tk_reg?r16:r32);
  12114.  
  12115.                         op(0x50+(unsigned int)itok.number);
  12116.  
  12117.                         break;
  12118.  
  12119.                 case tk_seg:
  12120.  
  12121.                         PushSeg((unsigned int)itok.number);
  12122.  
  12123.                         break;
  12124.  
  12125.                 case tk_undefofs:
  12126.  
  12127. pushundef:
  12128.  
  12129.                         hstok=itok;
  12130.  
  12131.                         tok=tk_number;
  12132.  
  12133.                         hnumber=doconstlongmath();
  12134.  
  12135.                         op66(i);        ////
  12136.  
  12137.                         op(0x68);
  12138.  
  12139.                         if(postnumflag&f_reloc)AddReloc();
  12140.  
  12141.                         AddUndefOff(2,hstok.name);
  12142.  
  12143.                         if(i==r16)outword(hnumber);
  12144.  
  12145.                         else outdword(hnumber);
  12146.  
  12147.                         possiblecpu=(unsigned char)(i==r16?2:3);
  12148.  
  12149.                         next=0;
  12150.  
  12151.                         break;
  12152.  
  12153.                 case tk_minus:
  12154.  
  12155.                         if(tok2!=tk_number)return FALSE;
  12156.  
  12157.                 case tk_number:
  12158.  
  12159. pushnum:
  12160.  
  12161.                         hnumber=doconstlongmath();
  12162.  
  12163.                         if(i==r16)hnumber&=0xffff;
  12164.  
  12165.                         else hnumber&=0xffffffff;
  12166.  
  12167.                         if(wtok&&(postnumflag&f_reloc)==0)Const2Var(wtok,hnumber,i==r16?tk_word:tk_dword);
  12168.  
  12169.                         op66(i);
  12170.  
  12171.                         if((postnumflag&f_reloc)==0&&short_ok(hnumber,i/2-1)){
  12172.  
  12173.                                 op(0x6A);
  12174.  
  12175.                                 op(hnumber);
  12176.  
  12177.                         }
  12178.  
  12179.                         else{
  12180.  
  12181.                                 op(0x68);
  12182.  
  12183.                                 if((postnumflag&f_reloc)!=0)AddReloc();
  12184.  
  12185.                                 if(i==r16)outword(hnumber);
  12186.  
  12187.                                 else outdword(hnumber);
  12188.  
  12189.                         }
  12190.  
  12191.                         possiblecpu=(unsigned char)(i==r16?2:3);
  12192.  
  12193.                         next=0;
  12194.  
  12195.                         break;
  12196.  
  12197.                 case tk_dwordvar:
  12198.  
  12199.                 case tk_longvar:
  12200.  
  12201.                         CheckAllMassiv(bufrm,4,&strinf);
  12202.  
  12203.                         possiblecpu=3;
  12204.  
  12205.                         razr=r32;
  12206.  
  12207.                         goto push;
  12208.  
  12209.                 case tk_wordvar:
  12210.  
  12211.                 case tk_intvar:
  12212.  
  12213.                         CheckAllMassiv(bufrm,2,&strinf);
  12214.  
  12215. push:
  12216.  
  12217.                         op66(razr);
  12218.  
  12219.                         outseg(&itok,2);
  12220.  
  12221.                         op(0xFF);       op(0x30+itok.rm);
  12222.  
  12223.                         outaddress(&itok);
  12224.  
  12225.                         break;
  12226.  
  12227.                 case tk_postnumber:
  12228.  
  12229.                         op(0x68);
  12230.  
  12231.                         (itok.flag&f_extern)==0?setwordpost(&itok):setwordext(&itok.number);
  12232.  
  12233.                         if(am32==FALSE)outword((unsigned int)itok.number);
  12234.  
  12235.                         else outdword(itok.number);
  12236.  
  12237.                         break;
  12238.  
  12239.                 case tk_string:
  12240.  
  12241.                         op66(i);
  12242.  
  12243.                         op(0x68);
  12244.  
  12245.                         if(am32==FALSE)outword(addpoststring());
  12246.  
  12247.                         else outdword(addpoststring());
  12248.  
  12249.                         break;
  12250.  
  12251.                 default:
  12252.  
  12253.                         return FALSE;
  12254.  
  12255.         }
  12256.  
  12257.         if(cpu<possiblecpu)cpu=possiblecpu;
  12258.  
  12259.         asmparam=FALSE;
  12260.  
  12261.         if(next)nexttok();
  12262.  
  12263.         return i;
  12264.  
  12265. }
  12266.  
  12267. /* end of TOKR.C */
  12268.  
  12269.  
  12270.  
  12271.