Add Brainfuck Interpreter #357
28
programs/develop/brainfuck/Readme.md
Normal file
28
programs/develop/brainfuck/Readme.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# KolibriOS Brainfuck Interpreter
|
||||
|
||||
A port of my Linux Brainfuck Interpreter (`bf-x86asm-compiler`) to KolibriOS.
|
||||
|
||||
## Program Versions
|
||||
This repository contains two implementations using different KolibriOS environments:
|
||||
1. **bf_console_interp.asm**: Uses the `console.obj` library for the console GUI
|
||||
2. **bf_shell_interp.asm**: Uses the `shell.inc` (which uses a shared memory and IPC to communicate with the shell)
|
||||
|
||||
|
||||
## Technical Details
|
||||
The interpreter uses direct threaded dispatch via a jump table for execution, and includes run-length encoding preprocessing for repeated instructions. On bf_console_interp.asm output is line buffered, to minimize screen redraws on the console. Since console output on KolibriOS seems to triggers immediate rerendering of the whole screen
|
||||
|
||||
## Limitations
|
||||
The interpreter has all the limitations in the original project and also the elf-compiler was not ported
|
||||
Original interpreter repo: [link](https://github.com/danieldamilare/bf-x86asm-compiler/tree/master)
|
||||
|
||||
|
||||
## Code Style
|
||||
|
||||
Follows KolibriOS coding conventions:
|
||||
- 8-space indentation for commands
|
||||
- Labels on separate lines
|
||||
- Function documentation with inputs/outputs
|
||||
- UTF-8 encoding without BOM
|
||||
|
||||
|
||||
|
||||
20
programs/develop/brainfuck/examples/addtwonums.bf
Normal file
20
programs/develop/brainfuck/examples/addtwonums.bf
Normal file
@@ -0,0 +1,20 @@
|
||||
++ Cell c0 = 2
|
||||
> +++++ Cell c1 = 5
|
||||
|
||||
[ Start your loops with your cell pointer on the loop counter (c1 in our case)
|
||||
< + Add 1 to c0
|
||||
> - Subtract 1 from c1
|
||||
] End your loops with the cell pointer on the loop counter
|
||||
|
||||
At this point our program has added 5 to 2 leaving 7 in c0 and 0 in c1
|
||||
BUT we cannot output this value to the terminal since it's not ASCII encoded!
|
||||
|
||||
To display the ASCII character "7" we must add 48 to the value 7!
|
||||
48 = 6 * 8 so let's use another loop to help us!
|
||||
|
||||
++++ ++++ c1 = 8 and this will be our loop counter again
|
||||
[
|
||||
< +++ +++ Add 6 to c0
|
||||
> - Subtract 1 from c1
|
||||
]
|
||||
< . Print out c0 which has the value 55 which translates to "7"!
|
||||
33
programs/develop/brainfuck/examples/beer.bf
Normal file
33
programs/develop/brainfuck/examples/beer.bf
Normal file
@@ -0,0 +1,33 @@
|
||||
99 bottles in 1752 brainfuck instructions
|
||||
by jim crawford (http://www (dot) goombas (dot) org/)
|
||||
>++++++++++[<++++++++++>-]<->>>>>+++[>+++>+++<<-]<<<<+<[>[>+
|
||||
>+<<-]>>[-<<+>>]++++>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<[[-]>>
|
||||
>>>>[[-]<++++++++++<->>]<-[>+>+<<-]>[<+>-]+>[[-]<->]<<<<<<<<
|
||||
<->>]<[>+>+<<-]>>[-<<+>>]+>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<
|
||||
<[>>+>+<<<-]>>>[-<<<+>>>]++>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<
|
||||
<[>+<[-]]<[>>+<<[-]]>>[<<+>>[-]]<<<[>>+>+<<<-]>>>[-<<<+>>>]+
|
||||
+++>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<[>+<[-]]<[>>+<<[-]]>>[<
|
||||
<+>>[-]]<<[[-]>>>++++++++[>>++++++<<-]>[<++++++++[>++++++<-]
|
||||
>.<++++++++[>------<-]>[<<+>>-]]>.<<++++++++[>>------<<-]<[-
|
||||
>>+<<]<++++++++[<++++>-]<.>+++++++[>+++++++++<-]>+++.<+++++[
|
||||
>+++++++++<-]>.+++++..--------.-------.++++++++++++++>>[>>>+
|
||||
>+<<<<-]>>>>[-<<<<+>>>>]>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<<<
|
||||
[>>>+>+<<<<-]>>>>[-<<<<+>>>>]+>+<[-<->]<[[-]>>-<<]>>[[-]<<+>
|
||||
>]<<<[>>+<<[-]]>[>+<[-]]++>>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<
|
||||
+<[[-]>-<]>[<<<<<<<.>>>>>>>[-]]<<<<<<<<<.>>----.---------.<<
|
||||
.>>----.+++..+++++++++++++.[-]<<[-]]<[>+>+<<-]>>[-<<+>>]+>+<
|
||||
[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<<[>>+>+<<<-]>>>[-<<<+>>>]++++
|
||||
>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<[>+<[-]]<[>>+<<[-]]>>[<<+>
|
||||
>[-]]<<[[-]>++++++++[<++++>-]<.>++++++++++[>+++++++++++<-]>+
|
||||
.-.<<.>>++++++.------------.---.<<.>++++++[>+++<-]>.<++++++[
|
||||
>----<-]>++.+++++++++++..[-]<<[-]++++++++++.[-]]<[>+>+<<-]>>
|
||||
[-<<+>>]+++>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<[[-]++++++++++.
|
||||
>+++++++++[>+++++++++<-]>+++.+++++++++++++.++++++++++.------
|
||||
.<++++++++[>>++++<<-]>>.<++++++++++.-.---------.>.<-.+++++++
|
||||
++++.++++++++.---------.>.<-------------.+++++++++++++.-----
|
||||
-----.>.<++++++++++++.---------------.<+++[>++++++<-]>..>.<-
|
||||
---------.+++++++++++.>.<<+++[>------<-]>-.+++++++++++++++++
|
||||
.---.++++++.-------.----------.[-]>[-]<<<.[-]]<[>+>+<<-]>>[-
|
||||
<<+>>]++++>+<[-<->]<[[-]>>-<<]>>[[-]<<+>>]<<[[-]++++++++++.[
|
||||
-]<[-]>]<+<]
|
||||
|
||||
7
programs/develop/brainfuck/examples/count1to5.bf
Normal file
7
programs/develop/brainfuck/examples/count1to5.bf
Normal file
@@ -0,0 +1,7 @@
|
||||
Prints 1 to 5 by using a loop that increments c0
|
||||
The loop counter is in c1
|
||||
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++
|
||||
|
||||
>+++++
|
||||
[<+.>-]
|
||||
35
programs/develop/brainfuck/examples/dbf2c.bf
Normal file
35
programs/develop/brainfuck/examples/dbf2c.bf
Normal file
@@ -0,0 +1,35 @@
|
||||
+++[>+++++<-]>>+<[>>++++>++>+++++>+++++>+>>+<++[++<]>---]
|
||||
|
||||
>++++.>>>.+++++.>------.<--.+++++++++.>+.+.<<<<---.[>]<<.<<<.-------.>++++.
|
||||
<+++++.+.>-----.>+.<++++.>>++.>-----.
|
||||
|
||||
<<<-----.+++++.-------.<--.<<<.>>>.<<+.>------.-..--.+++.-----<++.<--[>+<-]
|
||||
>>>>>--.--.<++++.>>-.<<<.>>>--.>.
|
||||
|
||||
<<<<-----.>----.++++++++.----<+.+++++++++>>--.+.++<<<<.[>]<.>>
|
||||
|
||||
,[>>+++[<+++++++>-]<[<[-[-<]]>>[>]<-]<[<+++++>-[<+++>-[<-->-[<+++>-
|
||||
[<++++[>[->>]<[>>]<<-]>[<+++>-[<--->-[<++++>-[<+++[>[-[-[-[->>]]]]<[>>]<<-]
|
||||
>[<+>-[<->-[<++>-[<[-]>-]]]]]]]]]]]]]
|
||||
|
||||
<[
|
||||
-[-[>+<-]>]
|
||||
<[<<<<.>+++.+.+++.-------.>---.++.<.>-.++<<<<.[>]>>>>>>>>>]
|
||||
<[[<]>++.--[>]>>>>>>>>]
|
||||
<[<<++..-->>>>>>]
|
||||
<[<<..>>>>>]
|
||||
<[<<..-.+>>>>]
|
||||
<[<<++..---.+>>>]
|
||||
<[<<<.>>.>>>>>]
|
||||
<[<<<<-----.+++++>.----.+++.+>---.<<<-.[>]>]
|
||||
<[<<<<.-----.>++++.<++.+++>----.>---.<<<.-[>]]
|
||||
<[<<<<<----.>>.<<.+++++.>>>+.++>.>>]
|
||||
<.>
|
||||
]>
|
||||
,]
|
||||
|
||||
<<<<<.<+.>++++.<----.>>---.<<<-.>>>+.>.>.[<]>++.[>]<.
|
||||
>[Translates brainfuck to C. Assumes no-change-on-EOF or EOF->0.
|
||||
Generated C does no-change-on-EOF, and uses unistd.h read and write calls.
|
||||
Daniel B Cristofani (cristofdathevanetdotcom)
|
||||
http://www.hevanet.com/cristofd/brainfuck/]
|
||||
15
programs/develop/brainfuck/examples/dquine.bf
Normal file
15
programs/develop/brainfuck/examples/dquine.bf
Normal file
@@ -0,0 +1,15 @@
|
||||
>+++++>+++>+++>+++++>+++>+++>+++++>++++++>+>++>+++>++++>++++>+++>+++>+++++>+>+
|
||||
>++++>+++++++>+>+++++>+>+>+++++>++++++>+++>+++>++>+>+>++++>++++++>++++>++++>+++
|
||||
>+++++>+++>+++>++++>++>+>+>+>+>++>++>++>+>+>++>+>+>++++++>++++++>+>+>++++++
|
||||
>++++++>+>+>+>+++++>++++++>+>+++++>+++>+++>++++>++>+>+>++>+>+>++>++>+>+>++>++>+
|
||||
>+>+>+>++>+>+>+>++++>++>++>+>+++++>++++++>+++>+++>+++>+++>+++>+++>++>+>+>+>+>++
|
||||
>+>+>++++>+++>+++>+++>+++++>+>+++++>++++++>+>+>+>++>+++>+++>+++++++>+++>++++>+
|
||||
>++>+>+++++++>++++++>+>+++++>++++++>+++>+++>++>++>++>++>++>++>+>++>++>++>++>++
|
||||
>++>++>++>++>+>++++>++>++>++>++>++>++>++>+++++>++++++>++++>+++>+++++>++++++>++++
|
||||
>+++>+++>++++>+>+>+>+>+++++>+++>+++++>++++++>+++>+++>+++>++>+>+>+>++++>++++
|
||||
[[>>>+<<<-]<]>>>>[<<[-]<[-]+++++++[>+++++++++>++++++<<-]>-.>+>[<.<<+>>>-]>]
|
||||
<<<[>>+>>>>+<<<<<<-]>++[>>>+>>>>++>>++>>+>>+[<<]>-]>>>-->>-->>+>>+++>>>>+[<<]
|
||||
<[[-[>>+<<-]>>]>.[>>]<<[[<+>-]<<]<<]
|
||||
[Quine. Tidy (and portable, naturally) but not very short.
|
||||
Daniel B Cristofani (cristofdathevanetdotcom)
|
||||
http://www.hevanet.com/cristofd/brainfuck/]
|
||||
199
programs/develop/brainfuck/examples/factor.bf
Normal file
199
programs/develop/brainfuck/examples/factor.bf
Normal file
@@ -0,0 +1,199 @@
|
||||
[
|
||||
Takes an integer from stdin and emits its factors to stdout
|
||||
|
||||
Factor an arbitrarily large positive integer
|
||||
|
||||
Copyright (C) 1999 by Brian Raiter
|
||||
under the GNU General Public License
|
||||
]
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-
|
||||
|
||||
*
|
||||
* read in the number
|
||||
*
|
||||
|
||||
<<<<<<<<<+
|
||||
[-[>>>>>>>>>>][-]<<<<<<<<<<[[->>>>>>>>>>+<<<<<<<<<<]<<<<<<<<<<]
|
||||
>>>>>>>>>>,----------]
|
||||
>>>>>>>>>>[------------------------------------->>>>>>>>>->]
|
||||
<[+>[>>>>>>>>>+>]<-<<<<<<<<<<]-
|
||||
|
||||
*
|
||||
* display the number and initialize the loop variable to two
|
||||
*
|
||||
|
||||
[>++++++++++++++++++++++++++++++++++++++++++++++++.
|
||||
------------------------------------------------<<<<<<<<<<<]
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
|
||||
--------------------------.[-]
|
||||
>>>>>>>>>>>>++<<<<+
|
||||
|
||||
*
|
||||
* the main loop
|
||||
*
|
||||
|
||||
[ [-]>>
|
||||
|
||||
*
|
||||
* make copies of the number and the loop variable
|
||||
*
|
||||
|
||||
[>>>>[-]>[-]>[-]>[-]
|
||||
>[-]>[-]
|
||||
<<<<<<<[->>>+>+<<<<]>>>>>>>>]
|
||||
<<<<<<<<<<[>>>>>>[-<<<<+>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>[->>>+>>+<<<<<]>>>>>>>>>]
|
||||
<<<<<<<<<<[>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
|
||||
*
|
||||
* divide the number by the loop variable
|
||||
*
|
||||
|
||||
[>>>[-]>>>[-]>[-]>>>] initialize
|
||||
<<<<<<<<<<[<<<<<<<<<<]
|
||||
>>>>>>>>>[-]>>>>>>>+<<<<<<<<[+]+
|
||||
[ ->> double divisor until above dividend
|
||||
[>>>>>>[->++<]>>>>]<<<<<<<<<<
|
||||
[>>>>>>>>[-]>[-]
|
||||
<<<<[->>>++<<<]<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<
|
||||
[->--------->>>>>>>>>+<<<<<<<<<<[->+<]]]]]]]]]]]>>]
|
||||
<<<<<<<<<<[>>>>>>>>>[-<+<<<+>>>>]<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>
|
||||
[-<--------->>>>>>>>>>>+<<<<<<<<<<[-<+>]]]]]]]]]]]>>>]
|
||||
<<<<<<<<<<
|
||||
[>>>>[->>>+>>+<<<<<]<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>>[>>>>>>>[-<<<+>>>]>>>]<<<<<<<<<<
|
||||
[>>>>>>>>[->-<]>
|
||||
[<<<<<<<<<[<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>>>>>>>>>>>]
|
||||
<<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>[+[+[+[+[+[+[+[+[+[+[[-]<+>]]]]]]]]]]]<
|
||||
]
|
||||
>>>>>>>>
|
||||
[ subtract divisor from dividend
|
||||
<<<<<<
|
||||
[>>>>>>>>[-]>[-]<<<<<[->>>+>+<<<<]>>>>>>]<<<<<<<<<<
|
||||
[>>>>>>>>[-<<<<+>>>>]<<<[->>>+>+<<<<]<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>>[-<<<<+>>>>]>]<<<<<<<<<<
|
||||
[>>>>>>>>[-<->]<<<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<
|
||||
[++++++++++[+>-<]>>>>>>>>>>-<<<<<<<<<<]]]]]]]]]]]>>>]
|
||||
>>>>>>>+
|
||||
[ if difference is nonnegative then
|
||||
[-]<<<<<<<<<<<<<<<<< replace dividend and increment quotient
|
||||
[>>>>[-]>>>>[-<<<<+>>>>]<<[->>+<<]<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>[->+<<<+>>]>>]<<<<<<<<<<
|
||||
[>>>[->>>>>>+<<<<<<]<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>>[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<--------->>>>>>>>>>>>>>>>+<<<<<<<<<<
|
||||
[-<<<<<<+>>>>>>]]]]]]]]]]]>]
|
||||
>>>>>>>
|
||||
] halve divisor and loop until zero
|
||||
<<<<<<<<<<<<<<<<<[<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>[-]<<[->+<]<[->>>+<<<]>>>>>]<<<<<<<<<<
|
||||
[+>>>>>>>[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>]]]]]]]]]<<<<<<<
|
||||
[->>>>>>>+<<<<<<<]-<<<<<<<<<<]
|
||||
>>>>>>>
|
||||
[-<<<<<<<<<<<+>>>>>>>>>>>]
|
||||
>>>[>>>>>>>[-<<<<<<<<<<<+++++>>>>>>>>>>>]>>>]<<<<<<<<<<
|
||||
[+>>>>>>>>[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>]]]]]]]]]<<<<<<<<
|
||||
[->>>>>>>>+<<<<<<<<]-<<<<<<<<<<]
|
||||
>>>>>>>>[-<<<<<<<<<<<<<+>>>>>>>>>>>>>]>>
|
||||
[>>>>>>>>[-<<<<<<<<<<<<<+++++>>>>>>>>>>>>>]>>]<<<<<<<<<<
|
||||
[<<<<<<<<<<]>>>>>>>>>>
|
||||
>>>>>>
|
||||
]
|
||||
<<<<<<
|
||||
|
||||
*
|
||||
* make copies of the loop variable and the quotient
|
||||
*
|
||||
|
||||
[>>>[->>>>+>+<<<<<]>>>>>>>]
|
||||
<<<<<<<<<<
|
||||
[>>>>>>>[-<<<<+>>>>]<<<<<[->>>>>+>>+<<<<<<<]<<<<<<<<<<<<]
|
||||
>>>>>>>>>>[>>>>>>>[-<<<<<+>>>>>]>>>]<<<<<<<<<<
|
||||
|
||||
*
|
||||
* break out of the loop if the quotient is larger than the loop variable
|
||||
*
|
||||
|
||||
[>>>>>>>>>[-<->]<
|
||||
[<<<<<<<<
|
||||
[<<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>[>-<[+[+[+[+[+[+[+[+[+[[-]>+<]]]]]]]]]]]>+
|
||||
|
||||
[ [-]
|
||||
|
||||
*
|
||||
* partially increment the loop variable
|
||||
*
|
||||
|
||||
<[-]+>>>>+>>>>>>>>[>>>>>>>>>>]<<<<<<<<<<
|
||||
|
||||
*
|
||||
* examine the remainder for nonzero digits
|
||||
*
|
||||
|
||||
[<<<<<<[<<<<[<<<<<<<<<<]>>>>+<<<<<<<<<<]<<<<]
|
||||
>>>>>>>>>>>>>>>>>>>>[>>>>>>>>>>]<<<<<<<<<<[<<<<<<<<<<]
|
||||
>>>>-
|
||||
|
||||
[ [+]
|
||||
|
||||
*
|
||||
* decrement the loop variable and replace the number with the quotient
|
||||
*
|
||||
|
||||
>>>>>>>>-<<[>[-]>>[-<<+>>]>>>>>>>]<<<<<<<<<<
|
||||
|
||||
*
|
||||
* display the loop variable
|
||||
*
|
||||
|
||||
[+>>[>>>>>>>>+>>]<<-<<<<<<<<<<]-
|
||||
[>>++++++++++++++++++++++++++++++++++++++++++++++++.
|
||||
------------------------------------------------<<<<<<<<<<<<]
|
||||
++++++++++++++++++++++++++++++++.[-]>>>>
|
||||
|
||||
]
|
||||
|
||||
*
|
||||
* normalize the loop variable
|
||||
*
|
||||
|
||||
>>>>>>
|
||||
[>>[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>--------->>>>>+<<<<<<<<<<
|
||||
[->>>>>+<<<<<]]]]]]]]]]]>>>>>>>>]
|
||||
<<<<<<<<<<[>>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>
|
||||
|
||||
]<
|
||||
|
||||
]>>
|
||||
|
||||
*
|
||||
* display the number and end
|
||||
*
|
||||
|
||||
[>>>>>>>>>>]<<<<<<<<<<[+>[>>>>>>>>>+>]<-<<<<<<<<<<]-
|
||||
[>++++++++++++++++++++++++++++++++++++++++++++++++.<<<<<<<<<<<]
|
||||
++++++++++.
|
||||
199
programs/develop/brainfuck/examples/factorize.bf
Normal file
199
programs/develop/brainfuck/examples/factorize.bf
Normal file
@@ -0,0 +1,199 @@
|
||||
[
|
||||
Takes an integer from stdin and emits its factors to stdout
|
||||
|
||||
Factor an arbitrarily large positive integer
|
||||
|
||||
Copyright (C) 1999 by Brian Raiter
|
||||
under the GNU General Public License
|
||||
]
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-
|
||||
|
||||
*
|
||||
* read in the number
|
||||
*
|
||||
|
||||
<<<<<<<<<+
|
||||
[-[>>>>>>>>>>][-]<<<<<<<<<<[[->>>>>>>>>>+<<<<<<<<<<]<<<<<<<<<<]
|
||||
>>>>>>>>>>,----------]
|
||||
>>>>>>>>>>[------------------------------------->>>>>>>>>->]
|
||||
<[+>[>>>>>>>>>+>]<-<<<<<<<<<<]-
|
||||
|
||||
*
|
||||
* display the number and initialize the loop variable to two
|
||||
*
|
||||
|
||||
[>++++++++++++++++++++++++++++++++++++++++++++++++.
|
||||
------------------------------------------------<<<<<<<<<<<]
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
|
||||
--------------------------.[-]
|
||||
>>>>>>>>>>>>++<<<<+
|
||||
|
||||
*
|
||||
* the main loop
|
||||
*
|
||||
|
||||
[ [-]>>
|
||||
|
||||
*
|
||||
* make copies of the number and the loop variable
|
||||
*
|
||||
|
||||
[>>>>[-]>[-]>[-]>[-]
|
||||
>[-]>[-]
|
||||
<<<<<<<[->>>+>+<<<<]>>>>>>>>]
|
||||
<<<<<<<<<<[>>>>>>[-<<<<+>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>[->>>+>>+<<<<<]>>>>>>>>>]
|
||||
<<<<<<<<<<[>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
|
||||
*
|
||||
* divide the number by the loop variable
|
||||
*
|
||||
|
||||
[>>>[-]>>>[-]>[-]>>>] initialize
|
||||
<<<<<<<<<<[<<<<<<<<<<]
|
||||
>>>>>>>>>[-]>>>>>>>+<<<<<<<<[+]+
|
||||
[ ->> double divisor until above dividend
|
||||
[>>>>>>[->++<]>>>>]<<<<<<<<<<
|
||||
[>>>>>>>>[-]>[-]
|
||||
<<<<[->>>++<<<]<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<
|
||||
[->--------->>>>>>>>>+<<<<<<<<<<[->+<]]]]]]]]]]]>>]
|
||||
<<<<<<<<<<[>>>>>>>>>[-<+<<<+>>>>]<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>
|
||||
[-<--------->>>>>>>>>>>+<<<<<<<<<<[-<+>]]]]]]]]]]]>>>]
|
||||
<<<<<<<<<<
|
||||
[>>>>[->>>+>>+<<<<<]<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>>[>>>>>>>[-<<<+>>>]>>>]<<<<<<<<<<
|
||||
[>>>>>>>>[->-<]>
|
||||
[<<<<<<<<<[<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>>>>>>>>>>>]
|
||||
<<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>[+[+[+[+[+[+[+[+[+[+[[-]<+>]]]]]]]]]]]<
|
||||
]
|
||||
>>>>>>>>
|
||||
[ subtract divisor from dividend
|
||||
<<<<<<
|
||||
[>>>>>>>>[-]>[-]<<<<<[->>>+>+<<<<]>>>>>>]<<<<<<<<<<
|
||||
[>>>>>>>>[-<<<<+>>>>]<<<[->>>+>+<<<<]<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>>[-<<<<+>>>>]>]<<<<<<<<<<
|
||||
[>>>>>>>>[-<->]<<<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<
|
||||
[++++++++++[+>-<]>>>>>>>>>>-<<<<<<<<<<]]]]]]]]]]]>>>]
|
||||
>>>>>>>+
|
||||
[ if difference is nonnegative then
|
||||
[-]<<<<<<<<<<<<<<<<< replace dividend and increment quotient
|
||||
[>>>>[-]>>>>[-<<<<+>>>>]<<[->>+<<]<<<<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>[->+<<<+>>]>>]<<<<<<<<<<
|
||||
[>>>[->>>>>>+<<<<<<]<<<<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>>[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>
|
||||
[-<<<<<<+>>>>>>[-<<<<<<--------->>>>>>>>>>>>>>>>+<<<<<<<<<<
|
||||
[-<<<<<<+>>>>>>]]]]]]]]]]]>]
|
||||
>>>>>>>
|
||||
] halve divisor and loop until zero
|
||||
<<<<<<<<<<<<<<<<<[<<<<<<<<<<]>>>>>>>>>>
|
||||
[>>>>>>>>[-]<<[->+<]<[->>>+<<<]>>>>>]<<<<<<<<<<
|
||||
[+>>>>>>>[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>
|
||||
[-<<<<<<<+>>>>>>>]]]]]]]]]<<<<<<<
|
||||
[->>>>>>>+<<<<<<<]-<<<<<<<<<<]
|
||||
>>>>>>>
|
||||
[-<<<<<<<<<<<+>>>>>>>>>>>]
|
||||
>>>[>>>>>>>[-<<<<<<<<<<<+++++>>>>>>>>>>>]>>>]<<<<<<<<<<
|
||||
[+>>>>>>>>[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>
|
||||
[-<<<<<<<<+>>>>>>>>]]]]]]]]]<<<<<<<<
|
||||
[->>>>>>>>+<<<<<<<<]-<<<<<<<<<<]
|
||||
>>>>>>>>[-<<<<<<<<<<<<<+>>>>>>>>>>>>>]>>
|
||||
[>>>>>>>>[-<<<<<<<<<<<<<+++++>>>>>>>>>>>>>]>>]<<<<<<<<<<
|
||||
[<<<<<<<<<<]>>>>>>>>>>
|
||||
>>>>>>
|
||||
]
|
||||
<<<<<<
|
||||
|
||||
*
|
||||
* make copies of the loop variable and the quotient
|
||||
*
|
||||
|
||||
[>>>[->>>>+>+<<<<<]>>>>>>>]
|
||||
<<<<<<<<<<
|
||||
[>>>>>>>[-<<<<+>>>>]<<<<<[->>>>>+>>+<<<<<<<]<<<<<<<<<<<<]
|
||||
>>>>>>>>>>[>>>>>>>[-<<<<<+>>>>>]>>>]<<<<<<<<<<
|
||||
|
||||
*
|
||||
* break out of the loop if the quotient is larger than the loop variable
|
||||
*
|
||||
|
||||
[>>>>>>>>>[-<->]<
|
||||
[<<<<<<<<
|
||||
[<<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>[>-<[+[+[+[+[+[+[+[+[+[[-]>+<]]]]]]]]]]]>+
|
||||
|
||||
[ [-]
|
||||
|
||||
*
|
||||
* partially increment the loop variable
|
||||
*
|
||||
|
||||
<[-]+>>>>+>>>>>>>>[>>>>>>>>>>]<<<<<<<<<<
|
||||
|
||||
*
|
||||
* examine the remainder for nonzero digits
|
||||
*
|
||||
|
||||
[<<<<<<[<<<<[<<<<<<<<<<]>>>>+<<<<<<<<<<]<<<<]
|
||||
>>>>>>>>>>>>>>>>>>>>[>>>>>>>>>>]<<<<<<<<<<[<<<<<<<<<<]
|
||||
>>>>-
|
||||
|
||||
[ [+]
|
||||
|
||||
*
|
||||
* decrement the loop variable and replace the number with the quotient
|
||||
*
|
||||
|
||||
>>>>>>>>-<<[>[-]>>[-<<+>>]>>>>>>>]<<<<<<<<<<
|
||||
|
||||
*
|
||||
* display the loop variable
|
||||
*
|
||||
|
||||
[+>>[>>>>>>>>+>>]<<-<<<<<<<<<<]-
|
||||
[>>++++++++++++++++++++++++++++++++++++++++++++++++.
|
||||
------------------------------------------------<<<<<<<<<<<<]
|
||||
++++++++++++++++++++++++++++++++.[-]>>>>
|
||||
|
||||
]
|
||||
|
||||
*
|
||||
* normalize the loop variable
|
||||
*
|
||||
|
||||
>>>>>>
|
||||
[>>[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>+<<<<<
|
||||
[->>>>>+<<<<<[->>>>>--------->>>>>+<<<<<<<<<<
|
||||
[->>>>>+<<<<<]]]]]]]]]]]>>>>>>>>]
|
||||
<<<<<<<<<<[>>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<<]
|
||||
>>>>>>>>>
|
||||
|
||||
]<
|
||||
|
||||
]>>
|
||||
|
||||
*
|
||||
* display the number and end
|
||||
*
|
||||
|
||||
[>>>>>>>>>>]<<<<<<<<<<[+>[>>>>>>>>>+>]<-<<<<<<<<<<]-
|
||||
[>++++++++++++++++++++++++++++++++++++++++++++++++.<<<<<<<<<<<]
|
||||
++++++++++.
|
||||
709
programs/develop/brainfuck/examples/hanoi.bf
Normal file
709
programs/develop/brainfuck/examples/hanoi.bf
Normal file
@@ -0,0 +1,709 @@
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>[-]>[-]+++++++++++++++++++++++++++.++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++.-------------------.-------
|
||||
--------------------------------------.+++++++++++++++++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++++.-----------------------------------------.++++++
|
||||
++++++++++++++++++.[-]+++++++++++++++++++++++++++.++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++.-------------------------------------
|
||||
----.+++++++++.---------.+++++.+++++++++++++++++.++++++++++++.++++++++++++++
|
||||
+++++++++++++.++++++++.------------------.+++++++++++++.+.------------------
|
||||
-----------------------------------------------------------------.++++++++++
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------
|
||||
---.----------------------------------------------------------------------.+
|
||||
+++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++.++++++++++
|
||||
+++.+.------.---------------------------------------------------------------
|
||||
----------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++.+++++.-------------------------------------------------------------
|
||||
-----------------.++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++.-----------------.++++++++.+++++.--------.--------
|
||||
----------------------------------------------------.+++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++.++++++++.[-]+++++++++++++++++++++++++++.+
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------------
|
||||
----------------------------.++++++++.----------.++++.+++++++++++++++++++.++
|
||||
+++++++++++++.+++++++++++++++++++++++++++.---------.+++++++++++..-----------
|
||||
----.+++++++++.-------------------------------------------------------------
|
||||
-----------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++.+++++++++++++++++++++++.-------------------------------------------
|
||||
----------------------------------------------.+++++++++++++++++++++++++++++
|
||||
++++++.+++++++++++++++++++++++++++++++++++++++++.---.---..+++++++++.+++.----
|
||||
----------.-----------------------------------------------------------------
|
||||
---.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++
|
||||
++++++++.---.------.--------------------------------------------------------
|
||||
--------------.++++++++++++++++++++++++++++.++++++++++++++++++++++++++++++++
|
||||
++++++++++++.++++++++++++..----.--------------------------------------------
|
||||
----------.-----------..++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++...-----------------------------------------------------
|
||||
--------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++.+
|
||||
++++++++.---.---..+++++++++.+++.--------------.-----------------------------
|
||||
-------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+.+++++++++++++++++++.------------------------------------------------------
|
||||
---------------.+++++++++++++++++++++++++++++++++++++++++++++++++++.++++.---
|
||||
.+++++++++++++.+++++.-------------------------------------------------------
|
||||
---------------.+++++++++++++++.[-]>[-]+++++++++>[-]+++>>[-]>[-]<<<<<[->>>>>
|
||||
+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<
|
||||
<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]
|
||||
>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-
|
||||
<<+>>]<<<[-]+>>>][-]<[->+<]>[[-<+>]<<<[-]+>>>]<<<[>[-]++++++++++++++++++++++
|
||||
+++++++++++++++++++++++>[-]<<<<<[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]<+++++++++
|
||||
++++++++++++++++++++++++++++++++++>]<<<[>>>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<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>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]++<<[-
|
||||
]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+
|
||||
>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>
|
||||
>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>
|
||||
]<<<[[-]<<<<----->>>>][-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<<<<<<<<<
|
||||
+>>>>>>->>>][-]+++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>
|
||||
>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[
|
||||
-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->
|
||||
>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<
|
||||
+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]
|
||||
>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<
|
||||
<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>
|
||||
+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<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<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->
|
||||
[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]
|
||||
+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[
|
||||
-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<
|
||||
<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>
|
||||
>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<
|
||||
<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[-
|
||||
>>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<+++
|
||||
+++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++
|
||||
+++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<
|
||||
]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.
|
||||
>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]
|
||||
<<]<<<<<<--------------------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>
|
||||
>>[-<+<<<<<+>>>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++
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[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>
|
||||
[-]+<[[-<+>]<++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++
|
||||
+++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++
|
||||
+++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++
|
||||
+++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++
|
||||
+++++++++++++++.>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++.>>>>>>]<<]<<<<<<+++++++++++++.>[-]>[-]<<<<<<<[->>>>>>>+<<<<<<<]>>>>
|
||||
>>>[-<+<<<<<<+>>>>>>>][-]+++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+
|
||||
>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>
|
||||
>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<
|
||||
+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<[-]<<<<<<<<[->>>>>>>>+<<<
|
||||
<<<<<]>>>>>>[-]>>[-<<<<<<<<+>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..
|
||||
>>>-]<<<.>>>>>[-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>[-]>>[-<<<<<<<<+>>>>>>+>>
|
||||
][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]>>>[-]>[-]<<<<<<<[->>>>>>>+<<<<<
|
||||
<<]>>>>>>>[-<+<<<<<<+>>>>>>>][-]++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>
|
||||
[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>
|
||||
+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]
|
||||
>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]+++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<<<<<<<<]>>>[-]<<<<
|
||||
<[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]<<<<<<<[-]<[-]<[-]>>>>>>>>>>[-]<<<<<[->>>
|
||||
>>+<<<<<]>>>>>[-<<<<<+<<<+>>>>>>>>][-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>]<<<<<<<<<[<<<[-]<[-]<[-]+>>>>>>[<<<<+>>>>-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
||||
-<<<<<<<+>>>+>>>>]<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++>>]<[-]++++++++++++++++>[-]+++++++++++++
|
||||
+>>>>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][
|
||||
-]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]
|
||||
<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-
|
||||
<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<
|
||||
[-]>>>]<<<[[-]<<<<+++++>>>>]>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>
|
||||
[-<+<<<<<<<<+>>>>>>>>>][-]+<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<
|
||||
<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>
|
||||
>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]
|
||||
>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<++++++++++>>>][-]>[-]<<<<<<<<[->>>
|
||||
>>>>>+<<<<<<<<]>>>>>>>>[-<+<<<<<<<+>>>>>>>>][-]+++++++++++++++++++++++++<<<[
|
||||
-]>>[>>[-]<[->+<]>[-<+<<<+>>>>]<<-][-]<<[->>+<<]>>[-<<+<<+>>>>][-]<<<<<<<<<<
|
||||
<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>>>[-<<<<<<<<<<<+>>>>>>>->>>>][-]<<<<<<<<
|
||||
<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>>>[-<<<<<<<<<<<+>>>>>>>->>>>]>[-]>[-]<
|
||||
<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]++<<[-]+>>>
|
||||
[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]
|
||||
<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[
|
||||
-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[
|
||||
[-]<<<<----->>>>][-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<<<<<<+>>>->>>][-]++++++++
|
||||
+++++++++++++++++++.++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>]>>>[-]>[-]<<<<<[->>>
|
||||
>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>
|
||||
+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<
|
||||
[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]
|
||||
>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<
|
||||
<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>
|
||||
[-<+<<<<+>>>>>][-]++++++++++<<<<<[-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<]>>>>>[-<+<<<<+>>>>>][-]++++++++++
|
||||
>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>
|
||||
]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]
|
||||
>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<[-]>>>>[-]
|
||||
<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[-<<<->>>]>]<<<[-]>[-]<<
|
||||
<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+
|
||||
<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>
|
||||
>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-
|
||||
]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]
|
||||
<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.<++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<
|
||||
<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<+++
|
||||
+++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<<<--------------
|
||||
------------------.>[-]>[-]<<<<<<[->>>>>>+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[->>>>+<<<<]>>>>
|
||||
[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>
|
||||
>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>
|
||||
[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-
|
||||
<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<
|
||||
<<+++++++++++++.>[-]>[-]<<<<<<<[->>>>>>>+<<<<<<<]>>>>>>>[-<+<<<<<<+>>>>>>>][
|
||||
-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>
|
||||
>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>
|
||||
>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<
|
||||
]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]+++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+++.<-<]>[[-]<<<<<<.>>>>>>]<[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>
|
||||
>[-]>>[-<<<<<<<<<<<+>>>>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]
|
||||
<<<.>>>>>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>[-]>>[-<<<<<<<<<<<
|
||||
+>>>>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]>>>[-]>[-]<<<<<<<[-
|
||||
>>>>>>>+<<<<<<<]>>>>>>>[-<+<<<<<<+>>>>>>>][-]+++++++++++++++++++++++++++++++
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<
|
||||
[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-
|
||||
]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]
|
||||
[-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[
|
||||
-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<<<<<<
|
||||
<<<]>[-]++++++++++.[-]+>[-]+>[-]+++++++++++++++++++++++++++.++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++.>[-]>[-]<<<[->>>+<<<]>>>[-<
|
||||
+<<+>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<
|
||||
[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<
|
||||
<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[
|
||||
-<<<<+>>>>]>[-]<<<[->>>+<<<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-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]
|
||||
>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+
|
||||
<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>
|
||||
[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<
|
||||
[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<
|
||||
->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]
|
||||
<<[-]+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>
|
||||
>]<<[-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++
|
||||
++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<
|
||||
<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>
|
||||
>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-
|
||||
]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>
|
||||
]<++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>
|
||||
>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++.>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>
|
||||
>>>>]<<]<<<<<<--------------------------------.>[-]>[-]<<<<[->>>>+<<<<]>>>>[
|
||||
-<+<<<+>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[
|
||||
-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>
|
||||
[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>
|
||||
>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[
|
||||
-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<
|
||||
<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>
|
||||
[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[-
|
||||
>>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<
|
||||
<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<
|
||||
+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>
|
||||
>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>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>>>[-<+<<<<+>>>>>][-]++++
|
||||
++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>
|
||||
[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<
|
||||
[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]
|
||||
+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[
|
||||
-<+>]<++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++.>>>>>>-<]>[[-]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+.>>>>>>]<<]<<<<<<+++++++++++++.<<[-]+++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+++++++++[>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[>[-]+++++++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+++++++++++++++[-]<-]<-]<<<<<]<<<<+>>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<
|
||||
<<+>>>>>][-]++++<<[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]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<
|
||||
[->+<]>[[-<+>]<<<[-]+>>>]<<<]>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<
|
||||
<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[
|
||||
-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<
|
||||
<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[->+<]>[[-<
|
||||
+>]<<<[-]+>>>]<<<[<<<<<<<<--->+>>>>>>>>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>
|
||||
+<<<<<<<<<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+
|
||||
<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<
|
||||
<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[-
|
||||
>+<]>[[-<+>]<<<[-]+>>>]<<<]<<<<+>>>]<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
1
programs/develop/brainfuck/examples/helloworld.bf
Normal file
1
programs/develop/brainfuck/examples/helloworld.bf
Normal file
@@ -0,0 +1 @@
|
||||
++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>++.>+.+++++++..+++.<<++.>+++++++++++++++.>.+++.------.--------.<<+.<.
|
||||
145
programs/develop/brainfuck/examples/mandelbrot.bf
Normal file
145
programs/develop/brainfuck/examples/mandelbrot.bf
Normal file
@@ -0,0 +1,145 @@
|
||||
A mandelbrot set fractal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[>>>
|
||||
>>>[->>+<<]>>>]<<<<<<<<<[>[-]<->>>>>>>>[-<<<<<<<<+>[<->-<<+>>]<[->+<]>>>>>>>>]<<
|
||||
<<<<<[->>>>>>>+<<<<<<<]<+<<<<<<<<<]>+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>
|
||||
+>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<[<<<<<<<<<]>>>>>>>>>[>>>>>>[-<<<<<<->>>>>>]+<
|
||||
<<<<<[->>>>>>->>[-<<<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<
|
||||
<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>
|
||||
-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>>
|
||||
>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++
|
||||
+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
|
||||
<<<<<]]>>>]
|
||||
16
programs/develop/brainfuck/examples/movedata0.bf
Normal file
16
programs/develop/brainfuck/examples/movedata0.bf
Normal file
@@ -0,0 +1,16 @@
|
||||
>+ Set c1 = 1
|
||||
>++ Set c2 = 2
|
||||
|
||||
<
|
||||
[->+<] Add the value of c1 to c2 and print c2
|
||||
|
||||
>
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
> Print c3 which is supposed to be zero
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
[-]
|
||||
|
||||
[-<+>] Add the value of c3 (which is 0) to c2
|
||||
|
||||
<+. Increment c2 and print it again
|
||||
10
programs/develop/brainfuck/examples/movedataleft.bf
Normal file
10
programs/develop/brainfuck/examples/movedataleft.bf
Normal file
@@ -0,0 +1,10 @@
|
||||
>>>>>> Set c6 = 5
|
||||
+++++
|
||||
[-<<<+>>>] Move the value of c6 to c3
|
||||
|
||||
Print the value of c6 as a single ASCII digit
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
Also print the value of c3
|
||||
<<<
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
65
programs/develop/brainfuck/examples/movedataloops.bf
Normal file
65
programs/develop/brainfuck/examples/movedataloops.bf
Normal file
@@ -0,0 +1,65 @@
|
||||
>+ Set c1 = 1
|
||||
>++ Set c2 = 2
|
||||
>+++ Set c3 = 3
|
||||
>++++ Set c4 = 4
|
||||
|
||||
[->>>>>>>>+<<<<<<<<] Move the value of c4 to c12
|
||||
|
||||
<
|
||||
[->>>>>>>>>+<<<<<<<<<] Add the value of c3 to c12
|
||||
|
||||
|
||||
Print the value of c12 as a single ASCII digit
|
||||
>>>>>>>>>
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
<
|
||||
[->+<] Add the value of c11 (which is 0) to c12
|
||||
|
||||
Print the value of c12 as a single ASCII digit
|
||||
>.
|
||||
|
||||
<<<<<<<<<<<
|
||||
[->+<] Add the value of c1 to c2 and print c2
|
||||
>
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
>
|
||||
[-<+>] Add the value of c3 (which is 0) to c2 nd print c2
|
||||
<.
|
||||
|
||||
>+++ Set c3 to 3 and add its value to c2 again and print c2
|
||||
[-<+>]
|
||||
<.
|
||||
|
||||
|
||||
Now in a loop set c3 to 2 and add it with a move loop to c6
|
||||
|
||||
[-] c2 is the loop counter initialized to 4
|
||||
++++
|
||||
|
||||
[
|
||||
>++ set c3 to 2
|
||||
[->>>+<<<] add c3 to c6
|
||||
<- decrement loop counter
|
||||
]
|
||||
|
||||
>>>> Print c6
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
Similarly in a loop do the same but now move data left from c6 to c4
|
||||
|
||||
<<<<
|
||||
[-] c2 is the loop counter initialized to 4
|
||||
++++
|
||||
|
||||
[
|
||||
>>>>[-]++
|
||||
[-<<+>>]
|
||||
<<<<-
|
||||
]
|
||||
|
||||
>> Print c4
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
|
||||
10
programs/develop/brainfuck/examples/movedataright.bf
Normal file
10
programs/develop/brainfuck/examples/movedataright.bf
Normal file
@@ -0,0 +1,10 @@
|
||||
>>>>>> Set c6 = 3
|
||||
+++
|
||||
[->>>>>>>>+<<<<<<<<] Move the value of c6 to c14
|
||||
|
||||
Print the value of c6 as a single ASCII digit
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
Also print the value of c14
|
||||
>>>>>>>>
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
36
programs/develop/brainfuck/examples/mult-nums.bf
Normal file
36
programs/develop/brainfuck/examples/mult-nums.bf
Normal file
@@ -0,0 +1,36 @@
|
||||
[
|
||||
Multiplies x by y, leaving the result in x; then prints x.
|
||||
|
||||
c0: x
|
||||
c1: y
|
||||
c2: temp0
|
||||
c3: temp1
|
||||
]
|
||||
|
||||
Initialize x and y
|
||||
++++
|
||||
> +++++
|
||||
|
||||
Copy x to temp1 (temp0 starts as 0)
|
||||
<[>>>+<<<-]
|
||||
|
||||
Outer loop runs temp1 (originally x) times; each iteration adds y to x
|
||||
>>>
|
||||
[
|
||||
<<
|
||||
[<+ >>+ <-] Add y to x and to temp0
|
||||
>
|
||||
[<+ >-] Restore y from temp0
|
||||
|
||||
>- Decrement temp1
|
||||
]
|
||||
|
||||
|
||||
Now the pointer is at temp1; both temp0 and temp1 are zeros;
|
||||
Add 8*8 to x by using a nested loop in temp0 and temp1; x was
|
||||
originally 20 so this loop will bring it to 84
|
||||
|
||||
++++++++
|
||||
[<++++++++[<<+>>-]>-]
|
||||
|
||||
<<<. Print x; 84 is capital T
|
||||
17
programs/develop/brainfuck/examples/nested-loops-2.bf
Normal file
17
programs/develop/brainfuck/examples/nested-loops-2.bf
Normal file
@@ -0,0 +1,17 @@
|
||||
Computes 5 times 3 by running an outer loop 3 times and an inner loop 3 times
|
||||
+++++
|
||||
|
||||
[
|
||||
Set j for the next iteration of the inner loop
|
||||
> +++
|
||||
|
||||
[>+<-] Point to c2; increment it; then point back to c
|
||||
|
||||
< - Decrement i and check if the inner loop iterates again
|
||||
]
|
||||
|
||||
|
||||
We get to 15 so this should print out ?
|
||||
|
||||
>>
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
9
programs/develop/brainfuck/examples/noloops1.bf
Normal file
9
programs/develop/brainfuck/examples/noloops1.bf
Normal file
@@ -0,0 +1,9 @@
|
||||
>>>>>>+++++++ Set c6 = 7
|
||||
|
||||
Print the value of c6 as a single ASCII digit
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
Also print the value of c3
|
||||
<<<
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
37
programs/develop/brainfuck/examples/numwrap.bf
Normal file
37
programs/develop/brainfuck/examples/numwrap.bf
Normal file
@@ -0,0 +1,37 @@
|
||||
>>>>+>+++>+++>>>>>+++>>+[
|
||||
-,[----------[---[+<++++[>-----<-]+>[<+>--------[<+>-
|
||||
[--->>+++++++++++++[<<[-<+>>]>[<]>-]<<
|
||||
[+>+++++[<-------->-]<[<+>-]]]]]]]]
|
||||
<
|
||||
[<<++[>>>>>>>>>>>+<<<<<<<<<<<-]<<+>+>+>>>+>+>>+>+<<<<<-
|
||||
[<<+>>>+>+>>>+<<<<<-
|
||||
[<<<<+>>->>>>->>+<<<<-
|
||||
[<<<<->+>>>>->>>->-<<<<<-
|
||||
[<<<->>>>+<-
|
||||
[<<<+>>>>->+>>+<<<<-
|
||||
[<<<<+>->+>>>+>>>>+<<<<<-
|
||||
[<<->>>->->>>-<<<<<-
|
||||
[<<<<->+>>>>+>+>>>+<<<<<-
|
||||
[<<<<+>>>>>>-<<-
|
||||
[<<+>>>->>>>-<<<<<-
|
||||
[>+>>>->+<<<<<-
|
||||
[>>+<<-
|
||||
[<<<->->>>->->>+<<<<-
|
||||
[<<<+>+>>>+>+<<-
|
||||
[>->-<<-
|
||||
[<<->>>+>+<<-
|
||||
[<<+>>>>>>->-<<<<<-
|
||||
[<<<<->>->>-
|
||||
[<<<<+>>>>>>>>+<<<<-
|
||||
[<<<<->>+>>>>>>>+<<<<<-
|
||||
[>->>>-<<<<-]]]]]]]]]]]]]]]]]]]]]
|
||||
>[[<<<<<<<<<<<+>>>>>>>>>>>-]>]+>>>>>>>+>>+<]>
|
||||
]<<[-]<[-[>>>>+<<<<-]]<<<<<<++<+++<+++[>]<[
|
||||
>>>>>++++++++[<++++++<++++>>-]>>>[-[<+<<<<.>>>>>-]]<<+<<-<<<<[
|
||||
-[-[>+<-]>]>>>[.[>]]<<[<+>-]>>>[<<-[<++>-]>>-]
|
||||
<<[++[<+>--]>+<]>>>[<+>-]<<<<<<<<
|
||||
]>>>>>++++++++++.>+[[-]<]<<<
|
||||
]
|
||||
[Enter a number using ()-./0123456789abcdef and space, and hit return.
|
||||
Daniel B Cristofani (cristofdathevanetdotcom)
|
||||
http://www.hevanet.com/cristofd/brainfuck/]
|
||||
37
programs/develop/brainfuck/examples/optimizable-loops.bf
Normal file
37
programs/develop/brainfuck/examples/optimizable-loops.bf
Normal file
@@ -0,0 +1,37 @@
|
||||
[
|
||||
Tests of various optimizable loops
|
||||
]
|
||||
|
||||
>>>>>> Set c6 = 5
|
||||
+++++
|
||||
|
||||
>>>>>> Set c12 = 5
|
||||
+++++
|
||||
|
||||
<<<<<<
|
||||
|
||||
[-<<<+>>>] Move the value of c6 to c3
|
||||
|
||||
|
||||
<+++ Set c5 = 3
|
||||
|
||||
[-<<+>>] Add c5 to c3 (so add 3 to 5 in c3)
|
||||
|
||||
<<
|
||||
Print the value of c3 as a single ASCII digit
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
[-] Clear c3
|
||||
|
||||
Print the value of c3 as a single ASCII digit
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
|
||||
Set values in c3 to c10 to nonzero
|
||||
|
||||
>+>+>+>+>+>+>+
|
||||
|
||||
Hop back to the first zero field before c10
|
||||
|
||||
[<<]
|
||||
Print its (c2) value of as a single ASCII digit
|
||||
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
|
||||
308
programs/develop/brainfuck/examples/pi.bf
Normal file
308
programs/develop/brainfuck/examples/pi.bf
Normal file
@@ -0,0 +1,308 @@
|
||||
This program requires a dialect of BF with 16 bit words (instead of the 8 bit
|
||||
words=the BF standard) An optimizing compiler and a fast computer would also
|
||||
help (as the arithmetic limitations of BF make calculating pi rather
|
||||
difficult)
|
||||
If you want to calculate more digits you can add more plus signs at the
|
||||
obvious place in the file
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
How many digits do you want? ++++++++++
|
||||
>[-]++++++++++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]<[-]>>>>>>>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+<+>>>>>>>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<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<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>.<<<<<.>.>
|
||||
>>>>>>>>>>>>>>>>>>>>-]<<[-]<<<<<<<<<<<<<<<<<<<<<<-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
>-]<<<<<<<<<<<<<<<<<<<<<<<[-]<<<<<<<<<<<<<<<<[-]>>>>>>>>>>>>>>>>>>[-<<+<<<<<<<<<
|
||||
<<<<<<<+>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<
|
||||
<<<<][-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<+<<<<<<<<<<<<<<<<+>>>>
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>
|
||||
>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>.<<<<<.>.
|
||||
23
programs/develop/brainfuck/examples/pi2.bf
Normal file
23
programs/develop/brainfuck/examples/pi2.bf
Normal file
@@ -0,0 +1,23 @@
|
||||
[ yet another pi calculation program in bf
|
||||
|
||||
Just like for pi16.b the accuracy of the result depends on the cellsize:
|
||||
|
||||
- using 8 bit cells causes an overflow after 4 digits
|
||||
- using 16 bit cells causes an overflow after 537 digits
|
||||
- using 32 bit cells causes an overflow after several millions of digits
|
||||
|
||||
It's about ~38 times shorter than pi16.b, ~364 times faster and works with
|
||||
not-wrapping (bignum) implementations.
|
||||
|
||||
by Felix Nawothnig (felix.nawothnig@t-online.de) ]
|
||||
|
||||
> +++++ +++++ +++++ (15 digits)
|
||||
|
||||
[<+>>>>>>>>++++++++++<<<<<<<-]>+++++[<+++++++++>-]+>>>>>>+[<<+++[>>[-<]<[>]<-]>>
|
||||
[>+>]<[<]>]>[[->>>>+<<<<]>>>+++>-]<[<<<<]<<<<<<<<+[->>>>>>>>>>>>[<+[->>>>+<<<<]>
|
||||
>>>>]<<<<[>>>>>[<<<<+>>>>-]<<<<<-[<<++++++++++>>-]>>>[<<[<+<<+>>>-]<[>+<-]<++<<+
|
||||
>>>>>>-]<<[-]<<-<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>[-]>+<<<-[>>+<<-]<]<<<<+>>>>>>>
|
||||
>[-]>[<<<+>>>-]<<++++++++++<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>[-]>+>[<<+<+>>>-]<<<
|
||||
<+<+>>[-[-[-[-[-[-[-[-[-<->[-<+<->>]]]]]]]]]]<[+++++[<<<++++++++<++++++++>>>>-]<
|
||||
<<<+<->>>>[>+<<<+++++++++<->>>-]<<<<<[>>+<<-]+<[->-<]>[>>.<<<<[+.[-]]>>-]>[>>.<<
|
||||
-]>[-]>[-]>>>[>>[<<<<<<<<+>>>>>>>>-]<<-]]>>[-]<<<[-]<<<<<<<<]++++++++++.
|
||||
14
programs/develop/brainfuck/examples/random.bf
Normal file
14
programs/develop/brainfuck/examples/random.bf
Normal file
@@ -0,0 +1,14 @@
|
||||
>>>++[
|
||||
<++++++++[
|
||||
<[<++>-]>>[>>]+>>+[
|
||||
-[->>+<<<[<[<<]<+>]>[>[>>]]]
|
||||
<[>>[-]]>[>[-<<]>[<+<]]+<<
|
||||
]<[>+<-]>>-
|
||||
]<.[-]>>
|
||||
]
|
||||
"Random" byte generator using the Rule 30 automaton.
|
||||
Doesn't terminate; you will have to kill it.
|
||||
To get x bytes you need 32x+4 cells.
|
||||
Turn off any newline translation!
|
||||
Daniel B Cristofani (cristofdathevanetdotcom)
|
||||
http://www.hevanet.com/cristofd/brainfuck/
|
||||
8
programs/develop/brainfuck/examples/square.bf
Normal file
8
programs/develop/brainfuck/examples/square.bf
Normal file
@@ -0,0 +1,8 @@
|
||||
++++[>+++++<-]>[<+++++>-]+<+[
|
||||
>[>+>+<<-]++>>[<<+>>-]>>>[-]++>[-]+
|
||||
>>>+[[-]++++++>>>]<<<[[<++++++++<++>>-]+<.<[>----<-]<]
|
||||
<<[>>>>>[>>>[-]+++++++++<[>-<-]+++++++++>[-[<->-]+[<<<]]<[>+<-]>]<<-]<<-
|
||||
]
|
||||
[Outputs square numbers from 0 to 10000.
|
||||
Daniel B Cristofani (cristofdathevanetdotcom)
|
||||
http://www.hevanet.com/cristofd/brainfuck/]
|
||||
149
programs/develop/brainfuck/examples/t.bf
Normal file
149
programs/develop/brainfuck/examples/t.bf
Normal file
@@ -0,0 +1,149 @@
|
||||
[
|
||||
A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
|
||||
Taken from https://github.com/pablojorge/brainfuck
|
||||
]
|
||||
|
||||
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
|
||||
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
|
||||
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>
|
||||
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>
|
||||
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>
|
||||
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>
|
||||
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<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>>>>-<<<<<<[<<<<
|
||||
<<<<<]]>>>]
|
||||
33
programs/develop/brainfuck/examples/triangle.bf
Normal file
33
programs/develop/brainfuck/examples/triangle.bf
Normal file
@@ -0,0 +1,33 @@
|
||||
[ This program prints Sierpinski triangle on 80-column display. ]
|
||||
>
|
||||
+ +
|
||||
+ +
|
||||
[ < + +
|
||||
+ +
|
||||
+ + + +
|
||||
> - ] >
|
||||
+ + + + + + + +
|
||||
[ >
|
||||
+ + + +
|
||||
< - ] >
|
||||
> + + > > > + >
|
||||
> > + <
|
||||
< < < < < < < <
|
||||
< [ - [ - > + <
|
||||
] > [ - < + > > > . < < ] > > >
|
||||
[ [
|
||||
- > + +
|
||||
+ + + +
|
||||
+ + [ > + + + +
|
||||
< - ] >
|
||||
. < < [ - > + <
|
||||
] + > [ - > + +
|
||||
+ + + + + + + + < < + > ] > . [
|
||||
- ] > ]
|
||||
] + < < < [ - [
|
||||
- > + < ] + > [
|
||||
- < + > > > - [ - > + < ] + + >
|
||||
[ - < - > ] < <
|
||||
< ] < < < < ] + + + + + + + + +
|
||||
+ . + + + . [ - ] < ] + + + + +
|
||||
* * * * * M a d e * B y : * N Y Y R I K K I * 2 0 0 2 * * * * *
|
||||
7
programs/develop/brainfuck/examples/trivial-in.bf
Normal file
7
programs/develop/brainfuck/examples/trivial-in.bf
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
Trivial example of stdin input in BF; Reads one char from input
|
||||
increments it and emits the result back
|
||||
]
|
||||
>+>+>+>+>+>+>+>+>+>+
|
||||
<<<<<<<<<<
|
||||
,+.
|
||||
6
programs/develop/brainfuck/examples/trivial-out.bf
Normal file
6
programs/develop/brainfuck/examples/trivial-out.bf
Normal file
@@ -0,0 +1,6 @@
|
||||
[
|
||||
Very trivial BF program that emits an exclamation mark by incrementing
|
||||
location 0's data 33 times (ASCII for !) and printing it
|
||||
]
|
||||
|
||||
+++++++++++++++++++++++++++++++++.
|
||||
BIN
programs/develop/brainfuck/src/bf_console_interp.
Normal file
BIN
programs/develop/brainfuck/src/bf_console_interp.
Normal file
Binary file not shown.
471
programs/develop/brainfuck/src/bf_console_interp.asm
Normal file
471
programs/develop/brainfuck/src/bf_console_interp.asm
Normal file
@@ -0,0 +1,471 @@
|
||||
;-----------------------------------------------------------
|
||||
; Brainfuck Interpreter for KolibriOS
|
||||
;
|
||||
; Interactive REPL
|
||||
; Uses console.obj for terminal interface
|
||||
;
|
||||
;-----------------------------------------------------------
|
||||
|
||||
format binary as ""
|
||||
|
||||
use32
|
||||
org 0
|
||||
|
||||
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd START
|
||||
dd I_END
|
||||
dd MEM
|
||||
dd STACKTOP
|
||||
dd 00
|
||||
dd 00
|
||||
|
||||
parameters rb 256
|
||||
include '../../../proc32.inc'
|
||||
include '../../../macros.inc'
|
||||
include '../../../dll.inc'
|
||||
include '../../../string.inc'
|
||||
|
||||
align 16
|
||||
@IMPORT:
|
||||
library terminal, 'console.obj'
|
||||
|
||||
import terminal, \
|
||||
con_init, 'con_init', \
|
||||
con_exit, 'con_exit', \
|
||||
con_gets, 'con_gets', \
|
||||
con_write, 'con_write_asciiz', \
|
||||
con_clear, 'con_cls', \
|
||||
con_getc, 'con_getch', \
|
||||
con_write_string, 'con_write_string', \
|
||||
con_printf, 'con_printf'
|
||||
|
||||
|
||||
; a brainfuck interpreter
|
||||
; data definitions
|
||||
BUFFER_SIZE = (2 shl 16)
|
||||
TAPE_SIZE = 30000
|
||||
OUTPUT_BUF_LEN = 512
|
||||
output_buf_idx dd 0
|
||||
|
||||
prompt db "BF:> ", 0
|
||||
TITLE db " BRAINFUCK INTERPRETER ",0
|
||||
err1 db "Missing parenthesis match",0
|
||||
err2 db "Invalid source file",0
|
||||
REPL db "in repl",10, 0
|
||||
exit_cmd db "exit", 0
|
||||
run_cmd db "run "
|
||||
clear_cmd db "clear", 0
|
||||
help_cmd db "help", 0
|
||||
reset_cmd db "reset", 0
|
||||
|
||||
help_text:
|
||||
db "BRAINFUCK INTERPRETER - HELP", 10
|
||||
db "========================", 10, 10
|
||||
db "COMMANDS:", 10
|
||||
db " help - show this help", 10
|
||||
db " clear - clear the screen", 10
|
||||
db " reset - clear the tape: set all cell as 0", 10
|
||||
db " run <file> - run a brainfuck file", 10
|
||||
db " exit - exit the interpreter", 10, 10
|
||||
db "NOTES:", 10
|
||||
db " - tape is persistent across REPL sessions", 10
|
||||
db " - use reset to clear tape between programs", 10
|
||||
db " - tape size is 30000 cells", 10
|
||||
db " - cells are 8-bit with wraparound", 10, 10
|
||||
db "BRAINFUCK COMMANDS:", 10
|
||||
db " > move tape pointer right", 10
|
||||
db " < move tape pointer left", 10
|
||||
db " + increment current cell", 10
|
||||
db " - decrement current cell", 10
|
||||
db " . output current cell as ASCII", 10
|
||||
db " , read one character into current cell", 10
|
||||
db " [ jump forward if current cell is zero", 10
|
||||
db " ] jump back if current cell is non-zero", 10, 0
|
||||
|
||||
|
||||
ERR_SIZE = 36
|
||||
ERR2_SIZE = 30
|
||||
nl db 10, 0
|
||||
|
||||
macro write2 a {
|
||||
local ..string, ..label
|
||||
jmp ..label
|
||||
..string db a, 0
|
||||
..label:
|
||||
invoke con_write, ..string
|
||||
}
|
||||
|
||||
macro write a {
|
||||
local ..string, ..label
|
||||
jmp ..label
|
||||
..string db a, 10, 0
|
||||
..label:
|
||||
invoke con_write, ..string
|
||||
}
|
||||
|
||||
macro flush {
|
||||
pusha
|
||||
invoke con_write_string, output_buf, dword [output_buf_idx]
|
||||
mov dword [output_buf_idx], 0
|
||||
popa
|
||||
}
|
||||
|
||||
; line buffering
|
||||
macro store_buf{
|
||||
local .store, .done
|
||||
cmp dword [output_buf_idx], OUTPUT_BUF_LEN
|
||||
jb .store
|
||||
flush
|
||||
.store:
|
||||
mov ebx, [output_buf_idx]
|
||||
mov [output_buf + ebx], al
|
||||
inc [output_buf_idx]
|
||||
cmp al, 10
|
||||
jne .done
|
||||
flush
|
||||
.done:
|
||||
}
|
||||
|
||||
align 4
|
||||
|
||||
file_info_struct:
|
||||
.fn dd 0
|
||||
.offset dd 0
|
||||
.offset2 dd 0
|
||||
.size dd 0
|
||||
.ptr dd 0
|
||||
.ecd db 0
|
||||
.path dd 0
|
||||
|
||||
macro DISPATCH {
|
||||
movzx eax, byte [ebp+ecx]
|
||||
mov ebx, ecx
|
||||
inc ecx
|
||||
jmp dword [jmp_table + eax *4]
|
||||
}
|
||||
|
||||
jmp_table:
|
||||
dd exit_interpret
|
||||
rept 42{
|
||||
dd BEGIN
|
||||
}
|
||||
dd vinc
|
||||
dd input
|
||||
dd vdec
|
||||
dd output
|
||||
rept 13 {
|
||||
dd BEGIN
|
||||
}
|
||||
dd pdec
|
||||
dd BEGIN
|
||||
dd pinc
|
||||
rept 28 {
|
||||
dd BEGIN
|
||||
}
|
||||
dd brac_left
|
||||
dd BEGIN
|
||||
dd brac_right
|
||||
rept 34 {
|
||||
dd BEGIN
|
||||
}
|
||||
|
||||
START:
|
||||
mcall 68, 11
|
||||
stdcall dll.Load, @IMPORT
|
||||
or eax, eax
|
||||
jnz EXIT
|
||||
invoke con_init, -1, -1, -1, -1, TITLE
|
||||
|
||||
repl:
|
||||
; write "Checking if there is data to flush"
|
||||
mov eax, [output_buf_idx]
|
||||
test eax, eax
|
||||
jz .prompt
|
||||
flush
|
||||
.prompt:
|
||||
invoke con_write, prompt
|
||||
invoke con_gets, buffer_data, BUFFER_SIZE
|
||||
test eax, eax ; documentation said eax is zero when console is closed
|
||||
jz exit
|
||||
|
||||
stdcall string.length, buffer_data
|
||||
|
||||
cmp eax, BUFFER_SIZE
|
||||
je .repl_continue
|
||||
lea ebx, [buffer_data + eax - 1]
|
||||
mov byte [ebx], 0
|
||||
.repl_continue:
|
||||
stdcall string.cmp, buffer_data, exit_cmd, 5 ; check if exit, length 5 to make sure it is only exit
|
||||
test eax, eax
|
||||
jz exit
|
||||
|
||||
stdcall string.cmp, buffer_data, clear_cmd, 6
|
||||
test eax, eax
|
||||
jz .clear
|
||||
|
||||
stdcall string.cmp, buffer_data, run_cmd, 4
|
||||
test eax, eax
|
||||
jz .run_prog
|
||||
|
||||
stdcall string.cmp, buffer_data, help_cmd, 5
|
||||
test eax, eax
|
||||
jz .display_help
|
||||
|
||||
stdcall string.cmp, buffer_data, reset_cmd, 5
|
||||
test eax, eax
|
||||
jz .reset
|
||||
|
||||
call interpret
|
||||
invoke con_write, nl
|
||||
jmp repl
|
||||
|
||||
.clear:
|
||||
invoke con_clear
|
||||
jmp repl
|
||||
|
||||
.reset:
|
||||
cld
|
||||
mov ecx, TAPE_SIZE
|
||||
xor eax, eax
|
||||
mov edi, tape
|
||||
rep stosb
|
||||
jmp repl
|
||||
|
||||
|
||||
.display_help:
|
||||
invoke con_write, help_text
|
||||
jmp repl
|
||||
|
||||
.run_prog:
|
||||
; assume command is in format run filepath
|
||||
lea eax, [buffer_data + 4]
|
||||
stdcall string.copy, eax, parameters
|
||||
mov esi, parameters
|
||||
; first get_file size
|
||||
|
||||
mov eax, 70
|
||||
mov dword [file_info_struct], 0x0
|
||||
mov dword [file_info_struct + 12], BUFFER_SIZE-1
|
||||
mov dword [file_info_struct + 16], buffer_data
|
||||
mov dword [file_info_struct + 21], parameters
|
||||
mov ebx, file_info_struct
|
||||
mcall
|
||||
|
||||
test eax, eax
|
||||
jnz .check_eof
|
||||
|
||||
.process_buffer:
|
||||
mov byte [buffer_data + ebx], 0
|
||||
call interpret
|
||||
flush
|
||||
; write "Finish flushing..."
|
||||
jmp .reset ; reset tape after reading from file
|
||||
|
||||
.check_eof:
|
||||
cmp eax, 6
|
||||
je .process_buffer
|
||||
|
||||
.run_error:
|
||||
write2 "Error opening file: "
|
||||
invoke con_write, parameters
|
||||
invoke con_write, nl
|
||||
jmp repl
|
||||
|
||||
.not_run:
|
||||
write "Invalid run Command. Use run file_path"
|
||||
jmp repl
|
||||
|
||||
;-----------------------------------------------------------
|
||||
; interpret: Execute Brainfuck program from buffer_data
|
||||
; uses ecx, edx, esi, edi, and epi, ebx, eax
|
||||
; ----------------------------------------------------------
|
||||
|
||||
interpret:
|
||||
;---------------------------------
|
||||
; ecx = Instruction Pointer for Ops
|
||||
; edx = Data Pointer for tape
|
||||
; edi = Tape Base Address
|
||||
; ebp = Ops array base address
|
||||
; ebx = Temporary for arg lookup
|
||||
;-----------------------------------
|
||||
|
||||
call preprocess
|
||||
|
||||
cmp eax, -1
|
||||
je .match_error
|
||||
|
||||
xor ecx, ecx
|
||||
xor edx, edx
|
||||
xor esi, esi
|
||||
mov edi, tape
|
||||
mov ebp, Ops
|
||||
|
||||
DISPATCH
|
||||
|
||||
.match_error:
|
||||
write "Match error found"
|
||||
ret
|
||||
|
||||
exit_interpret:
|
||||
ret
|
||||
|
||||
BEGIN:
|
||||
DISPATCH
|
||||
vinc:
|
||||
mov eax, [arg + ebx * 4]
|
||||
add byte [edi + edx], al
|
||||
DISPATCH
|
||||
|
||||
vdec:
|
||||
mov eax, [arg + ebx * 4]
|
||||
sub byte [edi + edx], al
|
||||
DISPATCH
|
||||
|
||||
pinc:
|
||||
add edx, [arg + ebx * 4]
|
||||
cmp edx, TAPE_SIZE
|
||||
jl .dispatch
|
||||
sub edx, TAPE_SIZE
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
pdec:
|
||||
sub edx, [arg + ebx * 4]
|
||||
jns .dispatch
|
||||
add edx, TAPE_SIZE
|
||||
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
output:
|
||||
push ecx
|
||||
mov ecx, [arg + ebx *4]
|
||||
mov al, byte [edi + edx]
|
||||
.loop:
|
||||
test ecx, ecx
|
||||
je .dispatch
|
||||
dec ecx
|
||||
store_buf
|
||||
jmp .loop
|
||||
.dispatch:
|
||||
pop ecx ; restore vm state
|
||||
DISPATCH
|
||||
|
||||
input:
|
||||
pusha
|
||||
invoke con_getc
|
||||
mov [edi + edx], al
|
||||
popa
|
||||
DISPATCH
|
||||
|
||||
brac_left:
|
||||
cmp byte [edi + edx], 0
|
||||
jne .dispatch
|
||||
mov ecx, [arg + ebx * 4]
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
brac_right:
|
||||
mov al, byte [edi + edx]
|
||||
test al, al
|
||||
jz .dispatch
|
||||
mov ecx, [arg + ebx * 4]
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
|
||||
;-----------------------------------------------------------
|
||||
; preprocess: simple peephole optimzer for the interpreter
|
||||
; returns eax = 0 on success or -1 on error
|
||||
; uses esi, ebx, edi, eax
|
||||
;------------------------------------------------------------
|
||||
preprocess:
|
||||
; esi as ptr for buffer, ebx as buffer reference
|
||||
; edi as pointer to Ops and arg
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov ebx, buffer_data
|
||||
xor esi, esi
|
||||
xor edi, edi
|
||||
xor edx, edx
|
||||
|
||||
.start:
|
||||
movzx eax, byte [ebx + esi]
|
||||
inc esi
|
||||
test eax, eax
|
||||
je .exit
|
||||
cmp eax, 127
|
||||
jg .start
|
||||
mov ecx, [jmp_table + eax * 4]
|
||||
cmp ecx, BEGIN
|
||||
je .start
|
||||
cmp eax, '['
|
||||
je .left
|
||||
cmp eax, ']'
|
||||
je .right
|
||||
jmp .repeat
|
||||
|
||||
.left:
|
||||
inc edx
|
||||
push edi
|
||||
mov byte [Ops + edi], al
|
||||
inc edi
|
||||
jmp .start
|
||||
|
||||
.right:
|
||||
test edx, edx
|
||||
je .error
|
||||
dec edx
|
||||
pop ecx
|
||||
mov [Ops + edi], al
|
||||
mov [arg + edi * 4], ecx
|
||||
inc [arg + edi * 4]
|
||||
inc edi
|
||||
mov [arg + ecx * 4], edi
|
||||
jmp .start
|
||||
|
||||
.repeat:
|
||||
mov ecx, 1
|
||||
.start_repeat:
|
||||
cmp al, byte [ebx + esi]
|
||||
jne .end_repeat
|
||||
inc ecx
|
||||
inc esi
|
||||
jmp .start_repeat
|
||||
|
||||
.end_repeat:
|
||||
mov [Ops + edi], al
|
||||
mov [arg + edi *4], ecx
|
||||
inc edi
|
||||
jmp .start
|
||||
|
||||
.error:
|
||||
mov eax, -1
|
||||
leave
|
||||
ret
|
||||
.exit:
|
||||
xor eax, eax
|
||||
mov byte [Ops + edi], 0
|
||||
leave
|
||||
ret
|
||||
|
||||
exit:
|
||||
invoke con_exit, 1
|
||||
EXIT:
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
I_END:
|
||||
rb 4096
|
||||
align 16
|
||||
|
||||
STACKTOP:
|
||||
|
||||
buffer_data rb BUFFER_SIZE
|
||||
tape rb TAPE_SIZE
|
||||
|
||||
Ops rb BUFFER_SIZE / 2 ; use half of buffer size
|
||||
arg rd BUFFER_SIZE / 2 ; use half of buffer size
|
||||
output_buf rb OUTPUT_BUF_LEN
|
||||
MEM:
|
||||
BIN
programs/develop/brainfuck/src/bf_shell_interp.
Normal file
BIN
programs/develop/brainfuck/src/bf_shell_interp.
Normal file
Binary file not shown.
299
programs/develop/brainfuck/src/bf_shell_interp.asm
Normal file
299
programs/develop/brainfuck/src/bf_shell_interp.asm
Normal file
@@ -0,0 +1,299 @@
|
||||
format binary as ""
|
||||
|
||||
use32
|
||||
org 0
|
||||
|
||||
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd START
|
||||
dd I_END
|
||||
dd MEM
|
||||
dd STACKTOP
|
||||
dd parameters
|
||||
dd 00
|
||||
|
||||
parameters rb 1024
|
||||
|
||||
include '../../../proc32.inc'
|
||||
include '../../../macros.inc'
|
||||
include '../../../shell.inc'
|
||||
include '../../../string.inc'
|
||||
|
||||
@pid dd 0
|
||||
|
||||
; a brainfuck interpreter
|
||||
; data definitions
|
||||
|
||||
BUFFER_SIZE = (2 shl 16)
|
||||
TAPE_SIZE = 30000
|
||||
|
||||
prompt db "BF:> ", 0
|
||||
err1 db "Missing parenthesis match",0
|
||||
err2 db "Invalid source file",0
|
||||
ERR_SIZE = 36
|
||||
ERR2_SIZE = 30
|
||||
nl db 10
|
||||
|
||||
file_info_struct:
|
||||
.fn dd 0
|
||||
.offset dd 0
|
||||
.offset2 dd 0
|
||||
.size dd 0
|
||||
.ptr dd 0
|
||||
.ecd db 0
|
||||
.path dd 0
|
||||
|
||||
jmp_table:
|
||||
dd exit_interpret
|
||||
rept 42{
|
||||
dd BEGIN
|
||||
}
|
||||
dd vinc
|
||||
dd input
|
||||
dd vdec
|
||||
dd output
|
||||
rept 13 {
|
||||
dd BEGIN
|
||||
}
|
||||
dd pdec
|
||||
dd BEGIN
|
||||
dd pinc
|
||||
rept 28 {
|
||||
dd BEGIN
|
||||
}
|
||||
dd brac_left
|
||||
dd BEGIN
|
||||
dd brac_right
|
||||
rept 34 {
|
||||
dd BEGIN
|
||||
}
|
||||
|
||||
|
||||
START:
|
||||
call shell.init
|
||||
shln
|
||||
cmp byte[parameters], 0
|
||||
je exit
|
||||
|
||||
|
||||
.run_prog:
|
||||
; assume command is in format run filepath
|
||||
lea eax, [buffer_data + 4]
|
||||
stdcall string.copy, eax, parameters
|
||||
mov esi, parameters
|
||||
; first get_file size
|
||||
|
||||
mov eax, 70
|
||||
mov dword [file_info_struct], 0x0
|
||||
mov dword [file_info_struct + 12], BUFFER_SIZE-1
|
||||
mov dword [file_info_struct + 16], buffer_data
|
||||
mov dword [file_info_struct + 21], parameters
|
||||
mov ebx, file_info_struct
|
||||
mcall
|
||||
|
||||
test eax, eax
|
||||
jnz .check_eof
|
||||
|
||||
.process_buffer:
|
||||
mov byte [buffer_data + ebx], 0
|
||||
call interpret
|
||||
jmp exit
|
||||
|
||||
.check_eof:
|
||||
cmp eax, 6
|
||||
je .process_buffer
|
||||
|
||||
.run_error:
|
||||
shps "Error opening file: "
|
||||
shpsa parameters
|
||||
shln
|
||||
jmp exit
|
||||
|
||||
macro DISPATCH {
|
||||
movzx eax, byte [ebp+ecx]
|
||||
mov ebx, ecx
|
||||
inc ecx
|
||||
jmp dword [jmp_table + eax *4]
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------
|
||||
; interpret: Execute Brainfuck program from buffer_data
|
||||
; uses ecx, edx, esi, edi, and epi, ebx, eax
|
||||
; ----------------------------------------------------------
|
||||
|
||||
interpret:
|
||||
;---------------------------------
|
||||
; ecx = Instruction Pointer for Ops
|
||||
; edx = Data Pointer for tape
|
||||
; edi = Tape Base Address
|
||||
; ebp = Ops array base address
|
||||
; ebx = Temporary for arg lookup
|
||||
;-----------------------------------
|
||||
call preprocess
|
||||
cmp eax, -1
|
||||
je .match_error
|
||||
xor ecx, ecx
|
||||
xor edx, edx
|
||||
xor esi, esi
|
||||
mov edi, tape
|
||||
mov ebp, Ops
|
||||
DISPATCH
|
||||
|
||||
.match_error:
|
||||
shpsa err1
|
||||
ret
|
||||
|
||||
exit_interpret:
|
||||
ret
|
||||
|
||||
BEGIN:
|
||||
DISPATCH
|
||||
vinc:
|
||||
mov eax, [arg + ebx * 4]
|
||||
add byte [edi + edx], al
|
||||
DISPATCH
|
||||
|
||||
vdec:
|
||||
mov eax, [arg + ebx * 4]
|
||||
sub byte [edi + edx], al
|
||||
DISPATCH
|
||||
|
||||
pinc:
|
||||
add edx, [arg + ebx * 4]
|
||||
cmp edx, TAPE_SIZE
|
||||
jl .dispatch
|
||||
sub edx, TAPE_SIZE
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
pdec:
|
||||
sub edx, [arg + ebx * 4]
|
||||
jns .dispatch
|
||||
add edx, TAPE_SIZE
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
|
||||
output:
|
||||
mov ebx, [arg + ebx *4]
|
||||
mov al, byte [edi + edx]
|
||||
.loop:
|
||||
test ebx, ebx
|
||||
je .dispatch
|
||||
dec ebx
|
||||
call shell.print_char
|
||||
jmp .loop
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
input:
|
||||
shgc
|
||||
mov [edi + edx], al
|
||||
DISPATCH
|
||||
|
||||
brac_left:
|
||||
cmp byte [edi + edx], 0
|
||||
jne .dispatch
|
||||
mov ecx, [arg + ebx * 4]
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
|
||||
brac_right:
|
||||
mov al, byte [edi + edx]
|
||||
test al, al
|
||||
jz .dispatch
|
||||
mov ecx, [arg + ebx * 4]
|
||||
.dispatch:
|
||||
DISPATCH
|
||||
;-----------------------------------------------------------
|
||||
; preprocess: simple peephole optimzer for the interpreter
|
||||
; returns eax = 0 on success or -1 on error
|
||||
; uses esi, ebx, edi, eax
|
||||
;------------------------------------------------------------
|
||||
|
||||
preprocess:
|
||||
; esi as ptr for buffer, ebx as buffer reference
|
||||
; edi as pointer to Ops and arg
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov ebx, buffer_data
|
||||
xor esi, esi
|
||||
xor edi, edi
|
||||
xor edx, edx
|
||||
|
||||
.start:
|
||||
movzx eax, byte [ebx + esi]
|
||||
inc esi
|
||||
test eax, eax
|
||||
je .exit
|
||||
cmp eax, 127
|
||||
jg .start
|
||||
mov ecx, dword [jmp_table + eax * 4]
|
||||
cmp ecx, BEGIN
|
||||
je .start
|
||||
cmp eax, '['
|
||||
je .left
|
||||
cmp eax, ']'
|
||||
je .right
|
||||
jmp .repeat
|
||||
|
||||
.left:
|
||||
inc edx
|
||||
push edi
|
||||
mov byte [Ops + edi], al
|
||||
inc edi
|
||||
jmp .start
|
||||
|
||||
.right:
|
||||
test edx, edx
|
||||
je .error
|
||||
dec edx
|
||||
pop ecx
|
||||
mov [Ops + edi], al
|
||||
mov [arg + edi * 4], ecx
|
||||
inc [arg + edi * 4]
|
||||
inc edi
|
||||
mov [arg + ecx * 4], edi
|
||||
jmp .start
|
||||
|
||||
.repeat:
|
||||
mov ecx, 1
|
||||
.start_repeat:
|
||||
cmp al, byte [ebx + esi]
|
||||
jne .end_repeat
|
||||
inc ecx
|
||||
inc esi
|
||||
jmp .start_repeat
|
||||
|
||||
.end_repeat:
|
||||
mov [Ops + edi], al
|
||||
mov [arg + edi *4], ecx
|
||||
inc edi
|
||||
jmp .start
|
||||
|
||||
.error:
|
||||
mov eax, -1
|
||||
leave
|
||||
ret
|
||||
.exit:
|
||||
xor eax, eax
|
||||
mov byte [Ops + edi], 0
|
||||
leave
|
||||
ret
|
||||
|
||||
exit:
|
||||
call shell.destroy
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
I_END:
|
||||
rb 4096
|
||||
align 16
|
||||
STACKTOP:
|
||||
buffer_data rb BUFFER_SIZE
|
||||
tape rb TAPE_SIZE
|
||||
|
||||
Ops rb BUFFER_SIZE / 2 ; use half of buffer size
|
||||
arg rd BUFFER_SIZE / 2 ; use half of buffer size
|
||||
|
||||
MEM:
|
||||
Reference in New Issue
Block a user