The Museum of HP Calculators


Fruit Machine Game for the HP41c

This program is Copyright © 2001 by Brian Ward and may be used freely with permission. This program was first published in the HHPC Datafile magazine.

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

How to get this Program to your Calculator (via HP-IL, disk, wand, and fingers)
Download Binary FRUIT (.raw) program for disk or PC HP-IL Card download
Download Binary HOLD (.raw) program for disk or PC HP-IL Card download
Download Binary NUDGE (.raw) program for disk or PC HP-IL Card download
Download Hexadecimal FRUIT (.dat) program for Serial Port download
Download Hexadecimal HOLD (.dat) program for Serial Port download
Download Hexadecimal NUDGE (.dat) program for Serial Port download
Barcode for FRUIT (.pdf) program for wand download
Barcode for HOLD(.pdf) program for wand download
Barcode for NUDGE(.pdf) program for wand download

You should download one each of FRUIT, HOLD, and RAW in either .raw, .dat or .pdf format.

Overview

This program simulates a Fruit Machine (Slot machine/One-armed bandit), including the "Nudge" and "Hold" features.

Quick Instructions

  1. Load all three programs – Fruit, Nudge and Hold, SIZE 18. You need one memory module and Extended Functions module or an HP41CX.
  2. XEQ “FRUIT”
  3. Enter a random number seed from 0 – 1
  4. Press the E key (LN) to spin the reels. Reel 1 (display positions 1&2) is above the A key, Reel 2 (display 3&4) is above the B key, and Reel 3 (display 5&6) is above the C key.
  5. If it says ‘Nudge’, press A, B or C keys to advance reels 1, 2 or 3 respectively in the hope of reaching a winning line.
  6. If it says ‘Hold’, you can press A, B or C to Hold reels 1,2 or 3 and prevent them from spinning next go. Key D cancels all holds. Held reels are indicated by flags 1,2 and 3.

Full Instructions

Ensure all three programs are loaded and execute "FRUIT".

The initial keyboard layout is as follows:

Display

Reel 1

Reel 2

Reel 3

 

 

Key

A

B

C

D

E

Function

-

-

-

-

SPIN

Each reel uses two character positions in the display. You'll need to use your imagination with the ‘graphics’, but I'm particularly proud of the 'Bells' <,> and the 'Cherries' (,)!

Reel 1 is display positions 1 and 2 (above the 'A' key)
Reel 2 - positions 3 and 4 (above the 'B' key)
Reel 3 - positions 5 and 6 (above the 'C' key).

After entering a random number seed, play the game by pressing the “E” key to spin the reels.

One of four things happens:

  1. You win nothing – you’re current winnings (or losses) are shown
  2. You win something  – you’re new winnings (or losses) are shown
  3. You win or lose plus you get the option to HOLD any or all of the reels
  4. You lose but get the option to "Nudge" any of the reels around one position at a time.

NUDGING

‘Nudges’ are awarded randomly and allow you to advance any reel one position at a time, until you have a winning combination, or run out of nudges. “NUDGE” appears in the display and the number of nudges awarded displayed. The keyboard becomes as follows:

 
Display

Reel 1

Reel 2

Reel 3

 

 

Key

A

B

C

D

E

Function

Nudge reel 1

Nudge reel 2

Nudge reel 3

-

SPIN

Press the button under the reel you want to advance. Take care - the first winning combination you hit pays out and no further nudges are allowed.

HOLDING

A ‘Hold’ allows you to stop selected reels from spinning on your next go eg to hold two reels currently the same, hoping to make it three in a row. If you get a hold after a win, you can hold them all and win again. “Holds” are awarded at randomly. “HOLD” appears in the display. The keyboard becomes as follows:

Display

Reel 1

Reel 2

Reel 3

 

 

Key

A

B

C

D

E

Function

Hold reel 1

Hold reel 2

Hold reel 3

Cancel all holds

SPIN

Flags 1,2,3 in the display illuminate to tell you which reels are currently held. "D" cancels all held reels in case you change your mind. When you're satisfied with your selection, press "E" - the Spin key.

Winning Combinations

++ ++ any .10      ++ ++ ++  .20
?? ?? any .10      ?? ?? ??  .40
dP dP any .20      dP dP dP  .60
££ ££ any .20      ££ ££ ££  .80
[,][,]any .30      [,][,][,] 1.00
** ** any .30      ** ** **  1.20
%% %% any .40      %% %% %%  1.40
$$ $$ any .40      $$ $$ $$  1.60
(,)(,)any .50      (,)(,)(,) 1.80
<,><,>any .50      <,><,><,> 2.00

Example

Keystrokes:  Display:
[XEQ][ALPHA]SIZE[ALPHA] 018
[XEQ][ALPHA]FRUIT[ALPHA]

SEED? (enter a random number seed between 0 and 1)

.789 [R/S]  $0.00
<,><,><,>  SPIN
[E]         -$0.10            (We're down 0.10)
dP (,) dP  SPIN
[E]         -$0.20            (We're now down 0.20)
££ $$ ££   SPIN
[E]         WIN $0.10         (We win 0.10)
-$0.20                        (But we're still down 0.20)
++ ++<,>   SPIN
[E]         -$0.30            (We're down 0.30)
dP ?? dP   SPIN
[E]         WIN $0.50
$0.10                         (We're up by 0.10)
<,><,>[,]  SPIN
[E]         6 NUDGES
++ <,>££  NUDGE               (We’ve won 6 Nudges)
[C]         ++ <,>[,]  NUDGE  (Let’s nudge reel 3)
[C]         ++ <,> **  NUDGE  (and again)
[C]         ++ <,> %%  NUDGE  (and again)
[C]         ++ <,> $$  NUDGE  (and again)
[C]         ++ <,>(,)  NUDGE  (and again)
[C]         ++ <,><,>
            ++ <,><,>  HOLD   (Now we’ve won a hold)
[A][B]                        (Let’s hold reels 1 & 2)
[D]                           (No I’ve changed my mind)
[B][C]                        (Let’s hold reels 2 & 3)
[E]         (,)<,><,>  HOLD   (We’ve won another hold)
[B][C]                        (Let’s hold reels 2 & 3 again)
[E]         6 NUDGES          (Now we’ve won 6 nudges)
[E]         (,)<,><,>  NUDGE  (Let’s nudge reel 1)
[A]         <,><,><,>
WIN $2.00
$1.80
<,><,><,>  ;SPIN

Programming

The game consists of 3 programs - Fruit, Nudge and Hold. This segregation allows the top row of keys (A – E) to function differently, depending on whether or not you have been awarded Nudges or Holds. In normal play, the Fruit program is executing. When you are awarded a Nudge or Hold, the corresponding program is called. Return is passed to the main Fruit program when you press the spin key. The programs contain many simplifications to reduce execution time. All three reels are identical with only ten symbols and no duplication. The main thing is that it plays like the real thing. You need at least one memory module, the Extended Functions module and some simple Synthetic Programming (SP is only cosmetic, used for fancy Tones and reel symbols – you can easily substitute standard characters and tones in the lines indicated below). SIZE = 018.

Synthetic Program Lines

FRUIT - Lines 18, 26, 28 SP characters, Lines 80, 81 SP Tones
NUDGE - Lines 10, 11 SP Tones
HOLD - Lines 9,13,17 SP Tones

The Programs

FRUIT

001 LBL "FRUIT"
002 FIX 2
003 SF 27
004 0
005 STO 16
006 X<>F
007 SEED?
008 PROMPT
009 STO 00
010 ++            ;Reel symbol 1
011 ASTO 04
012 ??            ;Reel symbol 2
013 ASTO 05
014 dP            ;Reel symbol 3
015 ASTO 06
016 ££            ;Reel symbol 4
017 ASTO 07
018 [,]           ;SP Reel symbol 5
019 ASTO 08
020 **            ;Reel symbol 6
021 ASTO 09
022 %%            ;Reel symbol 7
023 ASTO 10
024 $$            ;Reel symbol 8
025 ASTO 11
026 (,)           ;SP Reel symbol 9
027 ASTO 12
028 <,>           ;Reel symbol 10 (Angle sign, comma, greater than)
029 ASTO 13
030 ““            ;2 SP Starburst characters (hex 02) for a spinning reel
031 ASTO 14
032 13
033 STO 01
034 STO 02
035 STO 03
036 LBL 15
037 TONE 1
038 TONE 0
039 CLA
040 RCL 16
041 SIGN
042 X<0?
043 -
044 >"$"
045 LASTX
046 ABS
047 ARCL X
048 AVIEW
049 PSE
050 XEQ 17
051 >" SPIN"
052 PROMPT
053 LBL "SPIN"
054 LBL E
055 14
056 FC? 01
057 STO 01
058 FC? 02
059 STO 02
060 FC? 03
061 STO 03
062 XEQ 17
063 0.1
064 ST- 16
065 CF 08
066 1.003
067 STO 15
068 AVIEW
069 LBL 00
070 FS?C IND 15
071 GTO 01
072 XEQ 16
073 10
074 *
075 4
076 +
077 INT
078 STO IND 15
079 LBL 01
080 TONE 89      ;SP tone (although any normal tone will work)
081 TONE 89      ;SP tone (although any normal tone will work)
082 XEQ 17
083 AVIEW
084 ISG 15
085 GTO 00
086 LBL "WIN"
087 WIN $
088 RCL 01
089 RCL 02
090 X#Y?        ;does reel 1 match reel 2?
091 GTO 03
092 RCL 03
093 X#Y?        ;does reel 2 match reel 3?
094 GTO 02
095 BEEP        ;all three match
096 SF 08
097 3           ;work out the winnings
098 -
099 5
100 /
101 ARCL X
102 AVIEW
103 ST+ 16
104 GTO 03
105 LBL 02
106 FIX 0
107 TONE 6
108 TONE 5
109 SF 08
110 RDN
111 3
112 -
113 2
114 /
115 0.1
116 +
117 RND
118 10
119 /
120 FIX 2
121 ARCL X
122 AVIEW
123 ST+ 16
124 LBL 03
125 XEQ 16
126 0.2
127 X>Y?
128 GTO "HOLD"
129 RDN
130 0.9
131 FS?C 08
132 GTO 15
133 X>Y?
134 GTO 15
135 XEQ 16
136 GTO "NUDGE"
137 LBL 16
138 RCL 00
139 R-D
140 FRC
141 STO 00
142 RTN
143 LBL 17
144 CLA
145 ARCL IND 01
146 ARCL IND 02
147 ARCL IND 03
148 END

NUDGE

001 LBL "NUDGE"
002 SF 08
003 9
004 *
005 2
006 +
007 INT
008 STO 15
009 LBL 00
010 TONE 73      ;SP tone (although any normal tone will work)
011 TONE 72      ;SP tone (although any normal tone will work)
012 DSE X
013 GTO 00
014 CLA
015 FIX 0
016 ARCL 15
017 >" NUDGES"
018 AVIEW
019 1
020 ST+ 15
021 PSE
022 FIX 2
023 LBL 01
024 CLA
025 ARCL IND 01
026 ARCL IND 02
027 ARCL IND 03
028 >" NUDGE"
029 AVIEW
030 RCL 01
031 RCL 02
032 X=Y?
033 GTO 03
034 DSE 15
035 STOP
036 GTO 03
037 LBL A
038 1
039 GTO 02
040 LBL B
041 2
042 GTO 02
043 LBL C
044 3
045 LBL 02
046 TONE 0
047 STO 17
048 1
049 ST+ IND 17
050 RCL IND 17
051 14
052 X>Y?
053 GTO 01
054 4
055 STO IND 17
056 GTO 01
057 LBL 03
058 BEEP
059 GTO "WIN"
060 END

HOLD

001 LBL "HOLD"
002 CLA
003 ARCL IND 01
004 ARCL IND 02
005 ARCL IND 03
006 >" HOLD"
007 PROMPT
008 LBL A
009 TONE 89      ;SP tone (although any normal tone will work)
010 SF 01
011 PROMPT
012 LBL B
013 TONE 89      ;SP tone (although any normal tone will work)
014 SF 02
015 PROMPT
016 LBL C
017 TONE 89      ;SP tone (although any normal tone will work)
018 SF 03
019 PROMPT
020 LBL D
021 0
022 X<>F
023 PROMPT
024 LBL E
025 GTO "SPIN"
026 END

Register Use

R00     Random Number seed
R01     Reel 1
R02     Reel 2
R03     Reel 3
R04     Reel symbol 1
R05     Reel symbol 2
R06     Reel symbol 3
R07     Reel symbol 4
R08     Reel symbol 5
R09     Reel symbol 6
R10     Reel symbol 7
R11     Reel symbol 8
R12     Reel symbol 9
R13     Reel symbol 10
R14     ‘Spinning’ reel symbols
R15     The number of nudges
R16     Our winnings
R17     General usage

Flags

01 Reel 1 held
02 Reel 2 held
03 Reel 3 held
08 Last go was a win

Go back to the HP-41C software library
Go back to the software library
Go back to the main exhibit hall