- (BCSdsStore i) = [toChar i]
- (BCSdsFetch i) = [toChar i]
- (BCSdsPublish i) = [toChar i]
- (BCAnalogRead i) = [toChar i]
- (BCAnalogWrite i) = [toChar i]
- (BCDigitalRead i) = [toChar i]
- (BCDigitalWrite i) = [toChar i]
- (BCJmp i) = [toChar i]
- (BCJmpT i) = [toChar i]
- (BCJmpF i) = [toChar i]
- _ = []]
-
-instance Semigroup (ByteCode a p) where
- mappend m n = BC \s->let (b1, (b2, t)) = runBC m <$> runBC m s in (b1 ++ b2, t)
-
-instance Monoid (ByteCode a p) where
- mempty = retrn []
-
-(<++>) infixl 2 :: (ByteCode a p) (ByteCode b q) -> ByteCode c r
-(<++>) m n = BC \s->let (b1, (b2, t)) = runBC n <$> runBC m s in (b1 ++ b2, t)
-
-(<+->) infixr 1
-(<+->) m n :== m <++> retrn n
-
-runBC (BC m) = m
-
-retrn :: ([BC] -> ByteCode a p)
-retrn = BC o tuple
-fmp :: ([BC] -> [BC]) (ByteCode a p) -> ByteCode a p
-fmp f b = BC \s->let (bc, s`) = runBC b s in (f bc, s`)
-
-instance toByteCode Bool where
- toByteCode True = [toChar 1]
- toByteCode False = [toChar 0]
-instance toByteCode Int where toByteCode n = map toChar [n/256,n rem 256]
+ (BCLab i) = {toChar i}
+ (BCSdsStore i) = to16bit i
+ (BCSdsFetch i) = to16bit i
+ (BCSdsPublish i) = to16bit i
+ (BCAnalogRead i) = {toChar i}
+ (BCAnalogWrite i) = {toChar i}
+ (BCDigitalRead i) = {toChar i}
+ (BCDigitalWrite i) = {toChar i}
+ (BCJmp i) = {toChar i}
+ (BCJmpT i) = {toChar i}
+ (BCJmpF i) = {toChar i}
+ _ = ""
+
+instance toByteCode Bool where toByteCode b = toByteCode $ if b 1 0
+instance toByteCode Int where toByteCode n = {toChar $ n/256,toChar $ n rem 256}