Kind Of Blackjack (Sharp PC-1211) by aldweb
A downloadable game
Kind Of Blackjack
A BASIC 10-Liner for the Sharp PC-1211 Pocket Computer
by aldweb
[BASIC 10Liner 2026] | [PUR-80 Category]
Submission:
15th Edition of the BASIC 10 Liner Contest – "PUR-80" Category
Author:
Laurent Duveau (aldweb)
Coded for fun in 2026
License: Copyleft (attribution appreciated)
System Requirements:
Compatible with Sharp PC-1210, PC-1211, PC-1212, and Radio Shack Pocket Computers
Language:
S'-BASIC (Sharp Pocket Computer BASIC)
More Information:
Sharp PC-1211 Details & Articles
https://www.aldweb.com/articles.php?lng=en&pg=26
The challenge
=============
The Sharp PC-1211, released in March 1980, was the world's first pocket computer. It featured just 26 variable slots (A-Z or A$-Z$), 1,424 program steps (1.39 KB of memory), and 178 single-dimensional array slots for data storage—shared with program steps. Programming was limited to a tiny, interpreted version of BASIC, known as S'-BASIC.
Could a functional game be written for such a constrained device? Could it fit within the BASIC 10Liner Contest rules—10 lines or fewer, with each line under 80 characters? This "Kind Of Blackjack" game rises to that challenge, delivering a playable experience despite the hardware's severe limitations.
Kind Of Blackjack: game rules
=============================
Historical context:
The origins of Blackjack remain debated, but it is widely believed to have begun in French casinos around 1700.
Originally called "Vingt-et-Un" (French for "Twenty-One"), the game was later renamed Blackjack in the USA.
Gameplay overview:
In this simplified version of Blackjack, you play against the computer over 7 turns.
Turn mechanics:
Each turn, both you and the computer can choose to draw a random number between 1 and 9 or pass by selecting 0.
Scoring:
The drawn numbers are added to your existing total. If your sum exceeds 21, you automatically lose.
Winning:
After 7 turns, the player with the highest total (without exceeding 21) wins.
Listing
=======
chr tkn Basic code
[65](47) 1:PAUSE "WAIT...":FOR X=1 TO 22:A(X)=0:NEXT X:W=10:X=1:Q=1:GOTO 3 [43](34) 2:Z=221Z+.2113:Z=Z-INT Z:V=INT(9Z)+1:RETURN [77](62) 3:GOSUB 2:A(X)=VQ:GOSUB 2:Y=X+7:A(Y)=V*(S<21)*(((S<=R)+(S<17))>0):USING "##." [77](69) 4:R=R+A(X):T=W*(W*(W*(W*(W*(WA+B)+C)+D)+E)+F)+G+R/100:BEEP 1:PAUSE "TURN #";X [53](54) 5:S=S+A(Y):U=W*(W*(W*(W*(W*(WH+I)+J)+K)+L)+M)+N+S/100 [68](54) 6:PRINT "YOU PICK";A(X);" I PICK";A(Y):USING "########.##":PRINT T,U [32](26) 7:IF (R>21)+(S>21)+(X=7) GOTO 10 [28](24) 8:Q=0:INPUT "CARD (0/1)? ";Q [42](30) 9:Q=INT Q:IF (Q>-1)*(Q<2) LET X=X+1:GOTO 3 [54](38) 10:USING "###":BEEP 2:PRINT "GAME OVER:";R;" <>";S:END
Code metrics:
- Total characters: [539] (including spaces for readability)
- Tokenized size: (438) 8-bit memory cells
- Constraints met: all 10 lines adhere to the <80 characters limit for the PUR-80 category.
Initialization:
The screen will briefly display "WAIT...". Please wait while the game initializes—this may take a moment due to the slow processing speed of this early pocket computer.
Gameplay begins:
The screen will show a random number [1-9] that you "picked", and the computer will automatically play its turn.
Press [ENTER] to proceed to the main game screen.
Viewing hands:
Your hand is displayed on the left, and the computer's hand is on the right.
Each hand shows 7 digits, with the most recent pick on the far left and the remaining digits to the right.
A dot (.) follows the 7 digits, with 2 additional digits showing the sum of your hand.
Making your move:
Press [ENTER]. The prompt "CARD (0/1)?_" will appear.
Choose to either:
- Pick a random number (press 1, then [ENTER]).
- Pass and pick 0 (press 0, then [ENTER], or simply press [ENTER]).
Game progression:
The game continues in this manner until either:
- A player's total exceeds 21.
- All 7 turns have been played.
Game over:
The final scores will be displayed, with your score on the left and the computer's score on the right.
Listing the source code
=======================
Interrupting program execution:
While a program is running, you can pause execution at any time by pressing the [ON] key.
A message like "BREAK AT 4" will appear. Press the [CL] key to clear it.
Switching to program mode:
Press the [MODE] key twice until "PRO" appears in the top-right corner of the screen.
Viewing the source code:
Type LIST and press [ENTER], or use the down arrow key (to the right of the [ON] key) to start browsing the code.
Navigating the code:
Use the up/down arrow keys to move between lines.
Use the left arrow key (marked DEL) or right arrow key (marked INS) to navigate within a line.
Experimenting with the simulator:
Feel free to edit or write new code — almost all Sharp PC-1211 BASIC commands are fully functional.
Warning: any changes made will be lost when you close the simulator. The next time you launch it, the original preloaded source code will be restored.
Running the program again:
Switch back to RUN mode : press the [MODE] key until "DEF" or "RUN" appears at the top of the screen.
Execute the code: type RUN and press [ENTER] to restart the program (or any new code you have written).
Coding challenges on the Sharp PC-1211
======================================
A pioneer in pocket computing:
The Sharp PC-1211, released in 1980, was the first pocket computer programmable in BASIC, using S'-BASIC (S-prime BASIC). While it featured two 4-bit processors, its successor, the Sharp PC-1251 (1983), and later models adopted a full 8-bit architecture. Despite this, the code submitted here is fully compatible with the PC-1251 and other Sharp Pocket Computers, requiring no modifications.
Both the PC-1211 and PC-1251 share the same 24-character display, making them ideal for retro programming challenges.
S'-BASIC: efficiency in minimalism!
- Single-byte tokenization: every BASIC command, function, and operator is stored as a single-byte token, including the entire character set (uppercase only).
- Memory optimization: commands occupy only one memory cell, equivalent to one character. However, all lines in this submission remain under 80 characters, even without strict accounting.
Unique constraints of S'-BASIC:
No ELSE in IF statements
- The IF instruction lacks an ELSE feature. If the condition is true, the rest of the line executes; if false, execution jumps to the next line.
Workaround: Use IF as the last instruction in a line or rely on Boolean calculations to handle conditional logic.
Limited INPUT Instruction
- The INPUT instruction only accepts void entries if it is the last command in a line, which is restrictive in a 10-line contest.
Variable speed
- Variables W to Z execute faster and are ideal for FOR/NEXT loops and frequent calculations.
Dual variable mapping
- A(1) to A(26) map directly to variables A to Z. For example, A(3) and C store the same value. This allows the use of single-letter variables for simplicity, reserving A() arrays for bulk calculations or data transfers.
Implicit Multiplication
- The multiplication sign (*) can often be omitted. For example: ZT is equivalent to Z*T and 221Z is equivalent to 221*Z.
- Exception: I*F (calculation) is different from IF (keyword).
No pseudo-random function
- Randomness must be simulated in code.
Limited User Input
- No INKEY$ function—only basic INPUT is available, limiting interactivity.
Performance considerations:
Execution Speed: The real Sharp PC-1211 is extremely slow by modern standards. However, emulators like PokecomGO (PC-1251) and the PC-1211 simulator offer significantly faster execution, making them ideal for testing and gameplay.
Why this matters for the 10-Liner contest
Coding for the Sharp PC-1211 is a test of creativity and optimization. The constraints of S'-BASIC—limited memory, no ELSE, and slow execution—push programmers to innovate within tight boundaries. This submission is a perfect example of how to maximize functionality in minimal space!
Variables overview
==================
A-G Cards for Player 1 (stores up to 7 card values)
H-N Cards for Player 2 (stores up to 7 card values)
O (Unused)
P (Unused)
Q Card choice flag (0 = pass, 1 = draw a card)
R Total sum of Player 1's cards
S Total sum of Player 2's cards
T Display format for Player 1's hand (7 digits + sum)
U Display format for Player 2's hand (7 digits + sum)
V Random card value (generated between 1 and 9)
W* Constant value = 10 (used for display formatting)
X* Player 1's card pointer (initially used for setup, then tracks turns 1–7)
Y* Player 2's card pointer (tracks turns 8–14)
Z* Pseudo-random seed (used for generating random card values)
Key:
* = Optimized for speed (used in loops or frequent calculations)
Code listing and explanations
=============================
Line 1: Initialization
1:PAUSE "WAIT...":FOR X=1 TO 22:A(X)=0:NEXT X:W=10:X=1:Q=1:GOTO 3
Displays "WAIT..." to prepare the user.
Initializes the array A() to 0.
Sets W to 10 (used as a constant).
Initializes X (card pointer for Player 1) and Q (card choice).
Jumps to Line 3 to start the game.
Line 2: Pseudo-random number generator
2:Z=221Z+.2113:Z=Z-INT Z:V=INT(9Z)+1:RETURN
Generates a pseudo-random number between 1 and 9.
Uses a simple formula to simulate randomness.
Returns the value to the calling line.
Line 3: Player and computer turns
3:GOSUB 2:A(X)=VQ:GOSUB 2:Y=X+7:A(Y)=V*(S<21)*(((S<=R)+(S<17))>0):USING "##."
Calls the random number generator for the player.
If the player chooses a card (Q=1), stores the random value in A(X).
Calls the generator again for the computer.
The computer picks a card based on a simple logic to try to win.
Prepares the display format for scores.
Line 4: Update player score
4:R=R+A(X):T=W*(W*(W*(W*(W*(WA+B)+C)+D)+E)+F)+G+R/100:BEEP 1:PAUSE "TURN #";X
Adds the card value to the player's score (R).
Updates the display of the player's score (T).
Emits a beep and pauses to show the turn number.
Line 5: Update computer score
5:S=S+A(Y):U=W*(W*(W*(W*(W*(WH+I)+J)+K)+L)+M)+N+S/100
Adds the card value to the computer's score (S).
Updates the display of the computer's score (U).
Line 6: Display picked cards
6:PRINT "YOU PICK";A(X);" I PICK";A(Y):USING "########.##":PRINT T,U
Displays the cards picked by the player and the computer.
Prints the formatted scores.
Line 7: Check for game over
7:IF (R>21)+(S>21)+(X=7) GOTO 10
Checks if either player has exceeded 21 or if all 7 turns are completed.
If so, jumps to Line 10 to end the game.
Line 8: Prompt for card choice
8:Q=0:INPUT "CARD (0/1)? ";Q
Resets Q to 0.
Asks the player if they want a card (1) or to pass (0).
Line 9: Validate player input
9:Q=INT Q:IF (Q>-1)*(Q<2) LET X=X+1:GOTO 3
Converts the input to an integer.
If the input is 0 or 1, increments the card pointer and continues to the next turn.
Line 10: Game over
10:USING "###":BEEP 2:PRINT "GAME OVER:";R;" <>";S:END
Formats and prints the final scores.
Emits a beep to signal the end of the game.
Ends the program.
Download
Install instructions
Quick start: installing and running the game
============================================
(TL;DR)
Download the ZIP file to a directory on your Windows computer.
Run the Pocket80.exe simulator.
Press the [ON] button.
Right clic anywhere on the simulator window to open the popup menu.
Select [Load RAM (BASIC 10 Liner Contest)].
Choose [Kind Of Blackjack game (2026)].
Type RUN and press [ENTER].
Follow the instructions in the "Running the game" section below for detailed gameplay guidance.
Detailed Instructions
(For those who want the full story, read on below.)
Installing the source code
==========================
(Options for running on modern systems)
The Sharp PC-1211 lacks a dedicated emulator due to the unavailability of its processor and ROM specifications. However, you have a few alternatives:
Recommended alternative: custom simulator (Windows only)
In 2019, I began developing a Windows-based simulator for the Sharp PC-1211. While it is not yet finalized, it is functional enough to input and run the provided source code.
For convenience, a preconfigured version of the simulator is provided in this submission, preloaded with the game's source code and ready to run.
Alternative: PokecomGO emulator
For Android users, the PokecomGO emulator (running the Sharp PC-1251) is the closest alternative to the Sharp PC-1211.
All source codes designed for the PC-1211 can be executed on the PC-1251 without modification.
Alternative: PockEmul emulator
Windows, macOS, Android, and online versions of PockEmul are available, but note that the software now requires a subscription for activation.
Running the simulator
=====================
Extract the ZIP File:
Unzip the downloaded file to a folder on your Windows computer.
Launch the simulator:
Open the Pocket80sim subdirectory and double-click Pocket80.exe to start the simulator.
Customize your experience:
Right-click on the simulator's main screen to open a popup menu, where you can:
- Resize the window to fit your display.
- View the About section for additional details and credits.
Running the game
================
Boot the simulator:
Click the [ON] button to start the simulator (this mimics the actual boot sequence of the Sharp PC-1211).
Right clic anywhere on the simulator window to open the popup menu.
Select [Load RAM (BASIC 10 Liner Contest)].
Choose [Kind Of Blackjack game (2026)].
Press the R, U, and N keys in sequence, followed by [ENTER].


Leave a comment
Log in with itch.io to leave a comment.