junzis / the-1090mhz-riddle

The book about decoding Mode-S and ADS-B data
http://mode-s.org
Other
105 stars 51 forks source link

Relationship between callsign and ASCII codings #40

Closed ThomasN-Saab closed 3 years ago

ThomasN-Saab commented 4 years ago

An alternative to using the following lookup table, it seems to me that one could add 64 to any value that is lower than 32 and use ASCII.

#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######

These are the indexes of the table.

A - Z :   1 - 26
0 - 9 :  48 - 57
    _ :  32

And these are the indexes in ASCII

A - Z :  65 - 90
0 - 9 :  48 - 57
Space :  32

The seventh bit (64) in 7-bit ASCII is simply cut off. With that assumption, we could technically fill out the rest of the lookup table with ASCII symbols (though they are probably not in use anyway).

@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ !"#$%&'()*+´-./0123456789:;<=>?

Note that I put a space at index 32, instead of representing space with an underscore, because there's an actual underscore at index 31 because it has index 95 in ASCII. This lookup table assumes that the 7th bit is 1 when the 6th bit is 0. They can't both be 1 or both be 0. But those cases aren't all that interesting anyway. The ASCII symbols where both bits are 0 are hardly useful outside of filesystems or network communications and the symbols where both are 1 are mostly just lower case letters.

Of course, I'm not saying that these other symbols are ever used, but I figured that this little tidbit would be interesting to someone.

junzis commented 4 years ago

They are based on the ASCII but not directly mapped like ASCII, only alphanumeric values are used. The actual lookup table by ICAO Annex IV is:

image

I replaced the space with the underscore for debugging purposes (long time ago), then it was just left there. To be consistent with the standard, I will change it to space in a future update.

ThomasN-Saab commented 4 years ago

Yes. What I'm saying is that some simple bit operations are enough to convert between ASCII and that table. Also that if you do so you could theoretically fill out the blank spaces in the lookup table with other useful ASCII symbols.

Consider it more of a tip for anyone interested, rather than an actual suggestion to do so.