Documentos de Académico
Documentos de Profesional
Documentos de Cultura
EJERCICIO9
EJERCICIO10 EJERCICIO11 EJERCICIO12
EJERCICIO13
EJERCICIO14 EJERCICIO15
SEGUNDO DE ASIR
Pgina 1
SEGUNDO DE ASIR
Pgina 2
Una vez descargado procedemos a la instalacin seleccionando la ruta (letra de la unidad donde se instalar)
Se crear un icono en el escritorio el cual tendremos que ejecutar para iniciar el programa
SEGUNDO DE ASIR
Pgina 3
Funciona como un sencillo editor de texto y en la imagen que vemos ms abajo, vemos nuestro cdigo y remarcado en rojo donde pulsaremos para guardar el archivo
El archivo, lo tenemos que guardar con el nombre que queramos, pero hay que tener en cuenta que la extensin tiene que ser ASM como vemos en la imagen
SEGUNDO DE ASIR
Pgina 4
Y nos saldr la siguiente ventana donde se ve que dicho proceso se esta llevando a cabo
Una vez llevado a cabo pulsando la opcin Run program, ejecutaremos el programa que acabamos de compilar
Y veremos el resultado
SEGUNDO DE ASIR
Pgina 5
SEGUNDO DE ASIR
Pgina 6
SEGUNDO DE ASIR
Pgina 7
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM .IF uMsg==WM_DESTROY invoke PostQuitMessage,NULL .ELSE invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .ENDIF xor eax,eax ret WndProc endp end start
SEGUNDO DE ASIR
Pgina 8
SEGUNDO DE ASIR
Pgina 9
SEGUNDO DE ASIR
Pgina 10
SEGUNDO DE ASIR
Pgina 11
SEGUNDO DE ASIR
Pgina 12
SEGUNDO DE ASIR
Pgina 13
SEGUNDO DE ASIR
Pgina 14
SEGUNDO DE ASIR
Pgina 15
SEGUNDO DE ASIR
Pgina 16
SEGUNDO DE ASIR
Pgina 17
.386 .model flat,stdcall option casemap:none WinMain proto :DWORD,:DWORD,:DWORD,:DWORD include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc include \masm32\include\gdi32.inc includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\gdi32.lib .data ClassName db "SimpleWinClass",0 AppName db "Este es mi mensaje, se muestra donde has clickeado",0 MouseClick db 0 ; 0=no click yet .data? hInstance HINSTANCE ? CommandLine LPSTR ? hitpoint POINT <> .code start: invoke GetModuleHandle, NULL mov hInstance,eax invoke GetCommandLine invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
SEGUNDO DE ASIR
Pgina 18
SEGUNDO DE ASIR
Pgina 19
SEGUNDO DE ASIR
Pgina 20
SEGUNDO DE ASIR
Pgina 21
SEGUNDO DE ASIR
Pgina 22
SEGUNDO DE ASIR
Pgina 23
SEGUNDO DE ASIR
Pgina 24
SEGUNDO DE ASIR
Pgina 25
SEGUNDO DE ASIR
Pgina 26
SEGUNDO DE ASIR
Pgina 27
SEGUNDO DE ASIR
Pgina 28
SEGUNDO DE ASIR
Pgina 29
SEGUNDO DE ASIR
Pgina 30
SEGUNDO DE ASIR
Pgina 31
SEGUNDO DE ASIR
Pgina 32
#define IDC_EDIT #define IDC_BUTTON #define IDC_EXIT #define IDM_GETTEXT #define IDM_CLEAR #define IDM_EXIT
DIALOG MyDialog DIALOG 10, 10, 205, 60 STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK CAPTION "Our First Dialog Box" CLASS "DLGCLASS" BEGIN EDITTEXT IDC_EDIT, 15,17,111,13, ES_AUTOHSCROLL | ES_LEFT |WS_TABSTOP DEFPUSHBUTTON "Say Hello", IDC_BUTTON, 141,10,52,13 PUSHBUTTON "E&xit", IDC_EXIT, 141,26,52,13 END
MyMenu MENU BEGIN POPUP "Test Controls" BEGIN MENUITEM "Get Text", IDM_GETTEXT MENUITEM "Clear Text", IDM_CLEAR MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/ MENUITEM "E&xit", IDM_EXIT END END MAKEFILE NAME=dialog $(NAME).exe: $(NAME).obj $(NAME).res Link /SUBSYSTEM:WINDOWS /VERSION:4.0 /LIBPATH:c:\masm32\lib $(NAME).obj $(NAME).res $(NAME).res: $(NAME).rc rc $(NAME).rc $(NAME).obj: $(NAME).asm ml /c /coff /Cp $(NAME).asm EJECUCION DEL PROGRAMA Y CARACTERSTICAS
SEGUNDO DE ASIR
Pgina 33
SEGUNDO DE ASIR
Pgina 34
SEGUNDO DE ASIR
Pgina 35
SEGUNDO DE ASIR
Pgina 36
DlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM .if iMsg==WM_INITDIALOG invoke GetDlgItem,hWnd,IDC_EDIT invoke SetFocus,eax .elseif iMsg==WM_CLOSE invoke EndDialog,hWnd,NULL mov hwndDlg,0 .elseif iMsg==WM_COMMAND mov eax,wParam mov edx,eax shr edx,16 .if dx==BN_CLICKED .if eax==IDC_EXIT invoke SendMessage,hWnd,WM_CLOSE,NULL,NULL .elseif eax==IDC_BUTTON invoke SetDlgItemText,hWnd,IDC_EDIT,ADDR TestString .endif .endif .else mov eax,FALSE ret .endif mov eax,TRUE ret DlgProc endp end start
DIALOG.RC // constants for dialog box #define IDC_EDIT 3000 #define IDC_BUTTON 3001 #define IDC_EXIT 3002 #define DS_CENTER 0x0800L #define DS_CENTER 0x0800L #define WS_MINIMIZEBOX 0x00020000L #define WS_SYSMENU 0x00080000L #define WS_VISIBLE 0x10000000L #define WS_OVERLAPPED 0x00000000L #define DS_MODALFRAME 0x80L #define DS_3DLOOK 0x0004L
SEGUNDO DE ASIR
Pgina 37
MyDialog DIALOG 10, 10, 205, 60 STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK CAPTION "Our Second Dialog Box" BEGIN EDITTEXT IDC_EDIT, 15,17,111,13, ES_AUTOHSCROLL | ES_LEFT DEFPUSHBUTTON "Say Hello", IDC_BUTTON, 141,10,52,13 PUSHBUTTON "E&xit", IDC_EXIT, 141,26,52,13 END MAKEFILE NAME=dialog $(NAME).exe: $(NAME).obj $(NAME).res Link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib $(NAME).obj $(NAME).res $(NAME).res: $(NAME).rc rc $(NAME).rc $(NAME).obj: $(NAME).asm ml /c /coff /Cp $(NAME).asm EJECUCION DEL PROGRAMA Y CARACTERSTICAS
SEGUNDO DE ASIR
Pgina 38
SEGUNDO DE ASIR
Pgina 39
SEGUNDO DE ASIR
Pgina 40
SEGUNDO DE ASIR
Pgina 41
SEGUNDO DE ASIR
Pgina 42
SEGUNDO DE ASIR
Pgina 43
2.
3.
.386 .model flat,stdcall option casemap:none WinMain proto :DWORD,:DWORD,:DWORD,:DWORD include \masm32\include\windows.inc include \masm32\include\user32.inc
SEGUNDO DE ASIR
Pgina 44
SEGUNDO DE ASIR
Pgina 45
SEGUNDO DE ASIR
Pgina 46
SEGUNDO DE ASIR
Pgina 47
SEGUNDO DE ASIR
Pgina 48
SEGUNDO DE ASIR
Pgina 49
.386 .model flat,stdcall option casemap:none WinMain proto :DWORD,:DWORD,:DWORD,:DWORD include \masm32\include\windows.inc
SEGUNDO DE ASIR
Pgina 50
SEGUNDO DE ASIR
Pgina 51
SEGUNDO DE ASIR
Pgina 52
SEGUNDO DE ASIR
Pgina 53
// Constants for menu #define IDM_OPEN 1 #define IDM_SAVE 2 #define IDM_EXIT 3 FirstMenu MENU { POPUP "&File" { MENUITEM "&Open",IDM_OPEN MENUITEM "&Save As",IDM_SAVE, GRAYED MENUITEM SEPARATOR MENUITEM "E&xit",IDM_EXIT } } MAKEFILE NAME=filemap $(NAME).exe: $(NAME).obj $(NAME).res Link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib $(NAME).obj $(NAME).res $(NAME).res: $(NAME).rc rc $(NAME).rc $(NAME).obj: $(NAME).asm ml /c /coff /Cp $(NAME).asm
SEGUNDO DE ASIR
Pgina 54
SEGUNDO DE ASIR
Pgina 55
SEGUNDO DE ASIR
Pgina 56
SEGUNDO DE ASIR
Pgina 57
SEGUNDO DE ASIR
Pgina 58
SEGUNDO DE ASIR
Pgina 59
.386 .model flat,stdcall option casemap:none WinMain proto :DWORd,:DWORD,:DWORD,:DWORD include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib .const IDM_CREATE_THREAD equ 1 IDM_EXIT equ 2 WM_FINISH equ WM_USER+100h .data ClassName db "Win32ASMThreadClass",0
SEGUNDO DE ASIR
Pgina 60
SEGUNDO DE ASIR
Pgina 61
ThreadProc PROC USES ecx Param:DWORD mov ecx,300000000 Loop1: add eax,eax dec ecx jz Get_out jmp Loop1 Get_out: invoke SendMessage,hwnd,WM_FINISH,NULL,NULL ret ThreadProc ENDP end start
THREAD.RC
SEGUNDO DE ASIR
Pgina 62
THREAD.EXE
SEGUNDO DE ASIR
Pgina 63
SEGUNDO DE ASIR
Pgina 64
SEGUNDO DE ASIR
Pgina 65
SEGUNDO DE ASIR
Pgina 66
SEGUNDO DE ASIR
Pgina 67