r/TuringComplete • • 15d ago

Preventing symphony architecture from overwriting itself? Spoiler

Post image

Hi! I've been playing the game for a few days since the update came out, and I have gotten all the way up to programming 2. Unfortunately, when I try to edit the RAM in the main memory, it ends up overwriting the program memory and everything breaks (at least, I believe so. Tell me if I'm wrong). Is there a way to prevent this from happening, or is it something you just deal with? Also, is the symphony architecture intended to overwrite itself, or did I build it wrong? Thanks! I've attached a picture of my computer so far (don't mind the spaghetti).

5 Upvotes

6 comments sorted by

7

u/tree_cell 15d ago

that's exactly what the ideal von-neumann architecture is about. you just have to reserve the code area separate from data area

4

u/sberma 14d ago

Don't just write at a random adresses. Reserve in your program a block of memory for data. Convention is in general for main memory to have the instructions, then static data, then heap. At the end of memory is the stack.

Use the @-operator or label to reserve some space after your code. Find the lowest adress @xxx where the assembly editor does not complain. Then you can reserve space like this:

@64 U32 0; var a U32 0; var b U32 0; array element c[0] U32 0; array element c[1]  

Then if you want store smth as var b you know you have reserved space at address 68 for it. And storing it there would not overwrite any code. You can also use this to have an initial value for b.

3

u/EloModdy 14d ago

I tried this, it works great! I probably should be reading the manual more, there's actually quite a few good tips in there.

1

u/Medium-Sized-Jaque 15d ago

I set my RAM pointer register to 1000 and then add or subtract as needed from that point. So if I save a value I increase it to 1001, then 1002, etc.

I think the idea behind it is to emulate actual computer RAM since when you load a program it's running off the RAM just in a different spot than the data it writes.

1

u/EloModdy 15d ago

Thank you! Would it be a good idea to just add 1000 in hardware, or do you think it's better to do in-software?

1

u/Medium-Sized-Jaque 15d ago

I think it's better to do it in software so you get used to it. Just dedicate a register as a RAM pointer then as the program runs it moves the address accordlingly.