home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
old
/
misc
/
pckermit
/
pckermit.upd
< prev
next >
Wrap
Text File
|
2020-01-01
|
11KB
|
389 lines
ADDENDUM TO THE KERMIT USER'S GUIDE
Some minor changes were made to the set of programs used for bootstrapping
Kermit for the IBM PC. These include:
- PCKSEND.FOR
- PCKEXE.BAS
- PCKGET.BAS
- PCKFIX.ASM
The file PCKERMIT.FIX (the printable version of PCKERMIT.EXE) now
uses characters 30-3F (hex) rather than 20-2F (hex) to represent the
digits 0 through F (hex). Since many systems strip off trailing
blanks, a significant amount of data was sometimes lost when sending
the FIX file to the PC. The new format will not have this problem.
Each line now has only 62 characters rather than 64. So, on IBM
mainframes, the file should be save with Recfm = Fixed, Lrecl = 62.
Also, when bootstrapping from an IBM mainframe, the filedef for
the disk file should be:
filedef 7 disk kermit fix a (lrecl 62 recfm f block 62 perm
To modify PCKGET.BAS to create PCKEXE.BAS, follow the directions
in the User's Guide except for the change: In line 70, change
the "63" to a "62".
The original versions of the files mentionned above will remain
part of the distribution during the testing period. Note, however,
that they will be useful only to sites that have FIX files in the
older format. They have been renamed by adding an "O" to the end
of the file name.
PCKERMIT.FIX and STRIP.FIX have been modified to reflect the new
format.
; PCKFIX.ASM --
; Input file: KERMIT.EXE
; Output file: KERMIT.FIX
; The new file is a printable version of the executable file. Each byte
; in the EXE file is converted to two bytes in the FIX file: a constant
; of "0" (30H) is added to each nibble.
;
; Daphne Tzoar, December 1983
; Columbia University Center for Computing Activities
DOS EQU 21H
STACK SEGMENT PARA STACK 'STACK'
DW 100 DUP (0)
STK EQU THIS WORD
STACK ENDS
DATAS SEGMENT PARA PUBLIC 'DATAS'
buff db 80H DUP(0) ; Use our own DTA.
bufone db 80H DUP(0) ; Data read from EXE file.
buftwo db 80H DUP(0) ; Data to write out to FIX file.
fcbold db 25H DUP(0) ; For the EXE file.
fcbnew db 25H DUP(0) ; File the FIX file.
oldstk dw ?
kold db 'KERMIT EXE$'
knew db 'KERMIT FIX$'
chrcnt db 0 ; Number of chars left in BUFONE.
datcnt db 0 ; Number of chars in BUFTWO.
eoflag db 0 ; Remember when we hit the EOF.
crflg db 0 ; Flag when it's time to add a CRLF.
cnt db 0 ; Determine when to add a CRLF.
DATAS ENDS
MAIN SEGMENT PARA PUBLIC 'MAIN'
START PROC FAR
ASSUME CS:MAIN,DS:DATAS,SS:STACK,ES:NOTHING
push ds ; Initialization
sub ax,ax
push ax
mov ax,datas ; More of the same.......
mov ds,ax
sub ax,ax
mov oldstk,sp
mov ah,1AH ; Use my own DTA
mov dx,offset buff
int dos
call one ; Do the important stuff.
mov sp,oldstk
ret ; Done.
START ENDP
ONE PROC NEAR
mov bx,offset fcbold
mov ah,0
mov [bx],ah ; Use default drive.
inc bx
mov di,offset kold ; Get name of original file.
kerm3: mov ah,[di]
cmp ah,'$' ; Got all the data?
je kerm4
mov [bx],ah
inc di
inc bx
jmp kerm3
kerm4: mov bx,offset fcbnew ; Put name of new file here.
mov ah,0
mov [bx],ah
inc bx
mov di,offset knew
kerm5: mov ah,[di]
cmp ah,'$'
je kerm6
mov [bx],ah
inc di
inc bx
jmp kerm5
kerm6: mov ax,0
mov bx,offset fcbold+0CH
mov [bx],ax ; Zero current block number.
mov bx,offset fcbold+0EH
mov [bx],ax ; Lrecl.
mov bx,offset fcbold+20H
mov [bx],ah ; Current record (of block).
inc bx
mov [bx],ax ; Current record (of file).
mov bx,offset fcbold+23H
mov [bx],ax
mov ah,0FH ; Open file.
mov dx,offset fcbold
int dos
mov ax,0
mov bx,offset fcbnew+0CH
mov [bx],ax ; Zero current block number.
mov bx,offset fcbnew+0EH
mov [bx],ax ; Lrecl.
mov bx,offset fcbnew+20H
mov [bx],ah ; Current record (of block).
inc bx
mov [bx],ax ; Current record (of file).
mov bx,offset fcbnew+23H
mov [bx],ax
mov ah,16H ; Create file.
mov dx,offset fcbnew
int dos
mov eoflag,0 ; Not end-of-file yet.
mov datcnt,0 ; Chars in write-out buffer.
mov chrcnt,0 ; Chars in read-to buffer.
mov crflg,0
mov cnt,0
mov bx,offset bufone
mov di,offset buftwo
kerm1: cmp chrcnt,0H ; Any chars left in buffer?
jne kerm0 ; Yes, continue.
call inbuf ; Else get a buffer-full.
jmp kerm9 ; Hit the EOF.
mov ax,ds
mov es,ax ; Move for Dest uses ES register.
mov si,offset buff
push di
mov di,offset bufone ; Move read-in data to bufone.
mov cx,80H
rep movs es:bufone,buff
pop di
mov bx,offset bufone ; Where the chars are.
mov chrcnt,80H ; Number of chars.
kerm0: cmp datcnt,80H ; Time to write out the buffer?
je kerm2 ; Yup.
dec chrcnt
mov ah,[bx] ; Get a char.
mov ch,ah ; Save here.
and ah,0F0H ; Get high nibble.
and ch,0FH ; Lower nibble.
mov cl,4
shr ax,cl
add ah,'0' ; Make printable.
mov [di],ah
inc datcnt
inc di
add ch,'0'
mov [di],ch
inc datcnt
inc di
inc bx
add cnt,2
cmp cnt,3EH ; Time to add CRLF?
jne kerm1 ; Nope, keep going.
mov cnt,0 ; Reset counter.
cmp datcnt,80H ; Have room for it?
jne kerm8 ; Yup, we do.
mov crflg,0FFH ; No - remember add it later.
jmp kerm2
kerm8: mov crflg,0
mov ax,0A0DH ; Add the CRLF.
mov [di],ax
inc di
inc di
add datcnt,2
jmp kerm1
kerm2: mov ax,ds
mov es,ax ; Move for Dest uses ES register.
mov si,offset buftwo
mov di,offset buff
mov cx,80H
rep movs es:buff,buftwo ; Must use BUFF for r/w to file.
mov ah,15H ; Write out to file two.
mov dx,offset fcbnew
int dos
mov datcnt,0
mov di,offset buftwo ; Start at beginning of buffer.
cmp crflg,0FFH ; Had our buffer filled prior to CRLF?
je kerm8 ; Yup.
jmp kerm1 ; Get new buffer-full.
kerm9: mov ah,10H ; Close files.
mov dx,offset fcbold
int dos
mov dx,offset fcbnew
int dos
ret
inbuf: cmp eoflag,0 ; End of file?
je inbuf0 ; Nope.
ret
inbuf0: mov dx,offset fcbold
mov ah,14H ; Read from file.
int dos
cmp al,0
je inbuf2
mov eoflag,0FFH
inbuf2: jmp rskp
ONE ENDP
RSKP PROC NEAR
pop bp
add bp,3
push bp
ret
RSKP ENDP
MAIN ENDS
END START
PCKGET.BAS
5 'Run this program on the PC in conjunction with a Fortran program on the
6 ' mainframe to get Kermit to the PC
7 ' Daphne Tzoar , December 1983
8 ' Columbia University Center for Computing Activities
9 '
10 OPEN "com1:4800,n,8,1" AS #1 ' Clear the port status.
20 CLOSE #1
30 OPEN "com1:4800,n,8,1,cs,ds,cd" AS #1
40 OPEN "KERMIT.EXE" FOR OUTPUT AS #2
50 OK$ = "ok"
60 PRINT#1,OK$ ' Tell host we're ready for data
70 X$=INPUT$(63,#1) ' Data plus semi-colon
80 VALUE$ = LEFT$(X$,1) 'First char of input
90 VALUE = ASC(VALUE$)
100 IF VALUE = 64 OR VALUE = 192 GOTO 430 ' @ means we're done
110 IF VALUE >= 176 AND VALUE <= 191 THEN GOTO 140 ' Kill all illegal chars
120 IF VALUE >= 48 AND VALUE <= 63 THEN GOTO 140
130 X$ = MID$(X$,2) : GOTO 80
140 IF VALUE <> 174 GOTO 210 ' Not a dot (for read) - don't worry
150 TWO$ = MID$(X$,2,1) ' Look at char after the dot.
160 TWO = ASC(TWO$)
170 IF TWO >= 176 AND TWO <= 191 THEN GOTO 210 ' It's ok.
180 IF TWO >= 48 AND TWO <= 63 THEN GOTO 210
190 X$ = MID$(X$,3) ' Kill the char
200 GOTO 80
210 SIZ = LEN(X$) ' How much input was actual data
220 READIN = 64 - SIZ
225 IF READIN = 0 GOTO 260
230 XTWO$=INPUT$(READIN,#1) ' Get rest of data
240 X$ = X$ + XTWO$ : X$ = LEFT$(X$,62)
250 PRINT X$ ' Optional - use this line to follow the transmission
260 GOSUB 290
270 PRINT#2,X$; ' Put data to the file.
280 GOTO 60
290 ' GET TWO CHARS, SUBTRACT SPACE (20 HEX) FROM EACH, AND COMBINE
300 ' TO ONE DIGIT.
310 FOR A = 1 TO 31
320 Y$ = MID$(X$,A,1)
330 Z$ = MID$(X$,A+1,1)
340 YNUM = ASC(Y$) : ZNUM = ASC(Z$)
350 IF YNUM > 127 THEN YNUM = YNUM - 128 ' Turn off hi bit if on
360 IF ZNUM > 127 THEN ZNUM = ZNUM - 128
370 YNUM = YNUM -48 : ZNUM = ZNUM -48 ' Subtract the space
380 XNUM = (16 * YNUM) +ZNUM
390 NEWCHR$ = CHR$(XNUM)
400 X$ = MID$(X$,1,A-1) + NEWCHR$ + MID$(X$,A+2)
410 NEXT A
420 RETURN
430 PRINT " [All done.]"
440 CLOSE #1,#2 ' Clean up.
450 END
PCKEXE.BAS
4 ' Use this BASIC program on the PC to convert the printable file
5 ' KERMIT.FIX to the executable file KERMIT.EXE. Before running this
6 ' program, if the file KERMIT.EXE already exists, rename it just in case.
7 ' Daphne Tzoar , December 1983
8 ' Columbia University Center for Computing Activities
9 '
10 ON ERROR GOTO 430
30 OPEN "KERMIT.FIX" FOR INPUT AS #1
40 OPEN "KERMIT.EXE" FOR OUTPUT AS #2
50 OK$ = "ok"
70 X$=INPUT$(62,#1)
80 VALUE$ = LEFT$(X$,1) 'First char of input
90 VALUE = ASC(VALUE$)
100 IF VALUE = 64 OR VALUE = 192 GOTO 430 ' @ means we're done
110 IF VALUE >= 176 AND VALUE <= 191 THEN GOTO 140 ' Kill all illegal chars
120 IF VALUE >= 48 AND VALUE <= 63 THEN GOTO 140
130 X$ = MID$(X$,2) : GOTO 80
140 IF VALUE <> 174 GOTO 210 ' Not a dot (for read) - don't worry
150 TWO$ = MID$(X$,2,1) ' Look at char after the dot.
160 TWO = ASC(TWO$)
170 IF TWO >= 176 AND TWO <= 191 THEN GOTO 210 ' It's ok.
180 IF TWO >= 48 AND TWO <= 63 THEN GOTO 210
190 X$ = MID$(X$,3) ' Kill the char
200 GOTO 80
210 SIZ = LEN(X$) ' How much input was actual data
220 READIN = 64- SIZ
225 IF READIN = 0 GOTO 260
230 XTWO$=INPUT$(READIN,#1) ' Get rest of data
240 X$ = X$ + XTWO$ : X$ = LEFT$(X$,62)
260 GOSUB 290
270 PRINT#2,X$; ' Put data to the file.
280 GOTO 70
290 ' GET TWO CHARS, SUBTRACT SPACE (20 HEX) FROM EACH, AND COMBINE
300 ' TO ONE DIGIT.
310 FOR A = 1 TO 31
320 Y$ = MID$(X$,A,1)
330 Z$ = MID$(X$,A+1,1)
340 YNUM = ASC(Y$) : ZNUM = ASC(Z$)
350 IF YNUM > 127 THEN YNUM = YNUM - 128 ' Turn off hi bit if on
360 IF ZNUM > 127 THEN ZNUM = ZNUM - 128
370 YNUM = YNUM -48 : ZNUM = ZNUM -48 ' Subtract the space
380 XNUM = (16 * YNUM) +ZNUM
390 NEWCHR$ = CHR$(XNUM)
400 X$ = MID$(X$,1,A-1) + NEWCHR$ + MID$(X$,A+2)
410 NEXT A
420 RETURN
430 PRINT " [All done.]"
440 CLOSE #1,#2 ' Clean up.
450 END
PCKSEND.FOR
C This Fortran program should be run on the mainframe in conjunction
C with a Basic program on the IBM PC to transfer Kermit.Fix to the PC.
INTEGER A(62)
WRITE(6,50)
50 FORMAT(' Ready to transfer data......')
C Get terminal handshake
100 READ (5,10,END=35)X
10 FORMAT(A1)
C Get line from file
35 READ (7,20,END=90)A
20 FORMAT(62A1)
C Write to tty
WRITE (6,25)A
25 FORMAT(' ',62A1,';')
GOTO 100
90 CONTINUE
C Get final handshake
WRITE (6,30)
30 FORMAT(' ',63('@'))
STOP
END