chiark / gitweb /
init qq...
[trains.git] / detpic / program.asm
1 ;======================================================================
2 ; MAIN PROGRAM AND GLUE
3
4  include common.inc
5  code
6
7 ;----------
8 vector_reset
9
10  set_f qqTRISA
11  set_f qqTRISB
12  set_f qqTRISC
13  set_f qqTRISD
14  set_f qqTRISE
15  mov_lw 0xaa
16  mov_wf qqLATA
17  mov_wf qqLATB
18  mov_wf qqLATC
19  mov_wf qqLATD
20  mov_wf qqLATE
21
22         clr_f   INTCON
23         bs_f    RCON, IPEN      ; interrupt priorities
24
25         call    idlocs_init
26
27         tst_f_ifnz picno
28         goto    slave
29         bra     master
30
31 ;----------
32 master_interrupt_low
33         enter_interrupt_low
34         call    i2cm_interrupt
35         call    serial_interrupt
36         return_interrupt_low
37
38 ;======================================================================
39 ; MASTER/SLAVE deviations
40
41 ;----------
42 message_for_master
43 ; Either transmits the message to the master, or if we are the master,
44 ; handles it as an incoming message from the notional `slave 0'.
45 ;  W            message         unchanged
46 ;  GIEH         set             set
47         bt_f_if1 idloc1,idloc1_master
48         goto    loopback_read_byte
49         goto    slave_add_short_message
50
51 ;======================================================================
52 ; UNIMPLEMENTED STUFF
53
54 ;----------
55 loopback_read_byte
56         panic   morse_UL
57
58  include final.inc