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 " BINOCT - BINARY TO OCTAL ASCII CONVERSION FOR PL/1 PROGRAMS
11 "         4/2/74 - Richard A. Barnes
12 "         Improved 9/3/76 by Noel I. Morris
13 "
14 " This version based on bin_to_oct by Gordon Benedict
15 "
16 " Calling sequence:
17 "
18 " dcl     b36 aligned bit(36), s12 aligned char(12),
19 "         binoct entry(aligned bit(36)) returns(aligned char(12));
20 "
21 "         s12 = binoct(b36);
22 "
23           segdef    binoct
24 "
25           equ       pr0,0
26           equ       pr1,1
27           equ       pr2,2
28 "
29 binoct:
30           epp1      pr0|2,*             get ptr to number to be converted
31           epp2      pr0|4,*             get ptr to result
32 "
33 "         we will use last few bytes of the result string
34 "         as a temporary location for the translation
35 "
36           mvt       (pr),(pr)           unpack and translate
37           desc6a    pr1|0,6             6-bit bytes...
38           desc9a    pr2|1(2),6          -> 9-bit bytes...
39           arg       table               under translation
40 "
41           mvn       (pr),(pr)           make into ASCII
42           desc4ns   pr2|1(4),12         4-bit bytes...
43           desc9ns   pr2|0,12            -> 9-bit bytes
44 "
45           short_return
46 "
47 table:
48           vfd       5/0,4/0,5/0,4/1,5/0,4/2,5/0,4/3,5/0,4/4,5/0,4/5,5/0,4/6,5/0,4/7
49           vfd       5/1,4/0,5/1,4/1,5/1,4/2,5/1,4/3,5/1,4/4,5/1,4/5,5/1,4/6,5/1,4/7
50           vfd       5/2,4/0,5/2,4/1,5/2,4/2,5/2,4/3,5/2,4/4,5/2,4/5,5/2,4/6,5/2,4/7
51           vfd       5/3,4/0,5/3,4/1,5/3,4/2,5/3,4/3,5/3,4/4,5/3,4/5,5/3,4/6,5/3,4/7
52           vfd       5/4,4/0,5/4,4/1,5/4,4/2,5/4,4/3,5/4,4/4,5/4,4/5,5/4,4/6,5/4,4/7
53           vfd       5/5,4/0,5/5,4/1,5/5,4/2,5/5,4/3,5/5,4/4,5/5,4/5,5/5,4/6,5/5,4/7
54           vfd       5/6,4/0,5/6,4/1,5/6,4/2,5/6,4/3,5/6,4/4,5/6,4/5,5/6,4/6,5/6,4/7
55           vfd       5/7,4/0,5/7,4/1,5/7,4/2,5/7,4/3,5/7,4/4,5/7,4/5,5/7,4/6,5/7,4/7
56 "
57           end