--- title: "Turkey" id: 61158 type: "computer_media" slug: "turkey" url: "http://localhost/computer_media/turkey/" markdown_url: "http://localhost/computer_media/turkey.md" published_at: "2025-10-31T21:01:24+00:00" modified_at: "2026-03-30T21:15:18+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2025/10/turkey-ts1000.png" excerpt: "A BASIC subroutine plots filled ellipses row by row to assemble a complete stick-figure human body from four overlapping shapes." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" indiv: - name: "Joey Latimer" slug: "joey-latimer" taxonomy: "indiv" url: "http://localhost/indiv/joey-latimer/" genre: - name: "Entertainment" slug: "entertainment" taxonomy: "genre" url: "http://localhost/type/entertainment/" - name: "Holiday" slug: "holiday" taxonomy: "genre" url: "http://localhost/type/holiday/" media_type: "Program" programmers: - name: "Joey Latimer" slug: "joey-latimer" taxonomy: "indiv" url: "http://localhost/indiv/joey-latimer/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Turkey%20%281983%29%28Latimer%2C%20Joey%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1983" images: - url: "http://localhost/wp-content/uploads/2025/10/turkey-ts1000.png" article_media: - id: 8054 title: "Turkey" type: "article" url: "http://localhost/article/turkey/" media_type_tags: "Entertainment, Holiday, Software" --- # Turkey This program draws an ASCII-art figure of a turkey on screen using a subroutine that plots filled ellipses. The ellipse-fill algorithm works by iterating over rows within a bounding box, computing the horizontal half-width at each row via the standard ellipse equation x = a·√(1 − y²/b²), and printing a character across that span. *** ## Program Structure The program is divided into two logical parts: a main section (lines 10–310) that sets parameters and calls a reusable ellipse subroutine, and the subroutine itself (lines 320–390). Execution ends at the busy-loop `GOTO 310` on line 310, which freezes the display indefinitely after drawing is complete. 1. Lines 10–60: Head ellipse — centre approximately (8.6, 15), radii b=9, a=12, fill char CHR$ 16 2. Lines 70–110: Torso ellipse — centre (8.6, 15), radii b=8, a=7, fill char CHR$ 27 3. Lines 120–170: Left leg ellipse — centre (7.7, 15), radii b=3.4, a=2.7, fill char CHR$ 8 4. Lines 180–210: Right leg ellipse — same X, YY=14, radii b=5.4, a=5.4, fill char CHR$ 8 5. Lines 220–300: Individual PRINT AT statements for facial features, hands, and feet ## Ellipse Fill Subroutine (Lines 320–390) The subroutine at line 320 fills an axis-aligned ellipse centred at `(YY, XX)` with vertical semi-axis `B` and horizontal semi-axis `A`. For each row `Y` in the range `YY−B` to `YY+B`, it computes the normalised vertical displacement squared `P = (Y−YY)²`, then derives the horizontal half-width `M = A·√(1 − P/B²)`. It then prints the fill character `CHR$ I` at every column from `XX−M` to `XX+M`. | Variable | Role | | --- | --- | | `YY` | Row centre of ellipse | | `XX` | Column centre of ellipse | | `B` | Vertical semi-axis (rows) | | `A` | Horizontal semi-axis (columns) | | `I` | Character code used to fill the ellipse | | `Y`, `X` | Loop variables (row, column) | | `P` | Squared vertical distance from centre | | `M` | Computed horizontal half-width at row Y | ## Notable Techniques - The `ABS` wrapper around `1 − P/B²` on line 340 guards against tiny negative floating-point values that could cause a square-root error at the exact top and bottom of the ellipse. - Non-integer values for `YY` (8.6, 7.7) and the semi-axes shift the effective ellipse centre between character rows, giving the FOR loop slightly asymmetric extents and allowing finer positional tuning than integer coordinates alone. - Using `**2` rather than multiplying a variable by itself is idiomatic but slightly slower; the inner loop already makes performance the main bottleneck since the subroutine uses a pixel-by-pixel horizontal fill. - The fill characters CHR$ 16, CHR$ 27, and CHR$ 8 are control codes that display as inverse or special block characters on the target system, giving each body region a visually distinct texture. - Individual body details (eyes, mouth dots, hands marked `*`, feet and joints marked `I`, `+`) are applied after the ellipses with direct `PRINT AT` statements, effectively painting over or beside the filled shapes. ## Source Code ``` 10 LET YY=8.6 20 LET XX=15 30 LET I=16 40 LET B=9 50 LET A=12 60 GOSUB 320 70 LET XX=15 80 LET I=27 90 LET B=8 100 LET A=7 110 GOSUB 320 120 LET XX=15 130 LET YY=7.7 140 LET I=8 150 LET A=2.7 160 LET B=3.4 170 GOSUB 320 180 LET YY=14 190 LET A=5.4 200 LET B=5.4 210 GOSUB 320 220 PRINT AT 12,10; CHR$ 27; AT 17,20; CHR$ 8 230 PRINT AT 19,18; CHR$ 8; AT 20,13; "I" 240 PRINT AT 20,17; "I"; AT 8,12;"." 250 PRINT AT 7,12;"."; AT 5,13;"." 260 PRINT AT 4,15;"."; AT 7,14;"*" 270 PRINT AT 7,16;"*"; AT 21,16;"I" 280 PRINT AT 21,18;"I"; AT 21,12;"I" 290 PRINT AT 21,14;"I"; AT 8,15;"+" 300 PRINT AT 9,15;"+"; AT 10,15;"+" 310 GOTO 310 320 FOR Y=YY-B TO YY+B 330 LET P=(ABS(Y-YY))**2 340 LET M=A*SQR (ABS (1-P/B**2)) 350 FOR X=XX-M TO XX+M 360 PRINT AT Y,X;CHR$ I 370 NEXT X 380 NEXT Y 390 RETURN ```