28 lines
1.9 KiB
Markdown
28 lines
1.9 KiB
Markdown
# Create punch card patterns from binary strings
|
|
|
|
This script turns a binary string into a pattern formatted for copying to an IBM-style 80-column punch card.
|
|
|
|
It is intended for creating drawings patterns based on programs for my imaginary computer.
|
|
|
|
## Use
|
|
|
|
```
|
|
./punch-a-card.js bin.txt
|
|
```
|
|
|
|
The input must be a text file containing nothing but 0s and 1s (no spaces, newlines, etc). It must be an even number of 8-bit bytes in length.
|
|
|
|
## Example output
|
|
|
|
```
|
|
01234567 01234567 01234567 01234567 01234567 01234567 01
|
|
▮▯▮▯▮▯▮▮ ▮▮▮▯▮▮▮▮ ▯▮▯▯▯▯▮▮ ▯▮▯▮▮▮▯▯ ▯▮▮▮▮▮▯▮ ▮▮▮▮▯▮▮▮ ▯▯
|
|
▮▮▯▮▮▮▯▮ ▮▮▯▮▮▯▮▮ ▮▯▯▯▯▮▯▯ ▯▮▮▯▮▯▯▮ ▯▯▯▯▯▯▯▮ ▮▯▯▮▮▯▮▯ ▯▮
|
|
▯▯▯▯▯▯▯▯ ▯▯▯▮▯▯▯▮ ▯▮▯▯▮▯▯▮ ▮▯▮▯▯▮▮▮ ▮▮▮▮▯▮▮▯ ▮▯▯▯▮▯▯▮ ▮▮
|
|
▯▯▯▮▯▯▯▮ ▯▮▯▮▮▯▯▮ ▯▮▯▯▯▮▯▮ ▯▮▮▯▮▮▮▮ ▯▮▯▯▯▮▯▮ ▯▯▯▮▮▯▮▮ ▮▮
|
|
▯▯▯▮▯▯▯▮ ▯▯▯▮▯▮▯▮ ▯▮▯▯▯▮▯▮ ▯▮▯▯▯▮▯▮ ▯▮▯▯▯▮▯▮ ▯▯▯▮▯▯▯▮ ▯▮
|
|
▯▯▯▮▯▯▯▮ ▯▮▯▮▯▮▯▮ ▯▮▯▯▯▮▯▮ ▯▮▯▯▯▮▯▮ ▯▮▯▯▯▮▯▮ ▯▯▯▮▯▯▯▮ ▯▮
|
|
▯▯▯▮▯▯▯▮ ▯▯▯▮▯▯▯▮ ▯▮▯▯▯▮▯▮ ▯▮▯▯▯▯▯▮ ▯▮▯▯▯▮▯▮ ▯▯▯▮▯▯▯▯ ▯▮
|
|
▯▯▯▮▯▯▯▮ ▯▯▯▮▯▯▯▮ ▯▮▯▯▯▮▯▮ ▯▮▯▯▯▯▯▮ ▯▮▯▯▯▮▯▮ ▯▯▯▮▯▯▯▯ ▯▮
|
|
01234567 01234567 01234567 01234567 01234567 01234567 01
|
|
``` |