Enter the complete demo.bas in Sinclair ZX80 BASIC and RUN. Submit 1, then Return. The number is added to the running total; entering 2 adds two.

Take the reader
Copy the INPUT statement into a free numbered line in your own command flow. The complete caller shows where to initialise N and where to return after an update.
The reusable reader
40 INPUT AINPUT A is a blocking numeric reader. The nine-line caller adds the submitted A to N; it is a running total, not a validator restricted to 0 and 1. Entering 2 adds two.
BASIC owns the keyboard buffer, line editor, return stack and variable storage. The global variable and line-number names belong to your program: reserve or rename them consistently. INPUT waits; no animation or deadline code in your main path can run during that wait.
Change it and recognise a mistake
Copy the INPUT statement into your own numbered flow. Preserve N between decisions. At 1 KiB, the program and its display compete for memory.
The broken update adds A twice. Submitting 1 reaches 2 immediately. INPUT read the right number; the update used it twice. Restore N=N+A. The caller also checks a nonzero start, so a lost initialiser cannot hide behind zero-filled state.
Deliberately broken input/update path
10 LET N=0
20 CLS
30 PRINT N
31 PRINT "XXX"
32 PRINT "X X"
33 PRINT "XXX"
40 INPUT A
50 LET N=N+A+A
60 GOTO 20
There is no stock programmable speaker on this configuration. An external sound interface is a separate target, so this entry supplies no pretend sound routine.
The complete caller
Working setup and integration
10 LET N=0
20 CLS
30 PRINT N
31 PRINT "XXX"
32 PRINT "X X"
33 PRINT "XXX"
40 INPUT A
50 LET N=N+A
60 GOTO 20For more responsive controls, compare polling, buffering and press edges in input choices.
Verification and sources
Target: stock 4 KiB ROM, 1 KiB RAM, keyword entry. These callers were executed with released Emu198x 0.44.1; assembly uses Asm198x 0.0.71. The sample folder contains reproduction instructions and retained observations. The independent checker binds source, native captures and actual output; its rejection tests exercise wrong state, missing files and false audio claims.
This qualifies the named emulator/firmware path. Pitch accuracy, original hardware and other peripherals require their own observations.
Sinclair, ZX80 Operating Manual: INPUT, integer arithmetic, program/display memory and keyboard entry; stock ROM execution in the named 1 KiB configuration.