1 ;======================================================================
3 ; common macros & equs etc.
4 ; generally include this at the top of each file.
6 ;----------------------------------------------------------------------
7 ; COMMON INCLUDES and BOILERPLATE
8 include /usr/share/gputils/header/p18f458.inc
11 include morse+auto.inc
12 include ../iwjpictest/insn-aliases.inc
14 include ../iwjpictest/clockvaries.inc
15 include variables+vars.inc
18 ;----------------------------------------------------------------------
19 ; Common conventions for function register notation:
24 ; STATUS Trashed Trashed
25 ; BSR Not used Not used
27 ; TBLPTR*,TABLAT Low ISR Low ISR
28 ; FSR0 Low ISR Low ISR
29 ; FSR1 Low ISR High ISR (detect[1])
30 ; FSR2 Low ISR High ISR (detect[1])
32 ; Trashed May be trashed by any routine anywhere. Saved
33 ; during every ISR entry/exit.
35 ; Low ISR May be used/traashed by any routine run in low-priority
36 ; interrupt, or any routine run during initialisation.
37 ; May therefore not be used in background loop with
38 ; interrupts enabled. May not be used by high-priority
39 ; ISR (unless explicitly saved).
41 ; High ISR May be used/trashed by any routine run in high-priority
42 ; interrupt, or any routine run during initialisation.
43 ; May therefore not be used elsewhere with interrupts
46 ; Only the routines specially noted as intended to
47 ; be called from the High ISR are safe.
50 ; Register is reserved for use by this subsystem, which
51 ; is allowed to expect the value to be preserved.
52 ; Anything else which uses it must save and restore (and
53 ; may also need to disable interrupts, depending on its
56 ; Not High May be used by any routine not running in high-priority
57 ; interrupt. Not saved by high-priority interrupt
58 ; entry/exit, so any high-priority interrupt routine which
59 ; uses this register must save and restore it.
61 ; A routine which is allowed to trash a register may document that it
62 ; saves that register for the benefit of its callers.
64 ; [1] FSR1 and FSR2 on slave pics are reserved exclusively for the
65 ; I2C response and detection code (detect.asm), after det_slave_init.
67 ; General-purpose hardware allocation:
70 ; Timer 0 nmra Disabled
72 ; Timer 1 1ms tick, int. low 1ms tick, int. low
73 ; CCP1 1ms tick, int. low 1ms tick, int. low
74 ; Timer 3 point fire timer point fire timer
77 ;----------------------------------------------------------------------
80 enter_interrupt_low macro
81 mov_ff STATUS, isr_low_save_status
85 return_interrupt_low macro
87 mov_ff isr_low_save_status, STATUS
99 tblrd_postinc_fixup macro
104 tblrd_postdec_fixup macro
109 ;----------------------------------------------------------------------
112 ; A PINSPEC is a constant 0x<bit><port> where <port> is a b c d e
113 ; and <port> is 0 1 2 3 4 5 6 7. Generally p<picno>_<subsystem>_<pin>
114 ; are equ'd for this.
119 p0_booster_shutdown equ 2b
120 p0_booster_overload equ 1b
121 p0_booster_userfault equ 0b
124 p0_rs232_fcout equ 5c
125 pall_perpicled equ 2d
126 pall_pt0reverse equ 7b
128 p0_booster_dirn equ 0c
129 p0_booster_pwm equ 1c
133 bs_f TRISA + (TRISB-TRISA)*((pinspec-0xa) & 15), pinspec >> 4
137 bc_f TRISA + (TRISB-TRISA)*((pinspec-0xa) & 15), pinspec >> 4
141 bs_f LATA + (LATB-LATA)*((pinspec-0xa) & 15), pinspec >> 4
145 bc_f LATA + (LATB-LATA)*((pinspec-0xa) & 15), pinspec >> 4
158 pin_ifh macro pinspec
159 bt_f_if1 PORTA + (PORTB-PORTA)*((pinspec-0xa) & 15), pinspec >> 4
162 pin_ifl macro pinspec
163 bt_f_if0 PORTA + (PORTB-PORTA)*((pinspec-0xa) & 15), pinspec >> 4
166 ;----------------------------------------------------------------------