4 ms·
After Intel adding deep-learning instructions to its processors, I guess they could add BrainFuck extensions to the x86 ISA, too.
by faragon 10y ago
After Intel adding deep-learning instructions to its processors, I guess they could add BrainFuck extensions to the x86 ISA, too.
- posterboy 10y agoAll 6 BF commands have x86 opcode counterparts, already. Don't quote me, I'm guessing.
- userbinator 10y agoNot quite, but an interpreter can be written in less than 100 bytes of x86 instructions: http://www.hugi.scene.org/compo/compoold.htm#compo6 http://www.hugi.scene.org/compo/compoold.htm#compo6
- posterboy 10y agoThe 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.