The DATABAR Oscar was an optical bar code scanner used to input program code into computers such as Atari 1200XL/1400XL, Atari 400/600/800, Commodore Pet, Commodore VIC 20/64, TI99/4A and TRS 80.
Regarding the computer it acts as an ordinary cassette reader.
Writing a software decoder for databar sheets started with one posted in PoC||GTFO 12 as "puzzle".
See https://wiki.yobi.be/index.php/Databar_decoding for the write-up.
- http://www.mainbyte.com/ti99/hardware/oscar/oscar.html
- http://www.mainbyte.com/ti99/hardware/oscar/oscar_man.pdf
- https://www.google.com/patents/US4550247
- https://www.google.com/patents/US4521678
-
Extract images from pdf with
pdfimages -all
. -
Crop to keep only databars with white margins around, no side borders, no title.
-
Use scans as larges as possible.
-
If needed you can enhance scans by
- scaling up (x2, x4)
- using unsharp mask
- setting threshold manually
It may sound silly to scale up but it makes sense because the whole operation is to be seen as a conversion from luminosity to space, same as converting audio to 1-bit sampling at very high frequency.
oscar.py databar-000.png databar-001.png ...
You can set debuglevel to higher levels if needed.
Note that at the moment the script is full of assert so there is not much error handling and it'll break on the first issue ;)
Databar reuses the Cassette tape records format (see here):
ff <64 bytes> cc0000000000000000
with cc
being a checksum byte equal to the sum of the 64 bytes.
Data extraction: use post_ti994a.sh
Databar reuses the Cassette tape records format (see here):
5555fc <128 bytes> cc
...
5555fa <128 bytes> cc # last line
with cc
being a checksum byte equal to the sum with endaround carry of the 131 bytes (so carry bits are added to the cc byte too).
fc
indicates a full record; fa
indicates a partial record, its size being recorded just before the cc
byte.
Data extraction: use post_atari.sh
Databar reuses the Cassette tape data block for SEQ file format (see here):
Extracted data look like:
89888786858483828102 <191 bytes> cc
- Sync train
89 88 87 86 85 84 83 82 81
as for the first copy of a block. - file type =
02
: Data block for SEQ file - Data body : 171+20 bytes
- Data checkbyte
cc
: checksum byte equal to the xor of all 192 bytes from file type byte (02
) to the end.
Data extraction: use post_c64.sh
Commodore BASIC tokenized files can be converted with detox64 or CBM BASIC Lister.
The .txt
files available in the results
were produced by a version of detox64 slightly modified to convert unprintable chars by \xNN
notation.