chiark / gitweb /
more correct when off
[trains.git] / cebpic / common.inc
1 ;**********************************************************************
2 ; boilerplate.inc
3 ;  Include this at the top of each file.
4 ;  Does the following things:
5 ;   includes the PIC18F458 definitions file (register and bit names)
6 ;   switches to decimal by default
7 ;   defines various useful macros
8
9         include         /usr/share/gputils/header/p18f458.inc
10         radix           dec 
11
12 ;==============================
13 ; RAM memory usage
14
15 ; Access bank locations
16 WREG2           equ     0x000
17 WREG3           equ     0x001
18 WREG4           equ     0x002
19 TESTFLASH       equ     04h     ; test LED flash pattern
20
21
22 ;==============================
23 ; Program (flash) memory regions
24
25 ; Actual code starts at 0 with the reset and interrupt vectors and
26 ; then the program proper.
27
28 ;--------------------
29 ; Area filled in by morse-auto.asm (see morse-auto.asm-gen for details)
30 morse_messages_start    equ     0x4000
31 morse_messages_end      equ     0x4400
32
33 ;----------------------------------------
34 ; ifbit1(REGISTER,BITNUMBER)
35 ;       executes the next instruction but only if bit BITNUMBER
36 ;       in REGISTER (which must be in the access bank) is set
37 ifbit1 macro REGISTER, BITNUMBER
38         btfsc   REGISTER, BITNUMBER, 0
39         endm
40
41 ;----------------------------------------
42 ; ifbit0(REGISTER,BITNUMBER)
43 ;       executes the next instruction but only if bit BITNUMBER
44 ;       in REGISTER (which must be in the access bank) is clear
45 ifbit0 macro REGISTER, BITNUMBER
46         btfss   REGISTER, BITNUMBER, 0
47         endm
48