-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSELECT.asm
144 lines (134 loc) · 2.78 KB
/
SELECT.asm
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
DEF PRCKEY
*
REF OTTO,SCHUMN,FOSTER,MONTEV Ref from TUNEx
REF CURKEY,PRVKEY Ref from VAR
REF CURENV "
REF SONGHD,HERTZ,CURMNU "
REF DSPINT Ref from DISPLAY
REF PLYINT Ref from MUSIC
COPY 'CONST.asm'
* Range of keys to select a sub menu
LOWMNU BYTE '1'
HGHMNU BYTE '2'
*
CHGHTZ BYTE '3'
ESCKEY BYTE >0F
* Range of keys that can select an envelope
LOWENV BYTE 'A'
HGHENV BYTE 'I'
* Range of keys that can select a song
LOWSNG BYTE 'A'
HGHSNG BYTE 'D'
EVEN
SNGLST DATA SCHUMN,OTTO,FOSTER,MONTEV
MNULST DATA MMAIN,MSONG,MENV
*
* Public Method: Process Keys
*
PRCKEY DECT R10
MOV R11,*R10
* Did user decide to return to main menu?
CB @CURKEY,@ESCKEY
JEQ BCKMNU
* No, what is the current menu?
MOVB @CURMNU,R0
SRL R0,8-1
AI R0,MNULST
MOV *R0,R0
* Branch to it's routine
B *R0
*
* Return to main menu
*
BCKMNU
* Clear key selection
SB @CURKEY,@CURKEY
* Select main menu and redisplay
SB @CURMNU,@CURMNU
JMP MMAIN1
*
* Main menu
*
MMAIN
* Did the user decide to swap electrical system?
CB @CURKEY,@CHGHTZ
JEQ SWPHTZ
* No, did the user select a submenu?
CB @CURKEY,@LOWMNU
JL PRCRT
CB @CURKEY,@HGHMNU
JH PRCRT
* Yes, clear out key press
MOVB @CURKEY,R0
SB R0,@CURKEY
* Record selection
* If '1' pressed, set menu to >01, etc.
SB @LOWMNU,R0
AI R0,>100
MOVB R0,@CURMNU
* Redisplay menu
MMAIN1 BL @DSPINT
*
JMP PRCRT
*
* Song Sub-menu
*
MSONG
* Did the user select a submenu?
CB @CURKEY,@LOWSNG
JL PRCRT
CB @CURKEY,@HGHSNG
JH PRCRT
* Yes, clear out key press
MOVB @CURKEY,R0
SB R0,@CURKEY
* Record selection
SB @LOWSNG,R0
SRL R0,8-1
AI R0,SNGLST
MOV *R0,@SONGHD
* Reset the song from the start
BL @PLYINT
*
JMP PRCRT
*
* Envelope Sub-menu
*
* Did the user select a new envelope?
MENV CB @CURKEY,@LOWENV
JL PRCRT
CB @CURKEY,@HGHENV
JH PRCRT
* Yes, clear out key press
MOVB @CURKEY,R0
SB R0,@CURKEY
* Record selection
SB @LOWENV,R0
SRL R0,8
MOV R0,@CURENV
*
JMP PRCRT
*
* Switch between 60hz and 50hz
* Restart the song with new ratio
*
SWPHTZ
* clear key
SB @CURKEY,@CURKEY
* Is current mode 60hz?
MOVB @HERTZ,R0
JEQ MK50HZ
* No, switch back to 60hz
SB @HERTZ,@HERTZ
JMP RESET
* Yes, switch to 50hz
MK50HZ SETO R0
MOVB R0,@HERTZ
* Reset the song from the start
RESET BL @PLYINT
JMP PRCRT
*
* Return to caller
*
PRCRT MOV *R10+,R11
RT