This routine turns everything on the screen to inverse video almost instantly, and back again on the next call. The 28 bytes of machine code live in the string array I$, not in a REM: the call LET I$(1)=STR$ USR (PEEK 16402+256*PEEK 16403+1) uses the DEST system variable to find I$ wherever it is in memory. On a ZX81 with 4K or more the whole screen reverses; with less memory only the printed characters and the spaces to their left change.
The download is the article’s demonstration with I$ already loaded. Do not RUN it, because RUN clears the variables and the machine code with them. Enter GOTO 10: the program lists itself three times and then flips the screen every second. Press BREAK to stop. Any machine-code routine that does not print to the screen can be kept in a string this way.
The article has you type a short loader that DIMs I$ and stores the bytes in it, then delete the loader lines and type the demo. The download is the program saved at that point, with I$ in the variables area.
Published in Syntax June 1983 (8K MC Video Invert Routine).
Source Code
10 LIST
20 LIST
30 LIST
40 PAUSE 60
50 LET I$(1)=STR$ USR (PEEK 16402+256*PEEK 16403+1)
60 GOTO 40Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

