[fpc-devel] Re: GNU assembler programming
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Thu Apr 12 21:12:49 CEST 2007
Ok, maybe I´m too happy for making a asm app and writing my own idata
section, but here is another example =)
It shows a message box and then quit.
/* 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
MOV $0, %EAX
PUSH %EAX
CALL ExitProcess
LEAVE
RET
NOP
NOP
.section .text
.balign 4
.section .idata$2
.rva .L18
.long 0
.long 0
.rva .L17
.rva .L19
.section .idata$4
.L18:
.rva .L20
.long 0
.section .idata$5
.L19:
.section .text
.globl ExitProcess
ExitProcess:
jmp *.L21
.balign 4,144
.section .idata$5
.L21:
.rva .L20
.long 0
.section .idata$6
.L20:
.short 0
.ascii "ExitProcess\000"
.balign 2,0
.section .idata$7
.L17:
.ascii "kernel32.dll\000"
.section .text
.balign 4
.section .idata$2
.rva .L23
.long 0
.long 0
.rva .L22
.rva .L24
.section .idata$4
.L23:
.rva .L25
.long 0
.section .idata$5
.L24:
.section .text
.globl MessageBoxA
MessageBoxA:
jmp *.L26
.balign 4,144
.section .idata$5
.L26:
.rva .L25
.long 0
.section .idata$6
.L25:
.short 0
.ascii "MessageBoxA\000"
.balign 2,0
.section .idata$7
.L22:
.ascii "user32.dll\000"
More information about the fpc-devel
mailing list