Question: . DATA ; Constants minTempLimit SDWORD - 3 0 maxTempLimit SDWORD 5 0 coldLimit SDWORD 0 coolLimit SDWORD 1 5 warmLimit SDWORD 3 0 numReadings
DATA ; Constants minTempLimit SDWORD maxTempLimit SDWORD coldLimit SDWORD coolLimit SDWORD warmLimit SDWORD numReadings SWORD ; Strings titleMsg BYTE "Temperature Analysis Program", progNameMsg BYTE "Programmed by Your Name greetMsg BYTE "Hello, enterTempMsg BYTE "Please enter a temperature reading in Celsius to : invalidMsg BYTE "Invalid temperature! Please enter a value within the range to resultsMsg BYTE "Temperature Analysis Results:", partingMsg BYTE "Thank you for using the program, ; Variables userName BYTE DUP totalTemp SDWORD validCount SWORD coldCount SWORD coolCount SWORD warmCount SWORD hotCount SWORD minTemp SDWORD maxTemp SDWORD CODE main PROC ; Program title and programmer name call Clrscr mov edx, OFFSET titleMsg call WriteString call CrLf mov edx, OFFSET progNameMsg call WriteString call CrLf ; Get user's name mov edx, OFFSET greetMsg call WriteString mov edx, OFFSET userName call ReadString call CrLf ; Input loop for temperature readings mov cxnumReadings mov totalTemp, mov validCount, inputloop: mov edx, OFFSET enterTempMsg call WriteString call ReadInt ; Validate input cmp eax, minTempLimit jl invalidinput cmp eax, maxTempLimit jg invalidinput ; Valid input, process temperature add totalTemp, eax inc validCount ; Update max and min temperatures cmp eax, maxTemp jle notnewmax mov maxTemp eax notnewmax: cmp eax, minTemp jge notnewmin mov minTemp eax notnewmin: ; Categorize temperature cmp eax, coldLimit jl coldcategory cmp eax, coolLimit jle coolcategory cmp eax, warmLimit jle warmcategory jmp hotcategory coldcategory: inc coldCount jmp nextinput coolcategory: inc coolCount jmp nextinput warmcategory: inc warmCount jmp nextinput hotcategory: inc hotCount jmp nextinput invalidinput: mov edx, OFFSET invalidMsg call WriteString call CrLf nextinput: loop inputloop ; Calculate average temperature mov eax, totalTemp cdq idiv validCount add edx, edx cmp edx, validCount jl skipround inc eax skipround: mov totalTemp, eax ; Display results call CrLf mov edx, OFFSET resultsMsg call WriteString call CrLf mov eax, minTemp call WriteInt call CrLf mov eax, maxTemp call WriteInt call CrLf mov eax, totalTemp call WriteInt call CrLf mov eax, coldCount call WriteInt call CrLf mov eax, coolCount call WriteInt call CrLf mov eax, warmCount call WriteInt call CrLf mov eax, hotCount call WriteInt call CrLf ; Parting message mov edx, OFFSET partingMsg call WriteString mov edx, OFFSET userName call WriteString call CrLf exit main ENDP END main. When i plug this code in Microsoft visual studio it is failing because the instruction operands must be the same size. How do i fix this code to get the instruction operands the same size. It must use Irvineinc
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
