Added terminal writing capability in a sane way (not using assembly)