X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mTaskInterpret.icl;h=2d2005a6cdff2e8de78faf5fce3ff46d18a2736a;hb=e19299be4b02b01fdf187418f15ddcdead25fd5a;hp=697ce50da46fc200d6d9b8b0d73d13b47189e69d;hpb=ac7af718140b7b2950c52ae1a45ac16a3a7d0fbc;p=mTask.git diff --git a/mTaskInterpret.icl b/mTaskInterpret.icl index 697ce50..2d2005a 100644 --- a/mTaskInterpret.icl +++ b/mTaskInterpret.icl @@ -160,11 +160,14 @@ instance fromByteCode MTaskInterval = OnInterrupt $ fromByteCode s bitand 127 instance fromByteCode MTaskDeviceSpec where fromByteCode s = let c = toInt s.[0] in - {MTaskDeviceSpec - |haveLed=(c bitand 1) > 0 - ,haveAio=(c bitand 2) > 0 - ,haveDio=(c bitand 4) > 0 - ,bytesMemory=from16bit $ s % (1,3) + { MTaskDeviceSpec + | haveLed = (c bitand 1) > 0 + , haveAio = (c bitand 2) > 0 + , haveDio = (c bitand 4) > 0 + , bytesMemory = from16bit $ s % (1,3) + , stackSize = from16bit $ s % (3,5) + , aPins = toInt s.[5] + , dPins = toInt s.[6] } derive gPrint Long, UserLED, Button, AnalogPin, DigitalPin, PinMode, Pin, BC, MTaskDeviceSpec @@ -252,8 +255,8 @@ BCIfStmt (BC b) (BC t) (BC e) = BC $ t >>| tell [BCJmp endif, BCLab else] >>| e >>| tell [BCLab endif] -freshl = get >>= \st=:{freshl=[fr:frs]}->put {st & freshl=frs} >>| pure fr -freshs = get >>= \st=:{freshs=[fr:frs]}->put {st & freshs=frs} >>| pure fr +freshl = get >>= \st=:{freshl}->put ({st & freshl=freshl+1}) >>| pure freshl +freshs = get >>= \st=:{freshs}->put ({st & freshs=freshs+1}) >>| pure freshs instance noOp ByteCode where noOp = tell` [BCNop] @@ -301,7 +304,7 @@ instance retrn ByteCode where retrn = tell` [BCReturn] instance zero BCState where - zero = {freshl=[1..], freshs=[1..], sdss=[]} + zero = {freshl=1, freshs=1, sdss=[]} toRealByteCode :: (ByteCode a b) BCState -> (String, BCState) toRealByteCode x s