migrate screen code out of kernel.c