void emit_1_or_2_operandsl_vartext (char *str0, char *str1) { int j; if (tokennum == 2) { printf (" %s ", str0); emitanoperand (1, "ds:dword ptr", 1); } else if (tokennum == 3) { if (!_stricmp (tokens[2], "%st(0)")) printf (" %s ", str0); else printf (" %s ", str1); emitanoperand (2, "ds:dword ptr", 1); printf (","); emitanoperand (1, "ds:dword ptr", 1); } else { fprintf (stderr, "Error: too many operands\n"); for (j=0 ; j<tokennum ; j++) fprintf (stderr, "%s\n", tokens[j]); fprintf (stderr, "\n"); errorexit (); } }
void emit_1_or_2_operandsl (void) { int j; if (tokennum == 2) { printf (" "); emitanoperand (1, "ds:dword ptr", 1); } else if (tokennum == 3) { printf (" "); emitanoperand (2, "ds:dword ptr", 1); printf (","); emitanoperand (1, "ds:dword ptr", 1); } else { fprintf (stderr, "Error: too many operands\n"); for (j=0 ; j<tokennum ; j++) fprintf (stderr, "%s\n", tokens[j]); fprintf (stderr, "\n"); errorexit (); } }
void emittwooperandsb (void) { printf (" "); emitanoperand (2, "ds:byte ptr", 1); printf (","); emitanoperand (1, "ds:byte ptr", 1); }
void emittwooperandsw (void) { printf (" "); emitanoperand (2, "ds:word ptr", 1); printf (","); emitanoperand (1, "ds:word ptr", 1); }
void emitonejumpdata (void) { int i, isaddr, len; // 2000-07-30 Indirect jmp fix by QuakeForge start /* if (tokens[1][0] == '*') { printf (" dword ptr [%s]", &tokens[1][1]); } else { */ // 2000-07-30 Indirect jmp fix by QuakeForge end isaddr = 0; len = strlen(tokens[1]); for (i=0 ; i<len ; i++) { if (tokens[1][i] == '(') { isaddr = 1; break; } } // 2000-07-30 Indirect jmp fix by QuakeForge start if (tokens[1][0] == '*') { memmove(&tokens[1][0],&tokens[1][1],strlen(tokens[1])); if (!isaddr) { printf (" dword ptr ["); emitanoperand (1, "", 1); printf ("]"); } else { emitanoperand (1, " dword ptr", 1); } } else { // 2000-07-30 Indirect jmp fix by QuakeForge end if (!isaddr) { printf (" %s", tokens[1]); } else { emitanoperand (1, " dword ptr", 1); } } }
void emit_multiple_data (void) { int i; printf (" "); for (i=1 ; i<(tokennum-1) ; i++) { emitanoperand (i, "", 0); printf (", "); } emitanoperand (i, "", 0); }
void emitonecalldata (void) { int i, isaddr, len; if (tokens[1][0] == '*') { printf (" dword ptr[%s]", &tokens[1][1]); } else { isaddr = 0; len = strlen(tokens[1]); for (i=0 ; i<len ; i++) { if (tokens[1][i] == '(') { isaddr = 1; break; } } if (!isaddr) { printf (" near ptr %s", tokens[1]); } else { emitanoperand (1, " dword ptr", 1); } } }
void emitoneoperandw(void) { printf(" "); emitanoperand(1, "ds:word ptr", 1); }
void emitoneoperandb(void) { printf(" "); emitanoperand(1, "ds:byte ptr", 1); }
void emit_0_or_1_operandsl (void) { if (tokennum == 2) { printf (" "); emitanoperand (1, "ds:dword ptr", 1); } }
void emitonejumpdata (void) { /*jmp *Ljmptab(,%eax,4) jmp dword ptr[Ljmptab(,%eax,4)] jmp dword ptr[Ljmptab+eax*4] */ int i, isaddr, len; isaddr = 0; len = strlen(tokens[1]); if (tokens[1][0] == '*') { for (i=0 ; i<len ; i++) { if (tokens[1][i] == '(') { isaddr = 1; break; } } memmove(&tokens[1][0],&tokens[1][1],strlen(tokens[1])); if ( !isaddr ) { //printf (" dword ptr [%s]", &tokens[1][1]); printf (" dword ptr ["); emitanoperand (1, "", 1); printf ("]"); } else { emitanoperand (1, " dword ptr", 1); } } else { for (i=0 ; i<len ; i++) { if (tokens[1][i] == '(') { isaddr = 1; break; } } if (!isaddr) { printf (" %s", tokens[1]); } else { emitanoperand (1, " dword ptr", 1); } } }