-
Notifications
You must be signed in to change notification settings - Fork 0
/
k11hex.b2s
89 lines (77 loc) · 2.67 KB
/
k11hex.b2s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
10 extend
20 ! 04-Mar-84 23:15:56 Brian Nelson
30 ! 19-JUN-85 BDN Mods for VAX Basic and PRO/Basic
1000 on error go to 19000 &
\ dim xl%(128%) &
\ open 'ti:' as file 12% &
\ print 'K11HEX - Decode Kermit-11 Hex files (BP2/VAX Basic)' &
\ print &
\ xl%(i%) = -1% for i% = 0% to 128% &
\ xl%(ascii('0')) = 0% &
\ xl%(ascii('1')) = 1% &
\ xl%(ascii('2')) = 2% &
\ xl%(ascii('3')) = 3% &
\ xl%(ascii('4')) = 4% &
\ xl%(ascii('5')) = 5% &
\ xl%(ascii('6')) = 6% &
\ xl%(ascii('7')) = 7% &
\ xl%(ascii('8')) = 8% &
\ xl%(ascii('9')) = 9% &
\ xl%(ascii('A')) = 10% &
\ xl%(ascii('B')) = 11% &
\ xl%(ascii('C')) = 12% &
\ xl%(ascii('D')) = 13% &
\ xl%(ascii('E')) = 14% &
\ xl%(ascii('F')) = 15% &
1020 print 'Input Hex file ? '; &
\ input line #12%, infile$ &
\ print 'Output Task image ? '; &
\ input line #12%, outfile$ &
\ open.in% = 0% &
\ open.out% = 0% &
\ infile$ = edit$(infile$,-1%) &
\ outfile$ = edit$(outfile$,-1%) &
\ open infile$ for input as file #1% &
1030 map (outr) outrec$(511%) = 1% &
\ open outfile$ for output as file #2%, &
organization sequential fixed, &
map outr &
1040 while -1% &
\ offset% = 0% &
\ for i% = 1% to 16% &
\ input line #1, rec$ &
\ chk% = 0% &
\ for j% = 1% to 32% &
\ k% = (j% * 2%) - 1% &
\ b% = xl%( ascii(mid(rec$,k%+0%,1%)) ) * 16% &
+ xl%( ascii(mid(rec$,k%+1%,1%)) ) &
\ chk% = chk% + b% &
\ outrec$(offset%+(j%-1%)) = chr$(b%) &
\ next j% &
\ c$ = right(rec$,66%) &
\ check% = xl%( ascii(mid(c$,6%,1%)) ) &
+ xl%( ascii(mid(c$,5%,1%)) ) * 16% &
+ xl%( ascii(mid(c$,4%,1%)) ) * 256% &
+ xl%( ascii(mid(c$,3%,1%)) ) * 4096% &
\ print 'Checksum error - ';chk%,check% &
if chk% <> check% &
\ offset% = offset% + 32% &
\ next i% &
\ put #2% &
\ next
19000 er% = err &
\ el% = erl &
\ resume 19020 if er% = 11% &
\ print er%;' ';ert$(er%);' error at line number ';el% &
\ resume 32767% &
19020 close #1% &
\ close #2% &
\ go to 32767 if el% <> 1040% &
\ print 'All done. For P/OS and RSX11M/M+, please make the task'&
\ print 'image contiguous as in:' &
\ print 'COPY/CONT K11POS.TSK K11POS.TSK' &
\ print 'For P/OS, copy the file K11HLP.HLP to DW:[001002]' &
\ print 'For RSTS/E and RSX11M/M+, put K11HLP.HLP in LB:[1,2]' &
\ print 'For RSTS/E, do $ SET FILE K11.TSK/RUN=RSX' &
\ print 'and $ SET FILE K11.TSK/PRO=104' &
32767 end