home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pckermit / pckermit.upd < prev    next >
Text File  |  2020-01-01  |  11KB  |  389 lines

  1.         ADDENDUM TO THE KERMIT USER'S GUIDE 
  2.  
  3.  
  4. Some minor changes were made to the set of programs used for bootstrapping
  5. Kermit for the IBM PC.  These include: 
  6.  
  7.   - PCKSEND.FOR
  8.  
  9.   - PCKEXE.BAS
  10.  
  11.   - PCKGET.BAS
  12.  
  13.   - PCKFIX.ASM    
  14.  
  15. The file PCKERMIT.FIX (the printable version of PCKERMIT.EXE) now
  16. uses characters 30-3F (hex) rather than 20-2F (hex) to represent the
  17. digits 0 through F (hex).  Since many systems strip off trailing
  18. blanks, a significant amount of data was sometimes lost when sending
  19. the FIX file to the PC.  The new format will not have this problem.
  20.  
  21. Each line now has only 62 characters rather than 64.  So, on IBM
  22. mainframes, the file should be save with Recfm = Fixed, Lrecl = 62.
  23. Also, when bootstrapping from an IBM mainframe, the filedef for
  24. the disk file should be:
  25.  
  26.     filedef 7 disk kermit fix a (lrecl 62 recfm f block 62 perm
  27.  
  28. To modify PCKGET.BAS to create PCKEXE.BAS, follow the directions
  29. in the User's Guide except for the change: In line 70, change
  30. the "63" to a "62".
  31.  
  32. The original versions of the files mentionned above will remain
  33. part of the distribution during the testing period.  Note, however,
  34. that they will be useful only to sites that have FIX files in the 
  35. older format.  They have been renamed by adding an "O" to the end
  36. of the file name.  
  37.  
  38. PCKERMIT.FIX and STRIP.FIX have been modified to reflect the new 
  39. format.
  40.  
  41. ; PCKFIX.ASM -- 
  42. ; Input file: KERMIT.EXE
  43. ; Output file: KERMIT.FIX
  44. ; The new file is a printable version of the executable file.  Each byte
  45. ; in the EXE file is converted to two bytes in the FIX file: a constant
  46. ; of "0" (30H) is added to each nibble.  
  47. ;
  48. ; Daphne Tzoar, December 1983
  49. ; Columbia University Center for Computing Activities
  50.  
  51. DOS    EQU    21H
  52.  
  53. STACK    SEGMENT    PARA STACK 'STACK'
  54.     DW     100 DUP (0)
  55. STK    EQU    THIS WORD
  56. STACK     ENDS    
  57.  
  58. DATAS    SEGMENT    PARA PUBLIC 'DATAS'
  59. buff    db    80H DUP(0)        ; Use our own DTA.
  60. bufone    db    80H DUP(0)        ; Data read from EXE file.
  61. buftwo    db    80H DUP(0)        ; Data to write out to FIX file.
  62. fcbold    db    25H DUP(0)        ; For the EXE file. 
  63. fcbnew    db    25H DUP(0)        ; File the FIX file.
  64. oldstk    dw    ?
  65. kold    db    'KERMIT  EXE$'
  66. knew    db    'KERMIT  FIX$'
  67. chrcnt    db    0            ; Number of chars left in BUFONE.
  68. datcnt    db    0            ; Number of chars in BUFTWO.
  69. eoflag    db    0            ; Remember when we hit the EOF. 
  70. crflg    db    0            ; Flag when it's time to add a CRLF.
  71. cnt    db    0            ; Determine when to add a CRLF.
  72. DATAS    ENDS
  73.  
  74. MAIN    SEGMENT    PARA PUBLIC 'MAIN'
  75. START    PROC    FAR
  76.     ASSUME CS:MAIN,DS:DATAS,SS:STACK,ES:NOTHING
  77.  
  78.     push ds                ; Initialization
  79.     sub ax,ax
  80.     push ax
  81.  
  82.     mov ax,datas            ; More of the same.......
  83.     mov ds,ax
  84.     sub ax,ax
  85.  
  86.     mov oldstk,sp
  87.  
  88.     mov ah,1AH            ; Use my own DTA
  89.     mov dx,offset buff
  90.     int dos
  91.     call one            ; Do the important stuff.
  92.     mov sp,oldstk
  93.     ret                ; Done.
  94. START     ENDP
  95.     
  96. ONE    PROC    NEAR
  97.     mov bx,offset fcbold
  98.     mov ah,0
  99.     mov [bx],ah            ; Use default drive.
  100.     inc bx
  101.     mov di,offset kold        ; Get name of original file.
  102. kerm3:    mov ah,[di]
  103.     cmp ah,'$'            ; Got all the data?
  104.     je kerm4
  105.     mov [bx],ah
  106.     inc di
  107.     inc bx
  108.     jmp kerm3
  109. kerm4:  mov bx,offset fcbnew        ; Put name of new file here.
  110.     mov ah,0
  111.     mov [bx],ah
  112.     inc bx
  113.     mov di,offset knew
  114. kerm5:    mov ah,[di]
  115.     cmp ah,'$'
  116.     je kerm6
  117.     mov [bx],ah
  118.     inc di
  119.     inc bx
  120.     jmp kerm5
  121.  
  122. kerm6:    mov ax,0
  123.     mov bx,offset fcbold+0CH
  124.     mov [bx],ax            ; Zero current block number.
  125.     mov bx,offset fcbold+0EH
  126.     mov [bx],ax            ; Lrecl.
  127.     mov bx,offset fcbold+20H
  128.     mov [bx],ah            ; Current record (of block).
  129.     inc bx
  130.     mov [bx],ax            ; Current record (of file).
  131.     mov bx,offset fcbold+23H
  132.     mov [bx],ax
  133.     mov ah,0FH            ; Open file.
  134.     mov dx,offset fcbold
  135.     int dos
  136.  
  137.     mov ax,0
  138.     mov bx,offset fcbnew+0CH
  139.     mov [bx],ax            ; Zero current block number.
  140.     mov bx,offset fcbnew+0EH
  141.     mov [bx],ax            ; Lrecl.
  142.     mov bx,offset fcbnew+20H
  143.     mov [bx],ah            ; Current record (of block).
  144.     inc bx
  145.     mov [bx],ax            ; Current record (of file).
  146.     mov bx,offset fcbnew+23H
  147.     mov [bx],ax
  148.     mov ah,16H            ; Create file.
  149.     mov dx,offset fcbnew
  150.     int dos
  151.     mov eoflag,0            ; Not end-of-file yet.
  152.     mov datcnt,0            ; Chars in write-out buffer.
  153.     mov chrcnt,0            ; Chars in read-to buffer.
  154.     mov crflg,0
  155.     mov cnt,0
  156.     mov bx,offset bufone
  157.     mov di,offset buftwo
  158.  
  159. kerm1:    cmp chrcnt,0H            ; Any chars left in buffer?
  160.     jne kerm0            ; Yes, continue.
  161.     call inbuf            ; Else get a buffer-full.
  162.       jmp kerm9            ; Hit the EOF.
  163.     mov ax,ds
  164.     mov es,ax            ; Move for Dest uses ES register.
  165.     mov si,offset buff
  166.     push di
  167.     mov di,offset bufone        ; Move read-in data to bufone.
  168.     mov cx,80H
  169.     rep movs es:bufone,buff
  170.     pop di
  171.  
  172.     mov bx,offset bufone        ; Where the chars are.
  173.     mov chrcnt,80H            ; Number of chars.
  174. kerm0:    cmp datcnt,80H            ; Time to write out the buffer?
  175.     je kerm2            ; Yup.
  176.     dec chrcnt
  177.     mov ah,[bx]            ; Get a char.
  178.     mov ch,ah            ; Save here.
  179.     and ah,0F0H            ; Get high nibble.
  180.     and ch,0FH            ; Lower nibble.
  181.     mov cl,4
  182.     shr ax,cl
  183.     add ah,'0'            ; Make printable.
  184.     mov [di],ah
  185.     inc datcnt
  186.     inc di
  187.     add ch,'0'
  188.     mov [di],ch
  189.     inc datcnt
  190.     inc di
  191.     inc bx
  192.     add cnt,2
  193.     cmp cnt,3EH            ; Time to add CRLF?
  194.     jne kerm1            ; Nope, keep going.
  195.     mov cnt,0            ; Reset counter.
  196.     cmp datcnt,80H            ; Have room for it?
  197.     jne kerm8            ; Yup, we do.
  198.     mov crflg,0FFH            ; No - remember add it later.
  199.     jmp kerm2
  200.  
  201. kerm8:    mov crflg,0
  202.     mov ax,0A0DH            ; Add the CRLF.
  203.     mov [di],ax
  204.     inc di
  205.     inc di
  206.     add datcnt,2
  207.     jmp kerm1
  208.  
  209. kerm2:     mov ax,ds
  210.     mov es,ax            ; Move for Dest uses ES register.
  211.     mov si,offset buftwo
  212.     mov di,offset buff
  213.     mov cx,80H
  214.     rep movs es:buff,buftwo        ; Must use BUFF for r/w to file.
  215.  
  216.     mov ah,15H            ; Write out to file two.
  217.     mov dx,offset fcbnew
  218.     int dos
  219.     mov datcnt,0
  220.     mov di,offset buftwo        ; Start at beginning of buffer.
  221.     cmp crflg,0FFH            ; Had our buffer filled prior to CRLF?
  222.     je kerm8            ; Yup.
  223.     jmp kerm1            ; Get new buffer-full.
  224.  
  225. kerm9:    mov ah,10H            ; Close files.    
  226.     mov dx,offset fcbold
  227.     int dos
  228.     mov dx,offset fcbnew
  229.     int dos
  230.     ret
  231.  
  232. inbuf:  cmp eoflag,0            ; End of file?
  233.     je inbuf0            ; Nope.
  234.     ret
  235. inbuf0:    mov dx,offset fcbold
  236.     mov ah,14H            ; Read from file.
  237.     int dos
  238.     cmp al,0
  239.     je inbuf2
  240.     mov eoflag,0FFH
  241. inbuf2: jmp rskp
  242. ONE     ENDP
  243.  
  244. RSKP    PROC  NEAR
  245.     pop bp
  246.     add bp,3
  247.     push bp
  248.     ret
  249. RSKP    ENDP
  250.  
  251. MAIN    ENDS
  252.     END     START
  253.  
  254. PCKGET.BAS
  255.  
  256. 5  'Run this program on the PC in conjunction with a Fortran program on the
  257. 6  ' mainframe to get Kermit to the PC
  258. 7  ' Daphne Tzoar , December 1983
  259. 8  ' Columbia University Center for Computing Activities
  260. 9  '
  261. 10 OPEN "com1:4800,n,8,1" AS #1        ' Clear the port status.
  262. 20 CLOSE #1
  263. 30 OPEN "com1:4800,n,8,1,cs,ds,cd" AS #1
  264. 40 OPEN "KERMIT.EXE" FOR OUTPUT AS #2
  265. 50 OK$ = "ok"
  266. 60 PRINT#1,OK$           ' Tell host we're ready for data
  267. 70 X$=INPUT$(63,#1)        ' Data plus semi-colon
  268. 80 VALUE$ = LEFT$(X$,1)      'First char of input
  269. 90 VALUE = ASC(VALUE$)
  270. 100 IF VALUE = 64 OR VALUE = 192 GOTO 430    ' @ means we're done
  271. 110 IF VALUE >= 176 AND VALUE <= 191 THEN GOTO 140   ' Kill all illegal chars
  272. 120 IF VALUE >= 48 AND VALUE <= 63 THEN GOTO 140
  273. 130 X$ = MID$(X$,2) : GOTO 80
  274. 140 IF VALUE <> 174 GOTO 210     ' Not a dot (for read) - don't worry
  275. 150 TWO$ = MID$(X$,2,1)          ' Look at char after the dot.
  276. 160 TWO = ASC(TWO$)
  277. 170 IF TWO >= 176 AND TWO <= 191 THEN GOTO 210    ' It's ok.
  278. 180 IF TWO >= 48 AND TWO <= 63 THEN GOTO 210
  279. 190 X$ = MID$(X$,3)        ' Kill the char
  280. 200 GOTO 80
  281. 210 SIZ = LEN(X$)           ' How much input was actual data
  282. 220 READIN = 64 - SIZ
  283. 225 IF READIN = 0 GOTO 260
  284. 230 XTWO$=INPUT$(READIN,#1)     ' Get rest of data
  285. 240 X$ = X$ + XTWO$ : X$ = LEFT$(X$,62)
  286. 250 PRINT X$         ' Optional - use this line to follow the transmission
  287. 260 GOSUB 290
  288. 270 PRINT#2,X$;      ' Put data to the file.
  289. 280 GOTO 60
  290. 290 ' GET TWO CHARS, SUBTRACT SPACE (20 HEX) FROM EACH, AND COMBINE
  291. 300 ' TO ONE DIGIT.
  292. 310 FOR A = 1 TO 31
  293. 320 Y$ = MID$(X$,A,1)
  294. 330 Z$ = MID$(X$,A+1,1)
  295. 340 YNUM = ASC(Y$) : ZNUM = ASC(Z$)
  296. 350 IF YNUM > 127 THEN YNUM = YNUM - 128    ' Turn off hi bit if on
  297. 360 IF ZNUM > 127 THEN ZNUM = ZNUM - 128
  298. 370 YNUM = YNUM -48 : ZNUM = ZNUM -48       ' Subtract the space
  299. 380 XNUM = (16 * YNUM) +ZNUM
  300. 390 NEWCHR$ = CHR$(XNUM)
  301. 400 X$ = MID$(X$,1,A-1) + NEWCHR$ + MID$(X$,A+2)
  302. 410 NEXT A
  303. 420 RETURN
  304. 430 PRINT  " [All done.]"
  305. 440 CLOSE #1,#2                            ' Clean up.
  306. 450 END
  307.  
  308. PCKEXE.BAS
  309.  
  310. 4  ' Use this BASIC program on the PC to convert the printable file 
  311. 5  ' KERMIT.FIX to the executable file KERMIT.EXE.  Before running this
  312. 6  ' program, if the file KERMIT.EXE already exists, rename it just in case.
  313. 7  ' Daphne Tzoar , December 1983
  314. 8  ' Columbia University Center for Computing Activities
  315. 9  '
  316. 10 ON ERROR GOTO 430
  317. 30 OPEN "KERMIT.FIX" FOR INPUT AS #1
  318. 40 OPEN "KERMIT.EXE" FOR OUTPUT AS #2
  319. 50 OK$ = "ok"
  320. 70 X$=INPUT$(62,#1)
  321. 80 VALUE$ = LEFT$(X$,1)      'First char of input
  322. 90 VALUE = ASC(VALUE$)
  323. 100 IF VALUE = 64 OR VALUE = 192 GOTO 430    ' @ means we're done
  324. 110 IF VALUE >= 176 AND VALUE <= 191 THEN GOTO 140   ' Kill all illegal chars
  325. 120 IF VALUE >= 48 AND VALUE <= 63 THEN GOTO 140
  326. 130 X$ = MID$(X$,2) : GOTO 80
  327. 140 IF VALUE <> 174 GOTO 210     ' Not a dot (for read) - don't worry
  328. 150 TWO$ = MID$(X$,2,1)          ' Look at char after the dot.
  329. 160 TWO = ASC(TWO$)
  330. 170 IF TWO >= 176 AND TWO <= 191 THEN GOTO 210    ' It's ok.
  331. 180 IF TWO >= 48 AND TWO <= 63 THEN GOTO 210
  332. 190 X$ = MID$(X$,3)        ' Kill the char
  333. 200 GOTO 80
  334. 210 SIZ = LEN(X$)               ' How much input was actual data
  335. 220 READIN = 64- SIZ
  336. 225 IF READIN = 0 GOTO 260
  337. 230 XTWO$=INPUT$(READIN,#1)     ' Get rest of data
  338. 240 X$ = X$ + XTWO$ : X$ = LEFT$(X$,62)
  339. 260 GOSUB 290
  340. 270 PRINT#2,X$;      ' Put data to the file.
  341. 280 GOTO 70
  342. 290 ' GET TWO CHARS, SUBTRACT SPACE (20 HEX) FROM EACH, AND COMBINE
  343. 300 ' TO ONE DIGIT.
  344. 310 FOR A = 1 TO 31
  345. 320 Y$ = MID$(X$,A,1)
  346. 330 Z$ = MID$(X$,A+1,1)
  347. 340 YNUM = ASC(Y$) : ZNUM = ASC(Z$)
  348. 350 IF YNUM > 127 THEN YNUM = YNUM - 128    ' Turn off hi bit if on
  349. 360 IF ZNUM > 127 THEN ZNUM = ZNUM - 128
  350. 370 YNUM = YNUM -48 : ZNUM = ZNUM -48       ' Subtract the space
  351. 380 XNUM = (16 * YNUM) +ZNUM
  352. 390 NEWCHR$ = CHR$(XNUM)
  353. 400 X$ = MID$(X$,1,A-1) + NEWCHR$ + MID$(X$,A+2)
  354. 410 NEXT A
  355. 420 RETURN
  356. 430 PRINT  " [All done.]"
  357. 440 CLOSE #1,#2                            ' Clean up.
  358. 450 END
  359.  
  360. PCKSEND.FOR
  361.  
  362. C     This Fortran program should be run on the mainframe in conjunction
  363. C     with a Basic program on the IBM PC to transfer Kermit.Fix to the PC.
  364.  
  365.       INTEGER A(62)
  366.  
  367.       WRITE(6,50)
  368. 50    FORMAT(' Ready to transfer data......')
  369.  
  370. C     Get terminal handshake
  371. 100   READ (5,10,END=35)X
  372. 10    FORMAT(A1)
  373.  
  374. C     Get line from file
  375. 35    READ (7,20,END=90)A
  376. 20    FORMAT(62A1)
  377.  
  378. C     Write to tty
  379.       WRITE (6,25)A
  380. 25    FORMAT(' ',62A1,';')
  381.       GOTO 100
  382. 90    CONTINUE
  383.  
  384. C     Get final handshake
  385.       WRITE (6,30)
  386. 30    FORMAT(' ',63('@'))
  387.       STOP
  388.       END
  389.