Enter the complete demo.bas in Sinclair ZX81 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 caller performs N=N+A, so any valid numeric contribution is added; 0 leaves the total alone. It is not a one-key accept/reject routine.
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
Keep the normal display-serviced environment used here. FAST/SLOW choices change what the player sees while the CPU works; the sample does not add an artificial frame timer.
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 PAL 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, ZX81 BASIC Programming: INPUT, arithmetic, FAST/SLOW and display-file memory; recorded 1 KiB ROM configuration.