chiark / gitweb /
new arrangements including points; about to hack for qq test
[trains.git] / detpic / program.asm
1 ;======================================================================
2 ; MAIN PROGRAM AND GLUE
3
4  include common.inc
5  code
6
7 ;----------
8 vector_reset
9         clr_f   INTCON
10         bs_f    RCON, IPEN      ; interrupt priorities
11
12         call    idlocs_init
13
14         tst_f_ifnz picno
15         goto    slave
16         bra     master
17
18 ;----------
19 master_interrupt_low
20         enter_interrupt_low
21         call    i2cm_interrupt
22         call    serial_interrupt
23         return_interrupt_low
24
25 ;======================================================================
26 ; MASTER/SLAVE deviations
27
28 ;----------
29 message_for_master
30 ; Either transmits the message to the master, or if we are the master,
31 ; handles it as an incoming message from the notional `slave 0'.
32 ;  W            message         unchanged
33 ;  GIEH         set             set
34         bt_f_if1 idloc1,idloc1_master
35         goto    loopback_read_byte
36         goto    slave_add_short_message
37
38 ;======================================================================
39 ; UNIMPLEMENTED STUFF
40
41 ;----------
42 loopback_read_byte
43         panic   morse_UL
44
45  include final.inc