MARIE assembly - Raising integer to a power - Programmers Heaven

Howdy, Stranger!

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


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     

Store Int1  

Store Int2  

Jns prod    
Store answer


prod,    Hex 0  

Load Int2   
Store Ctr   

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 


Sign In or Register to comment.