← r0mheat z80 lessons: all projects

Binary numbers: 16-bit values

A 16-bit number has sixteen binary places. Its values range from 0 to 65,535.

Number basics

One word = 16 bits

A bit place doubles as you move left. The rightmost place is 2^0, which is 1. The leftmost place is 2^15, which is 32,768. A Z80 register pair such as HL can hold one 16-bit value.

Choose a starting value

Decimal value

Each button shows a decimal value. You can also toggle any of the sixteen bits.

Sixteen bits

Place values

For each 1 bit, include its place value. For each 0 bit, include zero. Add the values to get the decimal number.

One 16-bit value contains two bytes

The high byte holds bits 15–8. The low byte holds bits 7–0. Each byte can hold a value from 0 to 255.

This page treats the value as unsigned. It shows only non-negative values. The Z80 can also interpret 16-bit values as signed numbers.