ANSI working.

This code is uuuugly and incomplete, but it works at all,
so I wanted to commit that before I broke it trying to clean
it up.