Rick Kephart  (2/2/88)  

 This program is intended for anyone wishing to learn to play the guitar, or
for those beginning to learn. One of the most important points in learning to
play the guitar is learning how to find the notes. That is the purpose of this

 The first part of this program is in BASIC. The second part contains 3
machine language programs: one to set up the split screen, one to set up the
graphics screen, and one to set up the sprite data. Also contained here are
the data for the multi-color hi-res bit-map picture of the neck of the
guitar, and the data for all the sprites, in a squeezed form, and also the
notes for 7 short songs you can learn to play on the guitar. When you run the
BASIC program, it will load in the second part. This will only LOAD the first
time it is RUN: if the program is stopped and then RUN again this second
portion will remain in memory and will not be loaded again (unless the
computer has been turned off, or the BASIC portion has been re-loaded).

 After the second part of the program has been loaded, the neck of a guitar
will appear on the screen. The neck has 12 frets (the frets are the short bars
going across the neck). Many guitars have more than 12 frets, but only the
first 12 are shown (beyond this, they are rarely used, and on a Classical
guitar are almost never used). The fifth, seventh, ninth, and twelfth frets
are labeled. On a typical guitar, these same frets will be marked by a dot,
either on the top of the neck or along the side.

 This guitar image is a mirror image of the guitar as you would be holding it.

 In the lower right of the screen you will see a music staff with the location
of the note on the staff.

 At the bottom, there are 4 text lines.

 The first tells the name of the note (A-G) and, if it is sharp or flat, that
will also be indicated.

 The second line is the octave. This guitar is divided into 3 full octaves,
counted from E to E (the lowest and highest notes). The highest E is Octave 4.

 The third line indicates the string, and the fourth line, the fret. The
strings are counted from bottom to top, the highest string is 1 and the lowest
string is 6. The fret number indicates either the fret number, or says "open"
if no fret is being pressed to get the note.

 One other thing appears on-screen: a hand with a pointing finger. The finger
points to the string and fret to be pressed to make the note. If the string is
played "open" (no string is pressed on by the left hand), then the hand will
point to the top of the string which is to be plucked, and will turn gray to
indicate that the left hand is not used (normally the hand will appear
yellow). To play a note at a fret (with the hand yellow), you should place
your finger just above the fret to be played (as the finger shows) and press
down, plucking the string with the right hand at the same time. It is usually
best to play notes at the first fret by pressing down with the index finger of
the left hand, the second fret with the second finger, etc.

 There are 3 ways of changing the note:

 The first and simplest way is with the CURSOR-UP and CURSOR-DOWN key. This
will move the note in the lower right up and down the staff in half-steps
(i.e. one note at a time with the sharps or flats in-between). At the same
time, the finger will move and point to the corresponding string and fret, and
the text lines will change to show the new note name, octave, string, and
fret. This is most useful if you have sheet music, and wish to learn to play
the song on the guitar.

 The second method is with the joystick (in Port #2). The joystick will move
the hand around the guitar fingerboard. Moving the joystick to the left or to
the right will move the hand to a different string, and moving the joystick up
or down will move the finger up and down the neck of the guitar to different
frets. Pushing the joystick simultaneously up and to the left or right will
move the finger directly to the top of the previous or next string ("open"
fret). The note on the staff and the text lines will also change as the hand
is moved. This method of input is the only way to see (except on the first
string) notes past the fourth or fifth fret.

 The third method is by typing in the name of the note and the octave. To do
this, press RETURN. You can then INPUT the name of the note. If you want the
note sharp, you don't have to write out the word as you will see it displayed;
abbreviate it as "+" after the name of the note. Likewise, flats may be
abbreviated "-" after the note. Press RETURN, and you will be asked for the
octave. Remember, octaves change at the "E" note. Then press RETURN, and the
hand and the note on the staff will indicate the note. This is useful if you
know the name of the note: it if faster than the other two methods.

 To play the note, you can either press SPACE or you can press the FIRE button
on the joystick.

 This program can display either sharps or flats, but not both. To change from
sharp mode to flat mode (display flats) press "-" and to go to sharp mode
(display sharps) press "+" at any time, except when you are inputting the note
from the keyboard (when the cursor is flashing) or while a prerecorded song is

 There are also 7 pre-recorded songs, and an option to record your own song.
To do this, you use the 4 function keys and 4 shifted function keys:

 f1 : "Red River Valley"
 f3 : "Man on the Flying Trapeze"
 f5 : "Barbara Allen"
 f7 : "Blow the Man Down"
 shifted: f2 : "Minuet" (J.S.Bach)
 f4 : "The Skaters Waltz"
 f6 : "Silent Night"
 f8 : reserved

 Pressing the corresponding function key will play the song. All these songs
will automatically go into sharp mode, except for "The Skaters Waltz" which
will go into flat mode. Any song may be paused during play with the SHIFT or
SHIFT-LOCK key, and will resume when the key is released, to make it easier
for you to learn how to play it.

 The f8 function key is reserved for your own song! This should make it easier
to learn a song of your own choice.

 To record a song, press the BACK-ARROW key on the upper left corner of the
keyboard. This will change the border color from light green to dark green to
indicating that it is recording. Then, any note which is played by either
pressing the SPACE bar or the joystick FIRE button will be recorded. To stop
recording, press the BACK-ARROW key again. Then, the song can be played by
pressing the f8 (shift-f7) function key. If the BACK-ARROW key is pressed
again, any previously recorded song is instantly erased, and a new tune can be
recorded. As with the built-in songs, your own recording can be paused with
the SHIFT or SHIFT-LOCK key.

 The song you have recorded here can also be saved! To SAVE your recording,
exit the program with RUN/STOP-RESTORE. Do not attempt any disk access at any
time while the guitar image is being displayed! When you get the "READY."
prompt and the normal screen colors, the type RUN1000 and press RETURN. Then
simply answer the prompts. The song is saved to disk as a USR file. Do the
same thing to LOAD in a previously saved song. After the LOAD is finished, the
program will automatically start.

 Don't press f8 while the record mode is on (border is dark green). If you do,
it will place the play-back in an endless loop: since it is recording at the
same time it is playing, it will never reach the end!

 Program notes:

 The guitar is a multi-color, hi-res bit-map, and the text is displayed
normally. This is accomplished by splitting the screen, making the top
two-thirds multi-color bit-map mode, and the bottom third normal text mode.
The split can be seen by breaking out of the program with the RUN/STOP key.
The note and staff are sprites, so they can go over the screen split between
the two modes without being affected. The hand is also a sprite.

 The FN statements are used for the conversions among name and octave,
position of the note, and position of the hand.

 How the program calculates the frequencies of the notes:

 The frequency of the note is determined from the string and fret. The ratio
of frequency from one note to the next (in half-steps) is 2^(1/12). So to
determine the frequency of any note, this value is raised to a power equal to
the number of half-steps from the base frequency, and this is multiplied by
the base frequency. In the case of the guitar, the lowest note (E) has a
frequency of 1351. If N=number of half-steps from the lowest note, then the
frequency is 1351*((2^(1/12))^N) or 1351*(2^(N/12)). So, for example, the
frequency of Low C may be found by finding the number of half-steps from E to
C, which would be 8 (F-F#-G-G#-A-A#-B-C), then taking 1351*(2^(8/12)).

>  This program is copyright Rick Kephart, but has been made available <
>  free of charge by the author.                                       <

   Commented Disassembly of Machine-Language Routines

3F40 78       SEI; Point interrupt to split-screen routine
3F41 A9 7F    LDA #$7F
3F43 8D 0D DC STA $DC0D
3F46 A9 3F    LDA #$3F
3F48 8D 15 03 STA $0315
3F4B A9 D2    LDA #$D2
3F4D 8D 14 03 STA $0314
3F50 A9 81    LDA #$81
3F52 8D 1A D0 STA $D01A
3F55 A9 1B    LDA #$1B
3F57 8D 11 D0 STA $D011
3F5A 58       CLI

3F5B A9 12    LDA #$12; Set up zero-page pointers for guitar data
3F5D 85 FC    STA $FC
3F5F A9 40    LDA #$40
3F61 85 FD    STA $FD; $FC-$FD point to picture data
3F63 A9 00    LDA #$00
3F65 85 FE    STA $FE
3F67 A9 20    LDA #$20
3F69 85 FF    STA $FF; $FE-$FF point to bit-map screen at 8192

3F6B A0 00    LDY #$00; Begin decompression and transfer
3F6D B1 FC    LDA ($FC),Y; get 2 bytes of data
3F6F 85 04    STA $04; $04 holds the actual byte of data
3F71 C8       INY
3F72 B1 FC    LDA ($FC),Y
3F74 85 03    STA $03; $03 holds the quantity of that byte

3F76 A0 00    LDY #$00; Expand bit-map data pair
3F78 A5 04    LDA $04
3F7A 91 FE    STA ($FE),Y
3F7C E6 FE    INC $FE; Increase pointer to next screen location
3F7E D0 02    BNE $3F82
3F80 E6 FF    INC $FF
3F82 C6 03    DEC $03
3F84 A4 03    LDY $03
3F86 C0 FF    CPY #$FF; Finished?
3F88 D0 EC    BNE $3F76

3F8A 18       CLC; Increase pointer to next byte-pair of data
3F8B A9 02    LDA #$02
3F8D 65 FC    ADC $FC
3F8F 85 FC    STA $FC
3F91 A9 00    LDA #$00
3F93 65 FD    ADC $FD
3F95 85 FD    STA $FD

3F97 A5 FF    LDA $FF
3F99 C9 38    CMP #$38; Done?
3F9B 90 CE    BCC $3F6B

3F9D A9 01    LDA #$01; Colors
3F9F 8D 21 D0 STA $D021; Background Color

3FA2 A9 00    LDA #$00; Set up zero-page pointers
3FA4 A8       TAY
3FA5 85 FC    STA $FC
3FA7 85 FE    STA $FE
3FA9 A9 04    LDA #$04
3FAB 85 FD    STA $FD; $FC-$FD point to screen memory
3FAD A9 D8    LDA #$D8
3FAF 85 FF    STA $FF; $FE-$FF point to color memory

3FB1 A9 DA    LDA #$DA; Fill with correct color combinations
3FB3 91 FC    STA ($FC),Y
3FB5 A9 06    LDA #$06
3FB7 91 FE    STA ($FE),Y

3FB9 E6 FC    INC $FC; Increase both pointers
3FBF D0 04    BNE $3FC5
3FC1 E6 FD    INC $FD
3FC3 E6 FF    INC $FF

3FC5 A5 FF    LDA $FF; Done?
3FC7 C9 DA    CMP #$DA
3FC9 D0 E6    BNE $3FB1
3FCD C9 BD    CMP #$BD
3FCF D0 E0    BNE $3FB1
3FD1 60       RTS; End of Graphics set-up routines

3FD2 A9 01    LDA #$01; New Split-Screen Interrupt routine
3FD4 8D 19 D0 STA $D019; Unlatch interrupt flag register
3FD7 A2 C9    LDX #$C9
3FD9 A0 07    LDY #$07
3FDB AD 12 D0 LDA $D012; Raster scan-line
3FDE 10 13    BPL $3FF3
3FE0 A2 01    LDX #$01
3FE2 A9 1B    LDA #$1B
3FE4 8D 11 D0 STA $D011; Bit-map off
3FE7 A9 15    LDA #$15
3FE9 8D 18 D0 STA $D018; Normal character dot-data base
3FEC A9 C8    LDA #$C8
3FEE 8D 16 D0 STA $D016; Multicolor off
3FF1 D0 0F    BNE $4002
3FF3 A9 3B    LDA #$3B
3FF5 8D 11 D0 STA $D011; Bit-map on
3FF8 A9 1D    LDA #$1D
3FFA 8D 18 D0 STA $D018; Bit-map at 8192
3FFD A9 D8    LDA #$D8
3FFF 8D 16 D0 STA $D016; Multicolor on
4002 8E 12 D0 STX $D012; New scan-line for interrupt
4005 AD 0D DC LDA $DC0D; Interrupt control register
4008 29 01    AND #$01
400A F0 03BEQ $400F
400C 4C 31 EA JMP $EA31

$4012 to $4862 contain DATA

4863 A9 00    LDA #$00; Set up zero-page pointers for sprite data
4865 85 FE    STA $FE
4867 A9 38    LDA #$38
4869 85 FF    STA $FF; $FE-$FF point to sprite blocks starting at 224
486B A9 B2    LDA #$B2
486D 85 FC    STA $FC
486F A9 48    LDA #$48
4871 85 FD    STA $FD; $FC-$FD point to data for the sprites

4873 A0 00    LDY #$00; Get byte of data
4875 B1 FC    LDA ($FC),Y
4877 48       PHA
4878 20 A8 48 JSR $48A8; Increase pointers
487B 68       PLA
487C F0 0A    BEQ $4888; Zero bytes?
487E C9 05    CMP #$05; Done?
4880 F0 2F    BEQ $48B1; Good-bye

4882 91 FE    STA ($FE),Y; Store sprite byte
4884 A9 01    LDA #$01
4886 D0 13    BNE $489B; Branch always, to increase data pointers

4888 B1 FC    LDA ($FC),Y; Expand zero-bytes
488A 48       PHA
488B A8       TAY; Fill with correct number of zero-bytes
488C A9 00    LDA #$00
488E 91 FE    STA ($FE),Y
4890 88       DEY
4891 C0 FF    CPY #$FF
4893 D0 F9    BNE $488E
4895 20 A8 48 JSR $48A8; JSR to increase data pointers
4898 A0 00    LDY #$00
489A 68       PLA; How far into sprite data?

489B 18       CLC; Increase pointers
489C 65 FE    ADC $FE
489E 85 FE    STA $FE
48A0 A9 00    LDA #$00
48A2 65 FF    ADC $FF
48A4 85 FF    STA $FF
48A6 D0 CD    BNE $4875; Branch always

48A8 E6 FC    INC $FC; Increase pointers
48AA A5 FC    LDA $FC
48AC F0 01    BEQ $48AF
48AE 60       RTS
48AF E6 FD    INC $FD
48B1 60       RTS

$48B2 to $4B28 contain DATA

 End of File
HOME Religion Latin  Mass Denton Prayer  Requests Homeschooling
Stories Art ******* Commodore Miniatures
England Italy Florida Musical Gregorian  Chant LPH  Resource  Center