Marie code

Discussion in 'Homework Help' started by galtaash, Mar 29, 2011.

  1. galtaash

    Thread Starter New Member

    Mar 29, 2011
    You are to create a program in MARIE. You program will take the following list of numbers:

    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

    and perform the following sequence of operations:

    1. add them all up and store the answer
    2. reverse them into another list
    3. add the first (or original list) to the reversed list, item by item, and store the answer in a third list

    Each of the above operations is to be implemented as a subroutine. There should be a main program that calls each of the subroutines in order.

    Write your program. Run it within the MARIE environment. Turn in your listing, and include the results (show me that each subroutine worked correctly). Create a writeup explaining what is missing from the MARIE CPU architecture, th at is included in most every other real CPU architecture today, that makes this simple exercise more difficult in MARIE than it would be in a real CPU architecture. Create a gzip or zip file with these items and send it to the email in the syllabus.
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    That's nice.
  3. bertus


    Apr 5, 2008
  4. galtaash

    Thread Starter New Member

    Mar 29, 2011
    anybody please?
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    As a suggestion, start with a flow chart. That lets you see how the operations need to be performed to arrive at the result.

    BTW - we are not a homework service. We will assist, but you must be the one to do the work. Programming may seem overwhelming at first, but it's just a list of stepwise instructions.
  6. galtaash

    Thread Starter New Member

    Mar 29, 2011
    ok this is what I have. adding first 10 number.
    ORG 100
    Load Addr /address of first number to add
    Store Next /this address is our next pointer
    Load Num /load the number of items to be add
    Subt One /decrement
    Store Ctr /store this value in Ctr to control looping

    Loop1, Load Sum /Load the sum in AC
    AddI Next /Add the value pointed to by location Next
    Store Sum /Store this sum
    Add One /increment
    Store Next /store in our pointer next
    Load Ctr /load loop valiable
    Subt One /subt one from loop value
    Store Ctr /Store this new value in control variable
    Skipcond 000 /if control value<0, skip next instruction
    Jump Loop1 /go to loop
    Halt /terminate
    Addr, Hex 117
    Next, Hex 0
    Num, Dec 10
    Sum, Dec 0
    Ctr, Hex 0
    One, Dec 1

    Dec 1
    Dec 2
    Dec 3
    Dec 4
    Dec 5
    Dec 6
    Dec 7
    Dec 8
    Dec 9
    Dec 10

    how do I do next steps?
  7. SgtWookie


    Jul 17, 2007
    Please use CODE tags around your program source code; otherwise the formatting gets goofed up.
    Use the "Go Advanced" button. The "code tags" are pasted in when you click the # icon on the menu above the box.