Fix memory management for double-buffered image. Also use the lightweight getchar() by polling the memory-mapped UART address.