Simple PoASM example for newbies to get started

Started by Freddy, February 13, 2008, 09:50:19 PM

Previous topic - Next topic

Freddy

; POASM Example
; Written by Freddy
; Assemble with PoASM. Written in Pelles C IDE.

; EQUATES - Get them by right clicking the names at Pelles C editor and clicking at "Go to definition of", then translate to ASM. ;D
; No need for include files with a great IDE like Pelles C.
MB_OK EQU 0h
MB_YESNO EQU 4h
IDYES EQU 6h
MessageBox EQU MessageBoxA
;
.386
.model flat, stdcall
;
; Prototypes - See MSDN for more info. The nice thing is that most are DWORD args.
MessageBoxA proto :DWORD, :DWORD, :DWORD, :DWORD
ExitProcess proto : DWORD

; Data section
.data
strttl db 'Testing', 0
strmsg db 'Do you like PoASM?', 0
stryes db 'Yes, PoASM is cool!', 0

;Code section
.code
; Entry point
main:
invoke MessageBox,0, OFFSET strmsg, OFFSET strttl, MB_YESNO  ; Testing invoke macro to call MessageBox API
.If EAX == IDYES ; Testing .If macro :)
invoke MessageBox, 0, OFFSET stryes, OFFSET strttl, MB_OK
.EndIf ; Works great!
invoke ExitProcess,0 ; Exit the program
end main
; EOF


Enjoy! This example shows that it's easy to create stand-alone programs with PoASM too.

Grincheux


Pelle

No default wizard for asm projects, just create an empty project (of the appropriate type) and add one or more asm files...

(The project wizard API can be used to make custom wizards for asm projects too - this has been done in the past...)
/Pelle

Vortex

Quote from: Grincheux on October 27, 2008, 02:48:45 PM
How to create a project for an asm program ?

Attached is a simple asm project created with Pelles IDE.
Code it... That's all...