Re:Design and Implementation of a 256-Core BrainFuck Compute...
by faragon on Saturday October 15, 2016 @04:27PM
(#12715533)
After Intel adding deep-learning instructions to its processors, I guess they could add BrainFuck extensions to the x86 ISA, too.
[ Parent
| on HN ]
Re:Design and Implementation of a 256-Core BrainFuck Compute...
by posterboy on Saturday October 15, 2016 @06:01PM
(#12715839)
All 6 BF commands have x86 opcode counterparts, already. Don't quote me, I'm guessing.
Re:Design and Implementation of a 256-Core BrainFuck Compute...
by userbinator on Saturday October 15, 2016 @06:24PM
(#12715901)
Not quite, but an interpreter can be written in less than 100 bytes of x86 instructions:
Re:Design and Implementation of a 256-Core BrainFuck Compute...
by posterboy on Sunday October 16, 2016 @08:02AM
(#12718222)
The competition rules have added constraints to make the interpreter a usual command line tool. However, with memory mapped input and output ports it becomes a lot easier, which would be akin to 8bit micro controller programming. Parsing would take more than one cpu instruction per BF instruction, so the program would need to be assembled. I don't know x86 well enough to write that, though. I imagined, there would be a single instruction equivalent of 'x=*(p++)', but couldn't find anything like that.
In some makeshift syntax and with one instruction too much, I got:
>, < = inc, dec al
+, - = inc, dec [al]
. = out output_port, [al]
, = in [al], input_port
[ = Label: cmp [al], #0
jnz (Labelend + sizeof (jmp instruction))
] = Labelend: jmp Label
The labels are generated by the assembler. The ports would have to be directly soldered to some I/O peripherie, but alternatively the input and output could be memory mapped and fed by interrupts, as well.