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

  1. 10      extend
  2.  
  3. 20    ! 04-Mar-84  23:15:56  Brian Nelson
  4.  
  5. 1000      on error go to 19000                        &
  6.     \ dim xl%(128%)                            &
  7.     \ input.recordsize%  = 4096%                    &
  8.     \ output.recordsize% = 512%                    &
  9.     \ open '_kb:' as file 12%                    &
  10.     \ print 'K11HEX - Decode Kermit-11 Hex files (RSTS/E Basic+)'    &
  11.     \ print                                &
  12.     \ xl%(i%)         = -1% for i% = 0% to 128%            &
  13.     \ xl%(ascii('0')) = 0%                        &
  14.     \ xl%(ascii('1')) = 1%                        &
  15.     \ xl%(ascii('2')) = 2%                        &
  16.     \ xl%(ascii('3')) = 3%                        &
  17.     \ xl%(ascii('4')) = 4%                        &
  18.     \ xl%(ascii('5')) = 5%                        &
  19.     \ xl%(ascii('6')) = 6%                        &
  20.     \ xl%(ascii('7')) = 7%                        &
  21.     \ xl%(ascii('8')) = 8%                        &
  22.     \ xl%(ascii('9')) = 9%                        &
  23.     \ xl%(ascii('A')) = 10%                        &
  24.     \ xl%(ascii('B')) = 11%                        &
  25.     \ xl%(ascii('C')) = 12%                        &
  26.     \ xl%(ascii('D')) = 13%                        &
  27.     \ xl%(ascii('E')) = 14%                        &
  28.     \ xl%(ascii('F')) = 15%                        &
  29.  
  30. 1020      print 'Input  Hex  file  ? ';                    &
  31.     \ input line #12%, infile$                    &
  32.     \ print 'Output Task image ? ';                    &
  33.     \ input line #12%, outfile$                    &
  34.     \ open.in%  = 0%                        &
  35.     \ open.out% = 0%                        &
  36.     \ infile$  = cvt$$(infile$,-1%)                    &
  37.     \ outfile$ = cvt$$(outfile$,-1%)                &
  38.     \ open infile$    for input as file #1%,                &
  39.             recordsize  input.recordsize%,            &
  40.             mode 8192%                    &
  41.     \ open outfile$    as file #2%, recordsize output.recordsize%    &
  42.  
  43.  
  44.  
  45. 1040      while -1%                            &
  46.     \  offset% = 0%                            &
  47.     \  for i% = 1% to 16%                        &
  48.     \    input line #1, rec$                    &
  49.     \    chk% = 0%                            &
  50.     \    for j% = 1% to 32%                        &
  51.     \    k%  = (j% * 2%) - 1%                    &
  52.     \    b%  = xl%( ascii(mid(rec$,k%+0%,1%)) ) * 16%        &
  53.             + xl%( ascii(mid(rec$,k%+1%,1%)) )            &
  54.     \    chk% = chk% + b%                    &
  55.     \    field #2%, offset%+(j%-1%) as junk$, 1% as dat$        &
  56.     \    lset dat$ = 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%;' error at line number ';,el%            &
  75.     \ resume 32767%                            &
  76.  
  77. 19020      close #1%                            &
  78.     \ close #2%                            &
  79.     \ go to 32767 if el% <> 1040%                    &
  80.     \ cmd$ = 'PIP ' + outfile$ + '<104>/RTS:RSX=' + outfile$    &
  81.     \ print 'Trying to do CCL ';cmd$                &
  82.     \ junk$ = sys(chr$(14%) + cmd$ )                &
  83.     \ go to 32767                            &
  84.  
  85.  
  86. 32767      end
  87.