Tuesday, 3 September 2013

MASM program stops responding right before exiting

MASM program stops responding right before exiting

I've got a MASM/Assembly program (x86) that crashes right before/during
its exit command. I cannot figure out why it is doing this, but it is
consistently right at that command (if I set a breakpoint for that
command, and the command before it, it hits the command before it, but
crashes before the exit command is breakpointed). I am uncertain what
could be causing this.
Here is the main procedure for the program. in the file, after main ENDP
are the various other procedures that are called.
.code main PROC
; introduce the program and programmer
push OFFSET intro6
push OFFSET intro5
push OFFSET intro4
push OFFSET intro3
push OFFSET intro2
push OFFSET intro1
call intro
;input data
push counter
push MAX_INT
push REPETITIONS
push OFFSET list
push TEN
push OFFSET userInput
push OFFSET byteCount
push placeholder
push LO_INTEGER
push HI_INTEGER
push integer
push OFFSET error1
call read
;calculate sum and average
push REPETITIONS
push OFFSET list
push OFFSET numsum
push OFFSET numavg
call calc
;Converts and Prints list
push OFFSET comma
push REPETITIONS
push OFFSET list
push SIZEOF strOutput
push OFFSET strOutput
push OFFSET summary
call printList
call CrLf
;calculates sum and average
push REPETITIONS
push OFFSET list
push OFFSET numsum
push OFFSET numavg
call calc
;prints sum and average
push SIZEOF strOutput
push OFFSET strOutput
push numavg
push OFFSET average
push numsum
push OFFSET sum
call display
;prints goodbye
push OFFSET farewell
call goodbye
exit
main ENDP
;after a bunch of procedures
END main
What could be causing this? Everything executes fine, it just hangs up
before the exit and crashes instead of press any key to continue.

No comments:

Post a Comment