add hello-bf
This commit is contained in:
parent
ac1278de64
commit
ed933356d2
|
|
@ -40,7 +40,7 @@ print_help()
|
||||||
"output, currently Uxn tal code and Reality Engine rom.\n\n");
|
"output, currently Uxn tal code and Reality Engine rom.\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MEM_SIZE (1 << 16)
|
#define MEM_SIZE (1 << 18)
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
str code = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
|
str code = "+++++++++++[>++++++>+++++++++>++++++++>++++>+++>+<<<<<<-]>+++
|
||||||
|
+++.>++.+++++++..+++.>>.>-.<<-.<.+++.------.--------.>>>+.>-.";
|
||||||
byte[10000] memory;
|
byte[10000] memory;
|
||||||
|
|
||||||
nat mp = 0; // memory pointer
|
nat mp = 0; // memory pointer
|
||||||
|
|
@ -14,10 +15,8 @@ while (ip < code.length) {
|
||||||
} else if (code[ip] == '-') {
|
} else if (code[ip] == '-') {
|
||||||
memory[mp] = memory[mp] - 1;
|
memory[mp] = memory[mp] - 1;
|
||||||
} else if (code[ip] == '.') {
|
} else if (code[ip] == '.') {
|
||||||
// console.write = memory[mp];
|
|
||||||
write = memory[mp];
|
write = memory[mp];
|
||||||
} else if (code[ip] == ',') {
|
} else if (code[ip] == ',') {
|
||||||
// memory[mp] = console.read;
|
|
||||||
memory[mp] = read;
|
memory[mp] = read;
|
||||||
} else if (code[ip] == '[') {
|
} else if (code[ip] == '[') {
|
||||||
if(!memory[mp]) {
|
if(!memory[mp]) {
|
||||||
Loading…
Reference in New Issue