Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # GasNeed-Master (1.1.0.3)
- # Writes gas need key to housing based on required
- # ratio settings in cGas1r, cGas2r, ...
- # 1010 : error, missing gas reading device
- alias dHousing db
- alias dMaster d0
- alias dGasRead d1
- # required gas ratios
- define cGas1r 0.40 # returns 1 : RatioOxygen
- define cGas2r 0.06 # RatioCarbonDioxide
- define cGas3r 0.01 # RatioNitrogen
- define cGas4r 0.00 # RatioPollutant
- define cGas5r 0.00 # RatioVolatiles
- define cGas6r 0.00 # RatioWater
- define cGas7r 0.00 # RatioNitrousOxide
- #define cGas8r 0.00 # some new gas
- # registers
- alias rRa r0 # dynamic jump point
- alias rReturn r1
- alias rR r2 # reference
- alias rC r3 # compare
- alias rK r4 # key
- alias rD r5 # defined compare
- # loop
- jLoop:
- move rReturn 1010 # error return
- bdns dGasRead jLoopDone
- move rReturn 0 # default return
- # prepare compare
- l rR dGasRead RatioOxygen # first reference
- select rR rR rR 1 # !zero
- select rD cGas1r cGas1r 1 # !zero
- div rR rR rD # calc ratio
- move rK 0 # init key (raised by fx)
- # init gas key
- l rC dGasRead RatioCarbonDioxide # read compare
- move rD cGas2r
- jal jFxFindNeed
- l rC dGasRead RatioNitrogen
- move rD cGas3r
- jal jFxFindNeed
- l rC dGasRead RatioPollutant
- move rD cGas4r
- jal jFxFindNeed
- l rC dGasRead RatioVolatiles
- move rD cGas5r
- jal jFxFindNeed
- l rC dGasRead RatioWater
- move rD cGas6r
- jal jFxFindNeed
- l rC dGasRead RatioNitrousOxide
- move rD cGas7r
- jal jFxFindNeed
- move rD 1 # set final compare to fulfilled
- jal jFxFindNeed
- #...
- # l rC dGasRead SomeNewGas9
- # div rC rC cGas9r
- # move rK 8
- # jal jFxFindNeed
- jLoopDone:
- s dHousing Setting rReturn
- yield
- j jLoop
- jFxFindNeed:
- add rK rK 1
- select rC rC rC 1 # set fulfilled if zero
- select rD rD rD 1 # set fulfilled if zero
- div rC rC rD
- brge rR 1 3 # reference >= 1 : fulfilled
- brge rR rC 2 # reference >= compare : not priority
- move rReturn rK # set need to gas key
- move rR rC # store compare as new reference
- j ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement