-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirmware.asm
More file actions
188 lines (170 loc) · 7.1 KB
/
Copy pathfirmware.asm
File metadata and controls
188 lines (170 loc) · 7.1 KB
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
;****************************************************************************
;
; 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/>.
;
;
;
;****************************************************************************
;
.MODULE FIRMWARE
;
;#define DEBUG
#define RELEASE
#INCLUDE "macros.asm" ; include macros & definitions
#INCLUDE "regmem.asm" ; Portadresses & Random Access Memory
#include "audio_tabs.asm"
;
;**************************
; S T A R T O F R O M
;**************************
#ifdef EVA5
.ORG $2000
#endif
#ifdef EVA9
.ORG $C000
#endif
rom
;********************************
; S T A R T O F S Y S T E M
;********************************
.ORG $C000 ; start at $C000, lowest address accessible in EVA9 without HW mod
; (EPROM A14 & A15 are tied to VCC)
reset
lds #STACK1 ; initialize stackpointer 1
jsr io_init ; initialize I/O (Ports, I2C, etc...)
#ifdef TESTUNIT
jsr tests ; call code test routines (if compiled for test)
bra $ ; loop here
#endif
; jsr chk_debug ; Debugmodus ?
#ifdef EVA5
jsr chk_isu ; In System Update? ?
#endif
clrb ; do not try to store frequency to EEPROM before power-off
jsr pwr_sw_chk ; check power switch - put CPU to standby if radio is switched off
;************************************
;************************************
Start
jsr sci_init ; serielle Schnittstelle aktivieren
jsr init_SIO ; SIO Interrupt konfigurieren
jsr init_OCI ; Timer Interrupt starten
jsr ui_init ; 2. Task initialisieren (2. Stack)
; ab hier können I/O Funktionen verwendet werden
#ifdef EVA9
jsr io_init_second ; Initialize shift register, activate external EEPROM
#endif
ldd #FSTEP ; Kanalraster holen
jsr pll_init ; init PLL
ldab #1
stab tasksw_en ; Taskswitch verbieten
cli
#ifdef EVA5
oim #SQBIT_C, sql_mode
#endif
#ifdef EVA9
oim #SQBIT, sql_mode ; Squelch Input auf jeden Fall prüfen und neu setzen
#endif
#ifdef SIM
ldaa #2
staa cfg_head
ldd #0
jsr tone_start
sim_loop
bra sim_loop
#endif
jsr lcd_h_reset ; LCD Hardware Reset - gibts bei EVA9 nicht
clr bus_busy ; Watchodog Reset durch Timer Interrupt zulassen
jsr freq_init ; Frequenzeinstellungen initialisieren
psha
ldab #3
stab cfg_head
ldd #$01FD ; get config Byte
jsr eep_rand_read
andb #2 ; isolate Bit 1
ldaa cfg_defch_save ; get config value
anda #%11111101 ; exclude Bit 1
aba ; add Bit 1 from Reg B
staa cfg_defch_save ; store new config value
jsr ui_start ; UI Task starten
clr tasksw_en ; Taskswitch spätestens jede Millisekunde
ldab #GRN_LED+LED_ON
jsr led_set ; Grüne LED aktivieren
WAIT(200)
jsr s_timer_init
;
;
;***************
start_over
jsr receive ; Empfänger aktivieren
ldab #1
jsr pll_led ; check pll state and enforce LED update
ldaa #~SR_RXAUDIO ; disable RX Audio
ldab #SR_AUDIOPA
jsr send2shift_reg ; enable Audio PA
loop
ldab cfg_defch_save ; Frequenz etc. speichern wenn Gerät ausgeschaltet wird
andb #BIT_DEFCH_SAVE
jsr pwr_sw_chk ; Ein/Ausschalter abfragen & bedienen
;*** TRX check
jsr ptt_get_status ; PTT Status abfragen
asla ; Höchstes Bit ins Carryflag schieben
bcc trc_end ; War es gesetzt fand eine Statusänderung statt
bne trc_tx ; Ist es <>0 wird jetzt gesendet
; RX
jsr receive ; Empfänger aktivieren
bra trc_end
; TX
trc_tx
jsr transmit ; Sender aktivieren
trc_end
;****
jsr squelch ; Squelch bedienen
ml_sql_end
swi
clra
jsr pll_led ; show pll lock state on red LED
jsr frq_check ; Überprüfen ob Frequenz geändert werden soll
jsr wd_reset
jsr s_timer_update
jmp loop
;*******************
;*************************************************************************
; INCLUDES
#ifdef TESTUNIT
#INCLUDE "tests.asm"
#endif
#INCLUDE "ui.asm" ; User Interface (2nd Task)
#INCLUDE "menu.asm" ; User Interface / Menus
#INCLUDE "subs.asm" ; miscellaneous subroutines
#INCLUDE "timer.asm" ; Time/Timer related subroutines
#INCLUDE "pll_freq.asm" ; PLL & Frequency related Subroutines
#INCLUDE "display.asm" ; LC Display related Subroutines
#INCLUDE "mem.asm" ; Memory related Subroutines
#INCLUDE "math.asm" ; Math related subroutines (Division, Multiplication, Exponentiation)
#INCLUDE "eeprom.asm" ; I2C EEPROM related routines
#INCLUDE "io.asm" ; everything related to I/O
#INCLUDE "audio.asm" ; audio related subroutines (NCO, DAC, etc)
#INCLUDE "int.asm" ; Interrupt Service Routines
;#INCLUDE "debug.asm" ; Debugmodul
#ifdef EVA5
#INCLUDE "isu.asm" ; In System Update Modul
#endif
.end