lib/core: add low-level byte writing method