Quote
Your main program should ask the user to enter an integer. The entered integer should be stored in
the memory.
2. The program should prompt the user to enter more integers until the user enters -1. All the numbers
that the user entered should be stored in consecutive memory locations. For example, if the user
inputs 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1; a part of the data segment should look like this:
[0x10010000] 0x00000001 0x00000002 0x00000003 0x00000004
[0x10010010] 0x00000005 0x00000006 0x00000007 0x00000008
[0x10010020] 0x00000009 0x0000000a 0x00000000 0x00000000
the memory.
2. The program should prompt the user to enter more integers until the user enters -1. All the numbers
that the user entered should be stored in consecutive memory locations. For example, if the user
inputs 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1; a part of the data segment should look like this:
[0x10010000] 0x00000001 0x00000002 0x00000003 0x00000004
[0x10010010] 0x00000005 0x00000006 0x00000007 0x00000008
[0x10010020] 0x00000009 0x0000000a 0x00000000 0x00000000
Obviously the way to enter the integers would be to use a simple loop that branches when the input is equal to -1. I have not problem with that part. The thing I'm having trouble with is where/how to store the data. I'm not really sure what to do to store the data in consecutive locations. We've learned about the .data and .text segments of the mips memory storage, but we haven't really learned how to store or any commands for the .data other than input and output strings. So my question would be, how do I store these values in consecutive locations, and how can I call them to be used later in the program.
Thanks.

New Topic/Question
Reply



MultiQuote








|