-
Notifications
You must be signed in to change notification settings - Fork 1
/
menu.asm
262 lines (247 loc) · 6.92 KB
/
menu.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
;****************************************************************************
;
; MC70 - Firmware for the Motorola MC micro trunking radio
; to use it as an Amateur-Radio transceiver
;
; Copyright (C) 2004 - 2012 Felix Erckenbrecht, DG1YFE
;
; This file is part of MC70.
;
; MC70 is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; MC70 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with MC70. If not, see <http://www.gnu.org/licenses/>.
;
;
;
;****************************************************************************
;*****************************
; M E N U
;*****************************
;
; Die komplette Menüsteuerung der Software
;
; menu_init - Initialisiert State & Menu Timer ( nix | nix )
; menu - komplette Menu-Steuerung, User Interface
;
;
;
;
;
; Tastencodes nach "Key-Convert" Tabelle ( 0 - 9 = Numerische Tasten)
;
#DEFINE KC_NON_NUMERIC 10
#DEFINE KC_D1 11
#DEFINE KC_D2 12
#DEFINE KC_D3 13
#DEFINE KC_D4 14
#DEFINE KC_D5 15
#DEFINE KC_D6 16
#DEFINE KC_D7 17
#DEFINE KC_D8 18
#DEFINE KC_RAUTE 19
#DEFINE KC_STERN 10
;
#DEFINE KC_CLEAR KC_D4
;
#DEFINE HD2_ENTER 8
#DEFINE HD2_EXIT 5
;
#DEFINE HD2_UP KC_D1
#DEFINE HD2_DN KC_D2
;
#DEFINE HD3_ENTER KC_RAUTE
#DEFINE HD3_EXIT KC_STERN
;
; Menu
#DEFINE IDLE 0
#DEFINE F_IN 1
#DEFINE MEM_SELECT 2
#DEFINE MEM_STORE 3
#DEFINE MEM_RECALL_LOAD 4
#DEFINE TXSHIFT_SW 5
#DEFINE MENU_SELECT 6
#DEFINE DEFCH_SELECT 7
#DEFINE M_VERSION 8
#ifdef EVA9
#DEFINE POWER_SELECT 9
#endif
#DEFINE CTCSS_SEL_RX 10
#DEFINE CTCSS_SEL_TX 11
#DEFINE DTMF_IN 12
;#DEFINE MEM_SEL_DIGIT 5
;
;
;*****************************
; I N I T _ M E N U
;*****************************
menu_init
ldaa #IDLE
staa m_state ; begin in IDLE state
aim #~(BIT_MTIMER_EN),m_timer_en ; disable menu timer
clr m_svar1
clr m_svar2
clr io_menubuf_r
clr io_menubuf_w ; Zeiger von Eingabepuffer auf 0
clr mem_bank
#ifdef EVA5
oim #SQM_CARRIER,sql_mode ; start with carrier squelch
#endif
#ifdef EVA9
oim #SQBIT,sql_mode ; Squelch aktiviert
#endif
ldab #2
ldaa #1
jsr arrow_set
#ifdef EVA9
aim #~BIT_PWRMODE,pwr_mode ; Power Hi
ldab #3
ldaa #1
jsr arrow_set
#endif
rts
;
;*****************************
; M E N U
;*****************************
;
; "Menü" Subroutine
;
; Steuert die komplette Bedienung des Gerätes
; Frequenzeingabe, Speicherkanalwahl, etc.
;
; Parameter : none
;
; Ergebnis : none
;
; changed Regs : A,B,X
;
;
;************************
; Stack depth on entry: 2
;
menu
jsr sci_rx_m
tsta
bpl m_keypressed
jmp m_end
m_keypressed
pshb ; save key
ldab m_state ; Status holen
aslb
ldx #m_state_tab ; Tabellenbasisadresse holen
abx
pulb ; Tastenwert wiederholen
cpx #m_state_tab_end
bcc m_break ; sicher gehen dass nur existierende States aufgerufen werden
ldx 0,x ; Adresseintrag aus Tabelle lesen
jmp 0,x ; Zu Funktion verzweigen
m_break
jmp m_end
m_state_tab
.dw m_top ; Top Menu
.dw m_f_in ; Frequenzeingabe
.dw m_mem_select ; Memory Slot auswählen
.dw m_store
.dw m_recall_load
.dw m_txshift
.dw m_menu_select
.dw m_defch_select
.dw m_end_restore
#ifdef EVA9
.dw m_power_select
#endif
#ifdef EVA5
.dw m_none ; dummy
#endif
.dw m_none ; CTCSS SEL RX
.dw m_ctcss_submenu ; CTCSS SEL TX
.dw m_dtmf_input
m_state_tab_end
;*************
; M N O N E
;
; Dont do anything
;
m_none
jmp m_end ; Nix zu tun dann nix machen
;***********
; M E N D
;***********
m_end
ldab m_timer_en ; timer disabled ?
bpl m_return ; Dann nichts tun...
ldx m_timer ; menu timer holen
bne m_return ; timer nicht abgelaufen, dann return
m_end_restore
aim #~(BIT_MTIMER_EN),m_timer_en ; timer disable
jsr restore_dbuf ; Displayinhalt wiederherstellen
ldab #IDLE ; Zurück zum Idle State
stab m_state ; State speichern
clr m_svar1 ; clear menu state variables
clr m_svar2
m_return
rts
;**************************************
;
m_reset_timer ; Eingabe Timeout zurücksetzen
pshb
ldab #MENUTIMEOUT>>8
sei
stab m_timer
ldab #MENUTIMEOUT%256
stab m_timer+1
cli
oim #(BIT_MTIMER_EN),m_timer_en ; activate menu timer
pulb
rts
;
;**************************************
m_ok .db "OK",0
m_no_lock_str .db "NO LOCK ",0
m_out_str .db "out of",0
m_range_str .db "Range ",0
m_writing .db "writing",0
m_stored .db "stored",0
m_failed .db "failed",0
m_delete .db "deleting",0
m_offset .db "TXSHIFT",0
m_sq_on_str .db "SQ ON",0
m_sq_off_str .db "SQ OFF",0
m_off_str .db "OFF",0
m_ctcss_hz_str .db "%s HZ",0
key_convert
.db 00
.db KC_D1 ;D1
.db KC_D2 ;D2
.db KC_D3 ;D3
.db KC_D4 ;D4
.db KC_D5 ;D5
.db KC_D6 ;D6
.db KC_D7 ;D7
.db KC_D8 ;D8
.db 03 ; 3
.db 06 ; 6
.db 09 ; 9
.db 19 ; #
.db 02 ; 2
.db 05 ; 5
.db 08 ; 8
.db 00 ; 0
.db 01 ; 1
.db 04 ; 4
.db 07 ; 7
.db 10 ; *
#INCLUDE "menu_top.asm"
#INCLUDE "menu_mem.asm"
#INCLUDE "menu_input.asm"
#INCLUDE "menu_sub.asm"
;#INCLUDE "menu_config.asm"