Next: , Previous: DJGPP DPMI server, Up: GPC on DJGPP



3.3.7 I have troubles with assembly code

The GNU Assembler (as.exe), or gas, called by GCC accepts “AT&T” syntax which is different from “Intel” syntax. Differences are discussed in section 17.1 of the DJGPP FAQ.

A guide is available which was written by Brennan Mr. Wacko Underwood brennan@mack.rt66.com and describes how to use inline assembly programming with DJGPP, at this URL: http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html

There's also a GPC assembler tutorial at
http://www.gnu-pascal.de/contrib/misc/gpcasm.zip

Section 17.3 of the DJGPP FAQ discusses some methods to convert “Intel” syntax to “AT&T” syntax.

However, please note that assembler code is unportable, i.e. it will work on IA32 (“x86”) and compatible processors if written for them, but will not even compile for other processors. So by writing assembler code in your programs, you will limit their usefulness substantially.

If you think you “need” assembler code for speed – and you've checked that your assembler code actually runs faster than Pascal code compiled with suitable optimizations – you might want to put both Pascal and assembler versions of the critical sections in your program, and let, e.g., an {$ifdef i386} decide which one to use. This way, your program will at least compile on all processors.