That's really simple, tear the code appart and you discover that variable CounterA is a pointer into EEPROM starting at Address location 1 (for the first line)...
CounterA=1
Then after each note is played, we increment it by four...
CounterA=CounterA+4
So CounterA is pointing to the note currently being played... simply do something like this...
Only on this forum... rocket science for 5-year-olds (by five year olds!!).Code:MusicalLoop: If CounterA=1 then LCDOut $FE,1,"Yankee Doodle" If CounterA=17 then LCDOut $FE,$C0,"went to town" If CounterA=33 then LCDOut $FE,1,"A-riding on",$FE,$C0," a pony" If CounterA=57 then LCDOut $FE,1,"Stuck a feather" If CounterA=73 then LCDOut $FE,$C0," in his hat" If CounterA=85 then LCDOut $FE,1,"And called it",$FE,$C0," macaroni. Read CounterA,NotePeriod.Highbyte If NotePeriod.Highbyte=$FF then LCDOut $FE,1 Pause 2000 Goto RestartLoop endif Read CounterA+1,NotePeriod.Lowbyte Read CounterA+2,CounterB NoteRepeat=CounterB*10 Read CounterA+3,CounterB MessagePrompt=MessagePrompt+1 NotePause=CounterB*10 CounterA=CounterA+4 MessageNote Gosub PlayNote Goto MusicalLoop
If you want to go more advanced... you can have the words appearing prior to every note...
Code:If CounterA=1 then LCDOut $FE,1,"Yan" If CounterA=5 then LCDOut "kee " If CounterA=9 then LCDOut "Doo" If CounterA=13 then LCDOut "dle" If CounterA=17 then LCDOut $FE,$C0,"went " If CounterA=21 then LCDOut "to " If CounterA=25 then LCDOut "town" etc etc




Bookmarks