marie

How do I raise a number x to the power y in MARIE?

纵然是瞬间 提交于 2021-02-11 12:38:14
问题 I'm trying to create a MARIE program that raises a number (x) to a power (y) and provides an output. I have tried many alterations of the idea I have in mind but I am still facing errors. The code below is the closest I have gotten to solving this problem INPUT STORE X STORE XNUM INPUT STORE Y MULTIPLIERA,LOAD PROD ADD X STORE PROD LOAD XNUM SUBT ONE STORE XNUM SKIPCOND 400 JUMP MULTIPLIERA JUMP NEWPRODUCT NEWPRODUCT, LOAD X STORE XNUM LOAD PROD STORE X LOAD Y SUBT ONE STORE Y SKIPCOND 400

How does `Skipcond` work in the MARIE assembly language?

谁说我不能喝 提交于 2019-12-21 04:40:56
问题 I am trying to understand the MARIE assembly language. I don't quite understand skipcond for doing things like < , or > , or multiply or divide. I am taking this simple program: x = 1 while x < 10 do x = x +1 endwhile; What I don't understand is how to use certain skip conditions: Skipcond 800 if AC > 0, Skipcond 400 if AC = 0, Skipcond 000 if AC < 0 Now, I know I would subtract x from 10 and test using skipcond. I am not sure which one and why. I guess if I knew how they really work maybe it

How does `Skipcond` work in the MARIE assembly language?

眉间皱痕 提交于 2019-12-03 14:46:17
I am trying to understand the MARIE assembly language. I don't quite understand skipcond for doing things like < , or > , or multiply or divide. I am taking this simple program: x = 1 while x < 10 do x = x +1 endwhile; What I don't understand is how to use certain skip conditions: Skipcond 800 if AC > 0, Skipcond 400 if AC = 0, Skipcond 000 if AC < 0 Now, I know I would subtract x from 10 and test using skipcond. I am not sure which one and why. I guess if I knew how they really work maybe it would be easier to understand. Why is it used to compare to zero? This is what I have: 100 load one