1

In Marie assembly, how can I declare a specific address as a variable?

x should have a value of hex 2c and value should be at address 0015 Currently, I have code:

load x
add x \ 2x
store x
halt
x, hex 2c

I could load 2c to the accumulator, and store it at address 0015, but is there any other way?

asked Nov 9, 2023 at 5:30

1 Answer 1

2

Apparently proper command is org hhh where hhh are hex digits, and there must be 3 of them — so, for 1516 need to use org 015, or for 1510 then org 00F.

I have tested this on marie.js; it gives the error unknown operator org if 3 digits are not supplied.

Sadly, fyi, I'm having trouble using org in any position except first, i.e. in front of all the code & data. So, if you want to put the code ahead of the data, that's going to be difficult without counting lines of code. The following org usage will place x at 0x015.

org 011
load x
add x 
store x
halt
x, hex 2c

Alternately, you might do the following:

org 014
jump start
x, hex 2c
start, load x
...
...

Though this will place the code after the data, it involves only counting one line of code, i.e. the jump start.


Note: marie.js will load the initial PC with the org location, so you can relocate code & data to anywhere and it will still start the simulation at the beginning of that code & data.

answered Nov 9, 2023 at 16:15
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.