The program is to read numbers from the I/O window, store them in memory, then calculate the sum and the average of the numbers read. My program runs fine except for the fact that the message for displaying sum does not appear. Please check it for me. Thanks
Code:
ORG $1000
START: ; first instruction of program
* Put program code here
LOOP
ADD.B #1,D2
LEA MSG1,A1
MOVE.B #14,D0
TRAP #15
MOVE.B #4,D0
TRAP #15
ADD.B D1,D3
CMP.B #0,D1
BNE LOOP
SUB.B #1,D2
LEA MSG2,A1
MOVE D3,D1
MOVE.B #17,D0
TRAP #15
DIVU D2,D1
LEA MSG3,A1
MOVE.B #17,D0
TRAP #15
MOVE.B #9,D0 ; halt simulator
TRAP #15
* Put variables and constants here
CR EQU $0D
LF EQU $0F
MSG1 DC.B 'Enter the number, enter 0 to exist: ',0
MSG2 DC.B 'The sum is: ',0
MSG3 DC.B CR,LF,'The average is: ',0
END START ; last line of source