--- title: "21" id: 56278 type: "computer_media" slug: "21" url: "http://localhost/computer_media/21/" markdown_url: "http://localhost/computer_media/21.md" published_at: "2024-08-04T10:49:46+00:00" modified_at: "2026-03-30T21:40:50+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/08/SCR-20240804-koza.png" excerpt: "A Blackjack game with PLOT/DRAW card graphics and UDG suit symbols." 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 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Card Game" slug: "card-game" taxonomy: "genre" url: "http://localhost/type/card-game/" - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" media_contents: - id: 56277 title: "Timex Sinclair Public Domain Library Tape 2001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-2001/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/21%20%28198x%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/08/SCR-20240804-koza.png" media_type_tags: "Card Game, Game" --- # 21 A graphical Blackjack game for the TS2068. Cards are drawn as PLOT/DRAW rectangles with UDG suit symbols — hearts and diamonds in red, clubs and spades in black — and face values displayed as numerals or A/J/Q/K. The player hits or stands via keyboard; the dealer automatically plays by the standard rule of hitting on 16 or under. Running totals are displayed for both hands, and a bust is flagged with a “##BUSTED##” message. The program resets automatically for the next hand. The program auto-runs from line 4000, which loads four UDG suit symbols via DATA statements before jumping to line 20 to start play. Decoding the DATA bytes: - UDG `\a` (heart ♥): `01100110 / 11111111 / 11111111 / 01111110 / 00111100 / 00011000 / 00011000` - UDG `\b` (diamond ♦): symmetric `00010000` expanding to `11111110` then contracting - UDG `\c` (spade ♠): asymmetric top, two-lobed base - UDG `\d` (club ♣): trefoil pattern with stem Cards are drawn graphically using PLOT/DRAW (40×56 pixel rectangles). The suit is chosen randomly; INK 2 (red) is applied for hearts and diamonds, black for the others. Face values print as numerals 2–10 or A/J/Q/K. Card values: Aces=11 (reducible to 1), face cards=10. The layout uses two hands: p=0 is the player (top of screen, card slots 1–5), p=1 is the dealer (bottom of screen, slots 6–10). The initial deal gives the player two cards and the dealer one visible card. The player then hits or stops via keyboard. The dealer auto-plays at lines 160–200, hitting on 16 or under and standing on 17+, per standard rules. Busting triggers `##BUSTED##` and advances to the next hand. No explicit win/loss comparison between totals is shown — the player reads the displayed totals and judges the outcome themselves. The game resets with `RUN 20` after each hand. One note: line 200 uses `b>16` where `b` holds the dealer’s score (copied from `s` at line 1130) — the dealer correctly stands at 17+. No bugs observed, though the lack of a win/loss declaration is a design choice rather than an error. ## Source Code ``` 10 REM SAVE "21" LINE 4000 20 DIM v(10) 30 LET a=0 40 LET s=a 50 LET p=a 60 LET n=1 70 GO SUB 1000 80 LET p=1 90 LET n=6 100 GO SUB 1000 110 LET p=0 120 LET n=2 130 GO SUB 1000 140 GO SUB 2000 150 GO TO 130 160 LET p=1 170 LET n=7 180 GO SUB 1000 190 LET n=n+1 200 GO TO 180+2830*(b>16) 1000 LET v(n)=INT (2+RND*13) 1010 LET b=v(n) 1020 LET t=(n-1-p*5)*6 1030 PLOT 8*t+3,8*(21-p*10): DRAW 40,0: DRAW 0,-56: DRAW -40,0: DRAW 0,56 1035 LET z=INT (RND*4)+1 1040 PRINT AT 1+p*10,1+t;STR$ b AND b<11;"A" AND b=11;"J" AND b=12;"Q" AND b=13;"K" AND b=14 1045 IF z=1 OR z=2 THEN INK 2 1047 PRINT AT 2+p*10,1+t;"\a" AND z=1;"\b" AND z=2;"\c" AND z=3;"\d" AND z=4: INK 0 1050 FOR i=1+5*p TO 5+5*p 1060 IF v(i)=11 THEN LET a=a+1 1070 LET s=s+v(i)*(v(i)<12)+10*(v(i)>11) 1080 IF s>21 AND a THEN GO SUB 1150 1090 NEXT i 1100 LET a=0 1110 PRINT AT 8+10*p,0;"TOTAL=";s: PAUSE 60 1120 IF s>21 THEN GO TO 3000 1130 LET b=s: LET s=0 1140 RETURN 1150 LET s=s-10 1160 LET a=a-1 1170 RETURN 2000 PRINT AT 21,0;"Hit or Stop?" 2010 GO TO 2010+10*(INKEY$<>"") 2020 PRINT AT 21,0;" " 2030 GO TO 2040+970*(INKEY$="S" OR INKEY$= "s") 2040 LET n=n+1 2050 RETURN 3000 PRINT AT 8+10*p,0;"##BUSTED##" 3010 LET p=p+1 3020 LET s=0 3030 IF p=1 THEN GO TO 160 3040 PAUSE 600 3050 CLS 3060 RUN 20 4000 RESTORE : DATA 102,255,255,126,60,24,24,0,16,56,124,254,124,56,16,0,16,56,124,254,254,102,16,0,16,56,16,84,254,84,16,0 4010 FOR i=0 TO 7: READ a: POKE USR "a"+i,a: NEXT i 4020 FOR i=0 TO 7: READ a: POKE USR "b"+i,a: NEXT i 4030 FOR i=0 TO 7: READ a: POKE USR "c"+i,a: NEXT i 4040 FOR i=0 TO 7: READ a: POKE USR "d"+i,a: NEXT i 4050 POKE 23658,8: CLS : RUN 20 ```