flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > Asm .obj into Devpas(FreePascal) |
Author |
|
vid 08 Jan 2008, 23:58
"extrn" is for "importing" external symbol to your module. If you want to "export" symbol from module for other module to use, there is directive "public"
|
|||
08 Jan 2008, 23:58 |
|
sittingduck 09 Jan 2008, 13:27
format ms coff
section '.code' code readable executable ; export symbols public mymain as '_mymain' public var1 as '_var1' mymain: mov edx,var1 add edx,100 ret section '.data' data readable writeable var1 dd 0,0,0,0 Assembles to objectfile.OBJ no errors. But this: program MyProgram; uses crt; {$ASMMODE INTEL} {$APPTYPE GUI} {$MODE FPC} {$MMX ON} {$Q-} {$R-} {$S-} {$D-} {$L objectfile.OBJ} var var1,_var1: LongInt; begin var1:=20; _var1:=67; mymain; _mymain; WriteLN(var1,'...',_var1); readln; end. why.pas(20,3) Error: Identifier not found MYMAIN why.pas(20,9) Error: Illegal expression why.pas(21,2) Error: Identifier not found _MYMAIN why.pas(21,9) Error: Illegal expression why.pas(26) Fatal: There were 4 errors compiling module, stopping |
|||
09 Jan 2008, 13:27 |
|
OzzY 11 Jan 2008, 04:09
I never tried to link external .obj with free pascal.
But fpc's inline asm is easy: Code: program project1; {$APPTYPE CONSOLE} {$ASMMODE INTEL} function addnum(x, y : integer) : integer; var res : integer; begin asm pusha mov eax,x mov ebx,y add eax,ebx mov res,eax popa end; addnum:=res; end; begin writeln('The sum is ',addnum(2,3)); end. I hope it helps. It just reminds me how wonderful language pascal is. I'll start using it more. |
|||
11 Jan 2008, 04:09 |
|
sittingduck 11 Jan 2008, 21:15
OzzY wrote: I never tried to link external .obj with free pascal. That works like a charm. But why are the color of asm code same as the background in DevPas? |
|||
11 Jan 2008, 21:15 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.