CSI 212 Project 2, Fall 2011
American University of Science and Technology · Computer Organization And Assembly · 1 page
Stuck on a question? A tutor can walk you through it.
More CSI 212 files
- Project 1 · Fall 2011ProjectView
- Chapter 1 Slides · Spring 2012ChapterView
- Chapter 2 Slides · Spring 2012ChapterView
- Chapter 3 Slides · Spring 2012ChapterView
- Chapter 4 Slides · Spring 2012ChapterView
- Chapter 5 Slides · Spring 2012ChapterView
- Chapter 6 Slides Part I · Spring 2012ChapterView
- Chapter 6 Slides Part II · Spring 2012ChapterView
Show the text of this project
;program that let the user input 10 numbers and find the lowest and highest of
them
Include Irvine32.inc
.data
numbers BYTE 10 DUP(?) ;defining an array of 10 values
lowest BYTE 128 ;initializing the initial lowest grade
highest BYTE 0 ;initializing the initial highest grade
.code
mov esi, 0
mov ecx, 10
L1: ;loop to input numbers from the screen
mov eax, numbers[esi]
inc esi
call ReadDec
loop L1
mov esi,0
mov ecx,10
L2: ;loop to get the lowest number
mov eax, numbers[esi]
cmp lowest,eax
ja low
loop L2
mov esi,0
mov ecx,10
L3: ;loop to get the highest number
mov eax, numbers[esi]
cmp eax,lowest
ja high
loop L3
mov eax, high ;output the highest number
call WriteDec
call Crlf
mov eax, low ;output the lowest number
call WriteDec
call Crlf
high: ;comparing numbers to set as highest number
mov highest, eax
dec ecx
jmp L3
low: ;comparing numbers to set as lowest number
mov lowest, eax
dec ecx
jmp L2