<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/zx81-keyboard-subroutine-commentary-fr2z6olcl" -->

---
title: ZX81 KEYBOARD Subroutine—Commentary | daily.dev
description: A detailed technical analysis of the ZX81 keyboard scanning subroutine from the ROM at address 0x02BB. The routine uses an 8-iteration loop to scan an 8×5...
canonical: https://daily.dev/posts/zx81-keyboard-subroutine-commentary-fr2z6olcl
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: ZX81 KEYBOARD Subroutine—Commentary | daily.dev
og:description: A detailed technical analysis of the ZX81 keyboard scanning subroutine from the ROM at address 0x02BB. The routine uses an 8-iteration loop to scan an 8×5...
og:url: https://daily.dev/posts/zx81-keyboard-subroutine-commentary-fr2z6olcl
og:image: https://api.daily.dev/og/posts/Fr2z6OLcl.png
og:image:alt: ZX81 KEYBOARD Subroutine—Commentary
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ZX81 KEYBOARD Subroutine—Commentary

**[Two Stop Bits](https://daily.dev/sources/twostopbits)** · 10 min read · 0 upvotes · 0 comments

## Summary

A detailed technical analysis of the ZX81 keyboard scanning subroutine from the ROM at address 0x02BB. The routine uses an 8-iteration loop to scan an 8×5 keyboard matrix, encoding keypresses into HL registers where bits correspond to horizontal and vertical zones. The commentary walks through the Z80 assembly code instruction-by-instruction, explaining how the routine handles the shift key specially, uses bit manipulation tricks like SBC A,A for conditional logic, and interfaces with the keyboard hardware through I/O ports. Includes keyboard zone diagrams, hardware schematics, a Z80 assembly cheatsheet, and a BASIC program to inspect the scan codes.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://drj11.github.io/2026-02-10/zx81-keyboard.html>

## Similar posts on daily.dev

- [Sinclair 4K BASIC for the ZX80](https://daily.dev/posts/sinclair-4k-basic-for-the-zx80-icvlkapuu) · Two Stop Bits · 0 upvotes · 0 comments
- [For Such A Small Program, ZX81 1K Chess Sure Packs A Lot In](https://daily.dev/posts/for-such-a-small-program-zx81-1k-chess-sure-packs-a-lot-in-1nixokoj7) · Hackaday · 0 upvotes · 0 comments
- [Back To Basics: Hacking On Key Matrixes](https://daily.dev/posts/back-to-basics-hacking-on-key-matrixes-1az55yoey) · Hackaday · 0 upvotes · 0 comments

---

Tags: [#assembly](https://daily.dev/tags/assembly), [#embedded](https://daily.dev/tags/embedded), [#hardware](https://daily.dev/tags/hardware)

[View this post on daily.dev](https://daily.dev/posts/zx81-keyboard-subroutine-commentary-fr2z6olcl)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"ZX81 KEYBOARD Subroutine—Commentary","url":"https://daily.dev/posts/zx81-keyboard-subroutine-commentary-fr2z6olcl","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/zx81-keyboard-subroutine-commentary-fr2z6olcl"},"datePublished":"2026-02-17T06:08:00.017Z","dateModified":"2026-03-15T07:34:43.081Z","description":"A detailed technical analysis of the ZX81 keyboard scanning subroutine from the ROM at address 0x02BB. The routine uses an 8-iteration loop to scan an 8×5...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b24c0d70689ec70de4b1fd4a2bc0bfed?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b24c0d70689ec70de4b1fd4a2bc0bfed?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Two Stop Bits","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Two Stop Bits","logo":"https://media.daily.dev/image/upload/s--BScjOU_Q--/f_auto/v1728977574/logos/twostopbits","url":"https://daily.dev/sources/twostopbits"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/zx81-keyboard-subroutine-commentary-fr2z6olcl","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"assembly,embedded,hardware","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Two Stop Bits","item":"https://daily.dev/sources/twostopbits"},{"@type":"ListItem","position":3,"name":"ZX81 KEYBOARD Subroutine—Commentary"}]}
```

