; 注释; 指定CPU型号.386; FLAT - 使用平台内存模式; STDCALL - 默认函数调用约定.model FLAT ,STDCALL; 指定大小敏感option casemap:noneinclude msvcrt.incincludelib msvcrt.libinclude user32.incincludelib user32.lib.data pszStr db 'hello world', 0dh, 0ah , 0 pszPause db "pause" , 0 pszS db "%s" , 0 pszYes db "Yes",0 pszNo db "No",0 ; 定义了一个100字节是数组, 使用0来填充 g_buff db 100 dup(0); 汇编语句必须写在代码段中; .code 用于定义代码段.code ; 指定程序入口; entry: 表示定义一个标签,entry是标签的名字entry: push offset pszStr call crt_printf add esp , 4 push offset pszPause call crt_system add esp,4 ; scanf("%s" , g_buff) push offset g_buff push offset pszS call crt_scanf add esp , 8 ; 判断输入的字符个数是否小于8 ; 1. 得到字符串的长度 ; int n = strlen(g_buff) push offset g_buff call crt_strlen add esp, 4 ; 一般情况, 函数的返回值保存在eax中. ; if ( eax < 8) MessageBox(0,"Yes",0,0) cmp eax , 8 jb _BLOW ; 如果没有跳, 就说明是大于的 push 0 push 0 push offset pszYes push 0 call MessageBox jmp _ENDIF ; else MessageBox(0,"No",0,0)_BLOW: push 0 push 0 push offset pszNo push 0 call MessageBox_ENDIF: ret; 指定程序入口: end + 标签的名字end entry