Created
May 17, 2012 14:41
-
-
Save mattcan/2719365 to your computer and use it in GitHub Desktop.
A program that counts to ten, outputting each value along the way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
++++++++++ set loop counter to ten | |
[ | |
>>>>+++ increase 5th cell by 3 | |
<<<<- decrease loop counter | |
] | |
>>>>++ increase 5th cell by 2 to make the 'Space' ASCII code | |
<<<<++++++++++ reuse 1st cell as loop counter increase to ten | |
[ | |
>+++++ increase 2nd cell by 5 | |
>+++++ increase 3rd cell by 5 | |
>+++++ increase 4th cell by 5 | |
<<<- decrease loop counter | |
] | |
>-- 2nd cell = 48 :: ASCII for 0 | |
>- 3rd cell = 49 :: ASCII for 1 | |
>-- 4th cell = 48 :: ASCII for 0 | |
<<<+++++++++ reset and reuse loop counter | |
[ | |
>+. increase 2nd cell by 1 and ouput to screen | |
>>>. output the saved 'Space' in 5th cell | |
<<<<- decrease loop counter | |
] | |
>>. output 3rd cell = ASCII 1 | |
>. output 4th cell = ASCII 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment