“Code” in that sense predates pretty much any form of computer or technical writing. It came from the same word in old French in the 14th century, which itself came from the Latin codex. It basically meant “book”. Now of course it is specific to books that contain laws.