[fpc-devel] Re: GNU assembler programming

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu Apr 12 21:16:48 CEST 2007


Hi,

Today is a great day of the symbian port =) I also solved my other
problem. I learned how to use the .a files. They should be added on
the ld command line together with the other .o files, and not as lib
files.

So, here is the same program using the .a archives from DevC++:

Compile script:

C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\as hello.s -o hello.o
C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\ld.exe --entry=_E32EXE
-o hello.exe hello.o C:\Programas\Dev-Cpp\lib\libkernel32.a
C:\Programas\Dev-Cpp\lib\libuser32.a

Code:

/* Hello world to create a symbian os executable on assembler */

	.file   "hello.s"
    	.text
	/* Variables */
mymessage:
	.ascii	"My Message\000"

     	/* Entry point for Symbian OS executables */
     	.globl _E32EXE
_E32EXE:
     	/* Entry point for MS Windows */
     	.globl main
main:
     	/* Entry point for GCC */
     	.globl WinMain at 16
WinMain at 16:
     	MOV   $0, %EAX
	PUSH	%EAX
	MOV	$mymessage, %EAX
	PUSH  %EAX
     	MOV   $0, %EAX
	PUSH	%EAX
	PUSH  %EAX
	CALL 	_MessageBoxA at 16
     	MOV   $0, %EAX
	PUSH  %EAX
	CALL 	_ExitProcess at 4
	LEAVE
     	RET
     	NOP
     	NOP



More information about the fpc-devel mailing list