Slots

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Gambling

A four-reel slot machine with a cabinet drawn in colour blocks. You start with $50, and each pull of the handle costs $5. The reels show a red apple, a yellow bell and magenta cherries, each built from four UDGs, and spin with short beeps. Four of a kind pays $100 and three of a kind pays $35, and two bells side by side add a $15 bonus. After some pulls a flashing HOLD! prompt lets you type reel numbers to hold for the next spin. The game ends when you go broke or win more than the $500 house limit.

No author is named on screen or in the listing.

Program Analysis

Structure

  • Lines 10–60: the main loop. It sets the house limit HL=500, runs the set-up, then pulls the handle, offering a hold 55% of the time (RND>.45).
  • Lines 100–200: the hold prompt. Each reel number typed sets Q(n)=n. Pressing ENTER on an empty line ends it.
  • Lines 240–280: draw the four reels from A$() and B$(), the top and bottom halves of each symbol.
  • Lines 320–700: a pull. It takes $5, waits for a key, spins unheld reels eight times, scores the result, plays a jingle, and checks whether you are broke or over the house limit.
  • Lines 750–1140: set-up. It defines UDGs A–H and J–M from DATA, builds the symbol strings, and draws the cabinet, the money counter and the HOUSE LIMIT plate.
  • Lines 1160–1230: the UDG data, four bytes per row for each symbol.

Scoring

Line 490 tests all four reels for a jackpot. Line 500 tests the four ways to get three of a kind, and line 510 tests for an adjacent pair of bells (symbol 2). A jackpot skips the bonus test. The winnings PR are added to the money in line 550.

Notable Techniques

  • Each symbol string starts with CHR$ 16 and a colour number, an embedded INK control code, so a plain PRINT shows every symbol in its own colour.
  • Each 16×16 symbol is four UDGs, poked in one loop from DATA rows that hold one byte of each of the four characters.
  • Several GO SUB targets (70, 210, 290, 720) are not in the listing. Sinclair BASIC carries on at the next line that exists, so the calls still work. The missing lines were probably removed REMs.
  • Lines 360–370 wait for any key to be released and then pressed, so any key pulls the handle, not just ENTER.

Potential Issues

  • A bell bonus without three of a kind is paid but never announced. Line 560 skips the win messages whenever Q$ is empty, though the money counter still goes up.
  • In the hold prompt, a non-digit appears to stop the program with an error at line 140, and 0 or 5–9 with a subscript error at line 150.
  • Line 500 tests A(2)=A(3) AND A(3)=A(4) twice. This is harmless.
  • Line 100 opens a FOR T=1 TO 7 loop that is never closed.
  • Both endings jump to line 1240. On the disk copy, the program is damaged from that line on. Line 1240 is now a bare PRINT #, so the game appears to end with an error report, and what originally followed is lost.

This program came from an Oliger (JLO SAFE) disk and was converted to load from tape. The 21 garbled lines after line 1240 were blanked to REMs. It does not autostart, so type RUN. It was tested in ZEsarUX through spins of the reels and the HOLD prompt.

Image Gallery

Source Code

   10 CLS 
   20 LET HL=500: REM HOUSE LIMIT
   30 GO SUB 720
   40 GO SUB 290
   50 IF RND>.45 THEN GO SUB 70
   60 GO TO 40
  100 FOR T=1 TO 7
  110 PRINT AT 9,22; FLASH 1; INK RND*4;"HOLD!"
  120 INPUT ""; LINE Q$
  130 IF Q$="" THEN GO TO 190
  140 LET Q=VAL Q$(1)
  150 LET Q(Q)=Q
  170 PRINT AT 9+Q,22; INK RND*4; FLASH 1;"Held > ";Q;" "
  180 GO TO 120
  190 PRINT AT 9,22;"      ";AT 10,22;"         ";AT 11,22;"         ";AT 12,22;"            ";AT 13,22;"         "
  200 RETURN 
  240 PRINT AT 6,3;A$(A(1));AT 7,3;B$(A(1))
  250 PRINT AT 6,6;A$(A(2));AT 7,6;B$(A(2))
  260 PRINT AT 6,9;A$(A(3));AT 7,9;B$(A(3))
  270 PRINT AT 6,12;A$(A(4));AT 7,12;B$(A(4))
  280 RETURN 
  320 LET MO=MO-5
  330 LET PR=0
  340 LET Q$="": LET P$=""
  350 PRINT AT 4,19; PAPER 1; INK 7;" Press ENTER ";AT 5,19;" to pull the ";AT 6,21;" HANDLE "
  360 IF INKEY$<>"" THEN GO TO 360
  370 IF INKEY$="" THEN GO TO 370
  380 PRINT AT 4,19;"             ";AT 5,19;"              ";AT 6,21;"        "
  390 PRINT AT 2,28; FLASH 1; INVERSE 1; INK RND*4;MO; FLASH 0; INVERSE 0;"  "
  400 FOR Z=1 TO 8
  410 FOR B=1 TO 4
  420 IF Q(B)=B THEN GO TO 450
  430 BEEP .008,Z*B
  440 LET A(B)=INT (RND*3)+1
  450 NEXT B
  460 GO SUB 210
  470 NEXT Z
  480 DIM Q(4)
  490 IF A(1)=A(2) AND A(2)=A(3) AND A(3)=A(4) THEN LET Q$=" JACK POT!! ": LET PR=100: GO TO 520
  500 IF (A(1)=A(3) AND A(3)=A(4)) OR (A(1)=A(2) AND A(2)=A(3)) OR (A(2)=A(3) AND A(3)=A(4)) OR (A(2)=A(3) AND A(3)=A(4)) OR (A(1)=A(2) AND A(2)=A(4)) THEN LET Q$=" 3 OF A KIND!! ": LET PR=35
  510 IF A(1)=2 AND A(2)=2 OR A(2)=2 AND A(3)=2 OR A(3)=2 AND A(4)=2 THEN LET P$=" BONUS!! ": LET PR=PR+15
  520 FOR G=1 TO 20
  530 BEEP .008,50-5: BEEP .008,50
  540 NEXT G
  550 LET MO=MO+PR
  560 IF Q$="" THEN GO TO 630
  570 PRINT AT 19,6; BRIGHT 1; FLASH 1; INK 2; PAPER 4;Q$
  580 PRINT TAB 6; BRIGHT 1; FLASH 1; INVERSE 1; INK 2; PAPER 4;Q$
  590 IF PR>0 THEN PRINT AT 10,3; BRIGHT 1; INK 2;"You WIN $";PR
  600 IF P$="" THEN GO TO 630
  610 PRINT AT 10,20; FLASH 1; INK 5; PAPER 3;P$
  620 PRINT AT 11,20; INVERSE 1; FLASH 1; INK 3;P$
  630 FOR T=1 TO 100 STEP 2: BEEP .008,T-40: NEXT T
  640 PRINT AT 2,28; FLASH 1; INVERSE 1; INK RND*4;MO; INVERSE 0
  650 PRINT AT 19,6;"               ";TAB 6;"                "
  660 PRINT AT 10,2; INK 0;"              "
  670 PRINT AT 10,20;"         ";AT 11,20;"         "
  680 IF MO<1 THEN PRINT AT 0,0; FLASH 1;"That's the end my friend","You're broke": GO TO 1240
  690 IF MO>HL THEN PRINT AT 0,0; FLASH 1;"You've broken the house!!": GO TO 1240
  700 RETURN 
  750 LET MO=50
  760 DIM A$(3,4): DIM B$(3,4): DIM A(4): DIM Q(4)
  770 FOR Z=0 TO 7
  780 READ A,B,C,D
  790 POKE USR "A"+Z,A
  800 POKE USR "B"+Z,B
  810 POKE USR "C"+Z,C
  820 POKE USR "D"+Z,D
  830 NEXT Z
  840 LET A$(1)=CHR$ 16+CHR$ 2+"a"+"b"
  850 LET B$(1)=CHR$ 16+CHR$ 2+"c"+"d"
  860 FOR Z=0 TO 7
  870 READ E,F,G,H
  880 POKE USR "E"+Z,E
  890 POKE USR "F"+Z,F
  900 POKE USR "G"+Z,G
  910 POKE USR "H"+Z,H
  920 NEXT Z
  930 LET A$(2)=CHR$ 16+CHR$ 6+"e"+"f"
  940 LET B$(2)=CHR$ 16+CHR$ 6+"g"+"h"
  950 FOR Z=0 TO 7
  960 READ J,K,L,M
  970 POKE USR "J"+Z,J
  980 POKE USR "K"+Z,K
  990 POKE USR "L"+Z,L
 1000 POKE USR "M"+Z,M
 1010 NEXT Z
 1020 LET A$(3)=CHR$ 16+CHR$ 3+"j"+"k"
 1030 LET B$(3)=CHR$ 16+CHR$ 3+"l"+"m"
 1040 PAPER 7: CLS : BORDER 7
 1050 PRINT AT 1,3; INK 0;"           "
 1060 PRINT TAB 2; INK 0;"  "; INK 4; PAPER 2; FLASH 1;"         "; FLASH 0; PAPER 7; INK 0;"     ";TAB 21; INK 2; FLASH 1;"Money $";MO
 1070 PRINT TAB 2; INK 0;"  "; INVERSE 1; INK 4; PAPER 2; FLASH 1;"         "; INVERSE 0; FLASH 0; PAPER 7; INK 0;"    "
 1080 FOR Z=1 TO 11
 1090 PRINT TAB 2;"                "
 1100 NEXT Z
 1110 PRINT TAB 2;" "; PAPER 6; INK 3; FLASH 1;"           "; FLASH 0; PAPER 7; INK 0;"    "
 1120 PRINT TAB 2;" "; PAPER 6; INK 3; INVERSE 1; FLASH 1;"           "; FLASH 0; INVERSE 0; PAPER 7; INK 0;"    "
 1130 PRINT TAB 2;"                "
 1135 PRINT AT 15,3; FLASH 1; INVERSE 1; PAPER 6; INK 3;"HOUSE LIMIT";AT 16,6;"$";HL
 1140 RETURN 
 1160 DATA 0,8,121,254,0,28,63,254,0,48,63,254,15,32,31,254
 1170 DATA 31,240,15,252,51,252,7,248,52,254,1,224,101,254,0,0
 1190 DATA 0,128,7,240,0,128,15,248,1,192,15,248,3,224,31,252
 1200 DATA 3,224,0,128,3,224,1,192,3,224,1,192,3,224,0,0
 1220 DATA 0,0,1,136,0,2,26,8,56,12,60,16,124,52,126,208
 1230 DATA 127,204,61,224,124,20,25,240,124,36,1,224,56,72,0,224
 1240 PRINT #

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.