?? 2.asm
字號(hào):
.386
.model flat,stdcall
option casemap:none
include Windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
IDD_DIALOG1 EQU 101
IDC_RADIO1 EQU 1000
IDC_RADIO2 EQU 1001
IDC_RADIO3 EQU 1002
IDC_RADIO4 EQU 1003
ID_START EQU 1004
ID_EXIT EQU 1005
.data
CLK dw 31250
IOport dw 0A400h
w8253 dw 20h
.data?
rNum dw ?
.code
DlgProc proc hDlg, uMsg, wParam, lParam
.if uMsg == WM_INITDIALOG
invoke GetDlgItem,hDlg,ID_START
invoke EnableWindow,eax,FALSE
invoke GetDlgItem,hDlg,ID_EXIT
invoke EnableWindow,eax,FALSE
.elseif uMsg == WM_COMMAND
mov eax, wParam
.if ax == IDC_RADIO1
mov ax, CLK
shl ax, 1
mov rNum, ax
invoke GetDlgItem,hDlg,ID_START
invoke EnableWindow,eax,TRUE
invoke GetDlgItem,hDlg,ID_EXIT
invoke EnableWindow,eax,TRUE
.elseif ax == IDC_RADIO2
mov ax, CLK
mov rNum, ax
invoke GetDlgItem,hDlg,ID_START
invoke EnableWindow,eax,TRUE
invoke GetDlgItem,hDlg,ID_EXIT
invoke EnableWindow,eax,TRUE
.elseif ax == IDC_RADIO3
mov ax, CLK
shr ax, 1
mov rNum, ax
invoke GetDlgItem,hDlg,ID_START
invoke EnableWindow,eax,TRUE
invoke GetDlgItem,hDlg,ID_EXIT
invoke EnableWindow,eax,TRUE
.elseif ax == IDC_RADIO4
mov ax, CLK
mov dx, 0
mov bx, 5
div bx
mov rNum, ax
invoke GetDlgItem,hDlg,ID_START
invoke EnableWindow,eax,TRUE
invoke GetDlgItem,hDlg,ID_EXIT
invoke EnableWindow,eax,TRUE
.elseif ax == ID_START
mov al, 00110110b
mov dx, IOport
add dx, w8253
add dx, 3
out dx, al
mov dx, IOport
add dx, w8253
mov ax, rNum
out dx, al
mov al, ah
out dx, al
.elseif ax == ID_EXIT
invoke EndDialog,hDlg,NULL
.endif
.elseif uMsg == WM_CLOSE
invoke EndDialog,hDlg,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp
START:
invoke GetModuleHandle, NULL
invoke DialogBoxParam, eax, IDD_DIALOG1, NULL, DlgProc, NULL
invoke ExitProcess,NULL
END START
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -