Gather ’round children, we’re about to hear a story about the good old days. Except that this is really more of a horror story of what it used to be like as a code monkey. [John Graham-Cumming] shares his experience programming a 6502-based KIM-1 machine back in 1985. Simple, right? The caveat being that there was no assembler or hardware for loading the finished code!
The machine in question was a label application tool for a production line. You know, product goes in bottle, label gets slapped on the side. But the slapping needed to be perfect because consumers shy away from packaging that looks shoddy. Computer control would end up being far superior than the mechanical means the factory had been using because it simplifies the ability to adjust calibration and other parameters. [John] started from square one by interfacing the KIM-1 with the existing hardware. It has a hex keyboard which is how the program was entered into the device. But first he wrote the software on sheets of notebook paper like the one seen above. It includes his hand assembled code, which was then typed in on the keypad. Kind of makes you appreciate all the tools you take for granted (like Eclipse), huh?
We won’t call it useless, but we will ask why [Dan] wrote a brainfuck interpreter for the AVR
It’s not generating code for the AVR; think of it more as a bootloader. To run a brainfuck program, [Dan] uploads it to the EEPROM inside his ATMega32, after which the microcontroller takes over and starts performing whatever instruction the brainfuck program tells it to do. Because the whole thing runs off the EEPROM, the code size is limited to 1022 bytes. Enough for any brainfuck program written by a human, we think.
As for why [Dan] would want an AVR to build an interpreter for a language that is nearly unreadable by humans, we honestly have no idea other than the common, ‘because it’s there’ sentiment. There are some pretty cool projects out there that use brainfuck, including this genetic algorithm software developer. Right now, though, blinkey LEDs are enough to keep us happy, so you can see a video of brainfuck doing its thing on a LED bar display after the break.
Continue reading “Interpreting Brainf*#k on an AVR”
Although having a 3D printer means you can create custom object of your own design, that doesn’t change the fact that most object printed on Makerbots and RepRaps are copies, or slight derivations, of already existing object. If you need a gear, just go grab an OpenSCAD file for a gear, and a custom smart phone case can be easily made by modifying an already existing one. The problem with this approach, though, is you’ll need to learn OpenSCAD or another 3D design tool. Enter the Makerbot Customizer, a web app that allows you to create custom versions of other people’s work right in your browser.
The idea behind Customizer is simple: someone creates an OpenSCAD file with a few variables like the number of teeth on a gear or the number of turns on a screw. Customizer takes this OpenSCAD file, puts sliders and radio buttons on a web page, and allows you to create custom objects based on user-created templates.
Already we’ve seen a lot of Hackaday readers send in some pretty cool customizable things, like [Bryan]‘s coil form for DIY inductors and [Greg]‘s customizable PVC pipe couplers. If you already know OpenSCAD, it’s easy to create your own objects that are customizable by anyone on the Internet.
Here’s an interesting tool for making simple 3D games. It’s called 3DPL, the 3D programming language, and it’s a real-time interpreted language that allows you to create cubes and other primitives that respond to user input and internal logic. Not only that, but you can build 3D versions of breakout and asteroids very simply with only a few lines of code.
It’s still a very early build, but looks to be pretty interesting for an ‘introduction to 3D graphics programming’ perspective. You can grab a copy of 3DPL to try out over on [amigojapan]‘s github. Hopefully we’ll see a gravity method soon for a proper 3DPL Tetris implementation.
[Kory] has been experimenting with genetic algorithms. Normally we’d expect his experiments to deal with tuning the variables in a control system or something, but he’s doing something much cooler. [Kory] is using genetic algorithms to write computer programs, and in the process bringing us one step closer to the Singularity.
The first experiments with genetic algorithms generating applications did so in BASIC, C, and other human-readable languages. While these programs nearly worked, there were far too many limitations on what could be produced with a GA. A simpler language was needed, and after turning to assembly for a hot second, [Kory] ended up using brainfuck, an extremely minimal but still Turing-complete language.
The use of brainfuck for creating programs from a genetic algorithm may seem a bit strange, but there’s a method to [Kory]‘s madness. It’s relatively simple to write an interpreter the GA’s fitness function can look into and come up with a score of which programs should breed and which should die. Also, the simplicity of brainfuck means a computer doesn’t have to learn much syntax and grammar at all.
Right now, [Kory]‘s computer that can program itself only does so by creating simple ‘hello world’ programs. It should be possible, though, for this AI to create programs that take user input and generate an output, whatever that may be. Once [Kory] is able to have the computer generate its own fitness functions, though, the sky is the limit and the Singularity will be fast approaching.
[Rajesh] put web scraping to good use in order to gather the information important to him. He’s published two posts about it. One scrapes Amazon daily to see if the books he wants to read have reached a certain price threshold. The other scrapes Rotten Tomatoes in order to display the audience score next to the critics score for the top renting movies.
Web scraping uses scripts to gather information programmatically from HTML rather than using an API to access data. We recently featured a conceptual tutorial on the topic, and even came across a hack that scraped all of our own posts. [Rajesh's] technique is pretty much the same.
He’s using Python scripts with the Beautiful Soup module to parse the DOM tree for the information he’s after. In the case of the Amazon script he sets a target price for a specific book he’s after and will get an email automatically when it gets there. With Rotten Tomatoes he sometimes likes to see the audience score when considering a movie, but you can’t get it on the list at the website; you have to click through to each movie. His script keeps a database so that it doesn’t continually scrape the same information. The collected numbers are displayed alongside the critics scores as seen above.
For all the interesting DSP functions locked away in the Raspberry Pi, it’s still hard to imagine using the Raspberry Pi as an eminently capable software synthesizer, tracker, or sequencer. Running any of the usual Linux digital audio programs means – surprise – running Linux, and the performance penalty associated with that.
It would be much better if all these audio programs could run directly on the Raspberry Pi without an operating system, and [Joe]‘s project is right up that alley. He’s playing MIDI files without an operating system, in effect making the Raspberry Pi a very powerful embedded platform.
[Joe]‘s build is the first bare metal audio code for the Raspberry Pi. It’s actually an LV2 plugin host that will load audio plugins, read MIDI files, and shoot the resulting audio out over the 1/8″ jack on the Pi. This work wouldn’t have been possible without a few Raspberry Pi bare metal tutorials put together by [David Welch].
Hopefully this won’t be the last we’ll see of [Joe] and his code; the Raspberry Pi has more than enough horsepower to be an amazing sampler, synth, beat machine, or the next generation of Akai MPC. All we need are a few brave coders to take up coding bare metal on the Raspberry Pi.