/
ui.asm
157 lines (144 loc) · 5.45 KB
/
ui.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
;****************************************************************************
;
; MC70 - Firmware for the Motorola MC micro trunking radio
; to use it as an Amateur-Radio transceiver
;
; Copyright (C) 2004 - 2013 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/>.
;
;
;
;****************************************************************************
;***************************
; U I I N I T
;***************************
ui_init
clr tasksw ; Taskswitchzähler auf 0
ldab #1
stab tasksw_en ; Taskswitches per Interrupt verbieten
ldx #notask ; UI Task noch nicht starten
; ldd #ui
stx start_task ; immer wieder 'no task' aufrufen
ldx #STACK2-7 ; Stackpointer 2 setzen
ldd #notask ; UI Task noch nicht starten
std 6,x ; Return Addresse für SWI Int setzen
std 4,x ; X
clra
std 2,x ; AB
staa 1,x ; Condition Codes - alle Flags gelöscht
stx stackbuf ; Stackpointer 2 sichern
ldx #0
stx ui_frequency
stx ui_frequency+2 ; Bisher keine Frequenzeingabe
ldx #-1
stx ui_txshift
stx ui_txshift+2
#ifdef EVA5
oim #SQM_CARRIER,sql_mode ; Squelch aktiviert
#endif
#ifdef EVA9
oim #SQBIT,sql_mode ; Squelch aktiviert
#endif
rts
;***************************
; U I S T A R T
;***************************
ui_start
ldx #ui ; Zeiger auf UI Task holen
stx start_task ; Zeiger setzen
; swi ; Task starten
rts
;***************************
; U I
;***************************
;
; User Interface
; 2. Task für die Kommunikation mit dem Benutzer
; Alleine dieser Task bedient das (laaaaaangsame) Display
; Die Kommunikation mit dem Control-Task, der die meisten zeitkritischen
; Dinge steuert findet über verschiedene Flags und Variablen (Speicherzellen)
; statt
;
;
ui
jsr lcd_s_reset ; LCD Software Reset + Init
#ifdef DEBUG
bra no_intro
#endif
tsta
beq ui_cont_w_lcd ; Loopback detected -> no display (and no initialisation)
jmp no_intro ; -> start immediatly
ui_cont_w_lcd
ldab msg_mode ; check if we should print the version etc.
tba
andb #%11000000
cmpb #%10000000
bne ui_long_msg ; no, we did this a short time ago
jmp ui_short_msg ; only print short message
ui_long_msg
PRINTF(soft_str)
jsr lcd_fill
clrb
jsr lcd_cpos
WAIT(250)
PRINTF(ver_str)
jsr lcd_fill
clrb
jsr lcd_cpos
WAIT(400)
PRINTF(dg1yfe_str)
jsr lcd_fill
clrb
jsr lcd_cpos
ldaa msg_mode
oraa #%10000000
anda #%10111111
staa msg_mode ; kurze Meldung ausgeben
WAIT(250)
ui_short_msg
no_intro
jsr menu_init
WAIT(100)
ui_frq_prnt
ldx #frequency
jsr freq_print ; Frequenz anzeigen
jsr freq_offset_print ; Frequenz anzeigen
ui_loop ; komplette Display Kommunikation
jsr menu ; Menü für Frequenzeingabe etc.
#define UI_UPD_LOOP jsr sci_trans_cmd ; Eingabe prüfen und ggf. in Menü Puffer legen
#defcont \ jsr led_update ; LED Puffer lesen und ggf LEDs neu setzen
UI_UPD_LOOP
swi
ldx tick_hms
cpx #1200 ; schon 2 MInuten eingeschaltet?
bcs ui_loop ; Noch nicht -> loop
ldab msg_mode ; Wird lange Meldung ausgegeben?
bpl ui_loop ; Ja -> loop
andb #%01111111 ; Nach 2 Minuten Einschaltzeit lange Meldung ausgeben
stab msg_mode
bra ui_loop
;*******************************************
dg1yfe_str
.db "DG1YFE",0
soft_str
.db "MC70",0
ver_str
.db "13 001",0
rom_init_str
.db "ROM INIT",0
slot_str
.db " SLOTS",0