I have a program here that creates an array of 10 integers and asks the user to create the limit for the numbers being evaluated. For example, inputting a 7 will evaluate numbers 1-7 in the array. Due to my indexing methods, I start at 1, not 0. Of the numbers selected, the maximum number is to be stored and printed in an output. Everything works; however, I cannot run the program multiple times. I must reset the simulator manually each time to get an accurate result since only the AC clears when I add the command. I was wondering if there was any command that wiped the registers entirely without using the drop down menu in the MARIE jar? Here is my code:
/Begin at line 100.
org 0100
/clear AC of previous runs.
clear
/user input.
input
/Subtract 1 due to indexing method.
subt one
/add location of first
/value to input ro find limit.
add ctr
/store into limit variable n.
store n
/load first value @ location ctr.
loadi ctr
/first value becomes largest for now.
store large
/subtract ctr to begin loop @ beginning of index
load ctr
subt one
store ctr
/loop while ctr < n
/Increment ctr.
loop, load ctr
add one
store ctr
/compare value @ ctr
/to current largest value.
loadi ctr
subt large
/stores value @ ctr
/if greater than large.
skipcond 800
skipcond 000
jump store
/Post test
/When ctr reaches n,
/loop breaks to Stop.
test, load n
subt ctr
skipcond 400
jump loop
jump Stop
/stores variable @ address ctr
/Reached if variable > large.
store, loadi ctr
store large
jump test
/Reached when ctr == n.
/Outputs large and halts.
Stop, load large
output
halt
/Variables.
/ctr begins @ location of
/first variable in array.
ctr, hex 122
one, hex 1
n, hex 0
next, hex 0
large, hex 0
/Array.
hex 1
hex 3
hex 2
hex 5
hex 6
hex 4
hex 8
hex 0
hex 9
hex 8
Thank you!