Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/MAIN.ASM @ 92:82de387d6e7c
Interrupt trashes the PRODH:L registers.
author | JeanDo |
---|---|
date | Sat, 11 Dec 2010 09:57:42 +0100 |
parents | 3e351e25f5d1 |
children | dc349e4264bb |
rev | line source |
---|---|
0 | 1 |
2 ; OSTC - diving computer code | |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; it under the terms of the GNU General Public License as published by | |
20 ; the Free Software Foundation, either versio | |
21 ; includes and isr | |
22 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
23 ; written: 041013 | |
24 ; last updated: 081219 | |
25 ; known bugs: | |
26 ; ToDo: | |
27 | |
28 | |
29 LIST P=18F4685 ;directive to define processor | |
30 #include <P18F4685.INC> ;processor specific variable definitions | |
31 | |
32 #include definitions.asm ; Defines, I/O Ports and variables | |
33 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
34 reset_v code 0x0000 |
0 | 35 goto start ; Start! |
36 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
37 inter_v code 0x0008 |
0 | 38 bra HighInt ;High Priority Interrups |
39 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
40 inter_asm code 0x0018 ;Low Priority Interrups |
0 | 41 ; *** low priority interrupts not used |
42 bra HighInt ;High Priority Interrups | |
43 | |
44 HighInt: | |
45 movff BSR,0x102 ;save BSR register | |
46 movlb b'00000001' ;select Bank1 | |
47 | |
48 movff STATUS,status_temp ;save STATUS register | |
49 movff WREG,wreg_temp ;save working register | |
92 | 50 movff PRODL,prod_temp+0 |
51 movff PRODH,prod_temp+1 | |
0 | 52 |
53 movf PORTB,W ;move portb into latch register | |
54 | |
55 btfsc PIR1,TMR1IF ;Timer1 INT (external 32.768kHz Clock) | |
56 call timer1int | |
57 | |
58 btfsc INTCON,TMR0IF ;Timer0 INT (Debounce Timer) | |
59 call timer0int | |
60 | |
61 btfsc PIR2,TMR3IF ;Timer3 INT (Delay for PWM Buzzer) | |
62 call timer3int | |
63 | |
64 btfsc PIR1,RCIF ; UART | |
65 call uartint | |
66 | |
67 btfsc INTCON,INT0IF ; Switch left | |
68 call schalter_links | |
69 | |
70 btfsc INTCON3,INT1IF ; switch right | |
71 call schalter_rechts | |
72 | |
92 | 73 movff prod_temp+1,PRODH |
74 movff prod_temp+0,PRODL | |
0 | 75 movff wreg_temp,WREG ;restore working register |
76 movff status_temp,STATUS ;restore STATUS register | |
77 movff 0x102,BSR ;restore BSR register | |
78 retfie | |
79 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
80 ;============================================================================= |
0 | 81 #include text_table.asm ; includes textmacros |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
82 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
83 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
84 osct_asm code |
0 | 85 #include displaytext.asm ; sends texts to wordprocessor |
86 #include math.asm ; mathematical functions | |
87 #include wait.asm ; waitroutines | |
88 #include valconv.asm ; outputs to POSTINC2 | |
89 #include eeprom_rs232.asm ; Internal EEPROM and RS232 Interface | |
90 #include oled_samsung.asm ; Attached in 80-System 8-Bit Mode | |
91 #include menu_custom.asm ; Menu "Custom FunctionsI" and "Custom FunctionsII" | |
92 #include menu.asm ; Main Menu and Setup Menu | |
93 #include menu_reset.asm ; Submenu "Reset" | |
94 #include menu_settime.asm ; Submenu "Set Time" | |
95 #include ms5535.asm ; Interface to MS5535A,B or C pressure sensor | |
96 #include pled_outputs.asm ; div. PLED outputs and background debugger | |
97 #include i2c_eeprom.asm ; for external I2C EEPROM and general I2C Routines | |
98 #include menu_logbook.asm ; Submenu "Logbook" | |
99 #include interface.asm ; Interface routines | |
100 #include menu_ppO2.asm ; Constant ppO2 setup menu | |
101 #include menu_battery.asm ; Submenu "Battery Info" | |
102 #include menu_gassetup.asm ; Menu "Gas Setup" | |
103 #include isr.asm ; Interrupt service routine (RTC&Sensor) | |
104 #include surfmode.asm ; Mainroutines for Surfacemode | |
105 #include divemode.asm ; Mainroutines for Divemode | |
106 #include divemode_menu.asm ; Underwater menu | |
107 #include sleepmode.asm ; Mainroutines for Sleepmode | |
108 #include adc_rtc.asm ; A/D converter (battery control) and RTC init | |
109 #include temp_extrema.asm ; Takes care of the temperature extrema logger | |
110 #include sync_clock.asm ; syncs RTC with PC | |
111 #include start.asm ; Startup and init, checks background debugger | |
112 #include simulator.asm ; Stand-alone simulator routines | |
113 #include io.asm ; Low-Level I/O access | |
114 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
115 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
116 #include printf.asm ; jDG's compact printf test implementation. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
117 #ifdef TESTING |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
118 #include aa_tests.asm ; And testing code. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
119 #include test_printf.asm ; Special font/colors page |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
120 #endif |
0 | 121 |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
122 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
123 #ifdef AAFONTS |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
124 ; New antialiased word processor and fonts |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
125 #include aa_wordprocessor.asm ; ASM wordprocessor under tests. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
126 #else |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
127 ; Include C sub-routines automatically |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
128 p3_wp code 0x09A00 ; Mark segment name into the .map file |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
129 ; #include p3_wordprocessor_9A00_BAFF_0B468.txt ; jDG's C-Code |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
130 #include ostc_part3_wordprocessor_NEW_CURSOR_9A00_to_B960_jump_in_B410.txt ; Christians fonts... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
131 #endif |
62 | 132 |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
133 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
134 p2_deco code 0x0C000 ; Mark segment name into the .map file |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
135 #include p2_deco_main_v110d.txt |
62 | 136 |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
62
diff
changeset
|
137 ;============================================================================= |
58 | 138 MESSG "OSTC - diving computer code, Copyright (C) 2010 HeinrichsWeikamp GbR" |
0 | 139 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" |
140 MESSG "Free Software Foundation, either version 3 of the License, or (at your option) any later version." | |
141 MESSG "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY" | |
142 MESSG "or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details." | |
143 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/." | |
144 | |
145 END ; end of program | |
146 |