npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

icx-compiler

v2.1.7

Published

Compiler icX to ic10

Downloads

120

Readme

icX

icX is a programming language translated to ic10 used to simplify the programming of ic10 microprocessors in the Stationeers game.

Quick start

  1. Install plugin for VSC
  2. Create a file with .icX type
  3. Write a program. For example:
    use loop
    var on = d1.Open
    d0.On = on
  4. Save the file (Ctrl+S)
  5. Copy a code from a new generated file with the same name and type .ic10
  6. Paste code into microprocessor Ic10 in the game

Instructions

Comments

# Text after a # will be ignored to the end of the line

Vars

icX will automatically replace variable names with register names

---icX
   var a = 10
---ic10
   move r0 10

Using alias

---icX
   use aliases
   var a = 10
---ic10
   alias a r0
   move a 10

Using define

---icX
   use constants
   const PI = 3.14
---ic10
   define PI 3.14

Math

Unary operations (++, --)

inc

---icX
   var a = 0
   a++
---ic10
   move r0 0
   add r0 r0 1

dec

---icX
   var a = 0
   a--
---ic10
   move r0 0
   sub r0 r0 1

Binary operations (+, -, *, /, %)

Constants will be calculated automatically

---icX
   var x =  5 + 5 * 2 
---ic10
   move r0 15
---icX
   const x = 2 + 2
   const y = x + 2
   var z = y + 2
---ic10
   move r0 8

Binary operations with variables

---icX
   var k = 2
   var y = 5
   var x =  y + y * k
---ic10
   move r0 2
   move r1 5
   mul r15 r1 r0
   add r2 r1 r15
   add r2 r2 5

IF - ELSE

Binary logical operations used (<, >, ==, !=, <=, >=, &, |, ~=)

---icX
   var a = 0
   var b = 0
   if a >= 0
     b = 1
   else
     b = 0
   end
---ic10
   move r0 0
   move r1 0
   sgez r15 r0
   beqz r15 if0else
   beq r15 1 if0
   if0:
      move r1 1
      j if0exit
   if0else:
      move r1 0
   if0exit:

While

---icX
 var a = 0
 while a >= 10
    a++
 end
---ic10
 move r0 0
 while0:
    sge r15 r0 10
    beqz r15 while0exit
    add r0 r0 1
    j while0
 while0exit:

Devices

---icX
 d0.Setting = 1                  # Set device param
 var a = d0.Setting              # Load device param into a register 
 var b = d0.slot(a).PrefabHash   # Using a slot of the device
 a = d(5438547545).Setting(Sum)  # Batch load, where 5438547545 is hash of the device
 d(5438547545).Setting = b       # Batch configuration 
---ic10
 s d0 Setting 1
 l r0 d0 Setting
 ls r1 d0 r0 PrefabHash
 lb r0 5438547545 Setting Sum
 sb 5438547545 Setting r1

Function

To write a function, use the function keyword

{function name}()

function {function name}
   {code}
end
---icX
 use loop
 var a = 0 
 example()
 var on = d1.Open
 d0.On = on
 
 function example
     move a 1
 end
---ic10
 move r0 0
 jal example
 l r1 d1 Open
 s d0 On r1
 j 0
 example:
 move r0 1
 j ra

Use

In addition to use aliases and use constant, the following constructs are supported:

To loop the application, use use loop

---icX
 move r0 0
 jal example
 l r1 d1 Open
 s d0 On r1
 j 0
 example:
 move r0 1
 j ra
---ic10
 move r0 0
 jal example
 l r1 d1 Open
 s d0 On r1
 j 0
 example:
 move r0 1
 j ra

Use use comments to transfer your comments to ic10 code

---icX
 use comments
 # Example
 var a = 0
 var on = d1.Open
 # Example
 d0.On = on
 test()
 function test
  var c = 1
 end
---ic10
 # ---icX User code start---
 # Example
 move r0 0
 l r1 d1 Open
 # Example
 s d0 On r1
 jal test
 # ---icX User code end---
 jr 4
 test:
 move r2 1
 j ra

Additional examples of icX code

#alias SolarSensor d0
#alias SolarPanel d1
#alias LedVertical d2
#alias LedHorizontal d3
var SOLAR_HASH = d1.PrefabHash

var vertical = 180
var horizontal = 180

main:
    updateLED()
    setSolarPanels()
    yield
j main

function setSolarPanels
    d(SOLAR_HASH).Vertical = vertical
    d(SOLAR_HASH).Horizontal = horizontal
end

function updateLED
    d2.Setting = vertical
    d3.Setting = horizontal
end