Stationeers

Stationeers

View Stats:
Tutorial IC chips for beginners Chapter 1
I will probably make a mini-series for new players who want to learn how to program IC chips, this is the beginning:

https://www.youtube.com/watch?v=cXh2Y6nYHDE
< >
Showing 1-15 of 25 comments
FarmerPalmer Oct 22, 2019 @ 5:00pm 
Thank you, the simple way of using logic chips to show how inside of IC chip works is awesome, it made it so much easier to understand :)
Adam De Beers Oct 22, 2019 @ 5:12pm 
Originally posted by waxhed55:
Thank you, the simple way of using logic chips to show how inside of IC chip works is awesome, it made it so much easier to understand :)

Thank you very much, thats exactly what I want to show. Programming IC can look difficult, but it is very easy when players can see "what is happening inside of IC on old logic chips".
hektor Oct 22, 2019 @ 5:42pm 
Just got through these, excellent way of posting it as a logic simulator rather than just running around playing doing whatever.
atom heart Oct 23, 2019 @ 12:28am 
Finally able to understand where it all goes and why. Using the logic circuit to show what is happening was a cool idea.
Adam De Beers Oct 23, 2019 @ 7:12am 
More is coming, stay tuned :D
FarmerPalmer Oct 23, 2019 @ 6:47pm 
I just made my brain hurt hehe but i worked out how to turn on more than one light. Made a change to code so it uses a batch writer.

0
1 alias Switch d0
2 alias LightBW d1
3
4 alias SwitchValue r0
5
6 start:
7
8 l SwitchValue d0 Setting
9
10 s db Setting SwitchValue
11
12 yield
13
14 j start

My very first code that works yay.
Anyone feel free to use it or give tips :)
Last edited by FarmerPalmer; Oct 23, 2019 @ 9:55pm
Adam De Beers Oct 23, 2019 @ 7:04pm 
Originally posted by waxhed55:
I just made my brain hurt hehe but i worked out how to turn on more than one light. Made a change to code so it uses a batch writer.

0
1 alias Switch d0
2 alias LightBW d1
3
4 alias SwitchValue r0
5
6 start:
7
8 l SwitchValue d0 Setting
9
10 s db Setting SwitchValue
11
12 j start

My very first code that works yay.
Anyone feel free to use it or give tips :)

Perfect, I am glad the tutorial helped, more tutorials soon.

Ps: I dont see yield command :P
Last edited by Adam De Beers; Oct 23, 2019 @ 7:06pm
FarmerPalmer Oct 23, 2019 @ 10:08pm 
Oh crap, Thank you for pointing that out. It there now :). I do know that i basically made a very expensive batch writer-writer, but hey, its all part of learning.
4ndr34 Oct 24, 2019 @ 12:44am 
Saddamo, if you don't mind, I would add my 2 cent: it is really useful to put a logic reader and a slot reader close to computer, I mean close to where you code the IC, to quick check the device variables/slots that you need or want to use in your code, it makes IC coding much faster.
Anyway as always you have delivered to the community a very good tutorial, keep up making them. :dwarven:

As a much more advanced topic about IC coding, you can make procedures and functions structuring the program, and above all making it much more readable at least using jump and branch instructions that save the next line of code in the ra register and as last instruction of your function/procedure you jump back to ra value.
To pass parameters to your functions/procedures IC language should offer also a stack to push and pop parameters and eventually ra values if you want deeper function calls, but due to the fact that using the stack in such a way you are inflating the number of loc, you can hit very easy the 128 loc limit.

Just as an example about using functions/procedures I quote one of my scripts that I have coded to input fuel to the furnace. I have used r1 to pass the one needed parameter because I don't wanted to inflate the numbers of loc, and the use of functions procedures are just a way to see if they really works.
alias preInjVP d1
alias preInjPA d2
alias inputGasMixer d3
alias inputPA d4
alias FlashingLight d5
define preInjTargetPressure 50
define inputPressure 50

#check Switch
checkSwitch:
l r0 Switch Setting
bgtz r0 preInj
move r1 0
jal setFlashingLight
move r7 0
j checkSwitch
#Starting H2 preinjection
preInj:
#Light on warning flashing light
move r1 1
jal setFlashingLight
#Put on the pre injection pipe analyzer
move r1 1
jal preInjPAOnOff
#Pre-injection pressurization cycle
move r1 preInjTargetPressure
jal preInjPress
move r1 1
jal inputPAOnOff
move r1 inputPressure
jal gasMixing
j checkSwitch

#Function to set flashing light on/off
#1st parameter r1 = on/off
setFlashingLight:
s FlashingLight On r1
j ra

#Function to set preInjection Pipe Analyzer on/off
#1st parameter r1 = on/off
preInjPAOnOff:
s preInjPA On r1
j ra

#Function to set input Pipe Analyzer on/off
#1st parameter r1 = on/off
inputPAOnOff:
s inputPA On r1
move r1 0
j ra

#Function to pressurize pre injection pipe
#parameter r1 = pressure
preInjPress:
sub r9 r7 2
bgtz r9 preInjJump
preInjCycle:
l r8 preInjPA Pressure
bge r8 r1 preInjPressEnd
move r9 1
s preInjVP On r9
j preInjCycle
preInjPressEnd:
move r9 0
s preInjVP On r9
add r7 r7 1
preInjJump:
move r8 0
j ra

#Function to mix gasses into fuel
#Parameter r1 = input pressure
gasMixing:
sub r9 r7 1
bgtz r9 gasMixingJump
gasMixingCycle:
l r8 inputPA Pressure
bge r8 r1 gasMixingEnd
move r9 1
s inputGasMixer On r9
j gasMixingCycle
gasMixingEnd:
move r9 0
s inputGasMixer On r9
add r7 r7 2
gasMixingJump:
move r8 0
j ra
Last edited by 4ndr34; Oct 24, 2019 @ 12:52am
Adam De Beers Oct 24, 2019 @ 4:51am 
Originally posted by 4ndr34:
Saddamo, if you don't mind, I would add my 2 cent: it is really useful to put a logic reader and a slot reader close to computer, I mean close to where you code the IC, to quick check the device variables/slots that you need or want to use in your code, it makes IC coding much faster.
Anyway as always you have delivered to the community a very good tutorial, keep up making them. :dwarven:

As a much more advanced topic about IC coding, you can make procedures and functions structuring the program, and above all making it much more readable at least using jump and branch instructions that save the next line of code in the ra register and as last instruction of your function/procedure you jump back to ra value.
To pass parameters to your functions/procedures IC language should offer also a stack to push and pop parameters and eventually ra values if you want deeper function calls, but due to the fact that using the stack in such a way you are inflating the number of loc, you can hit very easy the 128 loc limit.

Just as an example about using functions/procedures I quote one of my scripts that I have coded to input fuel to the furnace. I have used r1 to pass the one needed parameter because I don't wanted to inflate the numbers of loc, and the use of functions procedures are just a way to see if they really works.
alias preInjVP d1
alias preInjPA d2
alias inputGasMixer d3
alias inputPA d4
alias FlashingLight d5
define preInjTargetPressure 50
define inputPressure 50

#check Switch
checkSwitch:
l r0 Switch Setting
bgtz r0 preInj
move r1 0
jal setFlashingLight
move r7 0
j checkSwitch
#Starting H2 preinjection
preInj:
#Light on warning flashing light
move r1 1
jal setFlashingLight
#Put on the pre injection pipe analyzer
move r1 1
jal preInjPAOnOff
#Pre-injection pressurization cycle
move r1 preInjTargetPressure
jal preInjPress
move r1 1
jal inputPAOnOff
move r1 inputPressure
jal gasMixing
j checkSwitch

#Function to set flashing light on/off
#1st parameter r1 = on/off
setFlashingLight:
s FlashingLight On r1
j ra

#Function to set preInjection Pipe Analyzer on/off
#1st parameter r1 = on/off
preInjPAOnOff:
s preInjPA On r1
j ra

#Function to set input Pipe Analyzer on/off
#1st parameter r1 = on/off
inputPAOnOff:
s inputPA On r1
move r1 0
j ra

#Function to pressurize pre injection pipe
#parameter r1 = pressure
preInjPress:
sub r9 r7 2
bgtz r9 preInjJump
preInjCycle:
l r8 preInjPA Pressure
bge r8 r1 preInjPressEnd
move r9 1
s preInjVP On r9
j preInjCycle
preInjPressEnd:
move r9 0
s preInjVP On r9
add r7 r7 1
preInjJump:
move r8 0
j ra

#Function to mix gasses into fuel
#Parameter r1 = input pressure
gasMixing:
sub r9 r7 1
bgtz r9 gasMixingJump
gasMixingCycle:
l r8 inputPA Pressure
bge r8 r1 gasMixingEnd
move r9 1
s inputGasMixer On r9
j gasMixingCycle
gasMixingEnd:
move r9 0
s inputGasMixer On r9
add r7 r7 2
gasMixingJump:
move r8 0
j ra

This IC program looks really advanced, I will jump into "branches" and other things hopefully in next few weeks. It depends how much time I will have for Stationeers. I dont want to scare new IC programmers yet.
atom heart Oct 24, 2019 @ 6:39am 
I have been experimenting with simple codes and instructions. For now I will stick with Saddamo. ppl posting 300 lines of advanced coding really doesn't add anything to this topic other than to show their proficiency and I must say, that looks very proficient.
Adam De Beers Oct 24, 2019 @ 7:09am 
Originally posted by atom heart:
I have been experimenting with simple codes and instructions. For now I will stick with Saddamo. ppl posting 300 lines of advanced coding really doesn't add anything to this topic other than to show their proficiency and I must say, that looks very proficient.

No worries, we will get there one day.
4ndr34 Oct 24, 2019 @ 7:22am 
Originally posted by atom heart:
I have been experimenting with simple codes and instructions. For now I will stick with Saddamo. ppl posting 300 lines of advanced coding really doesn't add anything to this topic other than to show their proficiency and I must say, that looks very proficient.
Don't get me wrong: I am not trying to rob the scene to Saddamo, I am just a newbie of this game, I have about 50 hours in it, and even if I had the same experience of Saddamo, that I have not, I haven't his skill in tutoring and teaching, his tutorials are really useful and without them I was really lost in this game, above all in the very first hours past in it.

Don't look at my code, as I have written is much more advanced, not suitable to someone who is at his first steps in coding in general, that was just a suggestion to Saddamo for another much more advanced topic eventually in his future tutorials...

What I feel to add to Saddamo current tutorial, is just that IC coding could be much more easy if you put down, and cable it, a logic reader close to the computer, to have a quick check of device variables, maybe also a logic writer could be useful. Just that.

Follow Saddamo he is one of the best tutoring in this game. :steamhappy:
Last edited by 4ndr34; Oct 24, 2019 @ 7:22am
Adam De Beers Oct 24, 2019 @ 8:04am 
Originally posted by 4ndr34:
Originally posted by atom heart:
I have been experimenting with simple codes and instructions. For now I will stick with Saddamo. ppl posting 300 lines of advanced coding really doesn't add anything to this topic other than to show their proficiency and I must say, that looks very proficient.
Don't get me wrong: I am not trying to rob the scene to Saddamo, I am just a newbie of this game, I have about 50 hours in it, and even if I had the same experience of Saddamo, that I have not, I haven't his skill in tutoring and teaching, his tutorials are really useful and without them I was really lost in this game, above all in the very first hours past in it.

Don't look at my code, as I have written is much more advanced, not suitable to someone who is at his first steps in coding in general, that was just a suggestion to Saddamo for another much more advanced topic eventually in his future tutorials...

What I feel to add to Saddamo current tutorial, is just that IC coding could be much more easy if you put down, and cable it, a logic reader close to the computer, to have a quick check of device variables, maybe also a logic writer could be useful. Just that.

Follow Saddamo he is one of the best tutoring in this game. :steamhappy:

You are right, I am always using logic readers or writers to get variables to use in IC code, even there is another way how to get it. Reader or slot reader is the best way how to get what you need, I will include it in the beginning of next tutorial, I think I did mention this way many times when I was streaming Stationeers and doing IC Classes on Twitch.

I promise next tutorial will start little bit different, I will mention this way at the beginning.

Thank you very much one more time.
Last edited by Adam De Beers; Oct 24, 2019 @ 8:05am
atom heart Oct 24, 2019 @ 9:48am 
Originally posted by 4ndr34:
Don't get me wrong: I am not trying to rob the scene to Saddamo, I am just a newbie of this game, I have about 50 hours in it, and even if I had the same experience of Saddamo, that I have not, I haven't his skill in tutoring and teaching, his tutorials are really useful and without them I was really lost in this game, above all in the very first hours past in it.

Don't look at my code, as I have written is much more advanced, not suitable to someone who is at his first steps in coding in general, that was just a suggestion to Saddamo for another much more advanced topic eventually in his future tutorials...

What I feel to add to Saddamo current tutorial, is just that IC coding could be much more easy if you put down, and cable it, a logic reader close to the computer, to have a quick check of device variables, maybe also a logic writer could be useful. Just that.

Follow Saddamo he is one of the best tutoring in this game. :steamhappy:

Totally agree and I do appreciate the advice.
< >
Showing 1-15 of 25 comments
Per page: 1530 50

Date Posted: Oct 18, 2019 @ 4:52pm
Posts: 25