-
Notifications
You must be signed in to change notification settings - Fork 0
/
PLAY68_ASM.txt
104 lines (99 loc) · 5.1 KB
/
PLAY68_ASM.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
PLAY68_ASM
---START OF LISTING---
00100 NAM PLAY68 REV.A SEPT 1977
00110 OPT O,NOP * NOP,O
00120 * COPYRIGHT (C) 1977 ALL RIGHTS RESERVED
00130 * NEWTECH COMPUTER SYSTEMS, INC
00140 *
00150 * PLAY68 STARTS AT THE BEGINNING OF ONE MEMORY AREA
00160 * DESIGNATED "SCORE" AND TRANSFERS INTO RAM LOCATION
00170 * "PITCH" A 1-BYTE PITCH PARAMETER AND INTO RAM
00180 * LOCATION "DURA" A 2-BYTE DURATION PARAMETER. THE
00190 * ROUTINE THEN CALLS SUBROUTINE PLAY TO OUTPUT TO
00200 * THE MODEL 68 THE MUSICAL NOTE SPECIFIED BY THESE
00210 * NOTE PARAMETERS. PLAY68 CONTINUES TRANSFERRING
00220 * NOTE PARAMETERS AND CALLI1NG THE PLAY ROUTINE UNTIL
00230 * A PITCH CONSTANT OF ZERO IS ENCOUNTERED WHICH
00240 * INDICATES THE END OF THE MUSICAL SCORE.
00250 *
00260 2B00 ORG $2B00
00270 2C00 SCORE EQU $2C00 SCORE AREA CAN BE CHANGED
00280 2B00 8E 2B90 LDS #STACK INIT. STACK POINTER
00290 2B03 CE 2C00 LDX #SCORE INIT. SCORE POINTER
00300 2B06 FF 2B77 STX PLACE
00310 2B09 FE 2B77 NEXT LDX PLACE
00320 2B0C 86 00 LDA A #0 IF END OF SCORE LOOP HERE.
00330 2B0E A1 00 CMP A X
00340 2B10 27 FE HERE BEQ HERE YOUR ENDING?
00350 * ELSE TRANSFER PARAMETERS FOR NEXT NOTE OR SCORE
00360 * INTO PLAY ROUTINE.
00370 2B12 A6 00 LDA A X LOAD PITCH.
00380 2B14 B7 2B7B STA A PITCH
00390 2B17 08 INX
00400 2B18 A6 00 LDA A X LOAD DURATION MSB
00410 2B1A B7 2B75 STA A DURA
00420 2B1D 08 INX
00430 2B1E A6 00 LDA A X LOAD DURATION LSB.
00440 2B20 B7 2B76 STA A DURA+1
00450 2B23 08 INX
00460 2B24 FF 2B77 STX PLACE SAVE SCORE POINTER.
00470 2B27 8D 02 BSR PLAY CALL NOTE PLAYING ROUTINE
00480 2B29 20 DE BRA NEXT GO DO NEXT NOTE.
00490 * THE PLAY ROUTINE PLAYS ONE NOTE AND RETURNS.
00500 2B2B CE 2B6C PLAY LDX #TBL1 INIT. ENVELOPE POINTER.
00510 2B2E FF 2B79 STX TBL1P STORE ENV. POINTER.
00520 2B31 E6 00 LDA B X PUT AMPLITUDE VALUE IN B.
00530 2B33 FE 2B75 LDX DURA LOAD DURATION PARAMETER
00540 * INTO INDEX REGISTER.
00550 2B36 BC E000 LOOP3 CPX $E000 5-WASTE TIME (31 STATES)
00560 2B39 BC E000 CPX $E000 5-
00565 2B3C BC E000 CPX $E000 5-
00570 2B3F BC E000 CPX $E000 5-
00580 2B42 BC E000 CPX $E000 5-
00590 2B45 73 E000 COM $E000 6-
00600 2B48 86 16 LOOP2 LDA A #22 4-FIXED DELAY TO ADJUST
00610 2B4A 4A LOOP4 DEC A 2-LOWEST NOTE TO 262HZ
00620 2B4B 26 FD BNE LOOP4 4- (MIDDLE C) WHEN PITCH
00630 * PARAMETER = FE.
00640 2B4D B6 2B7B LDA A PITCH 4-LOAD PITCH PARAMETER.
00650 2B50 F7 8010 STA B MOD68 5-OUTPUT TO MUSIC BOARD.
00660 2B53 4A LOOP1 DEC A 2-DELAY AS PER PITCH PARAM.
00670 2B54 26 FD BNE LOOP1 4-
00680 2B56 53 COM B 2-COMPLEMENT WAVEFORM VALUE
00690 2B57 09 DEX 4- DECREMENT DURATION COUNTER.
00700 2B58 26 DC BNE LOOP3 4-
00710 2B5A 7C 2B7A INC TBL1P+1 6-SET UP NEXT SEGMENT.
00720 2B5D FE 2B79 LDX TBL1P 5-
00730 2B60 E6 00 LDA B X 5-
00740 2B62 C1 01 CMP B #$01 2-END OF ENVELOPE CHAR. = 01.
00750 2B64 27 05 BEQ RETRN 4-RETURN IF LAST SEGMENT.
00760 2B66 FE 2B75 LDX DURA
00770 2B69 20 DD BRA LOOP2 4-
00780 2B6B 39 RETRN RTS
00790 *
00800 * AMPLITUDE ENVELOPE SPECIFICATION :
00810 * MAXIMUM AMPLITUDE IS OUTPUT WHEN ACCUMULATIOR B IS
00820 * COMPLEMENTED FROM 00 TO FF AND BACK. MINIMUM
00830 * AMPLITUDE IS OUTPUT WHEN B IS COMPLEMENTED
00840 * BETWEEN 80 AND 7F. AN END OF ENVELOPE RECORD
00850 * OF $01 MARKS THE END OF THE SPECIFICATION.
00860 *
00870 2B6C FF TBL1 FCB $FF,$FF,$F0,$E0,$D0,$C0,$B0,$85,$01
2B6D FF
2B6E F0
2B6F E0
2B70 B0
2B71 C0
2B72 B0
2B73 85
2B74 01
00880 *
00890 2B75 0002 DURA RMB 2 DURATION CONSTANT.
00900 8010 MOD68 EQU $8010 MUSIC BOARD IN I/O SLOT 4.
00910 2B77 0002 DURA RMB 2
00920 2B79 0002 TBL1P RMB 2 TABLE POINTER
00930 2B7B 0001 PITCH RMB 1 PITCH PARAMETER
00940 2B7C 0014 RMB 20
00950 2B90 STACK EQU *
00960 END
---END OF LISTING ---