   0000   e8                     SEX   8          ; Use Register-8 as stack ptr.
   0001   f8 50         LOOP:    LDI  MUSIC       ; 1st Music Byte loc'n to R-8.0
   0003   a8                     PLO   8
   0004   f8 43         NEXT:    LDI  SPEED       ; Speed modifier loc'n to R-9.0
   0006   a9                     PLO   9
   0007   72                     LDXA             ; Get music byte; advance stk ptr.
   0008   aa                     PLO   0AH        ; Store Music Byte in R-A.0
   0009   32 01                  BZ   LOOP        ; If Music Byte is 00, repeat tune
   000b   fa 70                  ANI  070H        ; AND 70 with B9
   000d   bb                     PHI   0BH        ; Store result - duration byte
   000e   f6            	shr
   000f   bb            	phi 0bh
                        ;         NOP              ; (See text for speed modifier)
                        ;         NOP              ; (See text for speed modifier)
   0010   c4                     NOP              ; (See text for speed modifier)
   0011   c4                     NOP              ; (See text for speed modifier)
   0012   c4                     NOP              ; (See text for speed modifier)
   0013   c4                     NOP              ; (See text for speed modifier)
   0014   c4                     NOP              ; (See text for speed modifier)
   0015   c4                     NOP              ; (See text for speed modifier)
   0016   c4                     NOP              ; (See text for speed modifier)
   0017   8a                     GLO  0AH         ; Get Music Byte
   0018   fa 0f                  ANI  0FH         ; AND 0F with B9
   001a   ac                     PLO  0CH         ; Store result-note constant = 09
   001b   f9 40                  ORI  040H        ; OR 40 with 09
   001d   ad                     PLO  0DH         ; Store result-note loc'n = 49
   001e   0d                     LDN  0DH         ; Get freq. constant in locn'n 49
   001f   ae                     PLO  0EH         ; Store note freq. constant = 33
   0020   8a                     GLO  0AH         ; Get Music Byte
   0021   fa 80                  ANI  080h        ; AND 80 with B9; oct. byte = 10
   0023   32 2a                  BZ   EX1         ; If oct. byte is 00, go to 2A
   0025   8e                     GLO  0EH         ; Get low oct. freq. constant
   0026   f6                     SHR              ; Shift rt., nominally halves 'E'
   0027   ff 01                  SMI  01          ; Final hi-oct. freq. constant mod'n
   0029   ae                     PLO  0EH         ; Store hi-oct. freq. constant
   002a   c4            EX1:     NOP              ; Spare (See "New Uses")
   002b   9b                     GHI  0BH         ; Get duration constant
   002c   bf                     PHI  0FH         ; Make a copy. (See "New Uses")
   002d   9f            DUR:     GHI  0FH         ; Get duration constant
   002e   32 04                  BZ   NEXT        ; If hi-F=00, get next Music Byte
   0030   8e                     GLO  0EH         ; Get frequency constant
   0031   ff 01         FRQL:    SMI  01H         ; Decrement freq. const; hold in 'D'
   0033   2f                     DEC  0FH         ; Decrement duration constant
   0034   3a 31                  BNZ  FRQL        ; Back through loop until 'D' = 0
   0036   8c                     GLO  0CH         ; Get note constant
   0037   32 2d                  BZ   DUR         ; If 00, back through duration loop
   0039   31 3e                  BQ   SKP         ; If Q = 1, go to reset Q
   003b   7b                     SEQ              ; Set Q
   003c   30 2d                  BR   DUR         ; Loop back until duration ends
   003e   7a            SKP:	 REQ              ; Reset Q
   003f   30 2d                  BR   DUR         ; Loop back until dur'n ends
   0041   c4                     NOP              ; Spare; end of main program
   0042   ff                     DB 0FFH          ; (See "New Uses")
   0043   c4            SPEED:   NOP              ; Reserved loc'n for speed mod'r
                        ;(#s in parentheses are for colorburst/2 crystal)
                        ;      DB 04DH                      ; A# (or B-flat)
                        ;      DB 041H                      ; C# (or D-flat)
                        ;      DB 03AH                      ; D# (or E-flat)
                        ;      DB 030H                      ; F# (or G-flat)
                        ;      DB 02BH                      ; G# (or A-flat)
                        ;      DB 02DH                      ; G
                        ;      DB 052H                      ; A
                        ;      DB 049H                      ; B
                        ;      DB 045H                      ; C
                        ;      DB 03DH                      ; D
                        ;      DB 036H                      ; E
                        ;      DB 033H                      ; F
                        ; (Note constants; numbers are for author's system, 2.01MHZ)
   0044   57                  DB 057H                       ; A# (or B-flat)
   0045   49                  DB 049H                       ; C# (or D-flat)
   0046   41                  DB 041H                       ; D# (or E-flat)
   0047   36                  DB 036H                       ; F# (or G-flat)
   0048   30                  DB 030H                       ; G# (or A-flat)
   0049   33                  DB 033H                       ; G
   004a   5c                  DB 05CH                       ; A
   004b   52                  DB 052H                       ; B
   004c   4d                  DB 04DH                       ; C
   004d   45                  DB 045H                       ; D
   004e   3d                  DB 03DH                       ; E
   004f   39                  DB 039H                       ; F
                        
                        
   0050                 MUSIC:	
                        ;;;  HERNANDO'S HIDEAWAY   b7=octave, b6-4=duration, b3-0=note
   0050   46            	DB 046H			; octave 0, duration 4, note 6
   0051   2d            	DB 02DH			; octave 0, duration 2, note 13
   0052   40            	DB 040H			; octave 0, duration 4, note 0=silence
   0053   26            	DB 026H			; octave 0, duration 2, note 6
   0054   2d            	DB 02DH			; octave 0, duration 2, note 13
   0055   40            	DB 040H			; octave 0, duration 4, note 0=silence
   0056   26            	DB 026H
   0057   2d            	DB 02DH
   0058   27            	DB 027H
   0059   aa            	DB 0AAH
   005a   60            	DB 060H
   005b   46            	DB 046H
   005c   2d            	DB 02DH
   005d   40            	DB 040H
   005e   26            	DB 026H
   005f   2d            	DB 02DH
   0060   40            	DB 040H
   0061   26            	DB 026H
   0062   2d            	DB 02DH
   0063   29            	DB 029H
   0064   a4            	DB 0A4H
   0065   60            	DB 060H
   0066   46            	DB 046H
   0067   2d            	DB 02DH
   0068   40            	DB 040H
   0069   26            	DB 026H
   006a   2d            	DB 02DH
   006b   40            	DB 040H
   006c   26            	DB 026H
   006d   2d            	DB 02DH
   006e   27            	DB 027H
   006f   aa            	DB 0AAH
   0070   60            	DB 060H
   0071   c4            	DB 0C4H
   0072   29            	DB 029H
   0073   40            	DB 040H
   0074   a6            	DB 0A6H
   0075   ad            	DB 0ADH
   0076   ac            	DB 0ACH
   0077   20            	DB 020H
   0078   94            	DB 094H
   0079   9a            	DB 09AH
   007a   29            	DB 029H
   007b   20            	DB 020H
   007c   4d            	DB 04DH
   007d   29            	DB 029H
   007e   20            	DB 020H
   007f   00            	DB 000H
                        
   0080                 	end
002d  DUR           002a  EX1           0031  FRQL          0001  LOOP      
0050  MUSIC         0004  NEXT          003e  SKP           0043  SPEED     
