exca / Stationeers-IC10-Automation

Some automation projects for Stationeers, coded using IC10, including a *Basic to IC10 Compiler*.
Other
24 stars 1 forks source link

No support for `getd` or `setd` #6

Open ArchAngel075 opened 2 months ago

ArchAngel075 commented 2 months ago

Basic to IC10 compiler does not support the powerful getd or setd instructions which are useful for IO on the stack of a separate IC10 chip. I personally use this as a external RAM - A,B,C chips reads and writes on D(ram) - Which makes useful a commonly shared "memory" stack.

exca commented 2 months ago

Hey @ArchAngel075 !

Yes, that's in my backlog.

It will be a bit difficult to implement because it requires that all the compiled codes reserve the same stack positions across all the ICs.

I was thinking about implementing a special keyword with arrays named "Comms" , so the Host IC will declare an array:

array Comms[20]  # with 20 stack registers starting from stack pointer = 0

And any Client IC would be able to read/write remote values using:

var remoteValue = IC.Reference[1234].Comms[12]  # To retrieve remote value in stack pointer = 12

My main problem now is that the stack is dynamically populated with indirect registers, arrays, and function calls.

What do you think about this implementation? Would it work for you?

Cheers,

-- Exca