随便解释下吧,仅供参考,有解释错误之地请多多原谅!
TITLE D:\资料\cyy\123.c
.386P //指令集
include listing.inc //包含一些宏
if @Version gt 510 //如果编译器版本大于 510
.model FLAT
else
//下面是段信息,用于链接时段的排序,合并,对齐方式,等等
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE' // 代码段 合并到->CODE
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA' // 数据段 合并到->DATA
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST' // 只读数据段
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS' // 未初始化段
_BSS ENDS
$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM' // 我也不知道,哈
$$SYMBOLS ENDS
$$TYPES SEGMENT BYTE USE32 'DEBTYP'
$$TYPES ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS' //TLS 数据段
_TLS ENDS
; COMDAT ??_C@_0BK@HKOA@please?5input?5two?5numbers?3?$AA@
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
; COMDAT ??_C@_04FBFD@?$CFd?$CFd?$AA@
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
; COMDAT ??_C@_03HMFC@?$CFd?6?$AA@
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
; COMDAT _main
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
// 申明全局数据/函数
PUBLIC _main
PUBLIC ??_C@_0BK@HKOA@please?5input?5two?5numbers?3?$AA@ ; `string'
PUBLIC ??_C@_04FBFD@?$CFd?$CFd?$AA@ ; `string'
PUBLIC ??_C@_03HMFC@?$CFd?6?$AA@ ; `string'
// 申明外部数据/函数
EXTRN _printf:NEAR
EXTRN _scanf:NEAR
EXTRN __chkesp:NEAR
// 下面的用于调试信息
; COMDAT ??_C@_0BK@HKOA@please?5input?5two?5numbers?3?$AA@
; File D:\资料\cyy\123.c
CONST SEGMENT
??_C@_0BK@HKOA@please?5input?5two?5numbers?3?$AA@ DB 'please input two nu'
DB 'mbers:', 00H ; `string' //字符串常量/因为在 CONST段中,不可写
CONST ENDS
; COMDAT ??_C@_04FBFD@?$CFd?$CFd?$AA@
CONST SEGMENT
??_C@_04FBFD@?$CFd?$CFd?$AA@ DB '%d%d', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_03HMFC@?$CFd?6?$AA@
CONST SEGMENT
??_C@_03HMFC@?$CFd?6?$AA@ DB '%d', 0aH, 00H ; `string'
CONST ENDS
; COMDAT _main
// 代码段
_TEXT SEGMENT
_i$ = -4 // 局部变量 i
_j$ = -8 // 局部变量 j
_k$ = -12 // 局部变量 k
// main 函数体 ,中间就不多说了
_main PROC NEAR ; COMDAT
; 3 : {
push ebp
mov ebp, esp
sub esp, 76 ; 0000004cH
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-76]
mov ecx, 19 ; 00000013H
mov eax, -858993460 ; ccccccccH
rep stosd
; 4 : int i,j,k;
; 5 : printf("please input two numbers:");
push OFFSET FLAT:??_C@_0BK@HKOA@please?5input?5two?5numbers?3?$AA@ ; `string'
call _printf
add esp, 4
; 6 : scanf("%d%d",&i,&j);
lea eax, DWORD PTR _j$[ebp]
push eax
lea ecx, DWORD PTR _i$[ebp]
push ecx
push OFFSET FLAT:??_C@_04FBFD@?$CFd?$CFd?$AA@ ; `string'
call _scanf
add esp, 12 ; 0000000cH
; 7 : k=i+j;
mov edx, DWORD PTR _i$[ebp]
add edx, DWORD PTR _j$[ebp]
mov DWORD PTR _k$[ebp], edx
; 8 : printf("%d\n",k);
mov eax, DWORD PTR _k$[ebp]
push eax
push OFFSET FLAT:??_C@_03HMFC@?$CFd?6?$AA@ ; `string'
call _printf
add esp, 8
; 9 : }
pop edi
pop esi
pop ebx
add esp, 76 ; 0000004cH
cmp ebp, esp
call __chkesp
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
END