Menu
Coddy logo textTech

ASCII & Hex

Part of the Fundamentals section of Coddy's Assembly journey — lesson 13 of 45.

Computers only understand numbers. So how do they store letters like 'A', 'b', or '?'?

The answer is ASCII (American Standard Code for Information Interchange). ASCII is a table that assigns a number to every character.

How ASCII works:

CharacterASCII number (decimal)ASCII number (hex)
'A'650x41
'B'660x42
'C'670x43
'a'970x61
'b'980x62
'0'480x30
'1'490x31
' ' (space)320x20
'\n' (newline)100x0A
'\0' (null)00x00

Important ASCII values to memorize for assembly:

CharacterHexWhy you need it
'A'0x41Uppercase letters start here
'a'0x61Lowercase letters start here
'0'0x30Digits start here
Space0x20Separating words
Newline (\n)0x0AMoving to next line
Null (\0)0x00End of string marker

Notice the pattern:

PatternExample
Uppercase A-Z are consecutive'A'=65, 'B'=66, 'C'=67...
Lowercase a-z are consecutive'a'=97, 'b'=98, 'c'=99...
Digits 0-9 are consecutive'0'=48, '1'=49, '2'=50...
Lowercase = uppercase + 32'a' (97) = 'A' (65) + 32

How a string is stored in memory:

The word "Hi" with a newline is stored as:

CharacterHexBinary
'H'0x4801001000
'i'0x6901101001
'\n'0x0A00001010

In assembly, you write this as: db 'Hi', 0x0A

Why you need this for assembly:

When you define a string in data.asm, you are storing ASCII codes in memory. When you print a string, the operating system reads those ASCII codes and displays the matching characters.

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals