From 6.2.1
Binary Code (.hack) Files A binary code file is composed of text lines. Each line is a sequence of 16 ‘‘0’’ and ‘‘1’’ ASCII characters, coding a single 16-bit machine language instruction. Taken together, all the lines in the file represent a machine language program. When a machine language program is loaded into the computer’s instruction memory, the binary code represented by the file’s nth line is stored in address n of the instruction memory (the count of both program lines and memory addresses starts at 0).
Note that the Nand2Tetris tools require ANSI/ASCII encoding
not UTF8. UTF8 encoded files start with a "byte order mark" 0xEF, 0xBB, 0xBF, that the tools can't handle.
For what it's worth, representing binary data with ASCII characters has a long history. Back in the late 70s we sent punched paper tape in BNPF format to part houses for them to burn ROMs for us. BNPF format used those characters to encode each 8-bit byte using 10 characters: B followed by 8 N or P followed by F. Spaces, returns and line-feeds were allowed between bytes. [B = begin, N = negative (0), P = positive (1), F = final]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/ o o /
/ oo oo o o oo oooo o oo oo oo oo o o o ooo oooooo oo oo o oo oo o o ooo o oo ooo oooooo oo o oooo oo o oo o ooo oooo o ooooo o o ooooo o oo o /
/ o oo o o o oooo o o oo oo o o o o oo oooooo o oo o o oo o oo o o oo oo oooooo o o oooo o o oo o oo oooo o oooo o o oooo o ooo /
/........................................................................................................................................................................../
< o oo o o oooo o oo o o o o oo ooooo o oo o oo o oo o o o oo ooooo o o ooo o o oo oo oooo oooo o oooo o o oo <
\ o oo o oo o ooo o oo o oo o ooo oo oo o o oooo o o oo o oo o o o o oo o o o \
\ o o o o o o o o o o o o \
\ oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo \
\ oo oo oo oo oo oo oo oo oo oo oo oo oo oo \
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 byte per inch -- good thing the ROMs were small then!
We still use ASCII hexadecimal to send ROM images to programming houses.
--Mark