📄 w.asm
字号:
.386
.model flat, stdcall
option casemap :none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
ICO_MAIN equ 1000h
IDM_MAIN equ 2000h
IDA_MAIN equ 2000h
IDM_COPY equ 4101h
IDM_STICK equ 4102h
IDM_EXIT equ 4103h
IDM_STANDRD equ 4201h
IDM_SCIENCE equ 4202h
IDM_INT equ 4203h
IDM_HELP equ 4301h
IDM_ABOUT equ 4302h
STATICID equ 301
IDM_MESSAGE equ 501
IDM_MESSAGE1 equ 502
IDM_INPUT1 equ 204
IDM_INPUT2 equ 205
IDM_RESULT equ 206
EDITBUTTON equ 1
BUTTON1 equ 2
BUTTON2 equ 3
BUTTON3 equ 4
BUTTON4 equ 5
BUTTON5 equ 6
BUTTON6 equ 7
BUTTON7 equ 8
BUTTON8 equ 9
BUTTON9 equ 10
BUTTON10 equ 11
BUTTON11 equ 12
BUTTON12 equ 13
BUTTON13 equ 14
BUTTON14 equ 15
BUTTON15 equ 16
BUTTON16 equ 17
BUTTON17 equ 18
BUTTON18 equ 19
BUTTON19 equ 20
BUTTON20 equ 21
BUTTON21 equ 22
BUTTON22 equ 23
BUTTON23 equ 24
BUTTON24 equ 25
BUTTON25 equ 26
BUTTON26 equ 27
BUTTON27 equ 28
.data
hInstance dd ?
hWinMain dd ?
hMenu dd ?
hSubMenu dd ?
hwndButton1 HWND ?
hwndButton2 HWND ?
hwndButton3 HWND ?
hwndButton4 HWND ?
hwndButton5 HWND ?
hwndButton6 HWND ?
hwndButton7 HWND ?
hwndButton8 HWND ?
hwndButton9 HWND ?
hwndButton10 HWND ?
hwndButton11 HWND ?
hwndButton12 HWND ?
hwndButton13 HWND ?
hwndButton14 HWND ?
hwndButton15 HWND ?
hwndButton16 HWND ?
hwndButton17 HWND ?
hwndButton18 HWND ?
hwndButton19 HWND ?
hwndButton20 HWND ?
hwndButton21 HWND ?
hwndButton22 HWND ?
hwndButton23 HWND ?
hwndButton24 HWND ?
hwndButton25 HWND ?
hwndButton26 HWND ?
hwndButton27 HWND ?
hwndStatic HWND ?
keychar db ?
hwndEdit HWND ?
tempString1 db 30 dup(?)
tempString2 db 30 dup(?)
emptyflags db ?
dotflags db ?
copyflags db 0
sign db ?
opnum1 dd ?
opnum2 dd ?
temp dw ?
tempnum dd ?
buffer db 512 dup(?)
result db 30 dup(?)
four db 5 dup(?)
display db 30 dup(?)
savet db 30 dup(?)
secondnum dd ?
status db ?
x dw ?
cw dw ?
cw1 dw ?
sw1 dw ?
sw dw ?
mans dt 0
exp dt 0
expnum dw 0
szClassName db 'Menu Example',0
szCaptionMain db '计算器',0
szMenuHelp db '帮助主题(&H)',0
szMenuAbout db '关于计算器(&A)',0
ExitText db '你真的要退出?',0
ExitTitle db '计算器',0
message db "除数不能为零。",0
message1 db "函数输入无效。",0
HelpText db '计算器怎么用就不用说了吧,自己摸索吧!',0
HelpTitle db '帮助',0
AboutText db 'by fuqiang zhang,012004016415',0
AboutTitle db 'Version Information',0
overflow db '结果溢出',0
InitText db '0',0
StaticClassName db "static",0
StaticText db "M",0
ButtonClassName db "button",0
ButtonText1 db "MC",0
ButtonText2 db "MR",0
ButtonText3 db "MS",0
ButtonText4 db "M+",0
ButtonText5 db "7",0
ButtonText6 db "4",0
ButtonText7 db "1",0
ButtonText8 db "0",0
ButtonText9 db "8",0
ButtonText10 db "5",0
ButtonText11 db "2",0
ButtonText12 db "+/-",0
ButtonText13 db "9",0
ButtonText14 db "6",0
ButtonText15 db "3",0
ButtonText16 db ".",0
ButtonText17 db "/",0
ButtonText18 db "*",0
ButtonText19 db "-",0
ButtonText20 db "+",0
ButtonText21 db "sqrt",0
ButtonText22 db "%",0
ButtonText23 db "1/x",0
ButtonText24 db "=",0
ButtonText25 db "Bkspace",0
ButtonText26 db "CE",0
ButtonText27 db "C",0
EditClassName db "edit",0
StaticText1 db " ",0
StaticText2 db 'M',0
char db ?
ten0 dd 10.0
ten17 dq 1.0E17
saveflags db 0
mrflags db 0
saveString db 30 dup(?)
miniusflags db 0
resultflags db 0
opflags db 0
maflags db 0
msdownflags db 0
changflags db 0
stickflags db 0
copytext db 30 dup(?)
edittring db 30 dup(?)
tempbuffer db 30 dup(?)
errflags db 0
t db '3',0
ten dw 10
cr db 0
.code
radix proc
push ecx
push edx
xor ecx,ecx
lop1: xor edx,edx
div ebx
push dx
inc ecx
or eax,eax
jnz lop1
lop2: pop ax
cmp al,10
jb l1
add al,7
l1: add al,30h
mov byte ptr [esi],al
inc esi
loop lop2
pop edx
pop ecx
ret
radix endp
TO proc
push eax
push edx
;mov esi,offset result
mov edx,esi
push edx
xor eax,eax
xor edx,edx
mov dl,byte ptr [esi+22]
sub dl,30h
mov al,dl
mul ten
mov dl,byte ptr [esi+23]
sub dl,30h
add ax,dx
mul ten
mov dl,byte ptr [esi+24]
sub dl,30h
add ax,dx
mul ten
mov dl,byte ptr [esi+25]
sub dl,30h
add ax,dx
mov expnum,ax
pop edx
cmp expnum,2550
ja @8001
cmp expnum,6
ja @2001
cmp expnum,0
je @6001
mov cx,expnum
mov al,byte ptr [esi+21]
cmp al,'+'
jne minius
add esi,2
mov edi,esi
inc edi
@1001: mov al,byte ptr [edi]
mov byte ptr [esi],al
inc esi
inc edi
loop @1001
mov byte ptr [esi],'.'
mov esi,edx
mov byte ptr [esi+20],0
add esi,19
@2005: mov al,byte ptr [esi]
cmp al,'0'
jne @2006
mov byte ptr [esi],0
dec esi
jmp @2005
@2006: cmp al,'.'
jne exit
mov byte ptr [esi],0
jmp exit
minius: add esi,19
mov edi,esi
cmp expnum,1
jne @7001
mov ecx,17
inc edi
@7002: mov al,byte ptr [esi]
mov byte ptr [edi],al
dec esi
dec edi
loop @7002
dec esi
mov al,byte ptr [esi]
mov byte ptr [edi],al
mov byte ptr [esi],'0'
mov byte ptr [esi+20],0
add esi,19
jmp @3001
@7001: add edi,ecx
mov ecx,17
@1008: mov al,byte ptr [esi]
mov byte ptr [edi],al
dec esi
dec edi
loop @1008
mov esi,edx
mov al,byte ptr [esi+1]
mov byte ptr [edi],al
mov byte ptr [esi+1],'0'
mov cx,expnum
dec cx
add esi,3
@1006: mov byte ptr [esi],'0'
inc esi
loop @1006
mov cx,expnum
mov esi,edx
add esi,ecx
mov byte ptr [esi+20],0
add esi,19
@3001: mov al,byte ptr [esi]
cmp al,'0'
jne @3002
mov byte ptr [esi],0
dec esi
jmp @3001
@3002: cmp al,'.'
jne exit
mov esi,edx
mov byte ptr [esi],'0'
mov byte ptr [esi+1],0
jmp exit
@2001: mov ax,expnum
mov ebx,10
movsx eax,ax
mov esi,offset four
call radix
mov byte ptr [esi],0
mov esi,offset four
mov edi,edx
add edi,22
@2003: mov al,byte ptr [esi]
cmp al,0
je @2002
mov byte ptr [edi],al
inc esi
inc edi
jmp @2003
@2002: mov byte ptr [edi],0
mov esi,edx
mov edi,esi
add esi,19
xor ecx,ecx
@4002: mov al,byte ptr [esi]
cmp al,'0'
jne @4001
inc cx
dec esi
jmp @4002
@4001: cmp al,'.'
jne @5001
dec esi
@5001: inc esi
add edi,20
@4004: mov al,byte ptr [edi]
cmp al,0
je @4003
mov byte ptr [esi],al
inc esi
inc edi
jmp @4004
@4003: mov byte ptr [esi],0
jmp exit
;cmp expnum,0
;jne exit
@6001: mov esi,edx
add esi,19
@6004: mov al,byte ptr [esi]
cmp al,'0'
jne @6002
dec esi
jmp @6004
@6002: cmp al,'.'
jne @6003
dec esi
@6003: inc esi
mov byte ptr [esi],0
jmp exit
@8001: mov edi,edx
mov esi,offset overflow
call _Strlen1
mov esi,offset overflow
inc ecx
@2220: mov al,byte ptr [esi]
mov byte ptr [edi],al
inc esi
inc edi
loop @2220
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -