.title k11ini initialization and rarely used routines .ident /2.18/ ; 03-Jul-84 09:34:32 Brian Nelson ; ; Copyright (C) 1984 Change Software, Inc. ; ; ; Remove Kermit init code and routines like SPAR and RPAR that ; are only called once per file transfer. Placed into overlay ; with K11ATR. This was done to reduce the task size a bit. ; Really, the only system the size is a problem is on RT11. .include /IN:K11MAC.MAC/ .iif ndf, k11inc, .error ; missing .INCLUDE for K11MAC.MAC .enabl gbl .psect $code .sbttl initialize ourselves kerini::call init0 call init1 return init0: mov #rwdata ,r0 ; first of all, clear all read/write mov #rwsize/2,r1 ; data out please 10$: clr (r0)+ ; for i := 1 to rwdata_size sob r1 ,10$ ; do data[i] := 0 ; mov sp ,remote ; assume remote call rparini ; default remotes sinit parameters call sparini ; initialize my sinit parameters mov #mx$try ,maxtry ; initialize retry limit mov #defchk ,chktyp ; set the default checksum type movb #defchk ,setsen+p.chkt ; here also please movb #defchk ,setrec+p.chkt ; here also please mov #defdly ,sendly ; init the delay for send command mov #1 ,chksiz ; and the default checksum size mov #par$no ,parity ; default the parity type please mov sp ,sendat ; default to sending attr packets copyz #defprm ,#prompt ; set the prompt up call xinit return ; end .enabl lc defprm: .asciz /Kermit-11>/ .even .enabl lsb init1: nop ; can always patch this with a 207 mov #200$ ,r3 ; try to open an INIT file somewhere 10$: tst @r3 ; any more to open up ? beq 100$ ; no calls open ,<(r3)+,#lun.ta,#text> tst r0 ; did the open work ? bne 10$ ; no, just ignore it 20$: mov #lun.ta ,cmdlun ; yes, setup for reading from INIT mov sp ,sy.ini ; a flag to use later 100$: return .save .psect $pdata 200$: .word 210$,220$,230$,240$,0 210$: .asciz /SY:KERMIT.INI/ 220$: .asciz /LB:[1,2]KERMIT.INI/ 230$: .asciz /SY:[1,2]KERMIT.INI/ 240$: .asciz /KERMIT:KERMIT.INI/ .even .restore .dsabl lsb global global .sbttl spar fill will my send-init parameters ; S P A R ; ; spar( %loc data ) ; ; input: @r5 address of array [0..9] of char spar:: save ; save registers we may use mov #.sparsz,sparsz ; copy the send init packet size tst sendat ; attribute support disabled today? bne 10$ ; no mov #11 ,sparsz ; yes, shorten the packet up 10$: mov @r5 ,r2 ; point to the destiniation mov #senpar ,r1 ; and our local parameters tochar (r1)+ ,(r2)+ ; senpar.spsiz tochar (r1)+ ,(r2)+ ; senpar.time tochar (r1)+ ,(r2)+ ; senpar.npad ctl (r1)+ ,(r2)+ ; senpar.padc tochar (r1)+ ,(r2)+ ; senpar.eol movb (r1)+ ,(r2)+ ; senpar.qctl movb (r1)+ ,(r2)+ ; senpar.qbin movb (r1)+ ,(r2)+ ; senpar.chkt movb (r1)+ ,(r2)+ ; senpar.rept tochar (r1)+ ,(r2)+ ; senpar.capas tochar (r1)+ ,(r2)+ ; senpar.capas+1 clrb (r2)+ ; end unsave return fixchk::tstb setsen+p.chkt ; did the user ever set block-check? beq 100$ ; no cmpb setsen+p.chkt,#'1 ; insure that it's legit blo 100$ cmpb setsen+p.chkt,#'3 ; insure that it's legit bhi 100$ movb setsen+p.chkt,senpar+p.chkt 100$: return .sparsz == 13 ; 10 parameters to send over sparin::save ; save registers we may use mov #.sparsz,sparsz ; copy the send init packet size tst sendat ; attribute support disabled today? bne 10$ ; no mov #11 ,sparsz ; yes, shorten the packet up 10$: mov #senpar ,r1 ; where to put them movb #maxpak ,(r1)+ ; maximum packet size movb #mytime ,(r1)+ ; my desired timeout movb #mypad ,(r1)+ ; how much padding movb #mypchar,(r1)+ ; whatever i use for padding movb #myeol ,(r1)+ ; line terminators (don't need it) movb #myquote,(r1)+ ; quoting ? movb #myqbin ,(r1)+ ; do quoting ? movb #mychkt ,(r1)+ ; checksum type movb #myrept ,(r1)+ ; default on the rest of it movb #mycapa ,(r1)+ ; we can read attributes clrb (r1)+ ; default on the rest of it clrb (r1)+ ; default on the rest of it unsave return global .sbttl rpar read senders initialization parameters ; R P A R ; ; rpar( %loc msgpacket, %val size ) ; ; input: @r5 message packet to get data from ; 2(r5) packet length ; output: REMPAR[0..20] of parameters rpar:: save ; save registers we may use clr do8bit ; no 8 bit stuff for now mov @r5 ,r1 ; incoming packet address mov 2(r5) ,r0 ; size mov #conpar ,r2 ; address of remotes parameters unchar (r1)+ ,(r2)+ ; conpar.spsiz dec r0 ; exit if no more data beq 1$ ; all done unchar (r1)+ ,(r2)+ ; conpar.time dec r0 ; exit if no more data beq 1$ ; all done unchar (r1)+ ,(r2)+ ; conpar.npad dec r0 ; exit if no more data beq 1$ ; all done ctl (r1)+ ,(r2)+ ; conpar.padc dec r0 ; exit if no more data beq 1$ ; all done unchar (r1)+ ,(r2)+ ; conpar.eol dec r0 ; exit if no more data beq 1$ ; all done movb (r1)+ ,(r2)+ ; conpar.qctl dec r0 ; exit if no more data beq 1$ ; all done movb (r1)+ ,(r2)+ ; conpar.qbin dec r0 ; exit if no more data beq 1$ ; all done movb (r1)+ ,(r2)+ ; conpar.chkt dec r0 ; exit if no more data beq 1$ ; all done movb (r1)+ ,(r2)+ ; conpar.rept dec r0 ; exit if no more data beq 1$ ; all done unchar (r1)+ ,(r2)+ ; conpar.capas 1$: clrb (r2)+ mov #conpar ,r2 ; now clear parity off please in mov #12 ,r0 ; case an IBM system set it. 5$: bicb #200 ,(r2)+ ; simple sob r0 ,5$ ; next please mov #setrec ,r0 ; check to see if we need to mov #conpar ,r1 ; override any of the sinit stuff movb p.spsiz(r0),r2 ; if user set packetsize beq 10$ ; then movb r2 ,p.spsiz(r1) ; conpar.size := setrec.size 10$: movb p.eol(r0),r2 ; if user set endofline beq 20$ ; then movb r2 ,p.eol(r1) ; conpar.eol := setrec.eol 20$: movb p.time(r0),r2 ; if user set timeout beq 30$ ; then movb r2 ,p.time(r1) ; conpar.time := setrec.time 30$: tstb p.chkt(r1) ; if checksum_type = null bne 40$ ; then movb #defchk ,p.chkt(r1) ; checksum_type := default 40$: movb p.chkt(r1),senpar+p.chkt; setup for type of checksum used unsave return rparin::save ; save registers we may use mov #conpar ,r1 ; where to put them movb #maxpak ,(r1)+ ; maximum packet size movb #mytime ,(r1)+ ; my desired timeout movb #mypad ,(r1)+ ; how much padding movb #mypchar,(r1)+ ; whatever i use for padding movb #myeol ,(r1)+ ; line terminators (don't need it) movb #myquote,(r1)+ ; quoting ? movb #myqbin ,(r1)+ ; do quoting ? movb #mychkt ,(r1)+ ; checksum type clrb (r1)+ ; default on the rest of it clrb (r1)+ ; default on the rest of it clrb (r1)+ ; default on the rest of it unsave return global .sbttl fillog log file opens/close to disk ; F I L L O G ; ; input: @r5 0 for open for read ; 1 for open for write ; 2(r5) filename fillog::save bit #log$fi ,trace ; logging file activity to disk ? beq 100$ ; no calls putc ,<#cr,#lun.lo> ; insure buffers are flushed mov #200$ ,r1 ; assume a header of 'writing' tst @r5 ; perhaps writing ? beq 10$ ; no mov #210$ ,r1 ; yes 10$: movb (r1)+ ,r0 ; copy the byte over beq 20$ ; all done calls putc , ; next byte pleae br 10$ ; next 20$: mov 2(r5) ,r1 ; now for the filename 30$: movb (r1)+ ,r0 ; copy the byte over beq 40$ ; all done calls putc , ; next byte pleae br 30$ ; next 40$: calls putc ,<#cr,#lun.lo> ; dump the record 100$: unsave ; and exit return 200$: .asciz /Receiving file / 210$: .asciz /Sending file / .even .sbttl debug dump to disk ; D S K D M P ; ; input: @r5 name ('rpack' or 'spack') ; 2(r5) packet length ; 4(r5) packet type ; 6(r5) packet number ; 10(r5) packet address dskdmp::save sub #120 ,sp ; allocate a formatting buffer mov sp ,r1 ; point to it mov #120 ,r0 ; and clear it out 10$: movb #40 ,(r1)+ ; simple sob r0 ,10$ mov sp ,r1 ; point back to the buffer mov (r5)+ ,r0 ; point to the routine name call 200$ ; and copy it mov #110$ ,r0 ; and a label ('LEN') call 200$ ; copy it mov (r5)+ ,r2 ; get the length saved deccvt r2,r1,#3 ; convert the length to decimal add #6 ,r1 ; and skip over it mov #120$ ,r0 ; another label ('TYP') call 200$ ; simple movb (r5)+ ,(r1)+ ; get the packet type movb #40 ,(r1)+ ; and some spaces cmpb @r1 ,#badchk ; checksum error ? bne 20$ ; no movb #'* ,-1(r1) ; yes, flag it please 20$: inc r5 ; point to the next arguement movb #40 ,(r1)+ ; and some spaces movb #40 ,(r1)+ ; and some spaces movb #40 ,(r1)+ ; and some spaces mov #130$ ,r0 ; and a label ('PAK') call 200$ ; copy it mov (r5)+ ,r0 deccvt r0,r1,#3 ; and convert to decimal add #4 ,r1 ; now point to the end clrb @r1 ; make it .asciz mov sp ,r1 ; point back to the start calls putrec , ; and put out to disk now calls putrec ,<@r5,r2,#lun.lo> ; also dump the data record tst debug ; should we also dump to ti:? beq 100$ ; no .print r1 ; yes, dump the length and type .newli ; and a carrriage return tst r2 ; anything in the packet? beq 100$ ; no .print @r5 ,r2 ; yes, dump it .newlin ; and do a 100$: add #120 ,sp ; pop the local buffer and exit unsave ; pop registers first, of course return ; bye 110$: .asciz /Length/ 120$: .asciz /Type/ 130$: .asciz /Paknum/ .even 200$: movb (r0)+ ,(r1)+ ; copy .asciz string to buffer bne 200$ ; done yet ? dec r1 ; yes, back up and overwrite the movb #40 ,(r1)+ ; null with a space movb #40 ,(r1)+ ; one more space for formatting return ; bye .end