⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 w.asm

📁 汇编语言的课程设计
💻 ASM
📖 第 1 页 / 共 5 页
字号:
                jz      positive
                mov     al,'-'
positive:       stosb
                ret

set_byte:       mov     al,byte ptr [ebx]
                mov     ah,al
                shr     al,4
                call    set_nibble
                mov     al,ah
                call    set_nibble
                dec     ebx
                ret
set_nibble:     and     al,0fh
                add     al,'0'
                stosb
                ret

_Dtoa        endp


WINCHILD  macro  x,a,b,c,d
        invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText&x,\ 
                        WS_CHILD or WS_VISIBLE or WS_BORDER or BS_DEFPUSHBUTTON,\ 
                        a,b,c,d,hWnd,BUTTON&x,hInstance,NULL 
        mov  hwndButton&x,eax
endm 

DIGIT   macro   a,b
                 .ELSEIF ax==BUTTON&a
                .if errflags==0 
               .if emptyflags<=1 
                    mov esi,offset tempString1
               .elseif emptyflags<=3
                    mov esi,offset tempString2
               .endif
                push edi
                push eax
                mov edi,esi
                mov keychar,b
                call _Strcat
                mov	tempString1+26,0
                mov tempString2+26,0                
                .if emptyflags==0
                    mov emptyflags,1
                    mov resultflags,0
                .elseif emptyflags==2
                    mov emptyflags,3
                    mov resultflags,0
                .endif    
                pop eax
                pop edi
                shr eax,16
                .IF ax==BN_CLICKED
                    .if emptyflags<=1
                        invoke SendMessage,hWnd,WM_COMMAND,IDM_INPUT1,0
                    .elseif emptyflags<=3
                        invoke SendMessage,hWnd,WM_COMMAND,IDM_INPUT2,0
                    .endif
                    invoke	SetFocus,hWnd    
                .ENDIF 
                .endif 
 endm   
 
KEYW	macro	b 

                .if errflags==0 
               .if emptyflags<=1 
                    mov esi,offset tempString1
               .elseif emptyflags<=3
                    mov esi,offset tempString2
               .endif
                push edi
                push eax
                mov edi,esi
                mov keychar,b
                call _Strcat
                mov	tempString1+26,0
                mov tempString2+26,0
                .if emptyflags==0
                    mov emptyflags,1
                    mov resultflags,0
                .elseif emptyflags==2
                    mov emptyflags,3
                    mov resultflags,0
                .endif    
                pop eax
                pop edi

                .if emptyflags<=1
                        invoke SendMessage,hWnd,WM_COMMAND,IDM_INPUT1,0
                .elseif emptyflags<=3
                        invoke SendMessage,hWnd,WM_COMMAND,IDM_INPUT2,0
                .endif 
                .endif

            
endm

OPR     macro       b

                             .if errflags==0 

                 .if    mrflags==0 && stickflags==0
                    .if emptyflags==0 
                       .if maflags==0
                        mov esi,offset tempString1
                        mov byte ptr [esi],'0'
                        inc esi
                        mov byte ptr [esi],0
                        mov emptyflags,2
          
                        mov dotflags,0
                        mov resultflags,1

                        shr eax,16
                        .IF ax==BN_CLICKED
                            invoke SendMessage,hWnd,WM_COMMAND,IDM_INPUT1,0
                            invoke	SetFocus,hWnd
                        .ENDIF 
                        .else
                            mov emptyflags,2
                         mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                           
                            mov dotflags,0
                            mov resultflags,1
                            mov maflags,0

                        .endif    
                    .elseif emptyflags==1
                        mov dotflags,0
                        mov emptyflags,2
                        mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                        
                        mov resultflags,1
           
                        shr eax,16
                        .IF ax==BN_CLICKED
                            invoke SendMessage,hWnd,WM_COMMAND,IDM_INPUT1,0
                            invoke	SetFocus,hWnd                            
                        .ENDIF
                    .elseif emptyflags==2 
                       .if maflags==1
                        mov ebx,offset tempString2
                        call    _Atod
                        fstp    secondnum
                        mov ebx,offset tempString1
                        call    _Atod
                        .if opflags!=4
                        .if opflags==1
                            fadd    secondnum
                        .elseif opflags==2
                            fsub    secondnum
                        .elseif opflags==3
                            fmul    secondnum

                        .endif
                        mov ebx,offset  result
                        call _Dtoa
                        mov edi,offset display
                        mov esi,offset result
                        call _Move
			mov esi,offset display
			call TO
                        finit
                        shr eax,16
                        .IF ax==BN_CLICKED
                            invoke SendMessage,hWnd,WM_COMMAND,IDM_RESULT,0
                            invoke	SetFocus,hWnd                            
                        .ENDIF
                        mov edi,offset tempString1
                        mov esi,offset result
                        call _Move
                        mov emptyflags,2
                        mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                        
                        mov dotflags,0
                        mov resultflags,1

                        mov maflags,0
                       .elseif opflags==4
                            .if secondnum==0
                                shr eax,16
                                .if ax==BN_CLICKED
                                    invoke SendMessage,hWnd,WM_COMMAND,IDM_MESSAGE,0
                                    mov emptyflags,0
                                    mov dotflags,0
                                    mov resultflags,1
                                    mov errflags,1
                             		invoke	SetFocus,hWnd                                   
                                 .endif
                            .else
                                fdiv    secondnum
                                mov ebx,offset result
                                call _Dtoa
                        mov edi,offset display
                        mov esi,offset result
                        call _Move
			mov esi,offset display
			call TO
                                finit
                                shr eax,16
                                .IF ax==BN_CLICKED
                                    invoke SendMessage,hWnd,WM_COMMAND,IDM_RESULT,0
                             	invoke	SetFocus,hWnd                                   
                                .ENDIF
                                 mov edi,offset tempString1
                                mov esi,offset result
                                call _Move
                                mov emptyflags,2
                          mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                              
                                mov dotflags,0
                                mov resultflags,1
                                mov maflags,0
                              .endif                               
                         .endif                          

                    .elseif  msdownflags==1
 
                        mov resultflags,1
                        mov dotflags,0
                        mov msdownflags,0
                    .elseif  msdownflags==2
                        mov ebx,offset tempString2
                        call    _Atod
                        fstp    secondnum
                        mov ebx,offset tempString1
                        call    _Atod
                        .if opflags!=4
                        .if opflags==1
                            fadd    secondnum
                        .elseif opflags==2
                            fsub    secondnum
                        .elseif opflags==3
                            fmul    secondnum

                        .endif
                        mov ebx,offset  result
                        call _Dtoa
                        mov edi,offset display
                        mov esi,offset result
                        call _Move
			mov esi,offset display
			call TO         
                        finit
                        shr eax,16
                        .IF ax==BN_CLICKED
                            invoke SendMessage,hWnd,WM_COMMAND,IDM_RESULT,0
                             invoke	SetFocus,hWnd                           
                        .ENDIF
                        mov edi,offset tempString1
                        mov esi,offset result
                        call _Move
                        mov emptyflags,2
                         mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                       
                        mov dotflags,0
                        mov resultflags,1
    
                        mov maflags,0
                       .elseif opflags==4
                            .if secondnum==0
                                shr eax,16
                                .if ax==BN_CLICKED
                                    invoke SendMessage,hWnd,WM_COMMAND,IDM_MESSAGE,0
                                    mov emptyflags,0
                                    mov dotflags,0
                                    mov resultflags,1
                                    mov errflags,1
                             		invoke	SetFocus,hWnd                                   
                                 .endif
                            .else
                                fdiv    secondnum
                                mov ebx,offset result
                                call _Dtoa
                        mov edi,offset display
                        mov esi,offset result
                        call _Move
			mov esi,offset display
			call TO                
                                finit
                                shr eax,16
                                .IF ax==BN_CLICKED
                                    invoke SendMessage,hWnd,WM_COMMAND,IDM_RESULT,0
                            	invoke	SetFocus,hWnd                                    
                                .ENDIF
                                 mov edi,offset tempString1
                                mov esi,offset result
                                call _Move
                                mov emptyflags,2
                         mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                               
                                mov dotflags,0
                                mov resultflags,1
                                mov maflags,0    
                              .endif                               
                         .endif                          


                     .endif                       

                    .elseif emptyflags==3
                        mov ebx,offset tempString2
                        call    _Atod
                        fstp    secondnum
                        mov ebx,offset tempString1
                        call    _Atod
                        .if opflags!=4
                        .if opflags==1
                            fadd    secondnum
                        .elseif opflags==2
                            fsub    secondnum
                        .elseif opflags==3
                            fmul    secondnum

                        .endif
                        mov ebx,offset  result
                        call _Dtoa
                        mov edi,offset display
                        mov esi,offset result
                        call _Move
			mov esi,offset display
			call TO     
                        finit
                        shr eax,16
                        .IF ax==BN_CLICKED
                            invoke SendMessage,hWnd,WM_COMMAND,IDM_RESULT,0
                            invoke	SetFocus,hWnd                            
                        .ENDIF
                        mov edi,offset tempString1
                        mov esi,offset result
                        call _Move
                        mov emptyflags,2
                         mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                       
                        mov dotflags,0
                        mov resultflags,1
  
                        mov maflags,0
                       .elseif opflags==4
                            .if secondnum==0
                                shr eax,16
                                .if ax==BN_CLICKED
                                    invoke SendMessage,hWnd,WM_COMMAND,IDM_MESSAGE,0
                                    mov emptyflags,0
                                    mov dotflags,0
                                    mov resultflags,1
                                    mov errflags,1
                            		invoke	SetFocus,hWnd                                    
                                 .endif
                            .else
                                fdiv    secondnum
                                mov ebx,offset result
                                call _Dtoa
                        mov edi,offset display
                        mov esi,offset result
                        call _Move
			mov esi,offset display
			call TO             
                                finit
                                shr eax,16
                                .IF ax==BN_CLICKED
                                    invoke SendMessage,hWnd,WM_COMMAND,IDM_RESULT,0
                            		invoke	SetFocus,hWnd                                    
                                .ENDIF
                                 mov edi,offset tempString1
                                mov esi,offset result
                                call _Move
                                mov emptyflags,2
                            mov esi,offset tempString1
                        mov edi,offset tempbuffer
                        call _Move                            
                                mov dotflags,0
                                mov resultflags,1
                                mov maflags,0
                              .endif                               
                         .endif                          

                   .endif 
                .else
                    .if emptyflags==0
                        .if mrflags==1
                        mov esi,offset saveString
                        .elseif stickflags==1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -