beautypg.com

Elenco Snap Circuits SnapMicro I Deluxe ® User Manual

Page 34

background image

33

After the song is loaded into the wizard, click on the Copy button to open

the copy window.

Answer yes to paste the tune directly into your program or a new program

if one is not open. The following information will now appear in your

program.

'Santa clause is coming to town

tune 0, 4,

($60,$64,$65,$27,$E7,$67,$69,$6B,$00,$C0,$64,$65,$27,$27,$27,$69,$67,$25,$E5,$24,$27,$20,$24,$22,$E5,$2B,$A0,

$60,$64,$65,$27,$E7,$67,$69,$6B,$00,$C0,$64,$65,$27,$27,$27,$69,$67,$25,$E5,$24,$27,$20,$24,$22,$E5,$2B,$80)

The above tune will all be on one line in the program. Close the PICAXE

®

Tune Wizard window and run a syntax check that will show the tune

added 85 bytes to the program! OUCH! That is a great deal of memory for

just one tune. Play the tune by clicking the simulate button.

Notice how the first line in the tune above is identical to the line beneath it except for the last note.

Redundancy in programming is a waste of memory. Change the tune section of your program by typing

in or deleting the information on your screen to match the following;

'Santa clause is coming to town reworked

Main

: inc

b0

tune

0, 4,($60,$64,$65,$27,$E7,$67,$69,$6B,$00,$C0,$64,$65,$27,$27,$27,$69,$67,$25,$E5,$24,$27,$20,$24,$22,$E5,$2B)

if

b0 < 2

then

tune

0, 4, ($A0)

goto

main

else tune

0, 4,($80)

end if

A syntax check will show this section is 65 bytes, or a savings of 20 bytes of memory. The tune will play

correctly after down load but may have a few pauses when played by the simulator.

This manual is related to the following products: