chiark / gitweb /
255f7db11771e310caed8796b6063ca8a313a454
[trains.git] / detpic / misc.asm
1 ;======================================================================
2
3  include common.inc
4  code
5
6 ;======================================================================
7 ; GENERALLY USEFUL ROUTINES
8
9 ;----------
10 read_pic_no
11 ; read pic no from ID locations and return it
12 ;       W               undefined               pic number from ID loc 0
13 ;       status Z        undefined               1 iff master PIC
14 ;       TBLPTR*         undefined               points to 20001
15
16         mov_lw  0x20
17         mov_wf  TBLPTRU
18         clr_f   TBLPTRH
19         clr_f   TBLPTRL
20
21         tblrd_postinc_fixup
22         mov_fw  TABLAT
23         return
24
25 ;----------
26 idlocs_init
27 ; read id locations and store in canonical place
28 ;       W               undefined               undefined
29 ;       picno           undefined               pic number (from 20000)
30 ;       idloc1          undefined               idloc1 (from 20001)
31
32         rcall   read_pic_no
33         mov_wf  picno
34
35         tblrd_postinc_fixup
36         mov_fw  TABLAT
37         mov_wf  idloc1
38
39         return
40
41 ;----------
42 bitnum2bit_init
43 ; populate bitnum2bit
44         mov_lw  0x80
45         mov_lfsr bitnum2bit,0
46 init_bitnum2bit_loop
47         rl_w
48         mov_wf  POSTINC0
49         bra_nn  init_bitnum2bit_loop
50         return
51
52  include final.inc