彙編學習筆記,過程編程習題

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.