Question: Why is my MASM code only outputting the first procedure? ; Description: 'This program generates a series of temperature readings ( TEMPS _ PER _

Why is my MASM code only outputting the first procedure?
; Description: 'This program generates a series of temperature readings (TEMPS_PER_DAY readings
; per day for DAYS_MEASURED days) in the range of [MIN_TEMP ... MAX_TEMP] into one array. Once
; this array is generated, the program calculates the highest and lowest temperature reading for each day,
; then calculates the average of each of these daily high and low temperatures. Everything is displayed
; wth descriptive titles.'
INCLUDE Irvine32.inc
; (insert macro definitions here)
; (insert constant definitions here)
DAYS_MEASURED =14 ;Rows
TEMPS_PER_DAY =11 ;Columns
MIN_TEMP EQU 20
MAX_TEMP EQU 80
ARRAYSIZE EQU DAYS_MEASURED * TEMPS_PER_DAY ;Total elements =(days measured*temps per day)
.data
; (insert variable definitions here)
intro_1 BYTE "Welcome to Chaotic Temperature Statistics - Programmed by Nicole",13,10,0
intro_2 BYTE "This program generates a series of temperature readings, X per day for Y days,",13,10,0
intro_3 BYTE "depending on constants, and performs some basic statistics on them: daily high and low",13,10,0
intro_4 BYTE "and average high and low temps. It then prints these results, with descriptive titles.",13,10,13,10,0
dispArray BYTE "The temperature readings are as follows (one row is one day): ",13,10,0
dispHigh BYTE "The highest temperature of each day was: ",13,10,0
dispLow BYTE "The lowest temperature of each day was: ",13,10,0
avgHigh BYTE "The truncated average high temperature was: ",13,10,0
avgLow BYTE "The truncated average low temperature was: ",13,10,0
;signOff optional
tempArray DWORD ARRAYSIZE DUP(?) ;Create a MAXSIZE-element DWORD array, leave values uninitialized
highArray DWORD DAYS_MEASURED DUP(?) ;Create a 14-element DWORD array of the highest temperature for each day, leave values uninitialized
lowArray DWORD DAYS_MEASURED DUP(?) ;Create a 14-element DWORD array of the lowest temperature for each day, leave values uninitialized
highAvg DWORD 80 ;High average value, initialized to decimal 80
lowAvg DWORD 20 ;Low average value, initialized to decimal 20
.code
main PROC
CALL Randomize ;Random int access
;greeting and explanation
PUSH OFFSET intro_1
PUSH OFFSET intro_2
PUSH OFFSET intro_3
PUSH OFFSET intro_4
CALL printGreeting
;setup temp array
PUSH OFFSET tempArray
CALL generateTemperatures
;find daily highs
PUSH OFFSET tempArray
PUSH DAYS_MEASURED
PUSH TEMPS_PER_DAY
PUSH OFFSET highArray
CALL findDailyHighs
;find daily lows
PUSH OFFSET tempArray
PUSH DAYS_MEASURED
PUSH TEMPS_PER_DAY
PUSH OFFSET lowArray
CALL findDailyLows
;calculate high and low averages
PUSH OFFSET highArray
PUSH OFFSET lowArray
CALL calcAverageLowHighTemps
;display temps from 14 days(rows) and 11 temps per day(columns)
PUSH OFFSET dispArray
PUSH OFFSET tempArray
PUSH DAYS_MEASURED
PUSH TEMPS_PER_DAY
CALL displayTempArray
;display daily highs
PUSH OFFSET dispHigh
PUSH OFFSET highArray
PUSH DAYS_MEASURED
PUSH 1
CALL displayTempArray
;display daily lows
PUSH OFFSET dispLow
PUSH OFFSET lowArray
PUSH DAYS_MEASURED
PUSH 1
CALL displayTempArray
;display temp avgs
PUSH OFFSET avgHigh
PUSH highAvg
CALL displayTempWithString
PUSH OFFSET avgLow
PUSH lowAvg
CALL displayTempWithString
RET
Invoke ExitProcess,0
main ENDP
;------------------------------------------------------------------------------------------------------------------
;Name: printGreeting
;{parameters: intro1(reference, input), intro2(reference, input),...)
;Procedure to introduce the program & programmer
;preconditions: intros are described
;postconditions: EDX changed
;receives:
;returns:
;------------------------------------------------------------------------------------------------------------------
printGreeting PROC ;introduce programmer
PUSH EBP
MOV EBP, ESP
; [EBP+20]= address of OFFSET intro_4
; [EBP+16]= address of OFFSET intro_3
; [EBP+12]= address of OFFSET intro_2
; [EBP+8]= address of OFFSET intro_1
; [EBP+4]= return address
; [EBP]= old ebp
MOV EDX, [EBP +20]
CALL WriteString
MOV EDX, [EBP +16]
CALL WriteString
MOV EDX, [EBP +12]
CALL WriteString
MOV EDX, [EBP +8]
CALL WriteString
POP EBP
RET 16
printGreeting ENDP
;------------------------------------------------------------------------------------------------------------------
;Name: generateTemperatures
;{parameters: tempArray (reference, output)}
;MIN_TEMP, MAX_TEMP, DAYS_MEASURED, TEMPS_PER_DAY will be used as globals within this procedure.
;Randomly generate temperatures within the range and stores them in tempArray
;preconditions:
;postconditions:
;receives:
;returns: tempArray
;------------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!