Title is No Title

not very good here!

导航

VC cl to create asm file at the same time's EXample.

//#include "windows.h"
#include "stdlib.h"
#include "stdio.h"
// use to olny show ASM:cl /FA test.cpp
main(){
printf("hello first by vc.");
return 0;
}

===========
cl /AF first.cpp;

and will get:
first.asm file:
 TITLE first.cpp
 .386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
FLAT GROUP _DATA, CONST, _BSS
 ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
PUBLIC _main
EXTRN _printf:NEAR
_DATA SEGMENT
$SG899 DB 'hello first by vc.', 00H
_DATA ENDS
_TEXT SEGMENT
_main PROC NEAR
; File first.cpp
; Line 5
 push ebp
 mov ebp, esp
; Line 6
 push OFFSET FLAT:$SG899
 call _printf
 add esp, 4
; Line 7
 xor eax, eax
; Line 8
 pop ebp
 ret 0
_main ENDP
_TEXT ENDS
END

posted on 2004-03-21 18:59  abraham  阅读(529)  评论(0编辑  收藏  举报