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!


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 


  • inquisitiveUserinquisitiveUser South Posts: 3Member

    I have no idea where to start for this and cant imagine anyone else will but though id give it a try as cant find anything to help anywhere. Its frustrating to say the very least...

Sign In or Register to comment.