Elara S. Novikova
Iskra-226

SNAKE

Змейка

The snake, arcade lineage from the mid 1970s; my own code, 2026

Fifty-six lines, and the reason the whole real-time side of this project exists. A snake needs a key read that does not stop and wait for Enter, and the dialect had a token for exactly that which my interpreter did not implement. SNAKE is the program that forced it. Everything on these disks that moves by itself came afterward.

sectors
20-22
source lines
56
field
20 x 10
step limit
40
The step the second apple is eaten on, with the score at 2 and the next apple already placed at 2, 2. The screen is redrawn every step, so these two lines stand together for one step only.
The step the second apple is eaten on, with the score at 2 and the next apple already placed at 2, 2. The screen is redrawn every step, so these two lines stand together for one step only.

Run this disk · The image, 256,256 bytes

The token that was just sitting there

KEYIN, 0x25, was in the token table from the beginning, and the firmware names a handler address for it. Nothing in the recovered corpus ever calls it. Accounting software asks a question and waits for the answer; it has no use for a key that might not have been pressed. So the token stayed a name in a table for a long time. A snake cannot work that way. It has to keep moving whether or not you touched anything, which means the read has to be allowed to come back empty and let the program continue on the next line. Implementing that opened everything else.

Why the snake never turned

The first version steered nowhere. Press 4 and it went straight on into the wall, every time, exactly as if the key had not been pressed at all. KEYIN was writing both the character and its code, into both variable spaces, so a comparison like IF V10 = 52 was reading a slot that held a string as well as a number, and the string won. Every branch failed and the snake kept its heading until it hit something. The corpus decides the question: comparisons here are numeric, BAM3 line 1160 opens with ON V21+1, so the slot holds the code alone.

What is on the disk

Twenty by ten of playing area, held as bounds rather than drawn as a grid: the program prints one status line per step with the head, the apple and the score, and the wall exists only as four comparisons. There is no tail, so the only ways to lose are the wall and the forty step clock. The apple does not jump at random either. It walks a fixed pattern, five columns back and three rows on, wrapping when it leaves the field, because the dialect's random number atom is still undecoded and a constant is more honest than an invented encoding.

Not a find

Written in 2026. The snake is one of the oldest mechanics there is, common property since the arcade cabinets of the mid seventies, and this code is new and in Russian. No Soviet games disk was recovered by this project or by anyone else, and the qualifier belongs on the small disks as much as on the large ones: three sectors, one catalog entry, a header in sector 0, all of it in a format copied from the sides that really were read, wrapped around a program that is entirely mine.

What I checked

All checked: loaded, started, played to an outcome. SNAKE takes its keystrokes through it.key_source, a callable returning a key code or None, the same way TETRIS is driven.

What this does not show

What is tested is the emulator, not the hardware. The snake has no growing body, so this is a steering exercise with an apple counter rather than the trap-yourself game the form is remembered for. The apple's fixed walk means the same forty steps play out identically every run, and the fall of the clock, like everything else here, is counted in program steps rather than in seconds.

Where to read more

The source

SNAKE.bas, 56 lines, assembled onto the image with iskra_asm.py

56 lines of BASIC
10 REM SNAKE
20 PRINT "*** ЗМЕЙКА ***"
30 PRINT "4-ВЛЕВО 6-ВПРАВО 8-ВВЕРХ 2-ВНИЗ"
40 V01 = 5
50 V02 = 5
60 V03 = 1
70 V04 = 0
80 V05 = 0
85 V08 = 0
90 V06 = 12
95 V07 = 5
100 V05 = V05 + 1
110 IF V05 > 40 GOTO 800
120 KEYIN V10, 130, 200
125 GOTO 200
130 IF V10 = 52 GOTO 140
131 IF V10 = 54 GOTO 145
132 IF V10 = 56 GOTO 150
133 IF V10 = 50 GOTO 155
134 GOTO 200
140 V03 = 0 - 1
141 V04 = 0
142 GOTO 200
145 V03 = 1
146 V04 = 0
147 GOTO 200
150 V03 = 0
151 V04 = 0 - 1
152 GOTO 200
155 V03 = 0
156 V04 = 1
200 V01 = V01 + V03
210 V02 = V02 + V04
220 IF V01 < 1 GOTO 850
221 IF V01 > 20 GOTO 850
222 IF V02 < 1 GOTO 850
223 IF V02 > 10 GOTO 850
230 IF V01 = V06 GOTO 240
231 GOTO 300
240 IF V02 = V07 GOTO 250
241 GOTO 300
250 V08 = V08 + 1
260 PRINT "*** СЪЕДЕНО! ОЧКОВ";V08;" ***"
270 V06 = V06 - 5
271 IF V06 > 0 GOTO 275
272 V06 = 18
275 V07 = V07 + 3
276 IF V07 < 11 GOTO 300
277 V07 = 2
300 PRINT "ШАГ";V05;" ЗМЕЙКА X";V01;" Y";V02;" ЯБЛОКО X";V06;" Y";V07
310 GOTO 100
800 PRINT "*** ВРЕМЯ ВЫШЛО ***"
810 GOTO 900
850 PRINT "*** ВРЕЗАЛИСЬ В СТЕНУ ***"
900 PRINT "ОЧКОВ:";V08
910 END

I wrote about this at the time

Back to Iskra-226