You are currently viewing Atari 65xe Train Sound

Atari 65xe Train Sound

Atari 65xe Train Sound

This is an example of an Atari 65xe Train Sound. The first part of this code sets up the variables ST$ and CH$. Each has 4 bytes reserved for Basic memory.

Sounds for the Atari 65xe train

The next line places the text “TOOT” inside of the ST$ variable to be used later in the program.

Atari 65xe train

In this part of the program we setup GRAPHICS mode 17 for the Atari 65xe Train Sound demo.

The next segment changes the border color with the POKE 712, 148. 

Then we position the text “ATARI CHOO-CHOO” at lines 10,10. The first parameter for the POSITION is known as the horizontal position, which reads from anywhere across the screen from left to right. The next part reads the vertical position from top to bottom. 

This next part begins what is known as a “loop” for our program the Atari 65xe Train Sound. 

This first part is actually reading the loop backward starting at a count of 15 to zero. The next section uses voice 1 and sets a decrease to the volume for this parameter.

Atari 65xe Random Data

Now we initialize the R variable choosing a value from 1 to 300. The plus 1 (+1) makes sure the selection starts at a value of one.

Then the next line says if R is equal to the value of 30 then we call the SOUND commands after this which set up the Atari 65xe train sound. In this line the program also does a subroutine jump to line 90.

Then we end the loop called X and increase the variable called P at .03 percent.

The next line checks the variable P to see if it is “greater or equal to 5”. If it is, then the variable P is set the value of five.

After this the GOTO returns to line 30 to stay in a program loop, which keeps the train whistling.

The POKE 77,0 turns off the attract mode for the color cycling that was common on the original Atari 2600 games.

After this, we begin a new loop (called “LOOP”) then counts up through the length of the data found in the variable ST$.

Then we set a position at 8+LOOP-1, 12. This positions the cursor at the horizontal line of 8+LOOP-1 which begins to read the text “TOOT” on the screen, and sets it vertically at line 12.

The next line that reads ? #6;CHR$(ASC(ST$(LOOP,LOOP))+32) begins to read the text found in the variable ST$ and increases the location by 32 to point to the character specific color set.

Now we begin a loop with the variable A and count from 1 to 400. The next part “NEXT A” finishes the loop. This is the Atari 65xe Train Sound demo’s way of slowing down the program.

Then we set the POSITION at 8,1 which again positions the line at 8 horizontal position and 1 vertical position.

Finally we initiate the clearing of the “TOOT” that appears after the variable R = 30 at line 50. Finally we RETURN back to line 50.

Full Atari 65xe Train Listing

15 DIM ST$(4),CH$(4)
16 ST$=”TOOT”
30 FOR X=15 TO 0 STEP -1-P:SOUND 1,0,0
40 R=INT(RND(0)*300)+1
50 IF R=30 THEN SOUND 3,36,10,10:SOUND
2,48,10,10:GOSUB 90:SOUND 3,0,0,0:SOU
ND 2,0,0,0
60 NEXT X:P=P+0.03
70 IF P>=5 THEN P=5
80 GOTO 30
90 POKE 77,0
96 ? #6;CHR$(ASC(ST$(LOOP,LOOP))+32);
100 FOR A=1 TO 400:NEXT A:POSITION 8,1
2:? #6;” “:RETURN
500 FOR Q=0 TO 3:SOUND Q,0,0,0:NEXT Q

Please follow and like us:


Steve has always had a passion for computers even before I owned one. His first personal computer was an Atari 65xe purchased at Children's Palace around 1986. In later years he attended DeVry University and received a Computer Science degree, works as a Front End Web Developer and is a born again Christian. Although this is a tech site, I am never shy to admit that I am a sinner saved by the blood of Jesus Christ. If you ever want to talk about salvation, I'm game.