We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Talk:Brain-os source code (not an esolang but an esolang-built OS)

From Esolang
Jump to navigation Jump to search

Address layout?

I propose a better system for managing addresses:
Use a byte (or 2 bytes if more space is required) for the address, and a single byte for data. The layout looks like this: address, data, address, data...
Instead of disallowing non-zero values for data, it is possible go to the start of the memory like this:

[<<]

(NOTE: This assumes that the pointer is on an address cell, if that is not the case, a single < or > instruction is enough to move to the address cell)
This way data gets skipped, which means that non-zero values do not disrupt anything.
dragon eater SIX SEVEN 15:33, 2 February 2026 (UTC)

This doesnt seem useful at all. Also, the current system is only for holding values, it is the bottommost memory system, for which everything is built. --Yayimhere2(school) (talk) 16:18, 2 February 2026 (UTC)
Also, non-zero values are allowed, they are just incremented when not in use. [<] also makes less assumptions on how the tape works. --Yayimhere2(school) (talk) 16:21, 2 February 2026 (UTC)
See rail (data structure) for the article I stubbed on this. Corbin (talk) 19:05, 2 February 2026 (UTC)
thanks i designed my own data structure i dont need --Mrtli08 (talk) 19:08, 2 February 2026 (UTC)

Someone please make an function for x==0

we need x==0 function. the one in bf algorithms is made by me and its hell to make because pointer doesnt stay on place --Mrtli08 (talk) 18:52, 2 February 2026 (UTC)

Like, one where its y = (x==0) ?
simply like if x equals 0 then y==1 else y==0 --Mrtli08 (talk) 18:52, 2 February 2026 (UTC)

... 2147483647. please run this brainfuck code to know what I say:

-[--->+<]>-.[---->+++++<]>-.+.++++++++++.+[---->+<]>+++.-[--->++<]>-.++++++++++.+[---->+<]>+++.---[->++++<]>.------------.---.--[--->+<]>-.-[--->++<]>+.--.+++++.----------.-[--->+<]>-.+++++[->+++<]>.---------.[--->+<]>--.[-->+++++++<]>.++.---.-----.-----.--.-[--->+<]>--.[---->+<]>+++.+++++[->+++<]>.-.--.-[--->+<]>.-[---->+<]>++.[->+++<]>+.-[->+++<]>.+[----->+<]>.------------.+++.-[--->+<]>-.++[->+++<]>+.--.+++++++++.-----.++++++++++++.--.+[---->+<]>+++.+[->+++<]>.++++++++++++.++++++.---------.--------.-[--->+<]>-.[-->+++++++<]>.+++++.---------..[++>---<]>--.+++++[->+++<]>.---------..-[->+++<]>-.>++++++++++.>-[--->+<]>-.[---->+++++<]>-.+.++++++++++.+[---->+<]>+++.-[--->++<]>-.++++++++++.+[---->+<]>+++.---[->++++<]>.------------.---.--[--->+<]>-.-[--->++<]>+.--.+++++.----------.-[--->+<]>-.+++++[->+++<]>.---------.[--->+<]>--.+[->+++<]>.-[--->+<]>-.---.+.++++[->+++<]>.-.-[--->+<]>-.[-->+++++++<]>.++.---.-----.-----.--.-[--->+<]>--.[---->+<]>+++.---[->++++<]>.------------.-------.--[--->+<]>-.[---->+<]>+++.+++++[->+++<]>.-.--.-[--->+<]>.-[---->+<]>++.[->+++<]>+.-[->+++<]>.---[->++++<]>.--.+++.++[->+++<]>.--[--->+<]>-.+[->+++<]>++.[--->+<]>----.----.+++++.+++[->+++<]>.+++++++++++++.---------.------.[--->+<]>-.++[--->++<]>.-----------.+++++++++++++.-------.--[--->+<]>--.[->+++<]>++.++++++.--.--[--->+<]>-.+[----->+<]>.------------.--[--->+<]>--.----.------------.+++++.+.++++++++++.+.[---->+<]>+++.--[->++++<]>-.--------.++++++.---------.--------.-[--->+<]>-.[->+++<]>+.--[--->+<]>-..+++[->+++<]>.++++++++.+++.++++.[++>---<]>.

NeurosamaLover (talk) 04:47, 20 February 2026 (UTC)

Is brainfuck a good choice?

One of the main OS facilities is process management. Even without multiprocessing/multithreading and process memory isolation, this facility requires a subroutine call. Brainfuck lacks subroutines. Subroutine call can be emulated with goto and manual stack management, but brainfuck lacks goto as well. --Blashyrkh (talk) 13:21, 1 June 2026 (UTC)

func=1;
step=halt=0;
while(!halt){
 if(func==0&&step==0){a=0;a++;step++;};
 else if(func==0&&step==1){
  if(a){
   retv=a+9;
   func=stack.pop();
   step=1+stack.pop();
  }else step++;
 }
 else if(func==1&&step==0){
  stack.push(step);
  stack.push(func);
  step=0;func=0;
 }
 else if(func==1&&step==1){
  console.log(retv);
  halt=true;
 }
}

is equal to

function f0(){let a=0;a++;if(a)return a+9;}function f1(){let retv=f(0);console.log(retv);process.exit();}f1();

ie. you can just simulate every step of a function and just store the ip. Cleverxia (talk) 05:26, 6 June 2026 (UTC)

So what exactly are you proposing to create? Interactive brainfuck interpreter/launcher/multi-program-scheduler written in brainfuck? Well, it's possible, but would it be OS? And I suppose it'd be terribly slow. --Blashyrkh (talk) 06:10, 6 June 2026 (UTC)
This is fully experimental and programs will probably be hardcoded (like we can make a command handler for "h" and it will output "Hello, world!"). If a interrupt system is added, it will use a spesific memory adress. OR... CREATE A LITERAL BRAINFUCK INTERPRETER TO RUN PROGRAMS (This thing is really fully experimental rn) Mrtli08 (talk) 09:46, 6 June 2026 (UTC)
Interactive command-line interface ('h' -> "hello, world") is not actually an OS from the OS developer's perspective. Resource management (CPU time - task scheduler, RAM - memory manager, hardware - HAL and interrupt management, IO - disk subsystem) is.
Interactive brainfuck IDE (interpreter + debugger with step-by-step execution, breakpoints and memory watch) could really be a cool thing. Excellent for educational purposes. Writing the IDE itself in brainfuck is really a MAD CHALLENGE. --Blashyrkh (talk) 10:33, 6 June 2026 (UTC)