| ||
Now, it is time to describe the inline assembler. This is a powerful tool. You should only bear in mind that contemporary inline assemblers often provide limited capabilities in relation to support of new microprocessor commands. This is natural, because the development of a new version of developer tools, such as C++ Builder, requires considerably more time than the development of TASM. In the examples provided in Listings 20.9 and 20.10, coprocessor commands are used.
program Project2; {$APPTYPE CONSOLE} uses SysUtils; var d:double; function soproc(f:double): double; var res:double; begin asm FLD f FSIN FSTP res end; soproc:=res ; end; begin d:=-pi; while (d<=pi) do begin writeln(d:10:2, '-', soproc(d):10:2); d:=d+0.1; end; end.
#include <windows.h> #include <stdio.h> double soproc(double f); void main() { double w = -3.14; while(w<=3.14) { printf("%f- %f\n", w, soproc(w)); w = w + 0.1; } ExitProcess (0); } double soproc (double f) { double d; asm { FLD f FSIN FSTP d } return d; }
| ||