Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

MARIE assembly - Raising integer to a power

inquisitiveUserinquisitiveUser South Posts: 3Member

Hi guys, so the following program multiplies 2 numbers by repeated addition. However i want to raise the first variable entered to the power of the second variable entered. I am trying to modify the code to allow for this. but considering the marie assembly language is so limited how would i do this without the use of a multiplication operator? If anyone can comment on this with a solution i would be majorly grateful :)

org 100     

input       
Store Int1  

input       
Store Int2  

Jns prod    
Store answer

Output
Halt

prod,    Hex 0  

Load Int2   
Store Ctr   
Clear       

Store Sum
Loop,   Load Sum    
Add Int1        
Store Sum       
Load Ctr        
Subt One        
Store Ctr       

Skipcond 400        
Jump Loop       
Load Sum        
JumpI prod      


Int1,   Dec 0
Int2,   Dec 0
Sum,    Dec 0
Ctr,    Hex 0
One,    Dec 1
answer, Dec 0 
Tagged:

Comments

Sign In or Register to comment.