-
Notifications
You must be signed in to change notification settings - Fork 0
/
k11ini.mac
846 lines (722 loc) · 23.7 KB
/
k11ini.mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
.title k11ini initialization and rarely used routines
.ident /3.42/
; 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.
.if ndf, K11INC
.ift
.include /IN:K11MAC.MAC/
.endc
.iif ndf, k11inc, .error ; missing .INCLUDE for K11MAC.MAC
.enabl gbl
.psect $code
.macro $chkb val ,reg ,?a
tstb @reg
bne a
movb val ,@reg
a: inc reg
.endm $chkb
.sbttl initialize ourselves
.iif ndf, SOH, SOH = 1
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 ; /42/ (Moved) assume remote
mov #1 ,blip ; assume logging all packets to tty
clrb defdir ; /51/ Moved it
call xinit ; /42/ Moved call forward
mov #15 ,recdlm ; /56/ Assume CR
mov #-1 ,setrpt ; assume we will do repeat counts
mov sp ,doattr ; default to sending attr packets
mov do$lng ,dolong ; /42/ We want long packets if doable
mov sp ,doauto ; default to cecking file attributes
mov do$exi ,exieof ; /45/ Exit on end of mcr command line
call rparini ; default remotes sinit parameters
call sparini ; initialize my sinit parameters
mov #60. ,serwait ; /41/ Support SET SERVER [NO]WAIT
mov argbuf ,argpnt ;
mov #SOH ,recsop ; assume control A please
mov #SOH ,sensop ; assume control A please
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
copyz #defprm ,#prompt ; set the prompt up
mov sp ,con8bit ; assume 8 bits are ok for console
tst vttype ; did xinit set this up?
bne 20$ ; yes
mov #tty ,vttype ; default to hardcopy console
20$: tst proflg ; if pro/350 then vt100
beq 30$ ; not
mov #vt100 ,vttype ; yes
clr con8bit ; also say we want 7 bit data at connect
30$: return ; end
.enabl lc
.save
.psect $PDATA ,D
defprm: .asciz /Kermit-11>/
.even
.restore
.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
.even
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 <xinit ,cmdlun ,lun.ta ,defchk ,defdly ,chktyp ,sendly>
global <chksiz ,sy.ini ,parity ,setrec ,setsen ,sendat ,vttype>
global <setrpt ,con8bit,proflg ,blip ,sensop ,recsop>
global <argbuf,argpnt>
.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 <r0,r1,r2> ; save registers we may use
mov #.sparsz,sparsz ; copy the send init packet size
tst doattr ; attribute support disabled today?
bne 10$ ; no
tst dolong ; /42/ What about long packets
bne 10$ ; /42/ Yep
mov #11 ,sparsz ; No, shorten the packet up
10$: mov @r5 ,r2 ; point to the destiniation
mov #senpar ,r1 ; and our local parameters
clr snd8bit ; assume we don't need 8bit prefixing
movb #'Y&137 ,p.qbin(r1) ; assume 'if we must do it, ok' for 8bit
movb conpar+p.qbin,r0 ; get senders 8bit quote character
cmpb r0 ,#'N&137 ; can the other kermit ever do 8bit ?
bne 15$ ; no, don't bother setting the mode
clr do8bit ; don't ever try to do it
br 30$ ;
15$: cmpb r0 ,#'Y&137 ; has the other one required this mode?
bne 20$ ; yes, set the mode up then
cmpb parity ,#par$no ; no, but do we need to do it?
beq 30$ ; no, don't waste the overhead
movb #myqbin ,r0 ; yes, force this to the other side
movb r0 ,p.qbin(r1) ; tell the other kermit we HAVE to do it
20$: mov sp ,snd8bit ; flag we need it for sending a file
mov sp ,do8bit ; force 8bit prefixing then
movb r0 ,ebquot ; and set ours to the same please
movb r0 ,p.qbin(r1) ; /29/ fix this please
30$: 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
bicb #CAPA.L ,@r1 ; /42/ Assume NO long packet support
tst dolong ; /42/ Do long packet crap?
beq 35$ ; /42/ No
bisb #CAPA.L ,@r1 ; /42/ Yes, insert it NOW
35$: bisb #CAPA.A ,@r1 ; /42/ Assume attribute support
tst doattr ; /42/ Really do it ?
bne 40$ ; /42/ Yes
bicb #CAPA.A ,@r1 ; /42/ No, disable it now
40$: tochar (r1)+ ,(r2)+ ; senpar.capas
tochar (r1)+ ,(r2)+ ; /42/ senpar.capas+1 (window size)
tochar (r1)+ ,(r2)+ ; /42/ senpar.capas+2 (maxlen2)
tochar (r1)+ ,(r2)+ ; /42/ senpar.capas+3 (maxlen1)
clrb (r2)+ ; end
unsave <r2,r1,r0>
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 == 15 ; /42/ 13 parameters to send over
sparin::save <r1,r2,r3> ; save registers we may use
mov #.sparsz,sparsz ; copy the send init packet size
tst doattr ; attribute support disabled today?
bne 10$ ; no
tst dolong ; /42/ Doing long packets ?
bne 10$ ; /42/ Yes
mov #11 ,sparsz ; No, 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 #'Y&137 ,(r1)+ ; do quoting ?
movb #mychkt ,@r1 ; /42/ checksum type
;- tst dolong ; /42/ Want to do long packet?
15$: inc r1
movb #40 ,@r1 ; assume no repeat processing
tst setrpt ; really say we do repeat crap?
beq 20$ ; no
movb #myrept ,@r1 ; default on the rest of it
20$: inc r1 ; fix the pointer please
movb #mycapa ,@r1 ; we can read attributes
tst doattr ; /42/ No attrs but do long packets?
bne 30$ ; /42/ Leave attribute support in
bicb #CAPA.A ,@r1 ; /42/ Remove attribute support
30$: tst dolong ; /42/ Long packet support desired?
bne 40$ ; /42/ Yes, leave the bit alone
bicb #CAPA.L ,@r1 ; /42/ No, remove support bit
40$: bicb #1 ,@r1 ; /42/ Insure no more capas bytes
inc r1 ; /42/ Next please
clrb (r1)+ ; /42/ No window size to send over
mov #maxpak ,r3 ; /42/ Setup to break the size into
clr r2 ; /42/ two bytes
div #95. ,r2 ; /42/ Done
movb r2 ,(r1)+ ; /42/ maxl1 = buffersize / 95
movb r3 ,(r1)+ ; /42/ maxl2 = buffersize mod 95
clrb (r1)+ ; default on the rest of it
clrb (r1)+ ; default on the rest of it
movb #'& ,ebquot
unsave <r3,r2,r1>
return
global <setrec ,senpar ,setsen ,sparsz>
global <reclng ,senlng ,dolong ,doattr ,doslid> ; /42/
global <senwin ,recwin ,inqbuf> ; /42/
.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 <r0,r1,r2,r3,r4> ; save registers we may use
clr r3 ; /42/ Sending long packet buffersize
mov @r5 ,r1 ; incoming packet address
mov 2(r5) ,r0 ; size
mov #conpar ,r2 ; address of remotes parameters
movb #'N ,p.qbin(r2) ; /58/ Worst case on 8bit quoting
unchar (r1)+ ,(r2)+ ; conpar.spsiz
dec r0 ; exit if no more data
beq 4$ ; all done
unchar (r1)+ ,(r2)+ ; conpar.time
dec r0 ; exit if no more data
beq 4$ ; all done
unchar (r1)+ ,(r2)+ ; conpar.npad
dec r0 ; exit if no more data
beq 4$ ; all done
ctl (r1)+ ,(r2)+ ; conpar.padc
dec r0 ; exit if no more data
beq 4$ ; all done
unchar (r1)+ ,(r2)+ ; conpar.eol
dec r0 ; exit if no more data
beq 4$ ; all done
movb (r1)+ ,(r2)+ ; conpar.qctl
dec r0 ; exit if no more data
beq 4$ ; all done
movb (r1)+ ,(r2)+ ; conpar.qbin
dec r0 ; exit if no more data
beq 4$ ; all done
movb (r1)+ ,(r2)+ ; conpar.chkt
dec r0 ; exit if no more data
beq 4$ ; all done
movb (r1)+ ,(r2)+ ; conpar.rept
1$: dec r0 ; exit if no more data
beq 4$ ; all done
unchar (r1)+ ,@r2 ; conpar.capas
bitb #1 ,(r2)+ ; /42/ More CAPAS to go ?
bne 1$ ; /42/ Yes, keep getting them
dec r0 ; /42/ Look for the Window size
beq 4$ ; /42/ Not present
unchar (r1)+ ,senwin ; /42/ Present, save it away please
dec r0 ; /42/ Look for long packet size
beq 4$ ; /42/ Anything ?
unchar (r1)+ ,r3 ; /42/ Yes, get it please
bicb #200 ,r3 ; /42/ Insure high bit off
mul #95. ,r3 ; /42/ and save it
dec r0 ; /42/ Get the next part please
beq 4$ ; /42/ Nothing is left
unchar (r1)+ ,r4 ; /42/ Last entry, low order of size
bicb #200 ,r4 ; /42/ Insure high bit off
add r4 ,r3 ; /42/ Add into senders buffersize
4$: clrb (r2)+
mov #conpar ,r2 ; now clear parity off please in
mov #15 ,r0 ; case an IBM system set it.
5$: bicb #200 ,(r2)+ ; simple
sob r0 ,5$ ; next please
call rparck ; /37/ insure parameters are OK
mov #setsen ,r0 ; /43/ check to see if we need to
mov #conpar ,r1 ; override any of the sinit stuff
movb p.padc(r0),r2 ; /57/ Check for SET SEND PADC
beq 6$ ; /57/ Never set
movb r2 ,p.padc(r1) ; /57/ Set, use it
6$: movb p.npad(r0),r2 ; /57/ Check for SET SEND PADC
beq 7$ ; /57/ Never set
movb r2 ,p.npad(r1) ; /57/ Set, use it
7$: 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
mov snd8bit ,do8bit ; in case SPAR decided WE need 8bit
clr snd8bit ; prefixing to send a file over.
cmpb p.qbin(r1),#'Y&137 ; was this a simple 'YES' ?
bne 50$ ; no
movb #myqbin ,ebquot ; yes, change it to the default '&'
br 70$ ; and exit
50$: cmpb p.qbin(r1),#'N&137 ; eight bit quoting support present
bne 60$ ; yes
clr do8bit ; no
br 70$
60$: mov sp ,do8bit ; flag for doing 8 bit prefixing then
movb p.qbin(r1),ebquot ; and set the quote character please
70$: clr senlng ; /42/ Clear the write long buffer size
tst dolong ; /42/ Really want long packets today?
bne 75$ ; /42/ Yes
bicb #CAPA.L ,p.capas(r1) ; /42/ No, so turn it off please
75$: bitb #CAPA.L ,p.capas(r1) ; /42/ Can the sender do long packets?
beq 90$ ; /42/ No
mov r3 ,senlng ; /42/ Yes, stuff the max buffersize
bne 80$ ; /42/ Something is there
..DEFL == . + 2 ; /52/ Default
mov #90. ,senlng ; /42/ Nothing, assume 90 (10) chars
80$: cmp senlng ,#MAXLNG ; /42/ Is this size bigger than buffer?
ble 100$ ; /42/ No
mov #MAXLNG ,senlng ; /42/ Yes, please fix it then
br 100$ ; /43/ And exit
90$: tst reclng ; /43/ Ever do a SET REC PAC > 94 ?
beq 100$ ; /43/ No
tst infomsg ; /43/ Really dump this message?
beq 100$ ; /43/ No
tst msgtim ; /43/ Please, NOT for EVERY file
bne 100$ ; /43/ Not again
mov sp ,msgtim ; /43/ Flag we printed a warning
calls printm ,<#1,#lmsg> ; /43/ Yes, print a warning message
100$: unsave <r4,r3,r2,r1,r0>
return
.save
.psect $PDATA ,D
lmsg: .ascii /%Warning - You have requested LONG packet support/<CR><LF>
.asciz /but the other Kermit does not support this feature./<CR><LF>
.even
.restore
.sbttl setup defaults for senders parameters and also check them
rparin::save <r1,r2> ; 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 #'Y&137 ,(r1)+ ; do quoting ?
movb #mychkt ,(r1)+ ; checksum type
movb #40 ,(r1)+ ; assume no repeat count processing
clrb (r1)+ ; default on the rest of it
clrb (r1)+ ; default on the rest of it
clrb (r1)+ ; default on the rest of it
clrb (r1)+ ; default on the rest of it
clrb (r1)+ ; default on the rest of it
mov #setsen ,r0 ; /57/ check to see if we need to
mov #conpar ,r1 ; /57/ override any of the sinit stuff
movb p.padc(r0),r2 ; /57/ Check for SET SEND PADC
beq 10$ ; /57/ Never set
movb r2 ,p.padc(r1) ; /57/ Set, use it
10$: movb p.npad(r0),r2 ; /57/ Check for SET SEND PADC
beq 20$ ; /57/ Never set
movb r2 ,p.npad(r1) ; /57/ Set, use it
20$: movb p.eol(r0),r2 ; /57/ if user set endofline
beq 30$ ; /57/ then
movb r2 ,p.eol(r1) ; /57/ conpar.eol := setrec.eol
30$: unsave <r2,r1>
return
rparck: mov #conpar ,r0 ; /37/ address of senders parameters
$chkb #maxpak ,r0 ; /37/ Be defensive about the senders
$chkb #mytime ,r0 ; /37/ parameters please
$chkb #mypad ,r0
$chkb #mypchar,r0
$chkb #myeol ,r0
$chkb #myquote,r0
$chkb #'Y ,r0
$chkb #mychkt ,r0
$chkb #40 ,r0
return ; /37/ exit to RPAR
global <conpar ,do8bit ,setrec ,ebquot>
.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
.enabl lsb
fillog::save <r0,r1>
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 ,<r0,#lun.lo> ; 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 ,<r0,#lun.lo> ; next byte pleae
br 30$ ; next
40$: calls putc ,<#cr,#lun.lo> ; dump the record
100$: unsave <r1,r0> ; and exit
return
.save
.psect $PDATA ,D
200$: .asciz /Receiving file /
210$: .asciz /Sending file /
.even
.restore
.dsabl lsb
.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
.enabl lsb
dskdmp::save ; /42/ Save R0-R5
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 ,<r1,#70.,#lun.lo> ; and put out to disk now
mov @r5 ,r3 ; /42/ May have very large packets
mov r2 ,r4 ; /42/ Save the length please
30$: mov r4 ,r0 ; /42/ Assume a reasonable size
bmi 50$ ; /42/ Anything left over to do?
cmp r0 ,#72. ; /42/ Will the leftovers fit?
ble 40$ ; /42/ Yes
mov #72. ,r0 ; /42/ No
40$: calls putrec ,<r3,r0,#LUN.LO>; /42/ Dump a (partial) bufferfull
add #72. ,r3 ; /42/ Move up to next partial
sub #72. ,r4 ; /42/ And try again
br 30$ ; /42/ Next please
50$: 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 <cr><lf>
100$: add #120 ,sp ; pop the local buffer and exit
unsave ; /42/ Unsave R5-R0
return ; bye
.save
.psect $PDATA ,D
110$: .asciz /Length/
120$: .asciz /Type/
130$: .asciz /Paknum/
.even
.restore
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
.dsabl lsb
.sbttl do some logging to TI: ?
senhdr::save <r1> ; /43/
mov #-1 ,pcnt.n+2
clr pcnt.n+0 ; /43/ Clear high order bits
mov #-1 ,pcnt.t+2 ; /44/ Clear timeout stuff
clr pcnt.t+0 ; /44/ Clear timeout stuff
call dovt
bcs 100$
print #$sendh
mov sp ,logini
100$: unsave <r1> ; /43/
return
rechdr::save <r1> ; /43/
mov #-1 ,pcnt.n+2
clr pcnt.n+0 ; /43/ Clear high order bits
mov #-1 ,pcnt.t+2 ; /44/ Clear timeout stuff
clr pcnt.t+0 ; /44/ Clear timeout stuff
call dovt ; vt100 vttype type?
bcs 100$ ; no, forget it
print #$rech ; initial header please
mov sp ,logini ; save we did it already
100$: unsave <r1> ; /43/
return ; bye
reclog::save <r1>
call dolog
bcs 100$
mov pcnt.r+2,r1 ; check for modulo on screen updates
clr r0 ; setup for the divide
div blip ,r0 ; do it
tst r1 ; any remainder left over
bne 100$ ; yes, simply exit
mov vttype ,r0 ; no, dispatch to the correct routine
asl r0
jsr pc ,@recdsp(r0)
100$: unsave <r1>
return
rectty: mov #pcnt.r ,r1 ; /43/ Pass address in r1
call numout
print #$delim
mov #pcnt.s+<4*<<'N&137>-100>>,r1 ; /43/ 32 bits this time
cmp 2(r1) ,pcnt.n+2 ; /43/ unlikely that the nak
beq 100$ ; /43/ count would ever be > 32767
mov 2(r1) ,pcnt.n+2 ; /43/ Use low order 16 bites
call numout
100$: print #$leftm
return
recvt1: call dovt ; vt100 type?
bcs 100$ ; no
tst logini ; need the header?
bne 10$ ; no
call rechdr ; yes
10$: print #$pos1 ; position the cursor
mov #pcnt.r ,r1 ; received packet count /43/
call numout ; dump it
mov #pcnt.s+<4*<<'N&137>-100>>,r1 ; get the sent NAK count /43/
cmp 2(r1) ,pcnt.n+2 ; /43/ Really need to update naks?
beq 90$ ; no
mov 2(r1) ,pcnt.n+2 ; /43/ Stuff low order 16 bits
call nakpos
call numout ; print the NAK count
90$: call dotmo ; /44/ DO timeouts
print #$leftm
100$: return
; for sending files, log transactions here
senlog::save <r1>
call dolog
bcs 100$
mov pcnt.s+2,r1 ; check for modulo on screen updates
clr r0 ; setup for the divide
div blip ,r0 ; do it
tst r1 ; any remainder left over
bne 100$ ; yes, simply exit
mov vttype ,r0
asl r0
jsr pc ,@sendsp(r0)
100$: unsave <r1>
return
sentty: mov #pcnt.s ,r1 ; /43/ 32 bits now
call numout
print #$delim
mov #pcnt.r+<4*<<'N&137>-100>>,r1 ; get the sent NAK count
cmp 2(r1) ,pcnt.n+2
beq 100$
mov 2(r1) ,pcnt.n+2
call numout
100$: print #$leftm
return
senvt1: tst logini ; need the header?
bne 10$ ; no
call senhdr ; yes
10$: print #$pos1 ; position the cursor
mov #pcnt.s ,r1 ; /43/ 32 bits now
call numout
mov #pcnt.r+<4*<<'N&137>-100>>,r1 ; get the sent NAK count
cmp 2(r1) ,pcnt.n+2
beq 90$
mov 2(r1) ,pcnt.n+2
call nakpos
call numout
90$: call dotmo ; /44/ Timeouts
print #$leftm
100$: return
.sbttl data for packet transfer logging
.save
.psect $vtdat ,ro,d,lcl,rel,con
$sendh: .byte 33,'<
.ascii <cr><33>/[2KPackets sent : Naks: /
.asciz / Timeouts: /
$rech: .byte 33,'<
.ascii <cr><33>/[2KPackets received : Naks: /
.asciz / Timeouts: /
$pos1: .asciz <cr><33>/[20C/ ; goto column 20
$pos2: .asciz <33>/[14C/ ; move over 14 please
$leftm: .byte cr,0 ; goto left margin please
$delim: .asciz #/#
.even
sendsp: .word sentty ,senvt1 ,senvt1 ,senvt1 ,senvt1 ,senvt1 ,senvt1
recdsp: .word rectty ,recvt1 ,senvt1 ,senvt1 ,senvt1 ,senvt1 ,senvt1
.assume tty eq 0
.assume vt100 eq 1
.restore
numout: save <r0,r1,r2> ; /43/ Use $CDDMG from SYSLIB
sub #20 ,sp ; /43/ Allocate a buffer please
mov sp ,r0 ; /43/ Point to buffer for $CDDMG
clr r2 ; /43/ We want leading zero and spaces
call $cddmg ; /43/ out please
clrb @r0 ; /43/ Make into .asciz
mov sp ,r0 ; /43/ Reset pointer
print r0 ; /43/ Dump the string and exit
add #20 ,sp ; /43/ Pop buffer
unsave <r2,r1,r0> ; /43/ Pop registers and exit
return ; /43/ Exit
global <$cddmg> ; /43/ From syslib.olb
.sbttl decide what to do about logging
.enabl lsb
dovt: cmpb vttype,#vt100 ; a vt100 today?
blo 90$ ; /39/ no, but allow vt220 type
dolog: tst blip ;
beq 90$ ; do not do this at all
tst infomsg ; /51/ Don't do if SET QUIET
beq 90$ ; /51/
tst remote ; a server?
bne 90$ ; could be
tst xmode ; text reply?
bne 90$ ; yes
br 100$ ; debug is ok then
90$: sec
return
100$: clc
return
global <blip>
.dsabl lsb
nakpos: print #npos
return
.save
.psect $PDATA ,D
npos: .asciz <cr><33>/[38C/ ; goto column 38
dpos: .asciz <cr><33>/[59C/ ; /44/ For timeout count
.even
.restore
dotmo: mov #pcnt.r+<4*<<'T&137>-100>>,r1 ; /44/ Get timeout count
cmp 2(r1) ,pcnt.t+2 ; /44/ Timeout count has changed?
beq 100$ ; /44/ No, just exit
mov 2(r1) ,pcnt.t+2 ; /44/ Yes, update counter
print #dpos ; /44/ Position cursor
call numout ; /44/ Dump please
100$: return
global <pcnt.n ,pcnt.r ,pcnt.s ,remote ,xmode ,vttype>
global <pcnt.t>
.sbttl Control A packet stats 09-Dec-86 07:46:02
.enabl lsb
; This is simliar to the vms kermit's Control A status line,
; which is just like that used in FTP. The useful way to use
; this is to, in the KERMIT.INI file, add a line to modify
; the packet count interval: to turn it off, SET UPDATE 0,
; otherwise its MOD value. Typing control A will print the
; char count stat.
cs$in:: mov #210$ ,r0 ; /56/ Save please
mov #filein ,r1 ; /56/ Address of data to print
br 10$ ; /56/ Common code now
; /56/
cs$out::mov #200$ ,r0 ; /56/ Save please
mov #fileout,r1 ; /56/ Address of data to print
10$: Message <[> ; /56/ Header for line
call numout ; /56/ Dump the character count
Print r0 ; /56/ Formatting
Print #filnam ; /56/ The name of the file
Message <]>,CR ; /56/ All done
clr logini ; /56/ Needed if packet counting
return ; /56/ Exit
.Save ; /56/ Save current Psect
.Psect $Pdata ,d ; /56/ Switch to data psect
200$: .asciz <33>/[K Characters sent for /
210$: .asciz <33>/[K Characters received for /
.even ; /56/ Insure word alignment
.Restore ; /56/ Pop old psect
.Dsabl lsb ; /56/ All done
Global <filein,fileout,filnam> ; /56/
.sbttl 32 bit conversion from rsx syslib
.GLOBL $CBTA ;Global reference
.GLOBL $SAVRG ;Global reference
.GLOBL $CDDMG
$CDDMG: JSR R5,$SAVRG
MOV R0,R3
MOV #23420,R4
MOV #12,R5
TST R2
BEQ C00024
C00022: BIS #1000,R5
C00024= C00022+2
CMP (R1),R4
BCC C00104
MOV (R1)+,R0
MOV (R1),R1
DIV R4,R0
MOV R1,-(SP)
MOV R0,R1
BEQ C00064
MOV #24000,R2
CALL C00072
BIS #1000,R5
MOV R0,R3
C00064: MOV (SP)+,R1
MOV #20000,R2
C00072: MOV R3,R0
BIS R5,R2
CALL $CBTA
BR C00116
C00104: MOV #5,R2
C00110: MOVB #52,(R0)+
SOB R2,C00110
C00116: RETURN
.end