NO

Author Topic: Simple PoASM example for newbies to get started  (Read 6808 times)

Freddy

  • Guest
Simple PoASM example for newbies to get started
« on: February 13, 2008, 09:50:19 pm »
Code: [Select]
; 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

  • Guest
Re: Simple PoASM example for newbies to get started
« Reply #1 on: October 27, 2008, 02:48:45 pm »
How to create a project for an asm program ?

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2084
    • http://www.smorgasbordet.com
Re: Simple PoASM example for newbies to get started
« Reply #2 on: October 30, 2008, 04:31:17 pm »
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

Offline Vortex

  • Member
  • *
  • Posts: 531
    • http://www.vortex.masmcode.com
Re: Simple PoASM example for newbies to get started
« Reply #3 on: November 28, 2008, 05:07:38 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...