Download filezillafor windows
InputPORTB ' Turn OFF the notes Delayms3000 ' Wait for the notes to decay naturally GIE= 0 ' Disable all interrupts Stop '---------------------------------------------------------------- REMINDERS= OFF ' Disable any reminders after this point REMARKS= OFF ' Disable assembler remarks after this point
' Lookup table to convert the midi note (0 to 127) into a frequency value
' for the interrupt sound generator Include"NOTE_DATA.INC" '----------------------------------------------------------------
' Load the music score Include"TUNE_DATA.INC" Although the above program looks large and complex, it is actually very simple
in operation. The music data is held in a series of LDATA tables, loaded into the main program by an INCLUDE directive. Each of the three tracks represent
a channel and consists o f the time to strike a note, (which is a 16-bit value),
and the midi value that represents the notes frequency, (which is a -bit
value). As shown below: - TRACK_1:
LDATAWORD00270, BYTE062
LDATAWORD00324, BYTE067
LDATAWORD00378, BYTE067 Each track is preceded by the label TRACK_n:, where n represents 1, 2, or 3.
TRACK_1 data is the melody line of the tune played via channel 1, TRACK_2
data is the harmony of the tune played via channel 2 and TRACK_3 is the bass
line of the tune played via channel 3. The time to strike a note value is compared to a constantly incrementing
counter ( TICKS), if the time to strike is equal to the TICKS variable, then a note is played. This is carried out for each channel until the music data is fin-
ished for a particular track (channel), which is represented by all zeroes in the
LDATAtable: - LDATAWORD00000, BYTE000 As mentioned above, the midi data representing a particular frequency consists
of a 7-bit value (0 to 127), however, the program requires different values in or-
der to play the correct frequency. This is accomplished by another LDATA table
that has the corresponding frequency required for a particular midi value. This
information is held in the include file NOTE_DATA.INC. The midi notes 24 to 95 are used in the program, implementing a 6 octave
span.