Создание программы с использованием программного продукта Turbo Assembler
Обновлено
2
Содержание
- Введение
- Исследование WinAPI функций
- Заключение
- Библиографический список
- Приложения
1. Методические указания к лабораторному практикуму /В.П. Кулюкин. Екатеринбург: изд. ИПК УГТУ, 2004. - 40с.
2. Лабораторный практикум по дисциплине "Системное программное обеспечение" / Уфимск. гос. авиац. техн. ун-т. Сост.: О.Д. Лянцев. - Уфа, 2008. - 57 с.
3. Калашников О.А. Ассемблер? Это просто! Учимся программировать. СПб.: БХВ-Петербург, 2006. - 384 с.: ил.
4. Абель П. Ассемблер. Язык и программирование для IBM PC / Пер. с англ. - К.: Век+, М.: ЭНТРОП, 2005. - 736 с.
ПриложенияПриложение А - Исходный текст программы
.586
. model flat, stdcall
extern GetModuleHandleA: near
extern LoadIconA: near
extern LoadCursorA: near
extern RegisterClassA: near
extern CreateWindowExA: near
extern GetMessageA: near
extern ShowWindow: near
extern UpdateWindow: near
extern TranslateMessage: near
extern DispatchMessageA: near
extern ExitProcess: near
extern DefWindowProcA: near
extern PostQuitMessage: near
extern BeginPaint: near
extern EndPaint: near
extern TextOutA: near
extern SetBkColor: near
extern InvalidateRect: near
includelib user32. lib
includelib kernel32. lib
includelib gdi32. lib
include windows. inc
style equ CS_HREDRAW + CS_VREDRAW + CS_GLOBALCLASS
_Data segment
hWnd dd 0
msg MSG <? >
wc WNDCLASS <? >
pnt PAINTSTRUCT <? >
hInst dd 0
TitleName db 'Программа 1',0
ClassName db 'Class32',0
char WPARAM 20h
clear db ' ',0
hdc dd 0
_Data ends
_Code segment
Start:
push 0
call GetModuleHandleA
mov [hInst],eax
mov [wc. style],style
mov [wc. lpfnWndProc],offset WndProc
mov [wc. cbClsExtra],0
mov [wc. cbWndExtra],0
mov eax, [hInst]
mov [wc. hInstance],eax
push IDI_APPLICATION
push 0
call LoadIconA
mov [wc. hIcon],eax
push IDC_CROSS
push 0
call LoadCursorA
mov [wc. hCursor],eax
mov [wc. hbrBackground],0
mov dword ptr [wc. lpszMenuName],0
mov dword ptr [wc. lpszClassName],offset ClassName
push offset wc
call RegisterClassA
push 0
push [hInst]
push 0
push 0
push 400
push 400
push 100
push 100
push WS_OVERLAPPEDWINDOW
push offset TitleName
push offset ClassName
push 0
call CreateWindowExA
cmp eax,0
jz _err
mov [hWnd],eax
push SW_SHOWNORMAL
push [hWnd]
call ShowWindow
push [hWnd]
call UpdateWindow
msg_loop:
push 0
push 0
push 0
push offset msg
call GetMessageA
cmp eax,0
je end_loop
push offset msg
call TranslateMessage
push offset msg
call DispatchMessageA
jmp msg_loop
end_loop:
push [msg. wParam]
call ExitProcess
_err:
jmp end_loop
WndProc proc
push ebp
mov ebp,esp
push ebx
push esi
push edi
cmp dword ptr [ebp+0ch],WM_DESTROY
je wmdestroy
cmp dword ptr [ebp+0ch],WM_CREATE
je wmcreate
cmp dword ptr [ebp+0ch],WM_PAINT
je wmpaint
cmp dword ptr [ebp+0ch],WM_CHAR
je wmchar
jmp defwndproc
wmchar:
push dword ptr [ebp+10h]
pop char
push TRUE
push NULL
push dword ptr [ebp+08h]
call InvalidateRect
wmpaint:
push offset pnt
push dword ptr [ebp+08h]
call BeginPaint
mov hdc,eax
push 5
push offset clear
push 100
push 100
push hdc
call TextOutA
push 1
push offset char
push 100
push 100
push hdc
call TextOutA
push offset pnt
push eax
call EndPaint
mov eax,0
jmp finish
wmcreate:
mov eax,0
jmp finish
defwndproc:
push dword ptr [ebp+14h]
push dword ptr [ebp+10h]
push dword ptr [ebp+0ch]
push dword ptr [ebp+08h]
call DefWindowProcA
jmp finish
wmdestroy:
push 0
call PostQuitMessage
mov eax,0
finish:
pop edi
pop esi
pop ebx
pop ebp
ret 16
WndProc endp
lenstr proc
push ebp
mov ebp,esp
push esi
mov esi,dword ptr [ebp+8]
xor ebx,ebx
lbl1:
cmp byte ptr [esi],0
jz lbl2
inc ebx
inc esi
jmp lbl1
lbl2:
pop esi
pop ebp
ret 4
lenstr endp
_Code ends
end Start
