annotate code_part1/OSTC_code_asm_part1/MAIN.ASM @ 34:5dbdc08e5460

New Simulator results screen
author heinrichsweikamp
date Tue, 25 May 2010 18:10:51 +0200
parents 96a35aeda5f2
children cd5b650920f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; the Free Software Foundation, either versio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; includes and isr
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; written: 041013
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; last updated: 081219
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 LIST P=18F4685 ;directive to define processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 #include <P18F4685.INC> ;processor specific variable definitions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 #include definitions.asm ; Defines, I/O Ports and variables
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 ORG 0x0000
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 goto start ; Start!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 ORG 0x0008
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 bra HighInt ;High Priority Interrups
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 ORG 0x0018 ;Low Priority Interrups
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 ; *** low priority interrupts not used
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 bra HighInt ;High Priority Interrups
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 HighInt:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 movff BSR,0x102 ;save BSR register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 movlb b'00000001' ;select Bank1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 movff STATUS,status_temp ;save STATUS register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 movff WREG,wreg_temp ;save working register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 movf PORTB,W ;move portb into latch register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53 btfsc PIR1,TMR1IF ;Timer1 INT (external 32.768kHz Clock)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 call timer1int
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 btfsc INTCON,TMR0IF ;Timer0 INT (Debounce Timer)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 call timer0int
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 btfsc PIR2,TMR3IF ;Timer3 INT (Delay for PWM Buzzer)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 call timer3int
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 btfsc PIR1,RCIF ; UART
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 call uartint
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 btfsc INTCON,INT0IF ; Switch left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 call schalter_links
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 btfsc INTCON3,INT1IF ; switch right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 call schalter_rechts
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 movff wreg_temp,WREG ;restore working register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 movff status_temp,STATUS ;restore STATUS register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 movff 0x102,BSR ;restore BSR register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 retfie
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 ORG 0x00100 ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 #include text_table.asm ; includes textmacros
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 #include displaytext.asm ; sends texts to wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 #include math.asm ; mathematical functions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 #include wait.asm ; waitroutines
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 #include valconv.asm ; outputs to POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 #include eeprom_rs232.asm ; Internal EEPROM and RS232 Interface
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 #include oled_samsung.asm ; Attached in 80-System 8-Bit Mode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 #include menu_custom.asm ; Menu "Custom FunctionsI" and "Custom FunctionsII"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 #include menu.asm ; Main Menu and Setup Menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 #include menu_reset.asm ; Submenu "Reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 #include menu_settime.asm ; Submenu "Set Time"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 #include ms5535.asm ; Interface to MS5535A,B or C pressure sensor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 #include pled_outputs.asm ; div. PLED outputs and background debugger
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 #include i2c_eeprom.asm ; for external I2C EEPROM and general I2C Routines
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 #include menu_logbook.asm ; Submenu "Logbook"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 #include interface.asm ; Interface routines
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 #include menu_ppO2.asm ; Constant ppO2 setup menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 #include menu_battery.asm ; Submenu "Battery Info"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 #include menu_gassetup.asm ; Menu "Gas Setup"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 #include isr.asm ; Interrupt service routine (RTC&Sensor)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 #include surfmode.asm ; Mainroutines for Surfacemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 #include divemode.asm ; Mainroutines for Divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 #include divemode_menu.asm ; Underwater menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 #include sleepmode.asm ; Mainroutines for Sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 #include adc_rtc.asm ; A/D converter (battery control) and RTC init
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 #include temp_extrema.asm ; Takes care of the temperature extrema logger
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 #include sync_clock.asm ; syncs RTC with PC
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 #include tempcomp.asm ; extra temperature compensation
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 #include start.asm ; Startup and init, checks background debugger
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 #include simulator.asm ; Stand-alone simulator routines
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 #include io.asm ; Low-Level I/O access
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 ORG 0x0A000 ; keep free for new c_code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 ORG deco_main_calc_hauptroutine
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 ORG deco_main_calc_without_deco
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 ORG deco_main_clear_tissue
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 ORG deco_main_calc_desaturation_time
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 ORG deco_main_calc_wo_deco_step_1_m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 ORG deco_main_hash
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 ORG main_clear_CNS_fraction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 ORG main_calc_CNS_fraction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 ORG main_calc_CNS_decrease_15min
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 ORG main_push_tissues_to_vault
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 ORG main_pull_tissues_from_vault
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 return ;Dummy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 MESSG "OSTC - diving computer code, Copyright (C) 2009 HeinrichsWeikamp GbR"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 MESSG "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 MESSG "Free Software Foundation, either version 3 of the License, or (at your option) any later version."
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 MESSG "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 MESSG "or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details."
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 MESSG "You should have received a copy of the GNU General Public License along with this program.If not, see http://www.gnu.org/licenses/."
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 END ; end of program
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144