Last active
January 27, 2020 20:42
-
-
Save CBenni/24c9a69291c17b4fcf8aed0d6b270b8d to your computer and use it in GitHub Desktop.
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
; loop memory layout: | |
; 0 0 | lf sp \ _ / n 2nmi 2nmi 0 4i 4i | |
[-] | |
; set up characters | |
++++++[->++++>+>+>+<<<<]>- | |
[->+++++>>+>++++>++++>++<<<<<<]> | |
+++>++++>+++>>+++>+ | |
> | |
+++++ ; n | |
[->++>+<<]>>[-<<+>>]<# ; duplicate n into 2nmi and go to first 2nmi (dump 0) | |
[ ; for each i | |
; duplicate 2nmi | |
[->+>+<<]>>[-<<+>>] | |
; go to second 2nmi | |
< | |
; print 2nmi spaces | |
+[- | |
<<<<<<.>>>>>> | |
] | |
; print slash | |
<<<.>>> | |
; duplicate 4i | |
>>[->+>+<<]>>[-<<+>>]< | |
; print 4i spaces | |
[- | |
<<<<<<<<<.>>>>>>>>> | |
] | |
; print backslash and newline | |
<<<<<<<<.<<.>>>>>>>>>> | |
; decrement 2nmi and increase 4i by 4 | |
<++++<<<-- | |
] | |
; reset 2i | |
>>>[-]<<< | |
; roof done | |
[-][ | |
; 2nd loop memory layout: | |
; 0 0 | lf sp \ _ / n n | |
] | |
<[->++++>+<<]>>[-<<+>>]< ; duplicate n | |
; draw space slash underscores a backslash and a newline | |
<<<<<.>>>.>>[-<<<.>>>]<<<<.<<.>>>>>> | |
[-][ | |
; 3rd loop memory layout: | |
; 0 0 | lf sp \ _ / n 4np1mi 4np1mim2 0 2i 2i 2i 0 | |
] | |
<[->++++>+<<]>>[-<<+>>]< ; duplicate n into 4np1mi and go to 4np1mi | |
++++ | |
[ | |
; duplicate 4nmi and subtract 2 from 4np1mim2 | |
[->+>+<<]>---->[-<<+>>] | |
; print pipe | |
<<<<<<<<<.>>>>>>>>>> | |
; duplicate 2i twice | |
[->+>+>+<<<]>>>[-<<<+>>>]<< | |
; print 2i spaces | |
[-<<<<<<<<<.>>>>>>>>>] | |
; print backslash | |
<<<<<<<<.>>>>>>>> | |
; print 4np1mim2 spaces | |
<<<[-<<<<<<.>>>>>>] | |
; print slash | |
<<<.>>>>>>> | |
; print 2i spaces | |
[-<<<<<<<<<<.>>>>>>>>>>]< | |
; increment 2i | |
<++ | |
; print pipe and newline | |
<<< <<<<<<<.>.>>>>>> | |
; decrement 4nmi | |
---- | |
] | |
; reset 2i | |
>>>[-]<<< | |
[-][ | |
; 4th loop memory layout: | |
; 0 0 | lf sp \ _ / n 2nmi 0 2nmi 2nmi 4i 4i 0 | |
] | |
<[->++>+<<]>>[-<<+>>]< ; duplicate n into 2nmi | |
[ | |
; duplicate 2nmi twice | |
[->+>+>+<<<]>[-<+>] (dump 1) | |
; print pipe | |
<<<<<<<<.>>>>>>>> | |
; print 2mni spaces | |
>[-<<<<<<<.>>>>>>>] | |
; print slash | |
<<<<.>>>> | |
; duplicate 4i and go to second | |
>>[->+>+<<]>>[-<<+>>]< | |
; print 4i spaces | |
[-<<<<<<<<<<.>>>>>>>>>>] | |
; print backslash | |
<<<<<<<<<.>>>>>>>>> | |
; print 2mni spaces | |
<<[-<<<<<<<<.>>>>>>>>] | |
; increment 4i | |
>++++< | |
; print pipe and newline | |
<<<<<<<<<<.>.>>>>>>>>> | |
; decrement iterator | |
<<<-- | |
] | |
; null 4i | |
>>>>[-]<<<< | |
[-][ | |
; 5th loop memory layout: | |
; 0 0 | lf sp \ _ / n n | |
] | |
<[->++++>+<<]>>[-<<+>>]< ; duplicate n | |
; draw pipe slash underscores a backslash a pipe and a newline | |
<<<<<<<.>>>>>.>>[-<<<.>>>]<<<<.<<<.>. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment