Character Generation In 144 Bytes

[Jaromir Sukuba]  has an awesome BrainF*ck interpreter project going. He’s handling the entire language in less than 1 kB of code. Sounds like a great entry in the 1 kB Challenge. The only problem is the user interface. The original design used a 4 line character based LCD. The HD44780 controller in these LCDs have their own character table ROM, which takes up more than 1 kB of space alone.

[Jaromir] could have submitted the BrainF*ck interpreter without the LCD, and probably would have done well in the contest. That wasn’t quite enough for him though. He knew he could get character based output going within the rules of the contest. The solution was a bit of creative compression.

bf-cs-3Rather than a pixel-by-pixel representation of the characters, [Jaromir] created a palette of 16 single byte vectors of commonly used patterns. Characters are created by combining these vectors. Each character is 4 x 8 pixels, so 4 vectors are used per character. The hard part was picking commonly used bit patterns for the vectors.

The first iteration was quite promising – the text was generally readable, but a few characters were pretty bad. [Jaromir] kept at it, reducing and optimizing his vector pallet twice more. The final design is pretty darn good. Each character uses 16 bits of storage (four 4-bit vector lookup values). The vector pallet itself uses 16 bytes. That means 64 characters only eat up 144 Bytes of flash.
This is exactly the kind of hack we were hoping to see in the 1 kB challenge. A bit of creative thinking finds a way around a seemingly impossible barrier. The best part of all is that [Jaromir] has documented his work, so now anyone can use it in the 1 kB challenge and beyond.

1kb-thumb

 

If you have a cool project in mind, there is still plenty of time to enter the 1 kB Challenge! Deadline is January 5, so check it out and fire up your assemblers!

 

ASCII Art With Pure Data And A Typewriter

[vtol] is quickly becoming our favorite technological artist. Just a few weeks ago he graced us with a Game Boy Camera gun, complete with the classic Game Boy printer. Now, he’s somehow managed to create even lower resolution images with a modified typewriter that produces ASCII art images.

As with everything dealing with typewriters, machine selection is key. [vtol] is using a Brother SX-4000 typewriter for this build, a neat little daisy wheel machine that’s somehow still being made today. The typewriter is controlled by an Arduino Mega that captures an image from a camera, converts it to ASCII art with Pure Data and MAX/MSP, then slowly (and loudly) prints it on a piece of paper one character at a time.

The ASCII art typewriter was recently shown at the 101 Festival where a number of people stood in front of a camera and slowly watched a portrait assemble itself out of individual characters. Check out the video of the exhibit below.

Continue reading “ASCII Art With Pure Data And A Typewriter”

Animated ASCII Fluid Dynamics Simulator Is Retro Cool

ASCII art holds a place near and dear to our hearts. If you were fortunate enough to get started in computers before there was such a thing as a graphical user interface (GUI) then you remember tolling for hours to make clever use of the ASCII characters to make on screen graphics appear as realistic as possible.

Although this animated ASCII fluid dynamics simulator dates back to 2012, it’s just too cool not to share. It’s the product of the International Obfuscated C Code Contest (IOCCC). A contest held each year where the goal is to write the most confusing C code that you can – making use of loopholes and ambiguity in the C programming language to obfuscate(hide) the purpose of the program. Basically, doing everything you’re taught not to do in school. You can take a look at the source code here.

We’re sure the programmer [Yusuke Endoh] would be the first to admit, that there is no practical use for such a low resolution simulator, but we give it an A+ in the retro cool department anyways. (Not to mention, the source code is way too confusing to even comment on) Take a look at the animated ASCII graphics in the video after the break.

Continue reading “Animated ASCII Fluid Dynamics Simulator Is Retro Cool”

Retrotechtacular: The History Of ANSI And ASCII Art

These slides may not be the style of character art you remember from the days of 2400 baud modems; they’re more advanced than what was out there in the beginning. It turns out there is still some life left in this art subculture. For this week’s installment of Retrotechtacular we look in on [Doug Moore’s] talk on the history and survival of ANSI and ASCII art given at this year’s BSides conference.

ASCII is still a common character encoding so chances are you’re already familiar with it. ANSI on the other hand is a rather confusing term as it’s been lost in obscurity when referring to character sets. In this case it refers to a set of extended characters which is better described as Windows Code Pages.

Most of what we know about the ANSI art scene is from watching BBS: The Documentary (which is on our ten best hacking videos list). We certainly remember seeing the vertically scrolling art after connecting to a dial-up BBS back in the day. But understanding the factions that formed around the creation, bundling, and distribution of this is art is fascinating. [Doug] does a great job of covering this history, sharing side-by-side examples of the shunned practice of “ripping” another artists work. This image is actually not a rip. Later in his talk he discusses the continued existence of the subculture, showing what a modern take on the same subject looks like.

If you’re merely into the technical the first half of the video below is worth watching. But we bet it’ll be hard not to continue to the end for a side-trip into art history.

Retrotechtacular is a weekly column featuring hacks, technology, and kitsch from ages of yore. Help keep it fresh by sending in your ideas for future installments.

Continue reading “Retrotechtacular: The History Of ANSI And ASCII Art”

Optical Data Transfer Project At Local School’s Family Science Night

optical-data-at-family-science-night

[Dave] wanted to show off a project at his 4th-grade son’s school during their family science night. We haven’t heard of an event like this before but it sounds like a fabulous idea! He had a new laser he wanted to include in the project, and noticed that his son was learning about how ASCII maps letters to binary number when the idea struck. He ended up building an optical data transfer system that demonstrates binary code.

This presents a fantastic learning opportunity as the project invited the school kids to select encoded strips like the ones seen above to form a secret message. The laser is pointed at a photosensor which is being read by a Raspberry Pi board. The Python code looks for a baseline and then records increases and decreases in intensity. Since the translucent tokens have either holes or black lines for 0 and 1 the baseline approach does away with the need to clock in the data. [Dave] reports that everyone who tried out the experiment was fully engaged at the prospect of pushing pieces of tape through the sensor and watching their secret message appear on a monitor.

He was motivated to write about this project after reading about data transfer using an LCD screen and photosensor.

Detecting ASCII Art Across The Internet

As a web developer and designer, [Victor] has a habit of putting a very nice ASCII signature in an HTML comment at the top of every web page he designs. He was inspired by seeing others do this,  and this piqued his curiosity to see who else was doing this. His idea was to scan through a chunk of the Internet and see what other web pages had ASCII signatures in an HTML comment. With a lot of very clever work, [Victor] managed to grab some interesting ASCII art that would have been missed without looking at the source of millions of web pages.

After gathering a list of the top million top-level domains from Alexa, [Victor] wrote a script to download the HTML for all the pages in parallel. After that, it was just an issue of detecting the ASCII art in all the HTML files. There were a few earlier ASCII art detection algorithms, but nothing that suited [Victor]’s use case. The best result came from only looking at the first comment (otherwise the signatory wouldn’t want you to find it with a quick glance at the source) that were at least 3 lines long and 40 characters wide. After discarding everything with HTML tags in it, [Victor] had an awesome gallery of the ASCII art from webpages all around the Internet.

What did he find? Well, there’s far too many ASCII signatures for [Victor] to put up on his webpage, but he did provide a nice sample of what he found. They’re mostly logos, although there is a Hypnotoad and Aperture Science sentry turret in there.

If you’d like to try out [Victor]’s script, he made everything available on GitHub.

Apple ][ Converted Into USB Keyboard

Sometimes it’s apparent that there is no practical use for something featured on Hack a Day, but we don’t know if [Andrew Filer]’s Apple ][ USB keyboard qualifies for this.

After reading through the very thorough documentation available in electronic and dead tree formats, [Andrew] decided that Apple ][ would make a great USB keyboard. Unlike modern keyboards, vintage computers like the TRS-80, Commodore 64, and the Apple ][ return the 7-bit ASCII value of the key instead of a scan code. The ASCII codes generated by the keyboard were sent through a Teensyduino running [Andrew]’s keyduino sketch.

Modern PS/2 keyboards use MAKE and BREAK scan codes sent from a microcontroller that reads the keyboard matrix. For example the MAKE code for the letter ‘A’ is 1C, while the BREAK code is F0 1C. There is a reason for this design, but for the DIYer, interfacing a keyboard becomes a challenge without a separate microcontroller. We’re thinking [Andrew]’s keyduino could be a great way to put a keyboard in a project, but we’re not about to tear up our Apples and C64s to get a keyboard.