Turbo Assembler Version 5.0 06-07-02 15:52:12 Page 1 primo.ASM 1 2 ;--------------------------------------------------------; 3 ; File primo.asm ; 4 ; Il primo programma Assembly per Win32 (versione TASM). ; 5 ; Mostra un messaggio attraverso la finestra predefinita ; 6 ; MessageBox. ; 7 ;--------------------------------------------------------; 8 9 ; ################# direttive per l'assembler ################# 10 11 .386 ; set di istruzioni a 32 bit 12 00000000 .MODEL FLAT, STDCALL ; memory model & calling conventions 13 OPTION CASEMAP: NONE ; case sensitive on symbols 14 15 ; ############### dichiarazione tipi e costanti ############### 16 17 =0000 NULL = 00000000h ; valore nullo 18 =0000 MB_OK = 00000000h ; codice bottone 'OK' 19 =0040 MB_ICONINFORMATION = 00000040h ; codice icona 'ICONINFORMATION' 20 21 ; ################# prototipi delle procedure ################# 22 23 MessageBoxA PROTO :DWORD, :DWORD, :DWORD, :DWORD 24 ExitProcess PROTO :DWORD 25 26 ; #################### inclusione librerie #################### 27 28 INCLUDELIB ..\lib\import32.lib ; libreria generale 29 30 ; ################ segmento dati inizializzati ################# 31 32 00000000 _DATA SEGMENT DWORD PUBLIC USE32 'DATA' 33 34 00000000 57 69 6E 33 32 20 41+ strTitolo db 'Win32 Assembly', 0 35 73 73 65 6D 62 6C 79+ 36 00 37 0000000F 49 6C 20 70 72 69 6D+ strMessaggio db 'Il primo programma Assembly per Win32', 0 38 6F 20 70 72 6F 67 72+ 39 61 6D 6D 61 20 41 73+ 40 73 65 6D 62 6C 79 20+ 41 70 65 72 20 57 69 6E+ 42 33 32 00 43 44 00000035 _DATA ENDS 45 46 ; ##################### segmento di codice ##################### 47 48 00000000 _TEXT SEGMENT DWORD PUBLIC USE32 'CODE' 49 50 00000000 start: ; entry point del programma 51 52 call MessageBoxA, NULL, offset strMessaggio, offset strTitolo, MB_OK OR + 53 MB_ICONINFORMATION 1 54 00000000 6A 40 PUSH MB_OK OR MB_ICONINFORMATION 1 55 00000002 68 00000000r PUSH offset strTitolo 1 56 00000007 68 0000000Fr PUSH offset strMessaggio 1 57 0000000C 6A 00 PUSH NULL 1 58 0000000E E8 00000000e CALL MessageBoxA 59 60 call ExitProcess, 0 ; termina con exit code = 0 1 61 00000013 6A 00 PUSH 0 1 62 00000015 E8 00000000e CALL ExitProcess 63 64 0000001A _TEXT ENDS 65 66 ; ############################################################## 67 68 END start ; fine del modulo Symbol Table Symbol Name Type Value ??date Text "06-07-02" ??filename Text "primo " ??time Text "15:52:12" ??version Number 0500 @32Bit Text 1 @CodeSize Text 0 @Cpu Text 0F0FH @DataSize Text 0 @FileName Text primo @Interface Text 003h @Model Text 1 @Type_ExitProcess Proctyp @Type_MessageBoxA Proctyp @WordSize Text 4 @code Text FLAT @curseg Text _TEXT @data Text FLAT @stack Text FLAT ExitProcess Struct ----:---- Extern @Type_ExitProcess MB_ICONINFORMATION Number 0040 MB_OK Number 0000 MessageBoxA Struct ----:---- Extern @Type_MessageBoxA NULL Number 0000 start Near32 FLAT:0000 strMessaggio Byte FLAT:000F strTitolo Byte FLAT:0000 Groups & Segments Bit Size Align Combine Class DGROUP Group _DATA 32 0035 Dword Public DATA FLAT Group _TEXT 32 001A Dword Public CODE