ypyangpong 发表于 2013-10-31 19:38:27

大家看看我照着罗云彬书上敲的一个代码怎么就报这么多错尼

.386                                                            ;1
.model flat,stdcall      ;2   
option casemap:none      ;3
;/////////////////////////////////////////////   ;5
includewindows.inc   ;6
includegdi32.inc   ;7
includelib gdi32.lib   ;8
includeuser32.inc   ;9
includelib user32.lib   ;10
includekernel32.inc   ;11
includelib kernel32.lib   ;12
;////////////////////////////////////////////////////
.const
szClassName db 'FirstWindow',0
szCaption db 'Hello Window',0
szTextdb 'haha',0
;/////////////////////////////////////////////////////
.data?
hWinMain dd ?   ;20
hInstance dd ?   ;21
;////////////////////////////////////////////////////
_ProcWinMain proc uses eax ebx edi esi,hWnd,uMsg,wParam,lParam
local @stPs:PAINTSTRUCT   ;24
local @stRect:RECT    ;25
local @hDc   ;26
   mov eax,uMsg    ;27
.if eax==WM_PAINT    ;28
invoke BeginPaint,hWnd,addr @stPs;29
   mov @hDc,eax    ;30
invoke GetClientRect,hWnd,addr @stRect;31
invoke DrawText,@hDc,addr szText,-1,addr @stRect,DT_SINGLELINE or DT_CENTER or DT_VCENTER
invoke EndPaint,hWnd,addr @stPs;33
      ;34
.elseif eax ==WM_CLOSE    ;35
invoke DestroyWindow,hWinMain   ;36
invoke PostQuitMessage,NULL   ;37
.else       ;38
invoke DefWindowProc,hWnd,uMsg,wParam,lParam ;39
   ret   ;40
.endif      ;41
   xor eax,eax
   ret
   
_ProcWinMain endp      ;45
;///////////////////////////////////////////////////////////////
_WinMain proc
local @stWndClass:WNDCLASSEX   ;49
local @stMsg:MSG    ;50
invoke GetModuleHandle,NULL   ;51
   mov hInstance,eax   ;52
invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
      ;54
invoke LoadCursor,0,IDC_ARROW   ;55
   mov @stWndClass.hCursor,eax
   push hInstance
   pop @stWndClass.hInstance
   mov @stWndClass.cbSize,sizeof WNDCLASS
   mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW
   mov @stWndClass.lpfnWndProc,offset _ProcWinMain
   mov @stWndClass.hbrBackground,COLOR_WINDOW+1
   mov @stWndClass.lpszClassName,offset szClassName
invoke ResgisterClassEx,addr @stWndClass ;64
   ;mov hWinMain,eax   ;65
invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szCaption,\
   WS_OVERLAPPEDWINDOW,100,100,600,400,NULL,NULL,hInstance,NULL
   mov hWinMain,eax   ;68
invoke ShowWindow,hWinMain,SW_SHOWNORMAL ;69
invoke UpdateWindow,hWinMain   ;70
.while TURE   ;71
invoke GetMessage,addr @stMsg,NULL,0,0
   .break .if eax==0
invoke TranslataMessage,addr @stMsg;74
invoke DispatchMessage,addr @stMsg
.endw      ;76
   ret
_WinMain endp
;////////////////////////////////////////////////////////////
start:call _WinMain   ;81
invoke ExitProcess,NULL
end start
   

ypyangpong 发表于 2013-10-31 19:39:18

1.asm(35) : error A2108: use of register assumed to ERROR
1.asm(38) : error A2108: use of register assumed to ERROR
1.asm(41) : error A2108: use of register assumed to ERROR
1.asm(64) : error A2006: undefined symbol : ResgisterClassEx
1.asm(71) : error A2108: use of register assumed to ERROR
1.asm(74) : error A2006: undefined symbol : TranslataMessage
1.asm(76) : error A2108: use of register assumed to ERROR
1.asm(81) : error A2108: use of register assumed to ERROR
1.asm(28) : error A2107: cannot have implicit far jump or call to near label
1.asm(30) : error A2107: cannot have implicit far jump or call to near label
1.asm(32) : error A2107: cannot have implicit far jump or call to near label
1.asm(33) : error A2107: cannot have implicit far jump or call to near label
1.asm(34) : error A2107: cannot have implicit far jump or call to near label
1.asm(35) : error A2107: cannot have implicit far jump or call to near label
1.asm(37) : error A2107: cannot have implicit far jump or call to near label
1.asm(40) : error A2107: cannot have implicit far jump or call to near label
1.asm(51) : error A2107: cannot have implicit far jump or call to near label
1.asm(53) : error A2107: cannot have implicit far jump or call to near label
1.asm(55) : error A2107: cannot have implicit far jump or call to near label
1.asm(66) : error A2107: cannot have implicit far jump or call to near label
1.asm(69) : error A2107: cannot have implicit far jump or call to near label
1.asm(70) : error A2107: cannot have implicit far jump or call to near label
1.asm(73) : error A2107: cannot have implicit far jump or call to near label
1.asm(76) : error A2006: undefined symbol : TURE
1.asm(82) : error A2107: cannot have implicit far jump or call to near label

ypyangpong 发表于 2013-10-31 19:40:26

大家帮小弟看下啊,,我看这本书时间不长,,今天照着敲书上的代码咋就出现这么多错

ypyangpong 发表于 2013-10-31 19:42:37

.386                                                            ;1
.model flat,stdcall                                                ;2                               
option casemap:none                                                ;3

;/////////////////////////////////////////////                        ;5
include                windows.inc                                        ;6
include                gdi32.inc                                        ;7
includelib        gdi32.lib                                        ;8
include                user32.inc                                        ;9
includelib        user32.lib                                        ;10
include                kernel32.inc                                        ;11
includelib        kernel32.lib                                        ;12
;////////////////////////////////////////////////////       
                .const
szClassName        db        'FirstWindow',0
szCaption        db        'Hello Window',0
szText                db        'haha',0
;/////////////////////////////////////////////////////
                .data?
hWinMain        dd        ?                                        ;20
hInstance        dd        ?                                        ;21
;////////////////////////////////////////////////////
_ProcWinMain        proc        uses eax ebx edi esi,hWnd,uMsg,wParam,lParam
                local        @stPs:PAINTSTRUCT                        ;24
                local        @stRect:RECT                                ;25
                local        @hDc                                        ;26
                        mov eax,uMsg                                ;27
                .if        eax==WM_PAINT                                ;28
                invoke        BeginPaint,hWnd,addr @stPs                ;29
                        mov @hDc,eax                                ;30
                invoke        GetClientRect,hWnd,addr @stRect                ;31
                invoke        DrawText,@hDc,addr szText,-1,addr @stRect,DT_SINGLELINE or DT_CENTER or DT_VCENTER
                invoke        EndPaint,hWnd,addr @stPs                ;33
                                                                ;34
                .elseif        eax ==WM_CLOSE                                ;35
                invoke        DestroyWindow,hWinMain                        ;36
                invoke        PostQuitMessage,NULL                        ;37       
                .else                                                 ;38
                invoke        DefWindowProc,hWnd,uMsg,wParam,lParam        ;39
                        ret                                        ;40
                .endif                                                ;41
                        xor eax,eax
                        ret
                       
_ProcWinMain        endp                                                ;45

;///////////////////////////////////////////////////////////////
_WinMain        proc       
                local        @stWndClass:WNDCLASSEX                        ;49
                local        @stMsg:MSG                                ;50
                invoke        GetModuleHandle,NULL                        ;51
                        mov hInstance,eax                        ;52
                invoke        RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
                                                                ;54
                invoke        LoadCursor,0,IDC_ARROW                        ;55
                        mov @stWndClass.hCursor,eax               
                        push hInstance
                        pop @stWndClass.hInstance
                        mov @stWndClass.cbSize,sizeof WNDCLASS
                        mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW
                        mov @stWndClass.lpfnWndProc,offset _ProcWinMain
                        mov @stWndClass.hbrBackground,COLOR_WINDOW+1
                        mov @stWndClass.lpszClassName,offset szClassName
                invoke        ResgisterClassEx,addr @stWndClass        ;64
                        ;mov hWinMain,eax                        ;65
                invoke        CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szCaption,\
                        WS_OVERLAPPEDWINDOW,100,100,600,400,NULL,NULL,hInstance,NULL
                        mov hWinMain,eax                        ;68
                invoke        ShowWindow,hWinMain,SW_SHOWNORMAL        ;69
                invoke        UpdateWindow,hWinMain                        ;70
                .while        TURE                                        ;71
                invoke        GetMessage,addr @stMsg,NULL,0,0
                        .break .if eax==0
                invoke        TranslataMessage,addr @stMsg                ;74
                invoke        DispatchMessage,addr @stMsg
                .endw                                                ;76
                        ret
_WinMain        endp

;////////////////////////////////////////////////////////////
start:                call _WinMain                                        ;81
                invoke        ExitProcess,NULL
                end start

锐利坚定 发表于 2013-11-1 16:13:48

不会吧,看你不是你哪里抄错了呢。我运行怎么没有事。

ypyangpong 发表于 2013-11-1 17:54:58

锐利坚定 发表于 2013-11-1 16:13 static/image/common/back.gif
不会吧,看你不是你哪里抄错了呢。我运行怎么没有事。

恩是的   我炒掉了个.code
页: [1]
查看完整版本: 大家看看我照着罗云彬书上敲的一个代码怎么就报这么多错尼