Hi, On Sun, Jul 31, 2016 at 9:07 AM, Joe Forster/STA <s...@c64.rulez.org> wrote: > >> Furthermore, any inline assembler, beside being 32bit, is by default in >> AT&T syntax and not the Intel like syntax used in the Borland compilers... > > I put online a well-commented sed script that _partially_ converts inline > assembler blocks in Turbo Pascal source from Intel syntax to AT&T. > I used it for porting my assembler-optimized libraries into Free Pascal > DOS32-compatible format.
(DOS32, aka Go32v2, aka DPMI, is much harder to use. Address translation, transfer buffer, etc.) Free Pascal already supports {$asmmode intel} (which is default for {$mode tp} anyways). " 1.2.3 $ASMMODE : Assembler mode (Intel 80x86 only) The default assembler reader is the AT&T reader [and default dialect/mode is "fpc", but you can change that manually or put it in fpc.cfg]. " However, there are still various caveats / incompatibilities, so read this: "Porting Turbo Pascal to Free Pascal" http://www.freepascal.org/port.var ... Here's a very sloppy example (try putting "//" before {$mode tp} to cause errors): ==================================== {$mode tp} program d2x; var n:byte; err:integer; procedure hexbyte(b: byte); assembler; asm mov al,b push ax mov cl,4 shr al,cl cmp al,10 sbb al,105 das int 29h pop ax and al,15 cmp al,10 sbb al,105 das int 29h end; begin if paramcount=0 then halt; val(paramstr(1),n,err); hexbyte(n); writeln('=',hexstr(n,2)) end. ==================================== ------------------------------------------------------------------------------ _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel