汇编语言的简单入门--Loop and output,input
来源:互联网 发布:外网端口怎么开 编辑:程序博客网 时间:2024/05/21 00:54
程序的目的:将13个随机数[0-100)存储在数组里面,翻转,输出。
TITLE Write a program
INCLUDE Irvine32.inc.data
ARRAY_SIZE = 13RAND_MAX = 100HALF_ARRAY_SIZE = ARRAY_SIZE/2rands DWORD ARRAY_SIZE dup(0)
.codemain PROC
mov esi,offset rands ;address to the randsmov ecx,lengthof rands ;calculate the size of arrayL1: mov eax,RAND_MAX ;for random the maxinum number call RandomRange ;call this function mov [esi],eax ;set the element that is save in EAX to [esi] add esi,TYPE rands ;point to next element loop L1 mov esi,offset rands ;address to the randsmov ecx,lengthof rands ;calculate the size of array
L2: mov eax,[esi] ;put the [esi] to eax for outputing call writeint mov eax,' ' ;output the space call writechar add esi,TYPE rands ;point to next pointer
loop L2 call crlf
mov esi,offset randsmov ecx,HALF_ARRAY_SIZEmov eax,48L3: mov ebx,[esi] ;put the first element to ebx mov ebp,[esi + eax] ;put the last element to ebp mov [esi + eax],ebx ;exchange the element mov [esi],ebp sub eax,8 ;for changeing the pointer add esi,TYPE rands loop L3
mov esi,offset randsmov ecx,ARRAY_SIZE ;for outputing ;L4: mov eax,[esi] call writeint mov eax,' ' call writechar add esi,TYPE rands loop L4 call crlf call waitmsg
exitmain ENDPEND main
- 汇编语言的简单入门--Loop and output,input
- input and output
- itk input and output
- Python input and output
- Input and Output
- 7. Input and Output
- 8 Input and Output
- Input and output of iostream.
- Ch.7 - Input and Output
- Hadoop Streaming Input and Output
- Redirecting standard input and output
- File Input and Output(1)
- Standard Input and Output Redirection
- I/O Input and Output
- [Language]File Input and Output
- 14.2. Input and Output Operators
- Synchronization and Overlapped Input and Output
- 1.5.输入和输出(Input and Output)
- 收藏中心
- CUDA和OpenCL全解释
- 在C语言中静态调用Native DLL(Windows平台)
- ActiveX控件签名与发布
- 在C语言中动态调用Native DLL(Windows平台)
- 汇编语言的简单入门--Loop and output,input
- ] 斯坦福ML公开课笔记9——偏差/方差、经验风险最小化、联合界、一致收敛
- project euler problem 8:Largest product in a series
- Leetcode: Merge Two Sorted Lists
- RFM分析模型
- 2014百度校招笔试题
- 几个面试题
- BCG分析模型
- hdu1538 A Puzzle for Pirates