;--------------------------------------------------------;
; File primo.asm                                         ;
; Il primo programma Assembly per Win32 (versione MASM). ; 
; Mostra un messaggio attraverso la finestra predefinita ;
; MessageBox.                                            ;
;--------------------------------------------------------;

; ################# direttive per l'assembler #################

.386                                ; set di istruzioni a 32 bit
.MODEL      FLAT, STDCALL           ; memory model & calling conventions
OPTION      CASEMAP: NONE           ; case sensitive on symbols

; ############### dichiarazione tipi e costanti ###############

NULL               = 00000000h      ; valore nullo
MB_OK              = 00000000h      ; codice bottone 'OK'
MB_ICONINFORMATION = 00000040h      ; codice icona 'ICONINFORMATION'

; ################# prototipi delle procedure #################

MessageBoxA    PROTO :DWORD, :DWORD, :DWORD, :DWORD
ExitProcess    PROTO :DWORD

; #################### inclusione librerie ####################

INCLUDELIB  ..\lib\user32.lib       ; libreria servizi GUI
INCLUDELIB  ..\lib\kernel32.lib     ; libreria servizi kernel

; ################ segmento dati inizializzati #################

_DATA       SEGMENT  DWORD PUBLIC USE32 'DATA'

strTitolo      db    'Win32 Assembly', 0
strMessaggio   db    'Il primo programma Assembly per Win32', 0

_DATA       ENDS

; ##################### segmento di codice #####################

_TEXT       SEGMENT DWORD PUBLIC USE32 'CODE'

start:                              ; entry point del programma

   invoke   MessageBoxA, NULL, offset strMessaggio, offset strTitolo, MB_OK OR MB_ICONINFORMATION

   invoke   ExitProcess, 0          ; termina con exit code = 0

_TEXT       ENDS

; ##############################################################

   END      start                   ; fine del modulo