Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MARIE + subroutine

Hello, I am having trouble with some homework. Im an assembly language noob. I need to write a program that does A*B+C*D. I know i Need a multiplication subroutine, but I just dont know how to make one. Here is a link to give you more information http://www.rivier.edu/faculty/bhiggs/web/cs245aweb/assignments/assignment3.htm

As you see, there is no Multiply command, so I would have to create the subroutine and loop it however many times. Any help would be appreciated. Thank you.

Comments

  • bobos_papasbobos_papas Member Posts: 1
    : Hello, I am having trouble with some homework. Im an assembly language noob. I need to write a program that does A*B+C*D. I know i Need a multiplication subroutine, but I just dont know how to make one. Here is a link to give you more information http://www.rivier.edu/faculty/bhiggs/web/cs245aweb/assignments/assignment3.htm
    :
    : As you see, there is no Multiply command, so I would have to create the subroutine and loop it however many times. Any help would be appreciated. Thank you.
    :


    my frend this is the marie code that you need for you homework
    This code let you give the for parameters A B C and D it cals the subroutine prod to make the multyplication of the first 2 stores the in a temp variable, calls again the prod subroutine for the second couple C an D an stores the in an other temp variable and finaly in adds the 2 temp vars and output the result and stops:


    org 100
    input
    store x
    input
    store y
    JnS prod
    Load sum
    store e
    input
    store x
    input
    store y
    jns prod
    load sum
    store f
    load e
    add f
    output
    halt

    sum, dec 0
    one, dec 1
    ctr, dec 0
    x, dec 0
    y, dec 0
    e, dec 0
    f, dec 0


    prod, hex 0
    load y
    store ctr
    clear
    store sum
    Loop, Load sum
    Add x
    Store sum
    Load ctr
    Subt one
    Store ctr
    Skipcond 400
    Jump Loop
    load sum
    JumpI prod


    it does exactly what you want to do!
    I hope i can help you

    ps sorry if my english wasnt so good but i am from greece i can't speek english very good!!!
  • nckinfutznckinfutz Member Posts: 3
    : : Hello, I am having trouble with some homework. Im an assembly language noob. I need to write a program that does A*B+C*D. I know i Need a multiplication subroutine, but I just dont know how to make one. Here is a link to give you more information http://www.rivier.edu/faculty/bhiggs/web/cs245aweb/assignments/assignment3.htm
    : :
    : : As you see, there is no Multiply command, so I would have to create the subroutine and loop it however many times. Any help would be appreciated. Thank you.
    : :
    :
    :
    : my frend this is the marie code that you need for you homework
    : This code let you give the for parameters A B C and D it cals the subroutine prod to make the multyplication of the first 2 stores the in a temp variable, calls again the prod subroutine for the second couple C an D an stores the in an other temp variable and finaly in adds the 2 temp vars and output the result and stops:
    :
    :
    : org 100
    : input
    : store x
    : input
    : store y
    : JnS prod
    : Load sum
    : store e
    : input
    : store x
    : input
    : store y
    : jns prod
    : load sum
    : store f
    : load e
    : add f
    : output
    : halt
    :
    : sum, dec 0
    : one, dec 1
    : ctr, dec 0
    : x, dec 0
    : y, dec 0
    : e, dec 0
    : f, dec 0
    :
    :
    : prod, hex 0
    : load y
    : store ctr
    : clear
    : store sum
    : Loop, Load sum
    : Add x
    : Store sum
    : Load ctr
    : Subt one
    : Store ctr
    : Skipcond 400
    : Jump Loop
    : load sum
    : JumpI prod
    :
    :
    : it does exactly what you want to do!
    : I hope i can help you
    :
    : ps sorry if my english wasnt so good but i am from greece i can't speek english very good!!!
    :

  • nckinfutznckinfutz Member Posts: 3
    : : : Hello, I am having trouble with some homework. Im an assembly language noob. I need to write a program that does A*B+C*D. I know i Need a multiplication subroutine, but I just dont know how to make one. Here is a link to give you more information http://www.rivier.edu/faculty/bhiggs/web/cs245aweb/assignments/assignment3.htm
    : : :
    : : : As you see, there is no Multiply command, so I would have to create the subroutine and loop it however many times. Any help would be appreciated. Thank you.
    : : :
    : :
    : :
    : : my frend this is the marie code that you need for you homework
    : : This code let you give the for parameters A B C and D it cals the subroutine prod to make the multyplication of the first 2 stores the in a temp variable, calls again the prod subroutine for the second couple C an D an stores the in an other temp variable and finaly in adds the 2 temp vars and output the result and stops:
    : :
    : :
    : : org 100
    : : input
    : : store x
    : : input
    : : store y
    : : JnS prod
    : : Load sum
    : : store e
    : : input
    : : store x
    : : input
    : : store y
    : : jns prod
    : : load sum
    : : store f
    : : load e
    : : add f
    : : output
    : : halt
    : :
    : : sum, dec 0
    : : one, dec 1
    : : ctr, dec 0
    : : x, dec 0
    : : y, dec 0
    : : e, dec 0
    : : f, dec 0
    : :
    : :
    : : prod, hex 0
    : : load y
    : : store ctr
    : : clear
    : : store sum
    : : Loop, Load sum
    : : Add x
    : : Store sum
    : : Load ctr
    : : Subt one
    : : Store ctr
    : : Skipcond 400
    : : Jump Loop
    : : load sum
    : : JumpI prod
    : :
    : :
    : : it does exactly what you want to do!
    : : I hope i can help you
    : :
    : : ps sorry if my english wasnt so good but i am from greece i can't speek english very good!!!
    : :
    :
    :
    Awesome! thanks alot, I really appreciate it. Your english is fine, btw
  • nguyenpenguyenpe Member Posts: 1
    : : Hello, I am having trouble with some homework. Im an assembly language noob. I need to write a program that does A*B+C*D. I know i Need a multiplication subroutine, but I just dont know how to make one. Here is a link to give you more information http://www.rivier.edu/faculty/bhiggs/web/cs245aweb/assignments/assignment3.htm
    : :
    : : As you see, there is no Multiply command, so I would have to create the subroutine and loop it however many times. Any help would be appreciated. Thank you.
    : :
    :
    :
    : my frend this is the marie code that you need for you homework
    : This code let you give the for parameters A B C and D it cals the subroutine prod to make the multyplication of the first 2 stores the in a temp variable, calls again the prod subroutine for the second couple C an D an stores the in an other temp variable and finaly in adds the 2 temp vars and output the result and stops:
    :
    :
    : org 100
    : input
    : store x
    : input
    : store y
    : JnS prod
    : Load sum
    : store e
    : input
    : store x
    : input
    : store y
    : jns prod
    : load sum
    : store f
    : load e
    : add f
    : output
    : halt
    :
    : sum, dec 0
    : one, dec 1
    : ctr, dec 0
    : x, dec 0
    : y, dec 0
    : e, dec 0
    : f, dec 0
    :
    :
    : prod, hex 0
    : load y
    : store ctr
    : clear
    : store sum
    : Loop, Load sum
    : Add x
    : Store sum
    : Load ctr
    : Subt one
    : Store ctr
    : Skipcond 400
    : Jump Loop
    : load sum
    : JumpI prod
    :
    :
    : it does exactly what you want to do!
    : I hope i can help you
    :
    : ps sorry if my english wasnt so good but i am from greece i can't speek english very good!!!
    :


    hi thanks for the code. It helped me out with my homework too! =)
    Have you got one that divides 2 numbers? IE. X/Y
    Thanks
Sign In or Register to comment.