add hello-bf

This commit is contained in:
zongor 2026-07-04 21:26:30 -07:00
parent ac1278de64
commit ed933356d2
2 changed files with 3 additions and 4 deletions

View File

@ -40,7 +40,7 @@ print_help()
"output, currently Uxn tal code and Reality Engine rom.\n\n");
}
#define MEM_SIZE (1 << 16)
#define MEM_SIZE (1 << 18)
int
main(int argc, char **argv)

View File

@ -1,4 +1,5 @@
str code = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
str code = "+++++++++++[>++++++>+++++++++>++++++++>++++>+++>+<<<<<<-]>+++
+++.>++.+++++++..+++.>>.>-.<<-.<.+++.------.--------.>>>+.>-.";
byte[10000] memory;
nat mp = 0; // memory pointer
@ -14,10 +15,8 @@ while (ip < code.length) {
} else if (code[ip] == '-') {
memory[mp] = memory[mp] - 1;
} else if (code[ip] == '.') {
// console.write = memory[mp];
write = memory[mp];
} else if (code[ip] == ',') {
// memory[mp] = console.read;
memory[mp] = read;
} else if (code[ip] == '[') {
if(!memory[mp]) {