1 " ***********************************************************
 2 " *                                                         *
 3 " * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4 " *                                                         *
 5 " * Copyright (c) 1972 by Massachusetts Institute of        *
 6 " * Technology and Honeywell Information Systems, Inc.      *
 7 " *                                                         *
 8 " ***********************************************************
 9 
10           name      fix_bit
11 
12           entry     fix_bit
13           entry     double
14 
15 "         This little function takes a left-adjusted bit string and
16 "         right-adjusts it in a word, propagating the sign. It can
17 "         be called from pl1 thus:
18 
19 "         fixed_bin_word = fixed_bit(aligned_bit, length);
20 
21 "         where length is the number of bits in the string (if it
22 "         exceeds 36 use entry point double below).
23 
24 
25 fix_bit:  lda       ap|2,*
26           ldq       36,dl
27           sbq       ap|4,*
28           ars       0,ql
29           sta       ap|6,*
30           short_return
31 
32 
33 "         This entry point is used when the string is longer
34 "         than 36 bits (but not more than 72). It returns its
35 "         result in a fixed bin(71) number, thus:
36 "
37 "         fixed_bin_71 = fix_bit$double(aligned_bit, length);
38 "
39 "
40 
41 double:   ldq       72,dl
42           sbq       ap|4,*
43           eax0      0,ql
44           ldaq      ap|2,*
45           lrs       0,0
46           staq      ap|6,*
47           short_return
48 
49 
50           end