Advertisement
drabont

Stationeers - Filter Monitor

Dec 29th, 2019
2,863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #= Filter Monitor = v 0.1 ============ by swagman =#
  2. #  ___ _ _ _             __  __       four-channel #
  3. # | __(_) | |_ ___ _ _  |  \/  |___ _ _  simple    #
  4. # | _|| | |  _/ -_) '_| | |\/| / _ \ ' \   safety  #
  5. # |_| |_|_|\__\___|_|   |_|  |_\___/_||_|    smart #
  6. #==================================================#
  7. # Automatically detects filter type on first start #
  8. # + shows filter resource on DiodeSlider           #
  9. # + shows type of filter if need of replacement    #
  10. # + validates filter type                          #
  11. # + turns off machine if wrong filter installed    #
  12. # Additional you can:                              #
  13. # + temp. disable type checking for any channel    #
  14. # + special channel programming mode on the fly    #
  15. #==================================================#
  16. #   |= | |_ "|" [- |2    |\/| () |\| | "|" () |2   #
  17. #= 2019.12.30 02:37  https://youtu.be/7z01YPlFDFI =#
  18.  
  19. define low 5 #- set minimum filter state in percent
  20.  
  21. alias Filter_1 d0
  22. alias DioSli_1R d1
  23. alias DioSli_1L d2
  24. alias Filter_2 d3
  25. alias DioSli_2R d4
  26. alias DioSli_2L d5
  27.  
  28. alias port r15
  29. alias slot r14
  30. alias hash r13
  31. alias can r12
  32. alias top r11
  33.  
  34. #---init
  35. move sp 0
  36. push 1635000764 #CO2
  37. push 1876847024
  38. push 416897318
  39. push 632853248 #N
  40. push -1387439451
  41. push -632657357
  42. push -1247674305 #N2O
  43. push 465267979
  44. push 1824284061
  45. push -721824748 #O
  46. push -1217998945
  47. push -1067319543
  48. push 1915566057 #X
  49. push 1959564765
  50. push 63677771
  51. push 15011598 #H
  52. push 1255156286
  53. push 1037507240
  54. push -1993197973 #H2O
  55. push 2004969680
  56. push 8804422
  57. move top sp
  58. move r1 0
  59. move r2 0
  60. move r3 0
  61. move r4 0
  62.  
  63. #---main loop
  64. loop:
  65. xor slot slot 1
  66. add can port 1 #-canal 1,2,4,5
  67. add can can slot
  68. bdns dr15 next #-skip if machine not set
  69.  
  70. #--check filter state
  71. ls r0 dr15 slot Quantity
  72. ls hash dr15 slot PrefabHash
  73. brgt r0 low 2
  74. s db Setting hash
  75. div r0 r0 100
  76. s dr12 Setting r0
  77.  
  78. #--check filer type
  79. l r0 dr12 On
  80. #bgtz r0 next #-skip if slider on (simple mode!)
  81. xor r0 r0 1
  82. mul rr12 rr12 r0 #-reset if slider on
  83. beqz hash next #-skip if no filter
  84. bnez rr12 test #-go test if type set
  85.  
  86. #-find hash
  87. move sp top
  88. beqz sp error
  89. pop r0
  90. brne r0 hash -2
  91. add r0 sp 1
  92. div r0 r0 3
  93. ceil r0 r0
  94. mul rr12 r0 3
  95. j next
  96.  
  97. test: #-test hash
  98. move sp rr12
  99. sub r3 sp 3
  100. pop r0
  101. beq r0 hash next
  102. brgt sp r3 -2
  103. s dr15 On 0
  104.  
  105. next:
  106. bgtz slot loop
  107. select port port 0 3
  108. bne slot port loop
  109. yield
  110. s db Setting 0
  111. j loop
  112.  
  113. error: #---unknown hash
  114. s db Setting 1005843700
  115. j next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement