--- title: "Circle Squared" id: 77359 type: "computer_media" slug: "circle-squared" url: "http://localhost/computer_media/circle-squared/" markdown_url: "http://localhost/computer_media/circle-squared.md" published_at: "2026-11-15T18:39:04+00:00" modified_at: "2026-11-15T18:39:04+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/circle-squared-1.png" excerpt: "Plots the even values of X²+Y² as a circle-and-square wallpaper pattern; written for JOBASIC hi-res on the ZX81." post_tag: - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" - name: "ZX81" slug: "zx81" taxonomy: "post_tag" url: "http://localhost/tag/zx81/" model: - name: "Sinclair ZX81" slug: "zx81" taxonomy: "model" url: "http://localhost/model/zx81/" - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" indiv: - name: "Mel R. Richardson" slug: "mel-richardson" taxonomy: "indiv" url: "http://localhost/indiv/mel-richardson/" genre: - name: "Graphics" slug: "graphics" taxonomy: "genre" url: "http://localhost/type/graphics/" media_type: "Program" programmers: - name: "Mel R. Richardson" slug: "mel-richardson" taxonomy: "indiv" url: "http://localhost/indiv/mel-richardson/" mediadate: "1986" images: - url: "http://localhost/wp-content/uploads/2026/11/circle-squared-1.png" article_media: - id: 42044 title: "Circle Games" type: "article" url: "http://localhost/article/circle-games/" media_type_tags: "Graphics" license: false --- # Circle Squared “Wallpaper for the mind”: for each point of a 170 by 120 pixel area it works out X²+Y² and plots the point when the whole-number part is even, which gives a pattern of circles over an underlying grid of squares that never quite repeats. Mel Richardson based it on John E. Connett’s program in A.K. Dewdney’s Computer Recreations column (Scientific American, September). Enter CORNA and CORNB (the lower left corner) and SIDE (the size; smaller magnifies), for example -15, -20, 87 or -30, 5, 40 or 20, -10, 20. Z copies the screen to the printer and R starts again. Written for a ZX81 with the Oliger video upgrade and JOBASIC: every PRINT, INPUT, PLOT and COPY goes through IF USR M2 THEN, and the set-up lines before line 10 are left for your system, so as printed it does not run on a stock ZX81. The article says a ZX81 with Graphica, or a TS2068, can run it with those lines changed. Published in Sinc-Link November-December 1986 ([Circle Games](https://timexsinclair.com/article/circle-games/)). ## Source Code ``` 2 REM CIRCLE SQUARED 3 REM 4 REM JOBASIC,GRAPHICA OR OTHER HI-RES INITIALIZTION HERE 5 REM 8 REM INPUT VARIABLES 10 IF USR M2 THEN PRINT "CORNA? "; 12 IF USR M2 THEN INPUT CORNA 14 IF USR M2 THEN PRINT "CORNB? "; 16 IF USR M2 THEN INPUT CORNB 18 IF USR M2 THEN PRINT "SIDE? "; 20 IF USR M2 THEN INPUT SIDE 25 REM 170X120 PIXEL DISPLAY 30 FOR I=1 TO 170 40 FOR J=1 TO 120 60 LET X=CORNA+(SIDE*I/100) 70 LET Y=CORNB+(SIDE*J/100) 80 LET Z=X*X+Y*Y 90 LET C=INT Z 92 REM 95 REM TEST FOR EVENESS 100 LET E=C/2-INT (C/2) 110 IF NOT E THEN IF USR M2 THEN PLOT I+40,J+36 120 NEXT J 130 NEXT I 1000 IF USR M2 THEN PRINT AT 23,0;"Z-COPY R-RESTART" 1010 IF INKEY$="" THEN GOTO 1000 1020 IF INKEY$="Z" THEN IF USR M2 THEN COPY 1022 IF INKEY$="R" THEN RUN 1025 GOTO 1000 ```