Look at the "Enhanced" CRT stuff in: http://valkyrie.chaosforge.org/

You could also abstract it to include things like double-buffering and virtual windows if you wanted.