home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pdp11 / k11hex.b2s < prev    next >
Text File  |  2020-01-01  |  3KB  |  90 lines

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