1 LET X=16382
2 LET Y=16381
3 LET T=0
40 LET Z=0
45 IF Z>10 THEN GOTO 90
..
counter for 10 cycles
50 POKE X, 16
.
..covered bridge by-pass (auto will stop under bridge)
54 LET B= PEEK Y
55 IF INT (B/128) <>
INT ((B/128) + 0.5) THEN GOTO 60
..checks O27 track
input near mansion
56 GOTO 54
60 PAUSE 20
62 POKE X, 0
..releases
auto under bridge (from POKE X, 16, line 50)
63 PAUSE 300
(causes auto and train to reach crossing simultaneously)
64 LET Z=Z+1
counter
Z
69 GOTO 45
90 LET B=PEEK Y
100 IF INT (B/2) <> INT ((B/2)
+ 0.5) THEN GOTO 200
checks input near telltale
110 GOTO 90
200 POKE X, 1
breaks
O27 track voltage
201 LET C=0
210 PAUSE 40
220 POKE X, 0
.puts
train in neutral
230 PAUSE 40
235 POKE X, 4
..O27
track switch set for train to back into station
236 PAUSE 10
237 POKE X, 0
stops
relay for O27 track switch
238 PAUSE 40
240 POKE X, 1
..breaks
O27 track voltage
250 PAUSE 40
260 POKE X, 0
.train
should now be in reverse
300 LET B=PEEK Y
301 IF INT (B/4) <> INT ((B/4)
+ 0.5) THEN GOTO 315
check input behind station
302 LET C=C+1
303 IF C>=75 THEN GOTO 6000
..if
counter reaches 75, then reversing unit in train malfunctioned
305 GOTO 300
then it goes to line 6000
315 POKE X, 1
O27
track voltage broken
320 PAUSE 40
330 POKE X, 10
.boom
box for station sound effects, R/R by-pass, and
340 PAUSE 40
American Flyer set in motion. O27 train in neutral
341 POKE X, 8
.just
boom box and R/R by-pass
342 PAUSE 6000
343 POKE X, 10
..boom
box, R/R by-pass, and Flyer
344 PAUSE 200
345 POKE X, 8
.just
boom box and R/R by-pass
350 IF PEEK Y>127 THEN GOTO 500
check input behind snow area
355 GOTO 350
500 POKE X, 136
bridge
by-pass and Snoopy rink
510 PAUSE 2000
520 POKE X, 128
.bridge
by-pass
530 PAUSE 300
540 POKE X, 139
bridge by-pass,
and toboggan (128+8+2+1) (2 is for voltage booster to toboggan)
541 PAUSE 60
542 POKE X, 137
.128+8+1
same as above, no booster
550 PAUSE 1800
551 POKE X, 128+2
.bridge
by-pass and booster so animation has full power on stopping
552 PAUSE 400
560 POKE X, 20
.16+4
Snoopy theme music on (separate relay)
570 PAUSE 40
1020 POKE X, 133
.128+4+1 reverse
mine track polarity, mine switch set to straight
1060 LET B=PEEK Y
1080 IF INT (B/8) <> INT ((B/8) + 0.5) THEN
GOTO 1120
.checks input behind mine track switch
1100 GOTO 1060
1120 PAUSE 20
1121 POKE X, 130
..mine
track voltage off, mine track switch set to turn
1140 PAUSE 650
.waiting
for switch motor to finish
1160 POKE X, 128
.mine
track polarity set to forward (default)
1180 PAUSE 100
1220 LET B=PEEK Y
1240 IF INT (B/8) <> INT ((B/8) + 0.5) THEN
GOTO 1280
..checking input behind mine switch
1260 GOTO 1220
1280 LET T=T+1
..counter to
cycle mine and elevator
1290 PAUSE 50
1300 IF T>=2 THEN GOTO 134
will break
loop
1310 PAUSE 40
1320 GOTO 1220
1340 PAUSE 60
1360 POKE X, 132
mine
track switch set to straight
1380 LET B=PEEK Y
1400 IF INT (B/8) <> INT ((B/8) + 0.5) THEN
GOTO 1440
checks input to see if handcar has passed
1420 GOTO 1380
1440 PAUSE 1000
1500 POKE X, 96
.handcar
now in tunnel, skateboard track on (64+32)
1510 PAUSE 2000
2000 POKE X, 192
Snoopy theme music
off (separate relay)
2010 PAUSE 40
2060 POKE X, 64+16
.R/R bypass and
Elephant animation, Kangaroo and Crocodile
2070 PAUSE 2000
2080 POKE, 32+16
..R/R by-pass
and Marx Twin train on
2090 PAUSE 3000
2091 POKE X, 8
..Boom box
and R/R by-pass
2092 PAUSE 1000
3999 LET Z=0
5999 GOTO 6005
6000 POKE X, 1
O27 track voltage off
6001 PAUSE 40
6002 POKE X, 0
all I/O relays off (default), train moving forword
6004 GOTO 90
7010 IF PEEK Y>127 THEN GOTO 7040
.waiting
for Snoopy in WV to reach snow area
7020 GOTO 7010
7040 IF PEEK Y<128 THEN GOTO 7055
.checks
that Snoopy has left area
7050 GOTO 7040
7055 POKE X, 16
covered by-pass
on
7060 LET B=PEEK Y
7070 IF INT (B/64) <> INT ((B/64) + 0.5) THEN
GOTO 6000
checks input near covered bridge
7080 GOTO 7060
8000 POKE X, 128+16
Japanese
track switch set to curved
8010 PAUSE 10
8020 POKE X, 128+32
siding
B now has O27 voltage, second train now in motion
8025 LET B=PEEK Y
8030 IF INT (B/32) <> INT ((B/32) + 0.5) THEN
GOTO 8050
..checks to see if train has left siding
8040 GOTO 8025
8050 POKE X, 128+32+16+2
Japanese switch
set to straight (16+2)
8060 PAUSE 10
8065 POKE X, 128+32
..keeps 32
(siding B) and bridge by-pass on
8070 FOR J=1 TO 4
.loop to
blow whistle
8071 LET B=PEEK Y
8072 IF INT (B/128) <> INT ((B/128) + 0.5) THEN
GOTO 8074 check to see if train is at highest point near mansion
8073 GOTO 8071
8074 PAUSE 400
8075 FOR I=1 TO 4
8076 POKE X, 128+32+64
.blows
whistle (64)
8077 PAUSE 40
8078 POKE X 128+32
.stops blowing
whistle
8079 PAUSE 80
8080 NEXT I
8081 NEXT J
8084 PAUSE 2000
8085 LET B=PEEK Y
8090 IF INT (B/32) <> INT ((B/32) + 0.5) THEN
GOTO 8110
..checks to see if train has passed input near gas station
8100 GOTO 8085
8110 POKE X, 1+16
O27 voltage off
8120 PAUSE 40
8130 POKE X, 128+32+16
.Japanese switch
set to curve
8132 PAUSE 10
8135 POKE X, 128+32
.switch relay off,
O27 track voltage back on, train in neutral
8140 PAUSE 40
8150 POKE X, 1+16
O27 voltage off
8155 PAUSE 40
8160 POKE X, 128+32
train now
in reverse
8165 LET B=PEEK Y
8170 IF INT (B/16) <> INT ((B/16) + 0.5) THEN
GOTO 8190
.waits for train to reach end of siding, input at end of siding
8180 GOTO 8165
8190 POKE X, 17
.
O27 voltage
off
8200 PAUSE 40
8210 POKE X, 128+32+16+2
Japanese
switch set to straight
8220 PAUSE 10
8221 POKE X, 1
all relays off except
1, O27 voltage still off
8222 PAUSE 40
8230 POKE X, 0
all relays off, O27
voltage on
8240 PAUSE 40
8250 POKE X, 1
.cycles reversing unit
in train if necessary
8260 PAUSE 40
8270 POKE X, 0
..passenger train at
station should be in forward
9000 GOTO 1