There have been Christmas cards. There have been musical Christmas cards. And now here is the computerised Christmas card! As you listen to a three-part arrangement of We Wish You A Merry Christmas, watch snowflakes fall gently around the Christmas tree. The program itself occupies about kB of Ram, and consists largely of data statements containing the musical information. Because of the large number of data elements, we have included a preprogram (Lines 10-90) which verifies the data. This is automatically deleted when the data is confirmed to be correct. All three sound channels are used in the musical arrangement. Rendezvous is provided between the channels, and short breaks are used to distinguish consecutive notes of the same frequency. Notes are specified as channel status, pitch, and duration; and are read from the data statements three at a time. This ensures that the sound channels are kept busy while the program gosnbs to the moving graphics routine. The snowflakes are chosen at random and are moved down the screen by reading an array. p(). giving the current snowflake position, which is then updated and a new snowflake printed. To ensure that snowflakes do not print over the Christmas tree, the bottom of the screen is redefined using an elliptical envelope. This is effected by the user defined function in Line 160. The tree is drawn using the usual graphics commands, but is made simpler by the use of for ... next loops permitted by regular symmetry of the tree. In order to get maximum effect from both green and colour monitor screens, two distinct versions of ink statements are given in Line 210. You should use whichever is appropriate. Part two next week. If you would prefer not to type the listing, you can obtain a tape copy by sending a blank cassette, together with an SAE and £1 to 217 Whitehorse Road, Croydon CRO 2LH. PPopularComputingWeekly851219 ★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser... |
|
|