Output the Source, One Bit at a Time Write a non-empty program or function that when called outputs a single value, 1 or 0, and when called
multiple times, the output numbers produce the binary representation of your program's source code
(in the same code page from which your code is compiled/interpreted).

For instance, if your source code was abc (in ASCII), the outputs would be:

1st call:  0           // ASCII letter 'a'
2nd call:  1
3rd call:  1
4th call:  0
5th call:  0
6th call:  0
7th call:  0
8th call:  1

9th call:  0           // ASCII letter 'b'
10th call: 1
11th call: 1
12th call: 0
13th call: 0
14th call: 0
15th call: 1
16th call: 0

17th call: 0           // ASCII letter 'c'
18th call: 1
19th call: 1
20th call: 0
21st call: 0
22nd call: 0
23rd call: 1
24th call: 1

After the 24th call, the behaviour is undefined.


The binary representation of the source must contain at least one 0 bit and one 1 bit.

Instead of 1 and 0, you can output any two distinct, consistent values (such as true and false).

Self-modifying programs that output the binary representation of the original source are allowed, provided that they don't read the source code to find out what to print next.

This is code-golf, so the shortest answer in bytes wins.
Bash, 105 bytes



trap -- 'trap|xxd -b -c1|cut -d\  -f2|tr -d \\n|cut -c`x=\`cat f||echo 1\`;echo $((x+1))&gt;f;echo $x`' EXIT


NOTE: Make sure that you don't have an important file called f in the directory you're testing this. 



If you want to test this, you can use the following command:

for i in $(seq 848); do bash path/to/script.sh 2&gt; /dev/null; done | tr -d \\n


Which should give the same output xxd -c1 -b path/to/script.sh|cut -d\  -f2|tr -d \\n.

Explanation

This is using the trap trick - calling trap inside the trap action simply prints that line. Next that output gets piped to xxd which converts it to binary (unfortunately xxd -bp doesn't work - thus the workaround with cut &amp; tr):

xxd -c1 -b $0|cut -d\  -f2|tr -d \\n


From that we're only interested in one bit (say N) which we can select with cut -cN.

To find out what N we're using (remember that's the part that needs to be incremented after each call), simply try to set x to the content of the file f and if it doesn't exist set it to 1:

x=`cat f||echo 1`


Last thing to do, is to update the file f - writing x+1 to it:

echo $((x+1))&gt;f