www.jupiter-ace.co.uk

Previous Page > Listings Index > Sailors' Hornpipe Listing


Sailors' Hornpipe

Popular Computing Weekly 16 December 1982 page 22

Sailors' Hornpipe

on Jupiter Ace
This is a Forth program written to run on the unexpanded Jupiter Ace. The program plays "The Sailors' Hornpipe" three times with increasing speed on each repetition.
  Load the program from the cassette by typing "load hornpipe" and then pressing "ENTER" whilst the tape is playing. When the program is loaded it may be run by typing "hornpipe" and then pressing "ENTER". To enter the program from the listing simply type in the listing pressing "ENTER" after each definition. The spaces in a Forth program are very critical especially after the colon at the beginning of a definition and before the semi-colon at the end of a definition. (This will all be obvious to a Forth user). Chapter 11 in the Jupiter Ace handbook is very helpful about how to use the BEEP command when playing tunes. I have modified the suggested method of playing tunes in the following ways:
1. Instead of  giving the
numerical value for the pitch of the note each time it is played I have defined the pitch of each note I use as the letter name of that note at the beginning of the program.
The tune is in E major so C, D, G and F should all be sharps, however, I omitted the sharp signs to make the typing simpler.
The note A does become A sharp a couple of times so I had to define an A# note.
2. There are only two lengths of
notes in the tune (semi-quavers and quavers) so I defined a standard note length DURATION and included this in two definitions, S (for short note) and L (for long note).

  With this set-up the tune can be written very easily in a definition by typing the letter name of the note followed by its duration, either long or short. This general method could be used for any tune. I don't think it is wortn defining a three octave set of named notes in semi-tone intervals which could be a universal tune-making set because this takes up too much memory in the unexpanded Ace.
  The tune may be played at any speed the user likes by typing a number for the duration of the note and following this by DURATION ! WHOLE eg: 20 DURATION ! WHOLE will play the tune so quickly that the individual notes are not discernible.
253 CONSTANT B
225 CONSTANT C
201 CONSTANT D	
190 CONSTANT E
169 CONSTANT F
150 CONSTANT G
142 CONSTANT A
134 CONSTANT A#
127 CONSTANT BB
113 CONSTANT CC
100 CONSTANT DD
95 CONSTANT EE
84 CONSTANT FF
75 CONSTANT GG
100 VARIABLE DURATION

: L DURATION @ 2 * BEEP ; 
: S DURATION @ 1 * BEEP ;

: PART1 EE S DD S EE L E L E L 
  BB S A S G S BB S EE S DD S EE
   S GG S FF S EE S FF L F L F L
  F S E S D S F S BB S A# S BB L 
; 

: PART2 CC S DD S EE S DD S 
  CC S BB S CC S BB S A S G S A 
  S G S F S E S E S D S C S B S
  C S E S D S F S E S G S F S A
  S G L E L E L 
;

: PART3 BB S A S G S BB S EE
  S BB S G S BB S EE S BB S CC 
  L A L A L CC S BB S A# S CC 
  S FF S CC S A# CC S FF S CC S 
  DDL BB L BB L
;
  
: WHOLE PART1 PART2 PART1 PART2
   PART3 PART2 PART3 PART2
;
 
: HORNPIPE CLS 10 5 AT 
  ." The Sailors' Hornpipe"
  120 DURATION ! WHOLE 90
  DURATION ! WHOLE 60 DURATION !
  WHOLE 
;
by Simon Cross