汇编学习笔记,过程编程习题
Intel汇编语言程序设计第五章编程联系
绘制色彩文本
1 INCLUDE irvine32.inc
2
3 .data
4 str1 BYTE "Enter",0
5 color DWORD 1
6
7 .code
8 PrintText PROC
9 mov ecx,4
10 L1:
11 mov eax,color
12 call SetTextColor
13 call WriteString
14 inc color
15 loop L1
16 ret
17 PrintText endp
18
19 main PROC
20 mov edx,offset str1
21 call PrintText
22 call WriteString
23 ret
24 main endp
25 END main
斐波那契数
1 INCLUDE irvine32.inc
2
3 .data
4 first DWORD 1
5 second DWORD 1
6 third DWORD 0
7 temp DWORD ?
8 space DWORD " ",0
9 line DWORD 10
10
11 array DWORD 47 dup(0)
12 .code
13 Fibona PROC
14
15 ret
16 Fibona endp
17
18
19 main PROC
20 mov eax,first
21 call WriteDec
22 mov edx,offset space
23 call WriteString
24
25 mov eax,second
26 call WriteDec
27 mov edx,offset space
28 call WriteString
29 mov ecx,45
30 L1:
31 mov eax,first
32 add third,eax ;third+=first
33
34 mov eax,second ;third+=second
35 add third,eax
36
37 mov eax,second ;first=second
38 mov first,eax
39
40 mov eax,third ;second=third
41 mov second,eax
42
43 call PrintString
44 mov eax,second
45 call WriteDec
46 mov edx,offset space
47 call WriteString
48 mov third,0
49 loop L1
50 ret
51 main endp
52 END main