drbitboy
Lifetime Supporting Member
As my Dad use to say, "There is only one operation: counting."
Nice, you should get there.
Displaying the 16-bit word values in hexadecimal* will make it easier, because there will always be two hex digits per character, and there are simple mnemonics to convert between most characters and their hex representation:
** "dec" means decimal i.e. base 10
Nice, you should get there.
Displaying the 16-bit word values in hexadecimal* will make it easier, because there will always be two hex digits per character, and there are simple mnemonics to convert between most characters and their hex representation:
- Numbers
- the character '0' is ASCII code 48 decimal 0 + 3 * 16dec = 0 + 0x30hex = 0x30hex
- digits '1' through '9' are in sequence after '0'
- '1' is ASCII code 49dec** =1+48dec = 1 + 3*16dec = 9 + 0x31hex = 0x31hex
- '2' is ASCII code 50dec = 2+48dec = 2 + 3*16dec = 2 + 0x30hex = 0x32hex
- ...
- '9' is ASCII code 57dec = 9+48dec == 9 + 3*16dec = 9 + 0x30hex = 0x39hex
- Alpha
- The character '@' is ASCII code 64dec = 4*16dec = 0x40hex, and "root" of the uppercase alphabet
- 'A' is ASCII code 65dec = 1 + 64dec = 1 + 4*16dec = 0x41hex
- 'B' is ASCII code 66dec = 2 + 64dec = 2 + 4*16dec = 0x41hex
- ...
- 'J' the 10th (dec) uppercase letter is ASCII code 74dec = 10dec + 64dec = 10dec + 4*16dec = 0xAhex + 0x40hex= 0x4Ahex
- Ahex is 10dec
- Bhex is 11dec
- Chex is 12dec
- Dhex is 13dec
- Ehex is 14dec
- Fhex is 15dec, the last single hex digit, so
- 1+Fhex = 0x10hex,
- i.e. carrying the 1 the same way that
- 1+9dec = 10dec does, because 9 is the last single dec digit
- 'Z' is the 26th (dec) uppercase letter is ASCII code 90dec = 26dec + 64dec = 26dec + 4*16dec = 0x1Ahex + 0x40hex = 0x5Ahex
- The character '`' (backtick) is ASCII code 96dec = 6*16dec = 0x60hex, and root of the lowercase alphabe
- 'a' is ASCII code 97dec = 1 + 96dec = 0x61hex = 1 + 6*16dec
- ...
- 'z' is ASCII code 122dec = 26dec + 96dec = 0x7Ahex = 26dec + 6*16dec = 0x1Ahex + 0x60hex
- The character '@' is ASCII code 64dec = 4*16dec = 0x40hex, and "root" of the uppercase alphabet
- Other - no mnemonic or sequence, but here are some examples
- ' ' (space) is ASCII code 32dec = 0 + 2*16dec = 0 + 0x20hex = 0x20hex
- '!' (bang; exclamation) is ASCII code 33dec = 1 + 2*16dec = 0 + 0x20hex = 0x21hex
- ...
- '~' (tilde) is ASCII code 127dec = 15dec + 7*16dec = 0xFhex + 0x70hex = 0x7Fhex
- ASCII 0 to 31dec = 0 to 0x2Fhex represent unprintable (control) characters that are typically not present in a string, although sometimes a null (ASCII code 0) is a terminator for a string of otherwise non-null characters.
- Exceptions are
- <CR> carriage return is ASCII code 13dec = 13dec + 0*16dec = 0xDhex + 0x00hex = 0x0Dhex
- <LF> linefeed a.k.a. newline is ASCII code 10dec = 10dec + 0*16dec = 0xAhex + 0x00hex = 0x0Ahex
- N.B. Control-M on most ASCII keyboards send <CR> i.e. ASCII code 13dec = 0x0Dhex, and M is the 13th (dec) letter of the alphabet
- Same for Control-J and <LF> ASCII code 10dec = 0x0Ahex
- Exceptions are
** "dec" means decimal i.e. base 10