mirror of
https://github.com/tebl/RC-Project-Board.git
synced 2025-01-07 15:30:44 +00:00
Fixed music (accidentally overwrote keyboard routines)
This commit is contained in:
parent
610e789539
commit
5ab8803f93
@ -8,6 +8,7 @@
|
||||
;
|
||||
VIA1 .EQ $4000 ; GAME BOARD (VIA #1)
|
||||
VIA3 .EQ $4C00 ; GAME BOARD (VIA #3)
|
||||
TABEG .EQ $0350 ; TABLE TO STORE MUSIC
|
||||
|
||||
.OR $8000
|
||||
.TA $0000
|
||||
|
@ -1,9 +1,9 @@
|
||||
:10000000200681A90085001820E180C90FD00520B5
|
||||
:100010008A8090EFC90ED006204B801890EA8501A7
|
||||
:10002000207380A500C9FFD005208A8090DA4AA8F5
|
||||
:10003000A501B009290F990003E60090CB0A0A0A2E
|
||||
:100040000A190003990003E60090BDA2008602A5EC
|
||||
:10005000024AAABD0003B004290F900629F04A4ABB
|
||||
:10003000A501B009290F995003E60090CB0A0A0ADE
|
||||
:100040000A195003995003E60090BDA2008602A54C
|
||||
:10005000024AAABD5003B004290F900629F04A4A6B
|
||||
:100060004A4A207380A220209F80E602A502C50094
|
||||
:1000700090DF60C90DD006A254209F8060AABDD435
|
||||
:10008000808504BDC78020AB8060A9FF8504A94B93
|
||||
|
@ -5,11 +5,12 @@
|
||||
0000- 8 ;
|
||||
4000- 9 VIA1 .EQ $4000 ; GAME BOARD (VIA #1)
|
||||
4C00- 10 VIA3 .EQ $4C00 ; GAME BOARD (VIA #3)
|
||||
0000- 11
|
||||
8000- 12 .OR $8000
|
||||
8000- 13 .TA $0000
|
||||
8000-20 06 81 14 ( 6) BE6502 JSR INITKEY
|
||||
8003- 15 .IN ../../common/CH02-Music/player.asm
|
||||
0350- 11 TABEG .EQ $0350 ; TABLE TO STORE MUSIC
|
||||
0000- 12
|
||||
8000- 13 .OR $8000
|
||||
8000- 14 .TA $0000
|
||||
8000-20 06 81 15 ( 6) BE6502 JSR INITKEY
|
||||
8003- 16 .IN ../../common/CH02-Music/player.asm
|
||||
8003- I 1 ; MUSIC PLAYER PROGRAM
|
||||
8003- I 2 ; USES 16-KEY KEYBOARD AND BUFFERED SPEAKER
|
||||
8003- I 3 ; PROGRAM PLAYS STORED MUSICAL NOTES. THERE ARE TWO MODES OF OPERATION: INPUT
|
||||
@ -23,161 +24,160 @@
|
||||
0002- I 11 PTR .EQ $02 ; CURRENT LOCATION IN LIST
|
||||
0003- I 12 FREQ .EQ $03 ; TEMPORARY STORAGE FOR FREQUENCY
|
||||
0004- I 13 DUR .EQ $04 ; TEMP STORAGE FOR DURATION
|
||||
0300- I 14 TABEG .EQ $0300 ; TABLE TO STORE MUSIC
|
||||
4C00- I 15 PORT3B .EQ VIA3 ; VIA OUTPUT PORT B
|
||||
4C02- I 16 DDR3B .EQ VIA3+2 ; VIA PORT B DIRECTION REGISTER
|
||||
4C03- I 17 DDR3A .EQ VIA3+3
|
||||
4C01- I 18 PORT3A .EQ VIA3+1
|
||||
4C00- I 19 PORT3B .EQ VIA3
|
||||
8003- I 20
|
||||
8003- I 21 ;
|
||||
8003- I 22 ; COMMAND LINE INTERPRETER
|
||||
8003- I 23 ; $F AS INPUT MEANS RESET POINTERS, START OVER.
|
||||
8003- I 24 ; $E MEANS PLAY CURRENTLY STORED NOTES
|
||||
8003- I 25 ; ANYTHING ELSE IS STORED FOR REPLAY.
|
||||
8003- I 26 ;
|
||||
8003-A9 00 I 27 ( 2) START LDA #0 ; CLEAR NOTE LIST LENGTH
|
||||
8005-85 00 I 28 ( 3) STA PILEN
|
||||
8007-18 I 29 ( 2) CLC ; CLEAR NIBBLE MARKER
|
||||
8008-20 E1 80 I 30 ( 6) NXKEY JSR GETKEY
|
||||
800B-C9 0F I 31 ( 2) CMP #15 ; IS KEY #15?
|
||||
800D-D0 05 I 32 (2**) BNE NXTST ; NO, DO NEXT TEST
|
||||
800F-20 8A 80 I 33 ( 6) JSR BEEP3 ; TELL USER OF CLEARING
|
||||
8012-90 EF I 34 (2**) BCC START ; CLEAR POINTERS AND START OVER
|
||||
8014-C9 0E I 35 ( 2) NXTST CMP #14 ; IS KEY #14?
|
||||
8016-D0 06 I 36 (2**) BNE NUMKEY ; NO, KEY IS NOTE NUMBER
|
||||
8018-20 4B 80 I 37 ( 6) JSR PLAYEM ; PLAY NOTES
|
||||
801B-18 I 38 ( 2) CLC
|
||||
801C-90 EA I 39 (2**) BCC NXKEY ; GET NEXT COMMAND
|
||||
801E- I 40 ;
|
||||
801E- I 41 ; ROUTINE TO LOAD NOT LIST WITH NOTES
|
||||
801E- I 42 ;
|
||||
801E-85 01 I 43 ( 3) NUMKEY STA TEMP ; SAVE KEY, FREE A
|
||||
8020-20 73 80 I 44 ( 6) JSR PLAYIT ; PLAY NOTE
|
||||
8023-A5 00 I 45 ( 3) LDA PILEN ; GET LIST LENGTH
|
||||
8025-C9 FF I 46 ( 2) CMP #$FF ; OVERFLOW?
|
||||
8027-D0 05 I 47 (2**) BNE OK ; NO, ADD NOTE TO LIST
|
||||
8029-20 8A 80 I 48 ( 6) JSR BEEP3 ; YES, WARN USER
|
||||
802C-90 DA I 49 (2**) BCC NXKEY ; RETURN TO INPUT MODE
|
||||
802E-4A I 50 ( 2) OK LSR A ; SHIFT LOW BIT INTO NIBBLE POINTER
|
||||
802F-A8 I 51 ( 2) TAY ; USE SHIFTED NIBBLE POINTER AS BYTE INDEX
|
||||
8030-A5 01 I 52 ( 3) LDA TEMP ; RESTORE KEY#
|
||||
8032-B0 09 I 53 (2**) BCS FINBYT ; IF BYTE ALREADY HAS A NIBBLE, FINISH IT AND STORE
|
||||
8034-29 0F I 54 ( 2) AND #%00001111 ; 1ST NIBBLE. MASK HIGH NIBBLE
|
||||
8036-99 00 03 I 55 ( 5) STA TABEG,Y ; SAVE UNFINISHED 1/2 BYTE
|
||||
8039-E6 00 I 56 ( 5) INC PILEN ; POINT TO NEXT NIBBLE
|
||||
803B-90 CB I 57 (2**) BCC NXKEY ; GET NEXT KEYSTROKE
|
||||
803D-0A I 58 ( 2) FINBYT ASL A ; SHIFT NIBBLE 2 TO HIGH ORDER
|
||||
803E-0A I 59 ( 2) ASL A
|
||||
803F-0A I 60 ( 2) ASL A
|
||||
8040-0A I 61 ( 2) ASL A
|
||||
8041-19 00 03 I 62 ( 4*) ORA TABEG,Y ; JOIN 2 NIBBLES AS BYTE
|
||||
8044-99 00 03 I 63 ( 5) STA TABEG,Y ; ... AND STORE.
|
||||
8047-E6 00 I 64 ( 5) INC PILEN ; POINT TO NEXT NIBBLE IN NEXT BYTE
|
||||
8049-90 BD I 65 (2**) BCC NXKEY ; RETURN
|
||||
804B- I 66 ;
|
||||
804B- I 67 ; ROUTINE TO PLAY NOTES
|
||||
804B- I 68 ;
|
||||
804B-A2 00 I 69 ( 2) PLAYEM LDX #0 ; CLEAR POINTER
|
||||
804D-86 02 I 70 ( 3) STX PTR
|
||||
804F-A5 02 I 71 ( 3) LDA PTR ; LOAD ACCUMULATOR WITH CURRENT POINTER VALUE
|
||||
8051-4A I 72 ( 2) LOOP LSR A ; SHIFT NIBBLE INDICATOR INTO CARRY
|
||||
8052-AA I 73 ( 2) TAX ; USE SHIFTED NIBBLE POINTER AS BYTE POINTER
|
||||
8053-BD 00 03 I 74 ( 4*) LDA TABEG,X ; LOAD NOTE TO PLAY
|
||||
8056-B0 04 I 75 (2**) BCS ENDBYT ; LOW NIBBLE USED, GET HIGH
|
||||
8058-29 0F I 76 ( 2) AND #%00001111 ; MASK OUT HIGH BITS
|
||||
805A-90 06 I 77 (2**) BCC FINISH ; PLAY NOTE
|
||||
805C-29 F0 I 78 ( 2) ENDBYT AND #%11110000 ; THROW AWAY LOW NIBBLE
|
||||
805E-4A I 79 ( 2) LSR A ; SHIFT INTO LOW
|
||||
805F-4A I 80 ( 2) LSR A
|
||||
8060-4A I 81 ( 2) LSR A
|
||||
8061-4A I 82 ( 2) LSR A
|
||||
8062-20 73 80 I 83 ( 6) FINISH JSR PLAYIT ; CALCULATE CONSTANTS & PLAY
|
||||
8065-A2 20 I 84 ( 2) LDX #$20 ; BETWEEN-NOTE DELAY
|
||||
8067-20 9F 80 I 85 ( 6) JSR DELAY
|
||||
806A-E6 02 I 86 ( 5) INC PTR ; ONE NIBBLE USED
|
||||
806C-A5 02 I 87 ( 3) LDA PTR
|
||||
806E-C5 00 I 88 ( 3) CMP PILEN ; END OF LIST?
|
||||
8070-90 DF I 89 (2**) BCC LOOP ; NO, GET NEXT NOTE
|
||||
8072-60 I 90 ( 6) RTS ; DONE
|
||||
8073- I 91 ;
|
||||
8073- I 92 ; ROUTINE TO DO TABLE LOOK UP, SEPARATE REST
|
||||
8073- I 93 ;
|
||||
8073-C9 0D I 94 ( 2) PLAYIT CMP #13 ; REST?
|
||||
8075-D0 06 I 95 (2**) BNE SOUND ; NO.
|
||||
8077-A2 54 I 96 ( 2) LDX #$54 ; DELAY = NOTE LENGTH = .21SEC
|
||||
8079-20 9F 80 I 97 ( 6) JSR DELAY
|
||||
807C-60 I 98 ( 6) RTS
|
||||
807D-AA I 99 ( 2) SOUND TAX ; USE KEYS AS INDEX..
|
||||
807E-BD D4 80 I 100 ( 4*) LDA DURTAB,X ; ... TO FIND DURATION.
|
||||
8081-85 04 I 101 ( 3) STA DUR ; STORE DURATION FOR USE
|
||||
8083-BD C7 80 I 102 ( 4*) LDA NOTAB,X ; LOAD NOTE VALUE
|
||||
8086-20 AB 80 I 103 ( 6) JSR TONE
|
||||
8089-60 I 104 ( 6) RTS
|
||||
808A- I 105 ;
|
||||
808A- I 106 ; ROUTINE TO MAKE 3 TONE SIGNAL
|
||||
808A- I 107 ;
|
||||
808A-A9 FF I 108 ( 2) BEEP3 LDA #$FF ; DURATION FOR BEEPS
|
||||
808C-85 04 I 109 ( 3) STA DUR
|
||||
808E-A9 4B I 110 ( 2) LDA #$4B ; CODE FOR E2
|
||||
8090-20 AB 80 I 111 ( 6) JSR TONE ; 1ST NOTE
|
||||
8093-A9 38 I 112 ( 2) LDA #$38 ; CODE FOR D2
|
||||
8095-20 AB 80 I 113 ( 6) JSR TONE
|
||||
8098-A9 4B I 114 ( 2) LDA #$4B
|
||||
809A-20 AB 80 I 115 ( 6) JSR TONE
|
||||
809D-18 I 116 ( 2) CLC
|
||||
809E-60 I 117 ( 6) RTS
|
||||
809F- I 118 ;
|
||||
809F- I 119 ; VARIABLE-LENGTH DELAY
|
||||
809F- I 120 ;
|
||||
809F-A0 FF I 121 ( 2) DELAY LDY #$FF
|
||||
80A1-EA I 122 ( 2) DLY NOP
|
||||
80A2-D0 00 I 123 (2**) BNE DL0 ; (.+2 IN BOOK)
|
||||
80A4-88 I 124 ( 2) DL0 DEY
|
||||
80A5-D0 FA I 125 (2**) BNE DLY ; 10 US. LOOP
|
||||
80A7-CA I 126 ( 2) DEX
|
||||
80A8-D0 F5 I 127 (2**) BNE DELAY ; LOOP TIME = 2556*[X]
|
||||
80AA-60 I 128 ( 6) RTS
|
||||
80AB- I 129 ;
|
||||
80AB- I 130 ; ROUTINE TO MAKE TONE: # OF 1/2 CYCLES IS IN 'DUR', AND 1/2 CYCLE TIME IS IN
|
||||
80AB- I 131 ; ACCUMULATOR. LOOP TIME = 20*[A]+26 US SINCE TWO RUNS THROUGH THE OUTER LOOP
|
||||
80AB- I 132 ; MAKES ONE CYCLE OF THE TONE.
|
||||
80AB- I 133 ;
|
||||
80AB-85 03 I 134 ( 3) TONE STA FREQ ; FREQ IS TEMP FOR # OF CYCLES
|
||||
80AD-A9 FF I 135 ( 2) LDA #$FF ; SET UP DATA DIRECTION REGISTER
|
||||
80AF-8D 02 4C I 136 ( 4) STA DDR3B
|
||||
80B2-A9 00 I 137 ( 2) LDA #$00 ; A IS SENT TO PORT, START HI
|
||||
80B4-A6 04 I 138 ( 3) LDX DUR
|
||||
80B6-A4 03 I 139 ( 3) FL2 LDY FREQ
|
||||
80B8-88 I 140 ( 2) FL1 DEY
|
||||
80B9-18 I 141 ( 2) CLC
|
||||
80BA-90 00 I 142 (2**) BCC FL0 ; (.+2 IN BOOK)
|
||||
80BC-D0 FA I 143 (2**) FL0 BNE FL1 ; INNER, 10 US LOOP.
|
||||
80BE-49 FF I 144 ( 2) EOR #$FF ; COMPLEMENT I/O PORT
|
||||
80C0-8D 00 4C I 145 ( 4) STA PORT3B ; ... AND SET IT
|
||||
80C3-CA I 146 ( 2) DEX
|
||||
80C4-D0 F0 I 147 (2**) BNE FL2 ; OUTER LOOP
|
||||
80C6-60 I 148 ( 6) RTS
|
||||
80C7- I 149 ;
|
||||
80C7- I 150 ; TABLE OF NOTE CONSTANTS
|
||||
80C7- I 151 ; CONTAINS:
|
||||
80C7- I 152 ; [OCTAVE BELOW MIDDLE C] : G,A,BCC
|
||||
80C7- I 153 ; [OCTAVE OF MIDDLE C] : C,D,E,F,F#,G,G#,A,B
|
||||
80C7- I 154 ; [OCTAVE ABOVE MIDDLE C] : C
|
||||
80C7- I 155 ;
|
||||
4C00- I 14 PORT3B .EQ VIA3 ; VIA OUTPUT PORT B
|
||||
4C02- I 15 DDR3B .EQ VIA3+2 ; VIA PORT B DIRECTION REGISTER
|
||||
4C03- I 16 DDR3A .EQ VIA3+3
|
||||
4C01- I 17 PORT3A .EQ VIA3+1
|
||||
4C00- I 18 PORT3B .EQ VIA3
|
||||
8003- I 19
|
||||
8003- I 20 ;
|
||||
8003- I 21 ; COMMAND LINE INTERPRETER
|
||||
8003- I 22 ; $F AS INPUT MEANS RESET POINTERS, START OVER.
|
||||
8003- I 23 ; $E MEANS PLAY CURRENTLY STORED NOTES
|
||||
8003- I 24 ; ANYTHING ELSE IS STORED FOR REPLAY.
|
||||
8003- I 25 ;
|
||||
8003-A9 00 I 26 ( 2) START LDA #0 ; CLEAR NOTE LIST LENGTH
|
||||
8005-85 00 I 27 ( 3) STA PILEN
|
||||
8007-18 I 28 ( 2) CLC ; CLEAR NIBBLE MARKER
|
||||
8008-20 E1 80 I 29 ( 6) NXKEY JSR GETKEY
|
||||
800B-C9 0F I 30 ( 2) CMP #15 ; IS KEY #15?
|
||||
800D-D0 05 I 31 (2**) BNE NXTST ; NO, DO NEXT TEST
|
||||
800F-20 8A 80 I 32 ( 6) JSR BEEP3 ; TELL USER OF CLEARING
|
||||
8012-90 EF I 33 (2**) BCC START ; CLEAR POINTERS AND START OVER
|
||||
8014-C9 0E I 34 ( 2) NXTST CMP #14 ; IS KEY #14?
|
||||
8016-D0 06 I 35 (2**) BNE NUMKEY ; NO, KEY IS NOTE NUMBER
|
||||
8018-20 4B 80 I 36 ( 6) JSR PLAYEM ; PLAY NOTES
|
||||
801B-18 I 37 ( 2) CLC
|
||||
801C-90 EA I 38 (2**) BCC NXKEY ; GET NEXT COMMAND
|
||||
801E- I 39 ;
|
||||
801E- I 40 ; ROUTINE TO LOAD NOT LIST WITH NOTES
|
||||
801E- I 41 ;
|
||||
801E-85 01 I 42 ( 3) NUMKEY STA TEMP ; SAVE KEY, FREE A
|
||||
8020-20 73 80 I 43 ( 6) JSR PLAYIT ; PLAY NOTE
|
||||
8023-A5 00 I 44 ( 3) LDA PILEN ; GET LIST LENGTH
|
||||
8025-C9 FF I 45 ( 2) CMP #$FF ; OVERFLOW?
|
||||
8027-D0 05 I 46 (2**) BNE OK ; NO, ADD NOTE TO LIST
|
||||
8029-20 8A 80 I 47 ( 6) JSR BEEP3 ; YES, WARN USER
|
||||
802C-90 DA I 48 (2**) BCC NXKEY ; RETURN TO INPUT MODE
|
||||
802E-4A I 49 ( 2) OK LSR A ; SHIFT LOW BIT INTO NIBBLE POINTER
|
||||
802F-A8 I 50 ( 2) TAY ; USE SHIFTED NIBBLE POINTER AS BYTE INDEX
|
||||
8030-A5 01 I 51 ( 3) LDA TEMP ; RESTORE KEY#
|
||||
8032-B0 09 I 52 (2**) BCS FINBYT ; IF BYTE ALREADY HAS A NIBBLE, FINISH IT AND STORE
|
||||
8034-29 0F I 53 ( 2) AND #%00001111 ; 1ST NIBBLE. MASK HIGH NIBBLE
|
||||
8036-99 50 03 I 54 ( 5) STA TABEG,Y ; SAVE UNFINISHED 1/2 BYTE
|
||||
8039-E6 00 I 55 ( 5) INC PILEN ; POINT TO NEXT NIBBLE
|
||||
803B-90 CB I 56 (2**) BCC NXKEY ; GET NEXT KEYSTROKE
|
||||
803D-0A I 57 ( 2) FINBYT ASL A ; SHIFT NIBBLE 2 TO HIGH ORDER
|
||||
803E-0A I 58 ( 2) ASL A
|
||||
803F-0A I 59 ( 2) ASL A
|
||||
8040-0A I 60 ( 2) ASL A
|
||||
8041-19 50 03 I 61 ( 4*) ORA TABEG,Y ; JOIN 2 NIBBLES AS BYTE
|
||||
8044-99 50 03 I 62 ( 5) STA TABEG,Y ; ... AND STORE.
|
||||
8047-E6 00 I 63 ( 5) INC PILEN ; POINT TO NEXT NIBBLE IN NEXT BYTE
|
||||
8049-90 BD I 64 (2**) BCC NXKEY ; RETURN
|
||||
804B- I 65 ;
|
||||
804B- I 66 ; ROUTINE TO PLAY NOTES
|
||||
804B- I 67 ;
|
||||
804B-A2 00 I 68 ( 2) PLAYEM LDX #0 ; CLEAR POINTER
|
||||
804D-86 02 I 69 ( 3) STX PTR
|
||||
804F-A5 02 I 70 ( 3) LDA PTR ; LOAD ACCUMULATOR WITH CURRENT POINTER VALUE
|
||||
8051-4A I 71 ( 2) LOOP LSR A ; SHIFT NIBBLE INDICATOR INTO CARRY
|
||||
8052-AA I 72 ( 2) TAX ; USE SHIFTED NIBBLE POINTER AS BYTE POINTER
|
||||
8053-BD 50 03 I 73 ( 4*) LDA TABEG,X ; LOAD NOTE TO PLAY
|
||||
8056-B0 04 I 74 (2**) BCS ENDBYT ; LOW NIBBLE USED, GET HIGH
|
||||
8058-29 0F I 75 ( 2) AND #%00001111 ; MASK OUT HIGH BITS
|
||||
805A-90 06 I 76 (2**) BCC FINISH ; PLAY NOTE
|
||||
805C-29 F0 I 77 ( 2) ENDBYT AND #%11110000 ; THROW AWAY LOW NIBBLE
|
||||
805E-4A I 78 ( 2) LSR A ; SHIFT INTO LOW
|
||||
805F-4A I 79 ( 2) LSR A
|
||||
8060-4A I 80 ( 2) LSR A
|
||||
8061-4A I 81 ( 2) LSR A
|
||||
8062-20 73 80 I 82 ( 6) FINISH JSR PLAYIT ; CALCULATE CONSTANTS & PLAY
|
||||
8065-A2 20 I 83 ( 2) LDX #$20 ; BETWEEN-NOTE DELAY
|
||||
8067-20 9F 80 I 84 ( 6) JSR DELAY
|
||||
806A-E6 02 I 85 ( 5) INC PTR ; ONE NIBBLE USED
|
||||
806C-A5 02 I 86 ( 3) LDA PTR
|
||||
806E-C5 00 I 87 ( 3) CMP PILEN ; END OF LIST?
|
||||
8070-90 DF I 88 (2**) BCC LOOP ; NO, GET NEXT NOTE
|
||||
8072-60 I 89 ( 6) RTS ; DONE
|
||||
8073- I 90 ;
|
||||
8073- I 91 ; ROUTINE TO DO TABLE LOOK UP, SEPARATE REST
|
||||
8073- I 92 ;
|
||||
8073-C9 0D I 93 ( 2) PLAYIT CMP #13 ; REST?
|
||||
8075-D0 06 I 94 (2**) BNE SOUND ; NO.
|
||||
8077-A2 54 I 95 ( 2) LDX #$54 ; DELAY = NOTE LENGTH = .21SEC
|
||||
8079-20 9F 80 I 96 ( 6) JSR DELAY
|
||||
807C-60 I 97 ( 6) RTS
|
||||
807D-AA I 98 ( 2) SOUND TAX ; USE KEYS AS INDEX..
|
||||
807E-BD D4 80 I 99 ( 4*) LDA DURTAB,X ; ... TO FIND DURATION.
|
||||
8081-85 04 I 100 ( 3) STA DUR ; STORE DURATION FOR USE
|
||||
8083-BD C7 80 I 101 ( 4*) LDA NOTAB,X ; LOAD NOTE VALUE
|
||||
8086-20 AB 80 I 102 ( 6) JSR TONE
|
||||
8089-60 I 103 ( 6) RTS
|
||||
808A- I 104 ;
|
||||
808A- I 105 ; ROUTINE TO MAKE 3 TONE SIGNAL
|
||||
808A- I 106 ;
|
||||
808A-A9 FF I 107 ( 2) BEEP3 LDA #$FF ; DURATION FOR BEEPS
|
||||
808C-85 04 I 108 ( 3) STA DUR
|
||||
808E-A9 4B I 109 ( 2) LDA #$4B ; CODE FOR E2
|
||||
8090-20 AB 80 I 110 ( 6) JSR TONE ; 1ST NOTE
|
||||
8093-A9 38 I 111 ( 2) LDA #$38 ; CODE FOR D2
|
||||
8095-20 AB 80 I 112 ( 6) JSR TONE
|
||||
8098-A9 4B I 113 ( 2) LDA #$4B
|
||||
809A-20 AB 80 I 114 ( 6) JSR TONE
|
||||
809D-18 I 115 ( 2) CLC
|
||||
809E-60 I 116 ( 6) RTS
|
||||
809F- I 117 ;
|
||||
809F- I 118 ; VARIABLE-LENGTH DELAY
|
||||
809F- I 119 ;
|
||||
809F-A0 FF I 120 ( 2) DELAY LDY #$FF
|
||||
80A1-EA I 121 ( 2) DLY NOP
|
||||
80A2-D0 00 I 122 (2**) BNE DL0 ; (.+2 IN BOOK)
|
||||
80A4-88 I 123 ( 2) DL0 DEY
|
||||
80A5-D0 FA I 124 (2**) BNE DLY ; 10 US. LOOP
|
||||
80A7-CA I 125 ( 2) DEX
|
||||
80A8-D0 F5 I 126 (2**) BNE DELAY ; LOOP TIME = 2556*[X]
|
||||
80AA-60 I 127 ( 6) RTS
|
||||
80AB- I 128 ;
|
||||
80AB- I 129 ; ROUTINE TO MAKE TONE: # OF 1/2 CYCLES IS IN 'DUR', AND 1/2 CYCLE TIME IS IN
|
||||
80AB- I 130 ; ACCUMULATOR. LOOP TIME = 20*[A]+26 US SINCE TWO RUNS THROUGH THE OUTER LOOP
|
||||
80AB- I 131 ; MAKES ONE CYCLE OF THE TONE.
|
||||
80AB- I 132 ;
|
||||
80AB-85 03 I 133 ( 3) TONE STA FREQ ; FREQ IS TEMP FOR # OF CYCLES
|
||||
80AD-A9 FF I 134 ( 2) LDA #$FF ; SET UP DATA DIRECTION REGISTER
|
||||
80AF-8D 02 4C I 135 ( 4) STA DDR3B
|
||||
80B2-A9 00 I 136 ( 2) LDA #$00 ; A IS SENT TO PORT, START HI
|
||||
80B4-A6 04 I 137 ( 3) LDX DUR
|
||||
80B6-A4 03 I 138 ( 3) FL2 LDY FREQ
|
||||
80B8-88 I 139 ( 2) FL1 DEY
|
||||
80B9-18 I 140 ( 2) CLC
|
||||
80BA-90 00 I 141 (2**) BCC FL0 ; (.+2 IN BOOK)
|
||||
80BC-D0 FA I 142 (2**) FL0 BNE FL1 ; INNER, 10 US LOOP.
|
||||
80BE-49 FF I 143 ( 2) EOR #$FF ; COMPLEMENT I/O PORT
|
||||
80C0-8D 00 4C I 144 ( 4) STA PORT3B ; ... AND SET IT
|
||||
80C3-CA I 145 ( 2) DEX
|
||||
80C4-D0 F0 I 146 (2**) BNE FL2 ; OUTER LOOP
|
||||
80C6-60 I 147 ( 6) RTS
|
||||
80C7- I 148 ;
|
||||
80C7- I 149 ; TABLE OF NOTE CONSTANTS
|
||||
80C7- I 150 ; CONTAINS:
|
||||
80C7- I 151 ; [OCTAVE BELOW MIDDLE C] : G,A,BCC
|
||||
80C7- I 152 ; [OCTAVE OF MIDDLE C] : C,D,E,F,F#,G,G#,A,B
|
||||
80C7- I 153 ; [OCTAVE ABOVE MIDDLE C] : C
|
||||
80C7- I 154 ;
|
||||
80C7-FE E2 C9 BE
|
||||
A9 96 8E 86
|
||||
7E 77 70 64
|
||||
5E I 156 NOTAB .HS FE.E2.C9.BE.A9.96.8E.86.7E.77.70.64.5E
|
||||
80D4- I 157 ;
|
||||
80D4- I 158 ; TABLE OF NOTE DURATIONS IN # OF 1/2 CYCLES SET FOR A NOTE LENGTH OF
|
||||
80D4- I 159 ; ABOUT .21 SEC.
|
||||
80D4- I 160 ;
|
||||
5E I 155 NOTAB .HS FE.E2.C9.BE.A9.96.8E.86.7E.77.70.64.5E
|
||||
80D4- I 156 ;
|
||||
80D4- I 157 ; TABLE OF NOTE DURATIONS IN # OF 1/2 CYCLES SET FOR A NOTE LENGTH OF
|
||||
80D4- I 158 ; ABOUT .21 SEC.
|
||||
80D4- I 159 ;
|
||||
80D4-55 60 6B 72
|
||||
80 8F 94 A1
|
||||
AA B5 BF D7
|
||||
E4 I 161 DURTAB .HS 55.60.6B.72.80.8F.94.A1.AA.B5.BF.D7.E4
|
||||
80E1- 16 .IN ../../common/CH01-Getkey/getkey_routine.asm
|
||||
E4 I 160 DURTAB .HS 55.60.6B.72.80.8F.94.A1.AA.B5.BF.D7.E4
|
||||
80E1- 17 .IN ../../common/CH01-Getkey/getkey_routine.asm
|
||||
80E1- I 1 ; 'GETKEY' KEYBOARD INPUT ROUTINE READS AND DEBOUNCES KEYBOARD. RETURNS WITH
|
||||
80E1- I 2 ; KEY NUMBER IN ACCUMULATOR IF KEY DOWN. OPERATION: SENDS NUMBERS 0-F TO 74154
|
||||
80E1- I 3 ; (4 TO 16 LINE DECODER), WHICH GROUNDS ONE SIDE OF KEYSWITCHES ONE AT A TIME.
|
||||
@ -216,10 +216,10 @@
|
||||
810B-A9 FF I 36 ( 2) LDA #$FF
|
||||
810D-8D 02 4C I 37 ( 4) STA DDR3B ; SET KEYS FOR OUTPUT
|
||||
8110-60 I 38 ( 6) RTS
|
||||
8111- 17 ;
|
||||
8111- 18 ; STORE CPU INITIALIZATION VECTORS AT THE END OF THE EEPROM.
|
||||
8111- 19 ;
|
||||
FFFA 20 .NO $FFFA,$FF
|
||||
FFFA-00 80 21 .DA BE6502 ; NMI VECTOR
|
||||
FFFC-00 80 22 .DA BE6502 ; RESET VECTOR
|
||||
FFFE-00 80 23 .DA BE6502 ; IRQ VECTOR
|
||||
8111- 18 ;
|
||||
8111- 19 ; STORE CPU INITIALIZATION VECTORS AT THE END OF THE EEPROM.
|
||||
8111- 20 ;
|
||||
FFFA 21 .NO $FFFA,$FF
|
||||
FFFA-00 80 22 .DA BE6502 ; NMI VECTOR
|
||||
FFFC-00 80 23 .DA BE6502 ; RESET VECTOR
|
||||
FFFE-00 80 24 .DA BE6502 ; IRQ VECTOR
|
||||
|
@ -8,6 +8,7 @@
|
||||
;
|
||||
VIA1 .EQ $C000
|
||||
VIA3 .EQ $CC00
|
||||
TABEG .EQ $0350 ; TABLE TO STORE MUSIC
|
||||
|
||||
.OR $0200
|
||||
.TA $0200
|
||||
|
@ -1,9 +1,9 @@
|
||||
:10020000200603A90085001820E102C90FD00520AF
|
||||
:100210008A0290EFC90ED006204B021890EA8501A1
|
||||
:10022000207302A500C9FFD005208A0290DA4AA8EF
|
||||
:10023000A501B009290F990003E60090CB0A0A0A2C
|
||||
:100240000A190003990003E60090BDA2008602A5EA
|
||||
:10025000024AAABD0003B004290F900629F04A4AB9
|
||||
:10023000A501B009290F995003E60090CB0A0A0ADC
|
||||
:100240000A195003995003E60090BDA2008602A54A
|
||||
:10025000024AAABD5003B004290F900629F04A4A69
|
||||
:100260004A4A207302A220209F02E602A502C5008E
|
||||
:1002700090DF60C90DD006A254209F0260AABDD4B1
|
||||
:10028000028504BDC70220AB0260A9FF8504A94B0B
|
||||
|
@ -5,11 +5,12 @@
|
||||
0000- 8 ;
|
||||
C000- 9 VIA1 .EQ $C000
|
||||
CC00- 10 VIA3 .EQ $CC00
|
||||
0000- 11
|
||||
0200- 12 .OR $0200
|
||||
0200- 13 .TA $0200
|
||||
0200-20 06 03 14 ( 6) RCONE JSR INITKEY
|
||||
0203- 15 .IN ../../common/CH02-Music/player.asm
|
||||
0350- 11 TABEG .EQ $0350 ; TABLE TO STORE MUSIC
|
||||
0000- 12
|
||||
0200- 13 .OR $0200
|
||||
0200- 14 .TA $0200
|
||||
0200-20 06 03 15 ( 6) RCONE JSR INITKEY
|
||||
0203- 16 .IN ../../common/CH02-Music/player.asm
|
||||
0203- I 1 ; MUSIC PLAYER PROGRAM
|
||||
0203- I 2 ; USES 16-KEY KEYBOARD AND BUFFERED SPEAKER
|
||||
0203- I 3 ; PROGRAM PLAYS STORED MUSICAL NOTES. THERE ARE TWO MODES OF OPERATION: INPUT
|
||||
@ -23,161 +24,160 @@ CC00- 10 VIA3 .EQ $CC00
|
||||
0002- I 11 PTR .EQ $02 ; CURRENT LOCATION IN LIST
|
||||
0003- I 12 FREQ .EQ $03 ; TEMPORARY STORAGE FOR FREQUENCY
|
||||
0004- I 13 DUR .EQ $04 ; TEMP STORAGE FOR DURATION
|
||||
0300- I 14 TABEG .EQ $0300 ; TABLE TO STORE MUSIC
|
||||
CC00- I 15 PORT3B .EQ VIA3 ; VIA OUTPUT PORT B
|
||||
CC02- I 16 DDR3B .EQ VIA3+2 ; VIA PORT B DIRECTION REGISTER
|
||||
CC03- I 17 DDR3A .EQ VIA3+3
|
||||
CC01- I 18 PORT3A .EQ VIA3+1
|
||||
CC00- I 19 PORT3B .EQ VIA3
|
||||
0203- I 20
|
||||
0203- I 21 ;
|
||||
0203- I 22 ; COMMAND LINE INTERPRETER
|
||||
0203- I 23 ; $F AS INPUT MEANS RESET POINTERS, START OVER.
|
||||
0203- I 24 ; $E MEANS PLAY CURRENTLY STORED NOTES
|
||||
0203- I 25 ; ANYTHING ELSE IS STORED FOR REPLAY.
|
||||
0203- I 26 ;
|
||||
0203-A9 00 I 27 ( 2) START LDA #0 ; CLEAR NOTE LIST LENGTH
|
||||
0205-85 00 I 28 ( 2) STA PILEN
|
||||
0207-18 I 29 ( 2) CLC ; CLEAR NIBBLE MARKER
|
||||
0208-20 E1 02 I 30 ( 6) NXKEY JSR GETKEY
|
||||
020B-C9 0F I 31 ( 2) CMP #15 ; IS KEY #15?
|
||||
020D-D0 05 I 32 (2**) BNE NXTST ; NO, DO NEXT TEST
|
||||
020F-20 8A 02 I 33 ( 6) JSR BEEP3 ; TELL USER OF CLEARING
|
||||
0212-90 EF I 34 (2**) BCC START ; CLEAR POINTERS AND START OVER
|
||||
0214-C9 0E I 35 ( 2) NXTST CMP #14 ; IS KEY #14?
|
||||
0216-D0 06 I 36 (2**) BNE NUMKEY ; NO, KEY IS NOTE NUMBER
|
||||
0218-20 4B 02 I 37 ( 6) JSR PLAYEM ; PLAY NOTES
|
||||
021B-18 I 38 ( 2) CLC
|
||||
021C-90 EA I 39 (2**) BCC NXKEY ; GET NEXT COMMAND
|
||||
021E- I 40 ;
|
||||
021E- I 41 ; ROUTINE TO LOAD NOT LIST WITH NOTES
|
||||
021E- I 42 ;
|
||||
021E-85 01 I 43 ( 2) NUMKEY STA TEMP ; SAVE KEY, FREE A
|
||||
0220-20 73 02 I 44 ( 6) JSR PLAYIT ; PLAY NOTE
|
||||
0223-A5 00 I 45 ( 3) LDA PILEN ; GET LIST LENGTH
|
||||
0225-C9 FF I 46 ( 2) CMP #$FF ; OVERFLOW?
|
||||
0227-D0 05 I 47 (2**) BNE OK ; NO, ADD NOTE TO LIST
|
||||
0229-20 8A 02 I 48 ( 6) JSR BEEP3 ; YES, WARN USER
|
||||
022C-90 DA I 49 (2**) BCC NXKEY ; RETURN TO INPUT MODE
|
||||
022E-4A I 50 ( 2) OK LSR A ; SHIFT LOW BIT INTO NIBBLE POINTER
|
||||
022F-A8 I 51 ( 2) TAY ; USE SHIFTED NIBBLE POINTER AS BYTE INDEX
|
||||
0230-A5 01 I 52 ( 3) LDA TEMP ; RESTORE KEY#
|
||||
0232-B0 09 I 53 (2**) BCS FINBYT ; IF BYTE ALREADY HAS A NIBBLE, FINISH IT AND STORE
|
||||
0234-29 0F I 54 ( 2) AND #%00001111 ; 1ST NIBBLE. MASK HIGH NIBBLE
|
||||
0236-99 00 03 I 55 ( 5) STA TABEG,Y ; SAVE UNFINISHED 1/2 BYTE
|
||||
0239-E6 00 I 56 ( 5) INC PILEN ; POINT TO NEXT NIBBLE
|
||||
023B-90 CB I 57 (2**) BCC NXKEY ; GET NEXT KEYSTROKE
|
||||
023D-0A I 58 ( 2) FINBYT ASL A ; SHIFT NIBBLE 2 TO HIGH ORDER
|
||||
023E-0A I 59 ( 2) ASL A
|
||||
023F-0A I 60 ( 2) ASL A
|
||||
0240-0A I 61 ( 2) ASL A
|
||||
0241-19 00 03 I 62 ( 4*) ORA TABEG,Y ; JOIN 2 NIBBLES AS BYTE
|
||||
0244-99 00 03 I 63 ( 5) STA TABEG,Y ; ... AND STORE.
|
||||
0247-E6 00 I 64 ( 5) INC PILEN ; POINT TO NEXT NIBBLE IN NEXT BYTE
|
||||
0249-90 BD I 65 (2**) BCC NXKEY ; RETURN
|
||||
024B- I 66 ;
|
||||
024B- I 67 ; ROUTINE TO PLAY NOTES
|
||||
024B- I 68 ;
|
||||
024B-A2 00 I 69 ( 2) PLAYEM LDX #0 ; CLEAR POINTER
|
||||
024D-86 02 I 70 ( 3) STX PTR
|
||||
024F-A5 02 I 71 ( 3) LDA PTR ; LOAD ACCUMULATOR WITH CURRENT POINTER VALUE
|
||||
0251-4A I 72 ( 2) LOOP LSR A ; SHIFT NIBBLE INDICATOR INTO CARRY
|
||||
0252-AA I 73 ( 2) TAX ; USE SHIFTED NIBBLE POINTER AS BYTE POINTER
|
||||
0253-BD 00 03 I 74 ( 4*) LDA TABEG,X ; LOAD NOTE TO PLAY
|
||||
0256-B0 04 I 75 (2**) BCS ENDBYT ; LOW NIBBLE USED, GET HIGH
|
||||
0258-29 0F I 76 ( 2) AND #%00001111 ; MASK OUT HIGH BITS
|
||||
025A-90 06 I 77 (2**) BCC FINISH ; PLAY NOTE
|
||||
025C-29 F0 I 78 ( 2) ENDBYT AND #%11110000 ; THROW AWAY LOW NIBBLE
|
||||
025E-4A I 79 ( 2) LSR A ; SHIFT INTO LOW
|
||||
025F-4A I 80 ( 2) LSR A
|
||||
0260-4A I 81 ( 2) LSR A
|
||||
0261-4A I 82 ( 2) LSR A
|
||||
0262-20 73 02 I 83 ( 6) FINISH JSR PLAYIT ; CALCULATE CONSTANTS & PLAY
|
||||
0265-A2 20 I 84 ( 2) LDX #$20 ; BETWEEN-NOTE DELAY
|
||||
0267-20 9F 02 I 85 ( 6) JSR DELAY
|
||||
026A-E6 02 I 86 ( 5) INC PTR ; ONE NIBBLE USED
|
||||
026C-A5 02 I 87 ( 3) LDA PTR
|
||||
026E-C5 00 I 88 ( 3) CMP PILEN ; END OF LIST?
|
||||
0270-90 DF I 89 (2**) BCC LOOP ; NO, GET NEXT NOTE
|
||||
0272-60 I 90 ( 6) RTS ; DONE
|
||||
0273- I 91 ;
|
||||
0273- I 92 ; ROUTINE TO DO TABLE LOOK UP, SEPARATE REST
|
||||
0273- I 93 ;
|
||||
0273-C9 0D I 94 ( 2) PLAYIT CMP #13 ; REST?
|
||||
0275-D0 06 I 95 (2**) BNE SOUND ; NO.
|
||||
0277-A2 54 I 96 ( 2) LDX #$54 ; DELAY = NOTE LENGTH = .21SEC
|
||||
0279-20 9F 02 I 97 ( 6) JSR DELAY
|
||||
027C-60 I 98 ( 6) RTS
|
||||
027D-AA I 99 ( 2) SOUND TAX ; USE KEYS AS INDEX..
|
||||
027E-BD D4 02 I 100 ( 4*) LDA DURTAB,X ; ... TO FIND DURATION.
|
||||
0281-85 04 I 101 ( 2) STA DUR ; STORE DURATION FOR USE
|
||||
0283-BD C7 02 I 102 ( 4*) LDA NOTAB,X ; LOAD NOTE VALUE
|
||||
0286-20 AB 02 I 103 ( 6) JSR TONE
|
||||
0289-60 I 104 ( 6) RTS
|
||||
028A- I 105 ;
|
||||
028A- I 106 ; ROUTINE TO MAKE 3 TONE SIGNAL
|
||||
028A- I 107 ;
|
||||
028A-A9 FF I 108 ( 2) BEEP3 LDA #$FF ; DURATION FOR BEEPS
|
||||
028C-85 04 I 109 ( 2) STA DUR
|
||||
028E-A9 4B I 110 ( 2) LDA #$4B ; CODE FOR E2
|
||||
0290-20 AB 02 I 111 ( 6) JSR TONE ; 1ST NOTE
|
||||
0293-A9 38 I 112 ( 2) LDA #$38 ; CODE FOR D2
|
||||
0295-20 AB 02 I 113 ( 6) JSR TONE
|
||||
0298-A9 4B I 114 ( 2) LDA #$4B
|
||||
029A-20 AB 02 I 115 ( 6) JSR TONE
|
||||
029D-18 I 116 ( 2) CLC
|
||||
029E-60 I 117 ( 6) RTS
|
||||
029F- I 118 ;
|
||||
029F- I 119 ; VARIABLE-LENGTH DELAY
|
||||
029F- I 120 ;
|
||||
029F-A0 FF I 121 ( 2) DELAY LDY #$FF
|
||||
02A1-EA I 122 ( 2) DLY NOP
|
||||
02A2-D0 00 I 123 (2**) BNE DL0 ; (.+2 IN BOOK)
|
||||
02A4-88 I 124 ( 2) DL0 DEY
|
||||
02A5-D0 FA I 125 (2**) BNE DLY ; 10 US. LOOP
|
||||
02A7-CA I 126 ( 2) DEX
|
||||
02A8-D0 F5 I 127 (2**) BNE DELAY ; LOOP TIME = 2556*[X]
|
||||
02AA-60 I 128 ( 6) RTS
|
||||
02AB- I 129 ;
|
||||
02AB- I 130 ; ROUTINE TO MAKE TONE: # OF 1/2 CYCLES IS IN 'DUR', AND 1/2 CYCLE TIME IS IN
|
||||
02AB- I 131 ; ACCUMULATOR. LOOP TIME = 20*[A]+26 US SINCE TWO RUNS THROUGH THE OUTER LOOP
|
||||
02AB- I 132 ; MAKES ONE CYCLE OF THE TONE.
|
||||
02AB- I 133 ;
|
||||
02AB-85 03 I 134 ( 2) TONE STA FREQ ; FREQ IS TEMP FOR # OF CYCLES
|
||||
02AD-A9 FF I 135 ( 2) LDA #$FF ; SET UP DATA DIRECTION REGISTER
|
||||
02AF-8D 02 CC I 136 ( 4) STA DDR3B
|
||||
02B2-A9 00 I 137 ( 2) LDA #$00 ; A IS SENT TO PORT, START HI
|
||||
02B4-A6 04 I 138 ( 3) LDX DUR
|
||||
02B6-A4 03 I 139 ( 3) FL2 LDY FREQ
|
||||
02B8-88 I 140 ( 2) FL1 DEY
|
||||
02B9-18 I 141 ( 2) CLC
|
||||
02BA-90 00 I 142 (2**) BCC FL0 ; (.+2 IN BOOK)
|
||||
02BC-D0 FA I 143 (2**) FL0 BNE FL1 ; INNER, 10 US LOOP.
|
||||
02BE-49 FF I 144 ( 2) EOR #$FF ; COMPLEMENT I/O PORT
|
||||
02C0-8D 00 CC I 145 ( 4) STA PORT3B ; ... AND SET IT
|
||||
02C3-CA I 146 ( 2) DEX
|
||||
02C4-D0 F0 I 147 (2**) BNE FL2 ; OUTER LOOP
|
||||
02C6-60 I 148 ( 6) RTS
|
||||
02C7- I 149 ;
|
||||
02C7- I 150 ; TABLE OF NOTE CONSTANTS
|
||||
02C7- I 151 ; CONTAINS:
|
||||
02C7- I 152 ; [OCTAVE BELOW MIDDLE C] : G,A,BCC
|
||||
02C7- I 153 ; [OCTAVE OF MIDDLE C] : C,D,E,F,F#,G,G#,A,B
|
||||
02C7- I 154 ; [OCTAVE ABOVE MIDDLE C] : C
|
||||
02C7- I 155 ;
|
||||
CC00- I 14 PORT3B .EQ VIA3 ; VIA OUTPUT PORT B
|
||||
CC02- I 15 DDR3B .EQ VIA3+2 ; VIA PORT B DIRECTION REGISTER
|
||||
CC03- I 16 DDR3A .EQ VIA3+3
|
||||
CC01- I 17 PORT3A .EQ VIA3+1
|
||||
CC00- I 18 PORT3B .EQ VIA3
|
||||
0203- I 19
|
||||
0203- I 20 ;
|
||||
0203- I 21 ; COMMAND LINE INTERPRETER
|
||||
0203- I 22 ; $F AS INPUT MEANS RESET POINTERS, START OVER.
|
||||
0203- I 23 ; $E MEANS PLAY CURRENTLY STORED NOTES
|
||||
0203- I 24 ; ANYTHING ELSE IS STORED FOR REPLAY.
|
||||
0203- I 25 ;
|
||||
0203-A9 00 I 26 ( 2) START LDA #0 ; CLEAR NOTE LIST LENGTH
|
||||
0205-85 00 I 27 ( 2) STA PILEN
|
||||
0207-18 I 28 ( 2) CLC ; CLEAR NIBBLE MARKER
|
||||
0208-20 E1 02 I 29 ( 6) NXKEY JSR GETKEY
|
||||
020B-C9 0F I 30 ( 2) CMP #15 ; IS KEY #15?
|
||||
020D-D0 05 I 31 (2**) BNE NXTST ; NO, DO NEXT TEST
|
||||
020F-20 8A 02 I 32 ( 6) JSR BEEP3 ; TELL USER OF CLEARING
|
||||
0212-90 EF I 33 (2**) BCC START ; CLEAR POINTERS AND START OVER
|
||||
0214-C9 0E I 34 ( 2) NXTST CMP #14 ; IS KEY #14?
|
||||
0216-D0 06 I 35 (2**) BNE NUMKEY ; NO, KEY IS NOTE NUMBER
|
||||
0218-20 4B 02 I 36 ( 6) JSR PLAYEM ; PLAY NOTES
|
||||
021B-18 I 37 ( 2) CLC
|
||||
021C-90 EA I 38 (2**) BCC NXKEY ; GET NEXT COMMAND
|
||||
021E- I 39 ;
|
||||
021E- I 40 ; ROUTINE TO LOAD NOT LIST WITH NOTES
|
||||
021E- I 41 ;
|
||||
021E-85 01 I 42 ( 2) NUMKEY STA TEMP ; SAVE KEY, FREE A
|
||||
0220-20 73 02 I 43 ( 6) JSR PLAYIT ; PLAY NOTE
|
||||
0223-A5 00 I 44 ( 3) LDA PILEN ; GET LIST LENGTH
|
||||
0225-C9 FF I 45 ( 2) CMP #$FF ; OVERFLOW?
|
||||
0227-D0 05 I 46 (2**) BNE OK ; NO, ADD NOTE TO LIST
|
||||
0229-20 8A 02 I 47 ( 6) JSR BEEP3 ; YES, WARN USER
|
||||
022C-90 DA I 48 (2**) BCC NXKEY ; RETURN TO INPUT MODE
|
||||
022E-4A I 49 ( 2) OK LSR A ; SHIFT LOW BIT INTO NIBBLE POINTER
|
||||
022F-A8 I 50 ( 2) TAY ; USE SHIFTED NIBBLE POINTER AS BYTE INDEX
|
||||
0230-A5 01 I 51 ( 3) LDA TEMP ; RESTORE KEY#
|
||||
0232-B0 09 I 52 (2**) BCS FINBYT ; IF BYTE ALREADY HAS A NIBBLE, FINISH IT AND STORE
|
||||
0234-29 0F I 53 ( 2) AND #%00001111 ; 1ST NIBBLE. MASK HIGH NIBBLE
|
||||
0236-99 50 03 I 54 ( 5) STA TABEG,Y ; SAVE UNFINISHED 1/2 BYTE
|
||||
0239-E6 00 I 55 ( 5) INC PILEN ; POINT TO NEXT NIBBLE
|
||||
023B-90 CB I 56 (2**) BCC NXKEY ; GET NEXT KEYSTROKE
|
||||
023D-0A I 57 ( 2) FINBYT ASL A ; SHIFT NIBBLE 2 TO HIGH ORDER
|
||||
023E-0A I 58 ( 2) ASL A
|
||||
023F-0A I 59 ( 2) ASL A
|
||||
0240-0A I 60 ( 2) ASL A
|
||||
0241-19 50 03 I 61 ( 4*) ORA TABEG,Y ; JOIN 2 NIBBLES AS BYTE
|
||||
0244-99 50 03 I 62 ( 5) STA TABEG,Y ; ... AND STORE.
|
||||
0247-E6 00 I 63 ( 5) INC PILEN ; POINT TO NEXT NIBBLE IN NEXT BYTE
|
||||
0249-90 BD I 64 (2**) BCC NXKEY ; RETURN
|
||||
024B- I 65 ;
|
||||
024B- I 66 ; ROUTINE TO PLAY NOTES
|
||||
024B- I 67 ;
|
||||
024B-A2 00 I 68 ( 2) PLAYEM LDX #0 ; CLEAR POINTER
|
||||
024D-86 02 I 69 ( 3) STX PTR
|
||||
024F-A5 02 I 70 ( 3) LDA PTR ; LOAD ACCUMULATOR WITH CURRENT POINTER VALUE
|
||||
0251-4A I 71 ( 2) LOOP LSR A ; SHIFT NIBBLE INDICATOR INTO CARRY
|
||||
0252-AA I 72 ( 2) TAX ; USE SHIFTED NIBBLE POINTER AS BYTE POINTER
|
||||
0253-BD 50 03 I 73 ( 4*) LDA TABEG,X ; LOAD NOTE TO PLAY
|
||||
0256-B0 04 I 74 (2**) BCS ENDBYT ; LOW NIBBLE USED, GET HIGH
|
||||
0258-29 0F I 75 ( 2) AND #%00001111 ; MASK OUT HIGH BITS
|
||||
025A-90 06 I 76 (2**) BCC FINISH ; PLAY NOTE
|
||||
025C-29 F0 I 77 ( 2) ENDBYT AND #%11110000 ; THROW AWAY LOW NIBBLE
|
||||
025E-4A I 78 ( 2) LSR A ; SHIFT INTO LOW
|
||||
025F-4A I 79 ( 2) LSR A
|
||||
0260-4A I 80 ( 2) LSR A
|
||||
0261-4A I 81 ( 2) LSR A
|
||||
0262-20 73 02 I 82 ( 6) FINISH JSR PLAYIT ; CALCULATE CONSTANTS & PLAY
|
||||
0265-A2 20 I 83 ( 2) LDX #$20 ; BETWEEN-NOTE DELAY
|
||||
0267-20 9F 02 I 84 ( 6) JSR DELAY
|
||||
026A-E6 02 I 85 ( 5) INC PTR ; ONE NIBBLE USED
|
||||
026C-A5 02 I 86 ( 3) LDA PTR
|
||||
026E-C5 00 I 87 ( 3) CMP PILEN ; END OF LIST?
|
||||
0270-90 DF I 88 (2**) BCC LOOP ; NO, GET NEXT NOTE
|
||||
0272-60 I 89 ( 6) RTS ; DONE
|
||||
0273- I 90 ;
|
||||
0273- I 91 ; ROUTINE TO DO TABLE LOOK UP, SEPARATE REST
|
||||
0273- I 92 ;
|
||||
0273-C9 0D I 93 ( 2) PLAYIT CMP #13 ; REST?
|
||||
0275-D0 06 I 94 (2**) BNE SOUND ; NO.
|
||||
0277-A2 54 I 95 ( 2) LDX #$54 ; DELAY = NOTE LENGTH = .21SEC
|
||||
0279-20 9F 02 I 96 ( 6) JSR DELAY
|
||||
027C-60 I 97 ( 6) RTS
|
||||
027D-AA I 98 ( 2) SOUND TAX ; USE KEYS AS INDEX..
|
||||
027E-BD D4 02 I 99 ( 4*) LDA DURTAB,X ; ... TO FIND DURATION.
|
||||
0281-85 04 I 100 ( 2) STA DUR ; STORE DURATION FOR USE
|
||||
0283-BD C7 02 I 101 ( 4*) LDA NOTAB,X ; LOAD NOTE VALUE
|
||||
0286-20 AB 02 I 102 ( 6) JSR TONE
|
||||
0289-60 I 103 ( 6) RTS
|
||||
028A- I 104 ;
|
||||
028A- I 105 ; ROUTINE TO MAKE 3 TONE SIGNAL
|
||||
028A- I 106 ;
|
||||
028A-A9 FF I 107 ( 2) BEEP3 LDA #$FF ; DURATION FOR BEEPS
|
||||
028C-85 04 I 108 ( 2) STA DUR
|
||||
028E-A9 4B I 109 ( 2) LDA #$4B ; CODE FOR E2
|
||||
0290-20 AB 02 I 110 ( 6) JSR TONE ; 1ST NOTE
|
||||
0293-A9 38 I 111 ( 2) LDA #$38 ; CODE FOR D2
|
||||
0295-20 AB 02 I 112 ( 6) JSR TONE
|
||||
0298-A9 4B I 113 ( 2) LDA #$4B
|
||||
029A-20 AB 02 I 114 ( 6) JSR TONE
|
||||
029D-18 I 115 ( 2) CLC
|
||||
029E-60 I 116 ( 6) RTS
|
||||
029F- I 117 ;
|
||||
029F- I 118 ; VARIABLE-LENGTH DELAY
|
||||
029F- I 119 ;
|
||||
029F-A0 FF I 120 ( 2) DELAY LDY #$FF
|
||||
02A1-EA I 121 ( 2) DLY NOP
|
||||
02A2-D0 00 I 122 (2**) BNE DL0 ; (.+2 IN BOOK)
|
||||
02A4-88 I 123 ( 2) DL0 DEY
|
||||
02A5-D0 FA I 124 (2**) BNE DLY ; 10 US. LOOP
|
||||
02A7-CA I 125 ( 2) DEX
|
||||
02A8-D0 F5 I 126 (2**) BNE DELAY ; LOOP TIME = 2556*[X]
|
||||
02AA-60 I 127 ( 6) RTS
|
||||
02AB- I 128 ;
|
||||
02AB- I 129 ; ROUTINE TO MAKE TONE: # OF 1/2 CYCLES IS IN 'DUR', AND 1/2 CYCLE TIME IS IN
|
||||
02AB- I 130 ; ACCUMULATOR. LOOP TIME = 20*[A]+26 US SINCE TWO RUNS THROUGH THE OUTER LOOP
|
||||
02AB- I 131 ; MAKES ONE CYCLE OF THE TONE.
|
||||
02AB- I 132 ;
|
||||
02AB-85 03 I 133 ( 2) TONE STA FREQ ; FREQ IS TEMP FOR # OF CYCLES
|
||||
02AD-A9 FF I 134 ( 2) LDA #$FF ; SET UP DATA DIRECTION REGISTER
|
||||
02AF-8D 02 CC I 135 ( 4) STA DDR3B
|
||||
02B2-A9 00 I 136 ( 2) LDA #$00 ; A IS SENT TO PORT, START HI
|
||||
02B4-A6 04 I 137 ( 3) LDX DUR
|
||||
02B6-A4 03 I 138 ( 3) FL2 LDY FREQ
|
||||
02B8-88 I 139 ( 2) FL1 DEY
|
||||
02B9-18 I 140 ( 2) CLC
|
||||
02BA-90 00 I 141 (2**) BCC FL0 ; (.+2 IN BOOK)
|
||||
02BC-D0 FA I 142 (2**) FL0 BNE FL1 ; INNER, 10 US LOOP.
|
||||
02BE-49 FF I 143 ( 2) EOR #$FF ; COMPLEMENT I/O PORT
|
||||
02C0-8D 00 CC I 144 ( 4) STA PORT3B ; ... AND SET IT
|
||||
02C3-CA I 145 ( 2) DEX
|
||||
02C4-D0 F0 I 146 (2**) BNE FL2 ; OUTER LOOP
|
||||
02C6-60 I 147 ( 6) RTS
|
||||
02C7- I 148 ;
|
||||
02C7- I 149 ; TABLE OF NOTE CONSTANTS
|
||||
02C7- I 150 ; CONTAINS:
|
||||
02C7- I 151 ; [OCTAVE BELOW MIDDLE C] : G,A,BCC
|
||||
02C7- I 152 ; [OCTAVE OF MIDDLE C] : C,D,E,F,F#,G,G#,A,B
|
||||
02C7- I 153 ; [OCTAVE ABOVE MIDDLE C] : C
|
||||
02C7- I 154 ;
|
||||
02C7-FE E2 C9 BE
|
||||
A9 96 8E 86
|
||||
7E 77 70 64
|
||||
5E I 156 NOTAB .HS FE.E2.C9.BE.A9.96.8E.86.7E.77.70.64.5E
|
||||
02D4- I 157 ;
|
||||
02D4- I 158 ; TABLE OF NOTE DURATIONS IN # OF 1/2 CYCLES SET FOR A NOTE LENGTH OF
|
||||
02D4- I 159 ; ABOUT .21 SEC.
|
||||
02D4- I 160 ;
|
||||
5E I 155 NOTAB .HS FE.E2.C9.BE.A9.96.8E.86.7E.77.70.64.5E
|
||||
02D4- I 156 ;
|
||||
02D4- I 157 ; TABLE OF NOTE DURATIONS IN # OF 1/2 CYCLES SET FOR A NOTE LENGTH OF
|
||||
02D4- I 158 ; ABOUT .21 SEC.
|
||||
02D4- I 159 ;
|
||||
02D4-55 60 6B 72
|
||||
80 8F 94 A1
|
||||
AA B5 BF D7
|
||||
E4 I 161 DURTAB .HS 55.60.6B.72.80.8F.94.A1.AA.B5.BF.D7.E4
|
||||
02E1- 16 .IN ../../common/CH01-Getkey/getkey_routine.asm
|
||||
E4 I 160 DURTAB .HS 55.60.6B.72.80.8F.94.A1.AA.B5.BF.D7.E4
|
||||
02E1- 17 .IN ../../common/CH01-Getkey/getkey_routine.asm
|
||||
02E1- I 1 ; 'GETKEY' KEYBOARD INPUT ROUTINE READS AND DEBOUNCES KEYBOARD. RETURNS WITH
|
||||
02E1- I 2 ; KEY NUMBER IN ACCUMULATOR IF KEY DOWN. OPERATION: SENDS NUMBERS 0-F TO 74154
|
||||
02E1- I 3 ; (4 TO 16 LINE DECODER), WHICH GROUNDS ONE SIDE OF KEYSWITCHES ONE AT A TIME.
|
||||
|
@ -9,10 +9,7 @@
|
||||
;
|
||||
VIA1 .EQ $C000
|
||||
VIA3 .EQ $CC00
|
||||
DDR3A .EQ VIA3+3 ; USING RC-ONE ADDRESS DECODING SCHEME, PLACING
|
||||
DDR3B .EQ VIA3+2 ; VIA3 AT $CC00 BY DEFAULT (INSTEAD OF $AC00)
|
||||
PORT3A .EQ VIA3+1 ; TO FIT RC-ONE ADDRESS DECODING THOUGH ORIGINAL
|
||||
PORT3B .EQ VIA3 ; CAN BE JUMPERED IF NEEDED/WANTED.
|
||||
TABEG .EQ $0350 ; TABLE TO STORE MUSIC
|
||||
|
||||
.OR $0200
|
||||
.TA $0200
|
||||
|
@ -1,9 +1,9 @@
|
||||
:10020000200603A90085001820E102C90FD00520AF
|
||||
:100210008A0290EFC90ED006204B021890EA8501A1
|
||||
:10022000207302A500C9FFD005208A0290DA4AA8EF
|
||||
:10023000A501B009290F990003E60090CB0A0A0A2C
|
||||
:100240000A190003990003E60090BDA2008602A5EA
|
||||
:10025000024AAABD0003B004290F900629F04A4AB9
|
||||
:10023000A501B009290F995003E60090CB0A0A0ADC
|
||||
:100240000A195003995003E60090BDA2008602A54A
|
||||
:10025000024AAABD5003B004290F900629F04A4A69
|
||||
:100260004A4A207302A220209F02E602A502C5008E
|
||||
:1002700090DF60C90DD006A254209F0260AABDD4B1
|
||||
:10028000028504BDC70220AB0260A9FF8504A94B0B
|
||||
|
@ -6,15 +6,12 @@
|
||||
0000- 9 ;
|
||||
C000- 10 VIA1 .EQ $C000
|
||||
CC00- 11 VIA3 .EQ $CC00
|
||||
CC03- 12 DDR3A .EQ VIA3+3 ; USING RC-ONE ADDRESS DECODING SCHEME, PLACING
|
||||
CC02- 13 DDR3B .EQ VIA3+2 ; VIA3 AT $CC00 BY DEFAULT (INSTEAD OF $AC00)
|
||||
CC01- 14 PORT3A .EQ VIA3+1 ; TO FIT RC-ONE ADDRESS DECODING THOUGH ORIGINAL
|
||||
CC00- 15 PORT3B .EQ VIA3 ; CAN BE JUMPERED IF NEEDED/WANTED.
|
||||
0000- 16
|
||||
0200- 17 .OR $0200
|
||||
0200- 18 .TA $0200
|
||||
0200-20 06 03 19 ( 6) BEGIN JSR INITKEY
|
||||
0203- 20 .IN player.asm
|
||||
0350- 12 TABEG .EQ $0350 ; TABLE TO STORE MUSIC
|
||||
0000- 13
|
||||
0200- 14 .OR $0200
|
||||
0200- 15 .TA $0200
|
||||
0200-20 06 03 16 ( 6) BEGIN JSR INITKEY
|
||||
0203- 17 .IN player.asm
|
||||
0203- I 1 ; MUSIC PLAYER PROGRAM
|
||||
0203- I 2 ; USES 16-KEY KEYBOARD AND BUFFERED SPEAKER
|
||||
0203- I 3 ; PROGRAM PLAYS STORED MUSICAL NOTES. THERE ARE TWO MODES OF OPERATION: INPUT
|
||||
@ -28,161 +25,160 @@ CC00- 15 PORT3B .EQ VIA3 ; CAN BE JUMPERED IF
|
||||
0002- I 11 PTR .EQ $02 ; CURRENT LOCATION IN LIST
|
||||
0003- I 12 FREQ .EQ $03 ; TEMPORARY STORAGE FOR FREQUENCY
|
||||
0004- I 13 DUR .EQ $04 ; TEMP STORAGE FOR DURATION
|
||||
0300- I 14 TABEG .EQ $0300 ; TABLE TO STORE MUSIC
|
||||
CC00- I 15 PORT3B .EQ VIA3 ; VIA OUTPUT PORT B
|
||||
CC02- I 16 DDR3B .EQ VIA3+2 ; VIA PORT B DIRECTION REGISTER
|
||||
CC03- I 17 DDR3A .EQ VIA3+3
|
||||
CC01- I 18 PORT3A .EQ VIA3+1
|
||||
CC00- I 19 PORT3B .EQ VIA3
|
||||
0203- I 20
|
||||
0203- I 21 ;
|
||||
0203- I 22 ; COMMAND LINE INTERPRETER
|
||||
0203- I 23 ; $F AS INPUT MEANS RESET POINTERS, START OVER.
|
||||
0203- I 24 ; $E MEANS PLAY CURRENTLY STORED NOTES
|
||||
0203- I 25 ; ANYTHING ELSE IS STORED FOR REPLAY.
|
||||
0203- I 26 ;
|
||||
0203-A9 00 I 27 ( 2) START LDA #0 ; CLEAR NOTE LIST LENGTH
|
||||
0205-85 00 I 28 ( 2) STA PILEN
|
||||
0207-18 I 29 ( 2) CLC ; CLEAR NIBBLE MARKER
|
||||
0208-20 E1 02 I 30 ( 6) NXKEY JSR GETKEY
|
||||
020B-C9 0F I 31 ( 2) CMP #15 ; IS KEY #15?
|
||||
020D-D0 05 I 32 (2**) BNE NXTST ; NO, DO NEXT TEST
|
||||
020F-20 8A 02 I 33 ( 6) JSR BEEP3 ; TELL USER OF CLEARING
|
||||
0212-90 EF I 34 (2**) BCC START ; CLEAR POINTERS AND START OVER
|
||||
0214-C9 0E I 35 ( 2) NXTST CMP #14 ; IS KEY #14?
|
||||
0216-D0 06 I 36 (2**) BNE NUMKEY ; NO, KEY IS NOTE NUMBER
|
||||
0218-20 4B 02 I 37 ( 6) JSR PLAYEM ; PLAY NOTES
|
||||
021B-18 I 38 ( 2) CLC
|
||||
021C-90 EA I 39 (2**) BCC NXKEY ; GET NEXT COMMAND
|
||||
021E- I 40 ;
|
||||
021E- I 41 ; ROUTINE TO LOAD NOT LIST WITH NOTES
|
||||
021E- I 42 ;
|
||||
021E-85 01 I 43 ( 2) NUMKEY STA TEMP ; SAVE KEY, FREE A
|
||||
0220-20 73 02 I 44 ( 6) JSR PLAYIT ; PLAY NOTE
|
||||
0223-A5 00 I 45 ( 3) LDA PILEN ; GET LIST LENGTH
|
||||
0225-C9 FF I 46 ( 2) CMP #$FF ; OVERFLOW?
|
||||
0227-D0 05 I 47 (2**) BNE OK ; NO, ADD NOTE TO LIST
|
||||
0229-20 8A 02 I 48 ( 6) JSR BEEP3 ; YES, WARN USER
|
||||
022C-90 DA I 49 (2**) BCC NXKEY ; RETURN TO INPUT MODE
|
||||
022E-4A I 50 ( 2) OK LSR A ; SHIFT LOW BIT INTO NIBBLE POINTER
|
||||
022F-A8 I 51 ( 2) TAY ; USE SHIFTED NIBBLE POINTER AS BYTE INDEX
|
||||
0230-A5 01 I 52 ( 3) LDA TEMP ; RESTORE KEY#
|
||||
0232-B0 09 I 53 (2**) BCS FINBYT ; IF BYTE ALREADY HAS A NIBBLE, FINISH IT AND STORE
|
||||
0234-29 0F I 54 ( 2) AND #%00001111 ; 1ST NIBBLE. MASK HIGH NIBBLE
|
||||
0236-99 00 03 I 55 ( 5) STA TABEG,Y ; SAVE UNFINISHED 1/2 BYTE
|
||||
0239-E6 00 I 56 ( 5) INC PILEN ; POINT TO NEXT NIBBLE
|
||||
023B-90 CB I 57 (2**) BCC NXKEY ; GET NEXT KEYSTROKE
|
||||
023D-0A I 58 ( 2) FINBYT ASL A ; SHIFT NIBBLE 2 TO HIGH ORDER
|
||||
023E-0A I 59 ( 2) ASL A
|
||||
023F-0A I 60 ( 2) ASL A
|
||||
0240-0A I 61 ( 2) ASL A
|
||||
0241-19 00 03 I 62 ( 4*) ORA TABEG,Y ; JOIN 2 NIBBLES AS BYTE
|
||||
0244-99 00 03 I 63 ( 5) STA TABEG,Y ; ... AND STORE.
|
||||
0247-E6 00 I 64 ( 5) INC PILEN ; POINT TO NEXT NIBBLE IN NEXT BYTE
|
||||
0249-90 BD I 65 (2**) BCC NXKEY ; RETURN
|
||||
024B- I 66 ;
|
||||
024B- I 67 ; ROUTINE TO PLAY NOTES
|
||||
024B- I 68 ;
|
||||
024B-A2 00 I 69 ( 2) PLAYEM LDX #0 ; CLEAR POINTER
|
||||
024D-86 02 I 70 ( 3) STX PTR
|
||||
024F-A5 02 I 71 ( 3) LDA PTR ; LOAD ACCUMULATOR WITH CURRENT POINTER VALUE
|
||||
0251-4A I 72 ( 2) LOOP LSR A ; SHIFT NIBBLE INDICATOR INTO CARRY
|
||||
0252-AA I 73 ( 2) TAX ; USE SHIFTED NIBBLE POINTER AS BYTE POINTER
|
||||
0253-BD 00 03 I 74 ( 4*) LDA TABEG,X ; LOAD NOTE TO PLAY
|
||||
0256-B0 04 I 75 (2**) BCS ENDBYT ; LOW NIBBLE USED, GET HIGH
|
||||
0258-29 0F I 76 ( 2) AND #%00001111 ; MASK OUT HIGH BITS
|
||||
025A-90 06 I 77 (2**) BCC FINISH ; PLAY NOTE
|
||||
025C-29 F0 I 78 ( 2) ENDBYT AND #%11110000 ; THROW AWAY LOW NIBBLE
|
||||
025E-4A I 79 ( 2) LSR A ; SHIFT INTO LOW
|
||||
025F-4A I 80 ( 2) LSR A
|
||||
0260-4A I 81 ( 2) LSR A
|
||||
0261-4A I 82 ( 2) LSR A
|
||||
0262-20 73 02 I 83 ( 6) FINISH JSR PLAYIT ; CALCULATE CONSTANTS & PLAY
|
||||
0265-A2 20 I 84 ( 2) LDX #$20 ; BETWEEN-NOTE DELAY
|
||||
0267-20 9F 02 I 85 ( 6) JSR DELAY
|
||||
026A-E6 02 I 86 ( 5) INC PTR ; ONE NIBBLE USED
|
||||
026C-A5 02 I 87 ( 3) LDA PTR
|
||||
026E-C5 00 I 88 ( 3) CMP PILEN ; END OF LIST?
|
||||
0270-90 DF I 89 (2**) BCC LOOP ; NO, GET NEXT NOTE
|
||||
0272-60 I 90 ( 6) RTS ; DONE
|
||||
0273- I 91 ;
|
||||
0273- I 92 ; ROUTINE TO DO TABLE LOOK UP, SEPARATE REST
|
||||
0273- I 93 ;
|
||||
0273-C9 0D I 94 ( 2) PLAYIT CMP #13 ; REST?
|
||||
0275-D0 06 I 95 (2**) BNE SOUND ; NO.
|
||||
0277-A2 54 I 96 ( 2) LDX #$54 ; DELAY = NOTE LENGTH = .21SEC
|
||||
0279-20 9F 02 I 97 ( 6) JSR DELAY
|
||||
027C-60 I 98 ( 6) RTS
|
||||
027D-AA I 99 ( 2) SOUND TAX ; USE KEYS AS INDEX..
|
||||
027E-BD D4 02 I 100 ( 4*) LDA DURTAB,X ; ... TO FIND DURATION.
|
||||
0281-85 04 I 101 ( 2) STA DUR ; STORE DURATION FOR USE
|
||||
0283-BD C7 02 I 102 ( 4*) LDA NOTAB,X ; LOAD NOTE VALUE
|
||||
0286-20 AB 02 I 103 ( 6) JSR TONE
|
||||
0289-60 I 104 ( 6) RTS
|
||||
028A- I 105 ;
|
||||
028A- I 106 ; ROUTINE TO MAKE 3 TONE SIGNAL
|
||||
028A- I 107 ;
|
||||
028A-A9 FF I 108 ( 2) BEEP3 LDA #$FF ; DURATION FOR BEEPS
|
||||
028C-85 04 I 109 ( 2) STA DUR
|
||||
028E-A9 4B I 110 ( 2) LDA #$4B ; CODE FOR E2
|
||||
0290-20 AB 02 I 111 ( 6) JSR TONE ; 1ST NOTE
|
||||
0293-A9 38 I 112 ( 2) LDA #$38 ; CODE FOR D2
|
||||
0295-20 AB 02 I 113 ( 6) JSR TONE
|
||||
0298-A9 4B I 114 ( 2) LDA #$4B
|
||||
029A-20 AB 02 I 115 ( 6) JSR TONE
|
||||
029D-18 I 116 ( 2) CLC
|
||||
029E-60 I 117 ( 6) RTS
|
||||
029F- I 118 ;
|
||||
029F- I 119 ; VARIABLE-LENGTH DELAY
|
||||
029F- I 120 ;
|
||||
029F-A0 FF I 121 ( 2) DELAY LDY #$FF
|
||||
02A1-EA I 122 ( 2) DLY NOP
|
||||
02A2-D0 00 I 123 (2**) BNE DL0 ; (.+2 IN BOOK)
|
||||
02A4-88 I 124 ( 2) DL0 DEY
|
||||
02A5-D0 FA I 125 (2**) BNE DLY ; 10 US. LOOP
|
||||
02A7-CA I 126 ( 2) DEX
|
||||
02A8-D0 F5 I 127 (2**) BNE DELAY ; LOOP TIME = 2556*[X]
|
||||
02AA-60 I 128 ( 6) RTS
|
||||
02AB- I 129 ;
|
||||
02AB- I 130 ; ROUTINE TO MAKE TONE: # OF 1/2 CYCLES IS IN 'DUR', AND 1/2 CYCLE TIME IS IN
|
||||
02AB- I 131 ; ACCUMULATOR. LOOP TIME = 20*[A]+26 US SINCE TWO RUNS THROUGH THE OUTER LOOP
|
||||
02AB- I 132 ; MAKES ONE CYCLE OF THE TONE.
|
||||
02AB- I 133 ;
|
||||
02AB-85 03 I 134 ( 2) TONE STA FREQ ; FREQ IS TEMP FOR # OF CYCLES
|
||||
02AD-A9 FF I 135 ( 2) LDA #$FF ; SET UP DATA DIRECTION REGISTER
|
||||
02AF-8D 02 CC I 136 ( 4) STA DDR3B
|
||||
02B2-A9 00 I 137 ( 2) LDA #$00 ; A IS SENT TO PORT, START HI
|
||||
02B4-A6 04 I 138 ( 3) LDX DUR
|
||||
02B6-A4 03 I 139 ( 3) FL2 LDY FREQ
|
||||
02B8-88 I 140 ( 2) FL1 DEY
|
||||
02B9-18 I 141 ( 2) CLC
|
||||
02BA-90 00 I 142 (2**) BCC FL0 ; (.+2 IN BOOK)
|
||||
02BC-D0 FA I 143 (2**) FL0 BNE FL1 ; INNER, 10 US LOOP.
|
||||
02BE-49 FF I 144 ( 2) EOR #$FF ; COMPLEMENT I/O PORT
|
||||
02C0-8D 00 CC I 145 ( 4) STA PORT3B ; ... AND SET IT
|
||||
02C3-CA I 146 ( 2) DEX
|
||||
02C4-D0 F0 I 147 (2**) BNE FL2 ; OUTER LOOP
|
||||
02C6-60 I 148 ( 6) RTS
|
||||
02C7- I 149 ;
|
||||
02C7- I 150 ; TABLE OF NOTE CONSTANTS
|
||||
02C7- I 151 ; CONTAINS:
|
||||
02C7- I 152 ; [OCTAVE BELOW MIDDLE C] : G,A,BCC
|
||||
02C7- I 153 ; [OCTAVE OF MIDDLE C] : C,D,E,F,F#,G,G#,A,B
|
||||
02C7- I 154 ; [OCTAVE ABOVE MIDDLE C] : C
|
||||
02C7- I 155 ;
|
||||
CC00- I 14 PORT3B .EQ VIA3 ; VIA OUTPUT PORT B
|
||||
CC02- I 15 DDR3B .EQ VIA3+2 ; VIA PORT B DIRECTION REGISTER
|
||||
CC03- I 16 DDR3A .EQ VIA3+3
|
||||
CC01- I 17 PORT3A .EQ VIA3+1
|
||||
CC00- I 18 PORT3B .EQ VIA3
|
||||
0203- I 19
|
||||
0203- I 20 ;
|
||||
0203- I 21 ; COMMAND LINE INTERPRETER
|
||||
0203- I 22 ; $F AS INPUT MEANS RESET POINTERS, START OVER.
|
||||
0203- I 23 ; $E MEANS PLAY CURRENTLY STORED NOTES
|
||||
0203- I 24 ; ANYTHING ELSE IS STORED FOR REPLAY.
|
||||
0203- I 25 ;
|
||||
0203-A9 00 I 26 ( 2) START LDA #0 ; CLEAR NOTE LIST LENGTH
|
||||
0205-85 00 I 27 ( 2) STA PILEN
|
||||
0207-18 I 28 ( 2) CLC ; CLEAR NIBBLE MARKER
|
||||
0208-20 E1 02 I 29 ( 6) NXKEY JSR GETKEY
|
||||
020B-C9 0F I 30 ( 2) CMP #15 ; IS KEY #15?
|
||||
020D-D0 05 I 31 (2**) BNE NXTST ; NO, DO NEXT TEST
|
||||
020F-20 8A 02 I 32 ( 6) JSR BEEP3 ; TELL USER OF CLEARING
|
||||
0212-90 EF I 33 (2**) BCC START ; CLEAR POINTERS AND START OVER
|
||||
0214-C9 0E I 34 ( 2) NXTST CMP #14 ; IS KEY #14?
|
||||
0216-D0 06 I 35 (2**) BNE NUMKEY ; NO, KEY IS NOTE NUMBER
|
||||
0218-20 4B 02 I 36 ( 6) JSR PLAYEM ; PLAY NOTES
|
||||
021B-18 I 37 ( 2) CLC
|
||||
021C-90 EA I 38 (2**) BCC NXKEY ; GET NEXT COMMAND
|
||||
021E- I 39 ;
|
||||
021E- I 40 ; ROUTINE TO LOAD NOT LIST WITH NOTES
|
||||
021E- I 41 ;
|
||||
021E-85 01 I 42 ( 2) NUMKEY STA TEMP ; SAVE KEY, FREE A
|
||||
0220-20 73 02 I 43 ( 6) JSR PLAYIT ; PLAY NOTE
|
||||
0223-A5 00 I 44 ( 3) LDA PILEN ; GET LIST LENGTH
|
||||
0225-C9 FF I 45 ( 2) CMP #$FF ; OVERFLOW?
|
||||
0227-D0 05 I 46 (2**) BNE OK ; NO, ADD NOTE TO LIST
|
||||
0229-20 8A 02 I 47 ( 6) JSR BEEP3 ; YES, WARN USER
|
||||
022C-90 DA I 48 (2**) BCC NXKEY ; RETURN TO INPUT MODE
|
||||
022E-4A I 49 ( 2) OK LSR A ; SHIFT LOW BIT INTO NIBBLE POINTER
|
||||
022F-A8 I 50 ( 2) TAY ; USE SHIFTED NIBBLE POINTER AS BYTE INDEX
|
||||
0230-A5 01 I 51 ( 3) LDA TEMP ; RESTORE KEY#
|
||||
0232-B0 09 I 52 (2**) BCS FINBYT ; IF BYTE ALREADY HAS A NIBBLE, FINISH IT AND STORE
|
||||
0234-29 0F I 53 ( 2) AND #%00001111 ; 1ST NIBBLE. MASK HIGH NIBBLE
|
||||
0236-99 50 03 I 54 ( 5) STA TABEG,Y ; SAVE UNFINISHED 1/2 BYTE
|
||||
0239-E6 00 I 55 ( 5) INC PILEN ; POINT TO NEXT NIBBLE
|
||||
023B-90 CB I 56 (2**) BCC NXKEY ; GET NEXT KEYSTROKE
|
||||
023D-0A I 57 ( 2) FINBYT ASL A ; SHIFT NIBBLE 2 TO HIGH ORDER
|
||||
023E-0A I 58 ( 2) ASL A
|
||||
023F-0A I 59 ( 2) ASL A
|
||||
0240-0A I 60 ( 2) ASL A
|
||||
0241-19 50 03 I 61 ( 4*) ORA TABEG,Y ; JOIN 2 NIBBLES AS BYTE
|
||||
0244-99 50 03 I 62 ( 5) STA TABEG,Y ; ... AND STORE.
|
||||
0247-E6 00 I 63 ( 5) INC PILEN ; POINT TO NEXT NIBBLE IN NEXT BYTE
|
||||
0249-90 BD I 64 (2**) BCC NXKEY ; RETURN
|
||||
024B- I 65 ;
|
||||
024B- I 66 ; ROUTINE TO PLAY NOTES
|
||||
024B- I 67 ;
|
||||
024B-A2 00 I 68 ( 2) PLAYEM LDX #0 ; CLEAR POINTER
|
||||
024D-86 02 I 69 ( 3) STX PTR
|
||||
024F-A5 02 I 70 ( 3) LDA PTR ; LOAD ACCUMULATOR WITH CURRENT POINTER VALUE
|
||||
0251-4A I 71 ( 2) LOOP LSR A ; SHIFT NIBBLE INDICATOR INTO CARRY
|
||||
0252-AA I 72 ( 2) TAX ; USE SHIFTED NIBBLE POINTER AS BYTE POINTER
|
||||
0253-BD 50 03 I 73 ( 4*) LDA TABEG,X ; LOAD NOTE TO PLAY
|
||||
0256-B0 04 I 74 (2**) BCS ENDBYT ; LOW NIBBLE USED, GET HIGH
|
||||
0258-29 0F I 75 ( 2) AND #%00001111 ; MASK OUT HIGH BITS
|
||||
025A-90 06 I 76 (2**) BCC FINISH ; PLAY NOTE
|
||||
025C-29 F0 I 77 ( 2) ENDBYT AND #%11110000 ; THROW AWAY LOW NIBBLE
|
||||
025E-4A I 78 ( 2) LSR A ; SHIFT INTO LOW
|
||||
025F-4A I 79 ( 2) LSR A
|
||||
0260-4A I 80 ( 2) LSR A
|
||||
0261-4A I 81 ( 2) LSR A
|
||||
0262-20 73 02 I 82 ( 6) FINISH JSR PLAYIT ; CALCULATE CONSTANTS & PLAY
|
||||
0265-A2 20 I 83 ( 2) LDX #$20 ; BETWEEN-NOTE DELAY
|
||||
0267-20 9F 02 I 84 ( 6) JSR DELAY
|
||||
026A-E6 02 I 85 ( 5) INC PTR ; ONE NIBBLE USED
|
||||
026C-A5 02 I 86 ( 3) LDA PTR
|
||||
026E-C5 00 I 87 ( 3) CMP PILEN ; END OF LIST?
|
||||
0270-90 DF I 88 (2**) BCC LOOP ; NO, GET NEXT NOTE
|
||||
0272-60 I 89 ( 6) RTS ; DONE
|
||||
0273- I 90 ;
|
||||
0273- I 91 ; ROUTINE TO DO TABLE LOOK UP, SEPARATE REST
|
||||
0273- I 92 ;
|
||||
0273-C9 0D I 93 ( 2) PLAYIT CMP #13 ; REST?
|
||||
0275-D0 06 I 94 (2**) BNE SOUND ; NO.
|
||||
0277-A2 54 I 95 ( 2) LDX #$54 ; DELAY = NOTE LENGTH = .21SEC
|
||||
0279-20 9F 02 I 96 ( 6) JSR DELAY
|
||||
027C-60 I 97 ( 6) RTS
|
||||
027D-AA I 98 ( 2) SOUND TAX ; USE KEYS AS INDEX..
|
||||
027E-BD D4 02 I 99 ( 4*) LDA DURTAB,X ; ... TO FIND DURATION.
|
||||
0281-85 04 I 100 ( 2) STA DUR ; STORE DURATION FOR USE
|
||||
0283-BD C7 02 I 101 ( 4*) LDA NOTAB,X ; LOAD NOTE VALUE
|
||||
0286-20 AB 02 I 102 ( 6) JSR TONE
|
||||
0289-60 I 103 ( 6) RTS
|
||||
028A- I 104 ;
|
||||
028A- I 105 ; ROUTINE TO MAKE 3 TONE SIGNAL
|
||||
028A- I 106 ;
|
||||
028A-A9 FF I 107 ( 2) BEEP3 LDA #$FF ; DURATION FOR BEEPS
|
||||
028C-85 04 I 108 ( 2) STA DUR
|
||||
028E-A9 4B I 109 ( 2) LDA #$4B ; CODE FOR E2
|
||||
0290-20 AB 02 I 110 ( 6) JSR TONE ; 1ST NOTE
|
||||
0293-A9 38 I 111 ( 2) LDA #$38 ; CODE FOR D2
|
||||
0295-20 AB 02 I 112 ( 6) JSR TONE
|
||||
0298-A9 4B I 113 ( 2) LDA #$4B
|
||||
029A-20 AB 02 I 114 ( 6) JSR TONE
|
||||
029D-18 I 115 ( 2) CLC
|
||||
029E-60 I 116 ( 6) RTS
|
||||
029F- I 117 ;
|
||||
029F- I 118 ; VARIABLE-LENGTH DELAY
|
||||
029F- I 119 ;
|
||||
029F-A0 FF I 120 ( 2) DELAY LDY #$FF
|
||||
02A1-EA I 121 ( 2) DLY NOP
|
||||
02A2-D0 00 I 122 (2**) BNE DL0 ; (.+2 IN BOOK)
|
||||
02A4-88 I 123 ( 2) DL0 DEY
|
||||
02A5-D0 FA I 124 (2**) BNE DLY ; 10 US. LOOP
|
||||
02A7-CA I 125 ( 2) DEX
|
||||
02A8-D0 F5 I 126 (2**) BNE DELAY ; LOOP TIME = 2556*[X]
|
||||
02AA-60 I 127 ( 6) RTS
|
||||
02AB- I 128 ;
|
||||
02AB- I 129 ; ROUTINE TO MAKE TONE: # OF 1/2 CYCLES IS IN 'DUR', AND 1/2 CYCLE TIME IS IN
|
||||
02AB- I 130 ; ACCUMULATOR. LOOP TIME = 20*[A]+26 US SINCE TWO RUNS THROUGH THE OUTER LOOP
|
||||
02AB- I 131 ; MAKES ONE CYCLE OF THE TONE.
|
||||
02AB- I 132 ;
|
||||
02AB-85 03 I 133 ( 2) TONE STA FREQ ; FREQ IS TEMP FOR # OF CYCLES
|
||||
02AD-A9 FF I 134 ( 2) LDA #$FF ; SET UP DATA DIRECTION REGISTER
|
||||
02AF-8D 02 CC I 135 ( 4) STA DDR3B
|
||||
02B2-A9 00 I 136 ( 2) LDA #$00 ; A IS SENT TO PORT, START HI
|
||||
02B4-A6 04 I 137 ( 3) LDX DUR
|
||||
02B6-A4 03 I 138 ( 3) FL2 LDY FREQ
|
||||
02B8-88 I 139 ( 2) FL1 DEY
|
||||
02B9-18 I 140 ( 2) CLC
|
||||
02BA-90 00 I 141 (2**) BCC FL0 ; (.+2 IN BOOK)
|
||||
02BC-D0 FA I 142 (2**) FL0 BNE FL1 ; INNER, 10 US LOOP.
|
||||
02BE-49 FF I 143 ( 2) EOR #$FF ; COMPLEMENT I/O PORT
|
||||
02C0-8D 00 CC I 144 ( 4) STA PORT3B ; ... AND SET IT
|
||||
02C3-CA I 145 ( 2) DEX
|
||||
02C4-D0 F0 I 146 (2**) BNE FL2 ; OUTER LOOP
|
||||
02C6-60 I 147 ( 6) RTS
|
||||
02C7- I 148 ;
|
||||
02C7- I 149 ; TABLE OF NOTE CONSTANTS
|
||||
02C7- I 150 ; CONTAINS:
|
||||
02C7- I 151 ; [OCTAVE BELOW MIDDLE C] : G,A,BCC
|
||||
02C7- I 152 ; [OCTAVE OF MIDDLE C] : C,D,E,F,F#,G,G#,A,B
|
||||
02C7- I 153 ; [OCTAVE ABOVE MIDDLE C] : C
|
||||
02C7- I 154 ;
|
||||
02C7-FE E2 C9 BE
|
||||
A9 96 8E 86
|
||||
7E 77 70 64
|
||||
5E I 156 NOTAB .HS FE.E2.C9.BE.A9.96.8E.86.7E.77.70.64.5E
|
||||
02D4- I 157 ;
|
||||
02D4- I 158 ; TABLE OF NOTE DURATIONS IN # OF 1/2 CYCLES SET FOR A NOTE LENGTH OF
|
||||
02D4- I 159 ; ABOUT .21 SEC.
|
||||
02D4- I 160 ;
|
||||
5E I 155 NOTAB .HS FE.E2.C9.BE.A9.96.8E.86.7E.77.70.64.5E
|
||||
02D4- I 156 ;
|
||||
02D4- I 157 ; TABLE OF NOTE DURATIONS IN # OF 1/2 CYCLES SET FOR A NOTE LENGTH OF
|
||||
02D4- I 158 ; ABOUT .21 SEC.
|
||||
02D4- I 159 ;
|
||||
02D4-55 60 6B 72
|
||||
80 8F 94 A1
|
||||
AA B5 BF D7
|
||||
E4 I 161 DURTAB .HS 55.60.6B.72.80.8F.94.A1.AA.B5.BF.D7.E4
|
||||
02E1- 21 .IN ../CH01-Getkey/getkey_routine.asm
|
||||
E4 I 160 DURTAB .HS 55.60.6B.72.80.8F.94.A1.AA.B5.BF.D7.E4
|
||||
02E1- 18 .IN ../CH01-Getkey/getkey_routine.asm
|
||||
02E1- I 1 ; 'GETKEY' KEYBOARD INPUT ROUTINE READS AND DEBOUNCES KEYBOARD. RETURNS WITH
|
||||
02E1- I 2 ; KEY NUMBER IN ACCUMULATOR IF KEY DOWN. OPERATION: SENDS NUMBERS 0-F TO 74154
|
||||
02E1- I 3 ; (4 TO 16 LINE DECODER), WHICH GROUNDS ONE SIDE OF KEYSWITCHES ONE AT A TIME.
|
||||
|
@ -11,7 +11,6 @@ TEMP .EQ $01 ; TEMPORARY STORAGE
|
||||
PTR .EQ $02 ; CURRENT LOCATION IN LIST
|
||||
FREQ .EQ $03 ; TEMPORARY STORAGE FOR FREQUENCY
|
||||
DUR .EQ $04 ; TEMP STORAGE FOR DURATION
|
||||
TABEG .EQ $0300 ; TABLE TO STORE MUSIC
|
||||
PORT3B .EQ VIA3 ; VIA OUTPUT PORT B
|
||||
DDR3B .EQ VIA3+2 ; VIA PORT B DIRECTION REGISTER
|
||||
DDR3A .EQ VIA3+3
|
||||
|
Loading…
Reference in New Issue
Block a user