chiark / gitweb /
do not show plat edges as rails
[trains.git] / hostside / skelproto-pic.c
1 /* @skeleton@ @1@ @L@ */
2 /*
3  * definitions of
4  *  enco_pic_WHATEVER
5  *  on_pic_WHATEVER
6  * and the tables
7  * and related functions
8  */
9
10 #include "hostside.h"
11 #include "auproto-pic.h"
12
13 extern void enco_pic_anyinsn(PicInsn *out, const PicInsnInfo *pii,
14                              int objnum) {
15   unsigned long as= objnum;
16   int i;
17
18   out->l= 1 + pii->argbits/7;
19   for (i= out->l - 1;
20        i >= 0;
21        i--, as >>= 7)
22     out->d[i]= (as & 0x07fUL) | 0x080UL;
23   out->d[out->l - 1] &= ~0x080UL;
24   out->d[0] |= pii->opcode;
25 }
26
27 #if 0
28 const char *pi_getarg(const PicInsn *pi, const PicInsnInfo *pi, long *a_r) {
29   
30 const PicInsn *pi, long *arg_o,
31 #endif
32                                    
33 const PicInsnInfo *lookup_byopcode(Byte byte0, const PicInsnInfo *table) {
34   const PicInsnInfo *pi;
35   for (pi= table;
36        pi->name;
37        pi++)
38     if ((byte0 & pi->mask) == pi->opcode)
39       return pi;
40   return 0;
41 }
42
43 const PicInsnInfo pic_command_infos[]= {
44   { "@cnameyn@", @opcodeyn@, @opcodemaskyn@, @arglen@ }, @h2p@
45   { 0 }
46 };
47
48 const PicInsnInfo pic_reply_infos[]= {
49   { "@cnameyn@", @opcodeyn@, @opcodemaskyn@, @arglen@ }, @p2h@
50   { 0 }
51 };