-
Notifications
You must be signed in to change notification settings - Fork 0
/
k11dia.mac
1618 lines (1385 loc) · 43 KB
/
k11dia.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
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.title K11DIA dial command for kermit-11
.ident /t2.40/
; 18-Oct-85 20:06:09 Brian Nelson
;
; 04-Dec-85 11:22:32 BDN Add optional linked list structure to
; define modem responses, will be useful
; when adding a SET DIAL command.
; 06-Dec-85 11:53:59 BDN Added extra field in DEFINE macro and
; support code to call external routines
; for dialing, needed for PRO/TMS.
; 09-Jan-86 17:48:17 RTM Added support for the RIXON Intelligent
; (RTM01) autodial modem (R212A).
;
; 13-Feb-86 10:10:08 BDN Put the DF112 and DF224 responses into
; linked lists.
; 23-Sep-86 14:10:30 BDN Vadic 4224 modems
; 23-Sep-86 14:10:42 BDN Added format effector %M for pulse/tone
; if a SET PHONE PULSE/TONE was done. Also
; added %B for 'blind' dialing, enabled if
; SET PHONE BLIND
; 30-Sep-86 13:05:53 BDN Added CTS2424, Also SHO DIAL
; 09-Feb-89 00:00:00 JCH Complete definition of DF224 modem.
;
; Copyright (C) 1985 1986 Change Software, Inc.
;
;
; Its about time for a DIAL command. Would be really nice to use
; on my PRO/350 and the XK: port. Of limitted utility on the 44
; as I have to enter the GANDALF PACX to access the VADIC 212PAR
; modems.
;
; As noted in a number of comments, the timer support for RSTS/E
; is abbysmal, the only thing you can do is SLEEP n, where 'n' is
; in seconds. Even worse is the fact that various asynchronous
; events can prematurely cancel the sleep, like a delimiter typed
; at a terminal allocated to the job. Also, you can NOT do a mark
; time on RSTS/E, though version 9 does have the groundwork layed
; for adding timer AST's in that v9 supports asych i/o, thus the
; needed executive data structures are mostly present.
;
; I do not mean to knock RSTS/E really, RSTS has a great number
; of features that make interfacing with the terminal driver much
; simpler than what one finds on RSX and RT11, while at the same
; time introducing its own peculiarities. RSX is by far the worst
; as I often find grossly dissimiliar behavior between RSX sites.
;
; As a final reflection, if I were to grade RSTS, RT and RSX on
; simplicity and stability of terminal driver interfacing, RT11
; would have to come first (both MT and XC/XL versions), followed
; by RSTS and bringing up the rear, RSX (I've been burned on both
; RSX and RSTS when new versions came out, though being a RSTS/E
; field test site tends to help).
.if ndf, K11INC
.ift
.include /IN:K11MAC.MAC/
.endc
.enabl lc
.nlist
; It would be nice to be able to do this in a macro call but the
; PDP-11 assembler does not allow continuation lines. So what we
; will instead do is define each arg as a word offset from a base
; address of a list for that modem.
; In many cases we could fit all the info on one line, but macros
; dragged out that way are unreadable. It would be really nice to
; be able to say:
;
; moddef type = <VA212PAR> - ,
; dial.time = 30. - ,
; wake.string = ..... and so on.
;
; .macro moddef dial.t,wake.s,wake.r,wake.p,dmod.s,dmod.p,dial.s,dial.r
;
; Losely based on CKUDIAL.C
;
; All times for delays are in TICKS (1/60 second intervals)
;
; dial.time Time the modem may use to dial a number
; wake.string Get modems attention, like in VADIC 212 ^E<CR>
; wake.rate Delay in milliseconds modem may need
; wake.prompt Modems command mode prompt
; dmod.string String needed to get it to dial a number
; dmod.prompt Dial mode prompt
; dial.string The string for dial, includes a %s for number position
; dial.rate delay between sending numbers over, in TICKS
; wake.ack as in va212, 'HELLO:I'M READY'
; dial.ack string to wait for to confirm number
; dial.echo
;
; WARNING: If any of these values are CHANGED, and there is absolutely
; NO reason to do so, you must check K11ST0.MAC where a few of these
; are also defined for the SET DIAL command. Anything new that's need-
; ed in the modem database is always added on to the END of the list.
; While it is freely acknowledged that there are now a couple of ob-
; solete fields, it doesn't cost that much. Leave the structure alone.
mod.next =: 0 ; next modem in list
mod.str =: 2 ; address of name of modem
mod.val =: 4 ; numeric value for dispatching
dial.time =: 6 ; value of dial time
wake.string =: 10 ; address of wakeup string
wake.rate =: 12 ; value of delay
wake.prompt =: 14 ; address of wakeup prompt
dmod.string =: 16 ; address of dial dial string
dmod.prompt =: 20 ; address of prompt returned for dial
dial.string =: 22 ; address of formatting string for dial
dial.rate =: 24 ; value of delay
wake.ack =: 26 ; address of wakeup response
dial.ack =: 30 ; 1st = waitfor, 2nd to confirm number
dial.online =: 32 ; online ack string
dial.blind =: 34 ; blind ack
dial.wait =: 36 ; String for PAUSE characters
dial.confirm =: 40 ; string to confirm number for dialing
dial.go =: 42 ; ie, va212 returns "DIALING\n"
res.bin =: 44 ; if <>, returns status with \n
; otherwise a binary response (DF03)
dial.echo =: 46 ; if <>, numbers are echoed immediately
mod.comment =: 50 ;
res.head =: 52 ;
ext.dial =: 54 ; if ne, address of external dialer
dial.xabort =: 56 ; /45/ To abort call from modem
dial.idle =: 60 ; /45/ Place modem in IDLE state
dial.pulse =: 62 ; /45/ Switch to pulse dialing
dial.nopulse =: 64 ; /45/ Switch to tone dialing
def.guard =: 66 ; /45/ last thing (unused)
.psect modinf ,ro,d,lcl,rel,con
.enabl lc
.macro modval val,offset
.save
.psect modinf
. = $$current + offset
.word val
.restore
.endm modval
.macro modstr s,offset
.save
.psect string
$$addr = .
$$ = 0
.irpc ch,<s>
ch1 = ''ch
.if eq, ch1 - '^
.ift
$$ = 100
.iff
.if ne ,$$
.if ge , <ch1!40> - <'a!40>
.iif le, <ch1!40> - <'z!40>, ch1 = ch1&137
.endc
.endc
.byte ch1-$$
$$ = 0
.endc
.endr
.byte 0
.restore
.save
.psect modinf
. = $$current + offset
.word $$addr
.restore
.endm modstr
.sbttl inialize subfields of modem info structure
.macro dial$time val
modval val,dial.time
.endm dial$time
.macro wake$rate val
modval val,wake.rate
.endm wake$rate
.macro dial$rate val
modval val,dial.rate
.endm dial$rate
.macro wake$string s
modstr <s>,wake.string
.endm wake$string
.macro wake$prompt s
modstr <s>,wake.prompt
.endm wake$prompt
.macro dmod$string s
modstr <s>,dmod.string
.endm dmod$string
.macro dmod$prompt s
modstr <s>,dmod.prompt
.endm dmod$prompt
.macro dial$string s
modstr <s>,dial.string
.endm dial$string
.macro mod$comment s
modstr <s>,mod.com
.endm mod$comment
.macro dial$ack s
modstr <s>,dial.ack
.endm dial$ack
.macro dial$confirm s
modstr <s>,dial.confirm
.endm dial$confirm
.macro dial$online s
modstr <s>,dial.online
.endm dial$online
.macro dial$blind s
modstr <s>,dial.blind
.endm dial$blind
.macro dial$wait s
modstr <s>,dial.wait
.endm dial$wait
.macro dial$go s
modstr <s>,dial.go
.endm dial$go
.macro dial$echo v
modval v,dial.echo
.endm dial$echo
.macro dial$pulse s ; /45/ String to force PULSE dialing
modstr <s>,dial.pulse ; /45/ ...
.endm dial$pulse ; /45/ ...
.macro dial$nopulse s ; /45/ String to force tone dialing
modstr <s>,dial.nopulse ; /45/ ...
.endm dial$nopulse ; /45/ ...
.macro dial$xabort s ; /45/ Use this field if we detect
modstr <s>,dial.xabort ; /45/ a control C abort and need
.endm dial$xabort ; /45/ to get the modem to stop dialing
.macro dial$idle s ; /45/ Switch from command mode to
modstr <s>,dial.idle ; /45/ to IDLE mode
.endm dial$idle ; /45/
.macro ext$dial v
modval v,ext.dial
.endm ext$dial
.macro res$bin v
modval v,res.bin
.endm res$bin
.macro wake$ack s
modstr <s>,wake.ack
.endm wake$ack
$$prev = modinf
$$seq = 1
.save
.psect usermd ,rw,d,gbl,rel,con
null2: .byte 0
null: .byte 0
.psect string ,ro,d,lcl,rel,con
.psect rwdata ,rw,d,lcl,rel,con
bell: .byte 'G&37,'G&37,0
.even
modtyp: .word 0
buffer: .blkb 200
ttbuff: .blkb 200
.restore
.macro define lab ,s ,user
.if nb ,user ; if we are defining the 'user'
.ift ; modem we need to be in a global
.save ; psect to be located in the root
.psect usermd ,rw,d,gbl,rel,con ; put a reference to this psect
.iff ; in k11dat
$modtail== . ; to manually set link to 'usermd'
.endc ;
.iif ndf, $$prev ,$$prev = modinf
$$current = . ; save current pc
$res = 0
$reslast= 0
lab: .word 0 ; link to next please
.iif nb, user, .globl lab ; must be global if USER mode
.save ; save current psect
.psect string ; switch to string psect
$$ = . ; save it's current PC
.asciz /s/ ; insert the modem type string
.even ; always useful for word addressing
.restore ; pop the previous psect (modinf)
.word $$ ; and insert address of the string
$'lab = $$seq ; define sequence value
.word $$seq ; store value in structure
$$seq = $$seq + 1 ; sequence number
.word 30. ; default for dial time
.word null ; default for wakeup
.word 0 ; default for delay
.word null ; default for command mode prompt
.word null ; default for dial command
.word null ; default for dial prompt
.word null ; default for dial formatting
.word 0 ; default for dial delay
.word null ; default for wakeup ack
.word null2 ; default for ack string
.word null ; default for dial.online
.word null ; default for dial.blind
.word null ; default for dial.wait
.word null ; default for dial.confirm
.word null ; default for dial.go
.word 0 ; 0 normal, else 1 for binary (res.bin)
.word 0 ; default for dial.echo
.word null ; default for MOD$COMMENT
.word 0 ; res.head
.word 0 ; possible external dialer address
.word null ; /45/ Default for XABORT string
.word null ; /45/ Default for IDLE string
.word null ; /45/ Default for PULSE dialing
.word null ; /45/ Default for TONE dialing
.word 0 ; guard word
$$end = .
$$size = $$end - $$current
.assume $$size eq <def.guard+2>
.if b ,user ; we don't want psect errors from
.ift ; MAC for the USER modem type.
. = $$prev
.word lab
. = $$end
$$prev = lab
.iff
.restore ; for USER type, return to old psect
.endc ; Also, the USER modem MUST be last
.endm define
.sbttl create a linked list, header in res.head
; Added edit /39/ Brian Nelson 4-DEC-1985 09:46
;
; Create a linked list of possible modem responses. The
; advantages of this is that we could use a SET DIAL command
; to create a modem data structure at run time, and that
; defining modems is simplified. As a note, there is no
; requirement to use this structure. It will be used for the
; DEFAULT entry in the 'GETSTS' routine.
;
;
; Format is: res.head(current_modem) --> first entry
;
;
; Entry format: .word next (or zero for tail)
; .word class (-1 fail, 0 info, 1 sucess)
; .asciz /response_string/
CONNECT = 1
INFO = 0
FAILED = -1
.save
.psect resdat ,rw,d,lcl,rel,con
resdat:
.restore
.macro mod$res s,class
.save ; save current psect context
.psect resdat ,rw,d,lcl,rel,con
$res1 = . ; save current pc in 'resdat'
.word 0 ; link to next is zero
.if b, class ; if class not specified, then
.word 0 ; make it zero
.iff ; else insert it
.word class ; response class
.endc ; if b, class
.asciz /s/ ; the actual text
.even ; must do
.restore ; get last psect
.if eq ,$res ; is this first time for new
.ift ; type ?
modval $res1,res.head ; yes, stuff the link header
.iff ; not the first time
.save ; save current psect context
.psect resdat ; and a new one
$respc = . ; save the current pc
. = $reslast ; backup to link word from previous
.word $res1 ; insert address of new entry
. = $respc ; restore correct pc
.restore ; restore old psect context
.endc ; end
$reslast = $res1 ; lastlink = current_entry
$res = 1 ; not the first time anymore
.endm ; thats it
.list
.sbttl finally, we can define the modem
.psect modinf ,ro,d,lcl,rel,con
; All xxxx$rate values are in TICKS (1/60 second)
; WARNING: The definition for USER_DEFINED MUST be last !!!!!!!
; WARNING: Before accessing any data here from outside of this
; module (overlay), insure the overlay is loaded, as in calling
; FINDMODEM with the modem type string .asciz pointed to by R5.
modinf::
define v2pa ,<VA212PA> ; stand alone VA212PA
dial$time 35.
wake$string <^E^M>
wake$rate 10 ; wait 8 ticks (8/60 second)
wake$ack <HELLO:I'M READY>
wake$prompt <*>
dmod$string <D^M>
dmod$prompt <?>
dial$string <%s^M>
dial$rate 10
dial$ack <^M>
dial$confirm <^M>
dial$go <DIALING>
dial$echo 1
dial$xabort <^M>
dial$idle <I^M>
dial$wait <K>
mod$comment <Stand alone VADIC VA212>
mod$res <ON LINE> ,CONNECT
mod$res <ONLINE> ,CONNECT
mod$res <BUSY> ,FAILED
mod$res <FAILED CALL> ,FAILED
mod$res <NO DIAL> ,FAILED
mod$res <VOICE> ,FAILED
mod$res <TIME OUT> ,FAILED
mod$res <RINGING> ,INFO
define v2par ,<VA212PAR> ; rack mounted VA212PAR
dial$time 35.
wake$string <^E^M>
wake$rate 10
wake$ack <HELLO:I'M READY>
wake$prompt <*>
dmod$string <D^M>
dmod$prompt <?>
dial$string <%s^M>
dial$rate 10
dial$go <DIALING>
dial$echo 1
dial$xabort <^M>
dial$idle <I^M>
dial$wait <K>
mod$comment <Rack mounted VADIC VA212PAR>
mod$res <ON LINE> ,CONNECT
mod$res <ONLINE> ,CONNECT
mod$res <BUSY> ,FAILED
mod$res <FAILED CALL> ,FAILED
mod$res <NO DIAL> ,FAILED
mod$res <VOICE> ,FAILED
mod$res <TIME OUT> ,FAILED
mod$res <RINGING> ,INFO
define vadic ,<VADIC> ; stand alone VA212PA
dial$time 35.
wake$string <^E^M>
wake$rate 10
wake$ack <HELLO:I'M READY>
wake$prompt <*>
dmod$string <D^M>
dmod$prompt <?>
dial$string <%s^M>
dial$rate 10
dial$ack <^M>
dial$confirm <^M>
dial$go <DIALING>
dial$echo 1
dial$xabort <^M>
dial$idle <I^M>
dial$wait <K>
mod$comment <Generic VADIC with autodial>
mod$res <ON LINE> ,CONNECT
mod$res <ONLINE> ,CONNECT
mod$res <BUSY> ,FAILED
mod$res <FAILED CALL> ,FAILED
mod$res <NO DIAL> ,FAILED
mod$res <VOICE> ,FAILED
mod$res <TIME OUT> ,FAILED
mod$res <RINGING> ,INFO
define cts24 ,<CTS2424> ; CTS (Fabritek) 2424 autodial
dial$time 35.
wake$string <^T^WAT^Q^M> ; Just in case add ^Q<cr> in also
wake$rate 10
wake$ack <Modem Ready>
dial$string <D%M%B%S^M>
dial$rate 10
dial$xabort <^T^W>
dial$idle <^T^W>
dial$wait <+>
dial$pulse <P>
dial$nopulse <T>
dial$blind <&>
dial$echo 1
mod$comment <CTS/Fabri-Tek 2424AD V.22bis Autodialier>
mod$res <Ring> ,INFO
mod$res <Busy> ,FAILED
mod$res <Dead Line> ,FAILED
mod$res <Disconnect> ,FAILED
mod$res <Modem Ready> ,INFO
mod$res <No Answer> ,FAILED
mod$res <No Dialtone> ,FAILED
mod$res <No Tone> ,FAILED
mod$res <On Line> ,CONNECT
mod$res <On Line Originate>,CONNECT
mod$res <Redialing> ,INFO
define va42 ,<VA4224> ; Rack mount 2400 baud
dial$time 35.
wake$string <^E^M>
wake$rate 10
wake$ack <HELLO:I'M READY>
wake$prompt <*>
dial$string <D%M%S%B^M>
dial$rate 10
dial$go <DIALING>
dial$echo 1
dial$xabort <^M>
dial$idle <I^M>
dial$wait <K>
dial$pulse <P>
dial$nopulse <T>
dial$blind <B>
mod$comment <Vadic 4224 CCITT V.22bis autodial>
mod$res <ON LINE> ,CONNECT
mod$res <ONLINE> ,CONNECT
mod$res <BUSY> ,FAILED
mod$res <FAILED CALL> ,FAILED
mod$res <NO DIAL> ,FAILED
mod$res <VOICE> ,FAILED
mod$res <TIME OUT> ,FAILED
mod$res <RINGING> ,INFO
mod$res <ON LINE 300> ,CONNECT
mod$res <ON LINE 1200> ,CONNECT
mod$res <ON LINE 2400> ,CONNECT
mod$res <ERROR CONTROL> ,INFO
mod$res <NO ERROR CONTROL>,INFO
define df03 ,<DF03> ; dec DF03
dial$time 30.
wake$string <^A^B>
dial$string <%s>
dial$echo 1
res$bin 1 ; responds in binary (no crlf)
mod$comment <DEC DF03AC Autodial modem>
define df100 ,<DF100> ; a DF112
dial$time 30.
wake$string <^B>
wake$rate 0
wake$ack <Ready>
wake$prompt <Ready>
dial$string <%s#> ; /45/
dial$rate 10
dial$xabort <^M>
dial$echo 1
mod$comment <DEC Standalone DF112>
mod$res <Attached> ,CONNECT
mod$res <Busy> ,FAILED
mod$res <Disconnected> ,FAILED
mod$res <Error> ,FAILED
mod$res <No answer> ,FAILED
mod$res <No dial tone> ,FAILED
mod$res <Speed:> ,FAILED
define df200 ,<DF200> ; a DF2xx ?
dial$time 30.
wake$string <^B>
wake$rate 0
wake$ack <Ready>
wake$prompt <Ready>
dial$string <%b%m%s!> ; /60/
dial$rate 0
dial$xabort <^B> ; /60/
dial$echo 1
dial$pulse <P> ; /60/
dial$nopulse <T> ; /60/
dial$blind <^A> ; /60/
mod$comment <DEC Standalone DF224>
mod$res <Attached> ,CONNECT
mod$res <Busy> ,FAILED
mod$res <Disconnected> ,FAILED
mod$res <Error> ,FAILED
mod$res <No answer> ,FAILED
mod$res <No dial tone> ,FAILED
mod$res <Speed:> ,FAILED
define hayes ,<HAYES> ; actually, its a VOLKSMODEM 12
dial$time 35. ; that we are testing with. It's
wake$string <ATZ V1^M> ; supposed to be compatible.
wake$rate 0
wake$ack <OK>
wake$prompt <OK>
dmod$string <>
dmod$prompt <>
dial$string <AT D %s^M>
dial$rate 0
dial$echo 1
define microcom,<MICROCOM> ;
dial$time 35.
wake$string <4445^MSE2^MS1C0^MSCE ON^M>
wake$rate 10
wake$ack <!>
wake$prompt <!>
dial$string <D%s^M>
dial$rate 10
dial$echo 1
mod$res <CONNECT> ,CONNECT
mod$res <NO CONNECT> ,FAILED
mod$res <!> ,FAILED
mod$comment <MicroCom SX1200>
; The following entry was added by edit (RTM01).
define r212a ,<R212A> ; RIXON R212A Intelligent modem.
dial$time 60. ; Long timeout for overseas.
wake$string <^M^M>
wake$rate 10 ; wait 8 ticks (8/60 second)
wake$ack <RIXON R212A INTELLIGENT MODEM>
wake$prompt <$>
dmod$string <K>
dmod$prompt <NUMBER:>
dial$string <%s^M>
dial$rate 10
; dial$ack <^M>
; dial$confirm <^M>
dial$go <DIALING:>
dial$echo 1
mod$comment <RIXON R212A Intelligent Modem>
mod$res <ON LINE> ,CONNECT
mod$res <ON-LINE> ,CONNECT
mod$res <NO ANSWER> ,FAILED
mod$res <DEAD LINE> ,FAILED
mod$res <BUSY> ,FAILED
mod$res <END D> ,INFO
mod$res <RINGING> ,INFO
define protms ,<PROTMS> ; this one has to use QIOS for dial
ext$dial tmsdial ; we will have to catch this one in
; a not so clean manner. Waiting for
; Steve Kovey's code for support.
.sbttl define user defined modem structure
; This one <USER_DEFINED> MUST be the last one in the list. The link
; must be inserted at run time via a call to FINDMODEM with a known
; type, like CALLS FINDMO,<#vadid>.
; NONE of the field macros used above will work for this since the
; psect it's in is global.
; Setting up the fields is fairly simple, for example, setting the
; wakeup string would be:
;
; mov #usermd ,r4
; strcpy #udiawake,argbuf
; mov #udiawake,wake.string(r4) ; stuff wakeup string addr
;
; And setting a reponse string, assuming CONNECT is success
;
; mov #usermd ,r4 ; address of data structure
; mov #contxt ,res.header(r4) ; and stuff the list in
;
; contxt: .word faitxt ; link to next
; .word 1 ; > 0 for indicating connect
; .asciz /CONNECT/ ; the string itself
; .even ; please
; faitxt: .word 0 ; no link to next
; .word -1 ; flag call failed
; .asciz /NOCONNECT/ ; the text if it fails
; .even ; please
;
; Where udiawake was a area in the root, defined in K11DAT.MAC
; Keep in mind that the code which looks for a response will NOT
; exit until (1) nothing happens for 30 seconds or (2) it finds
; a match in the list with a non-zero status.
define usermd ,<USER_DEFINED>,GLOBAL ; This MUST be the last one
; No more definitions allowed past here
.sbttl local macros to make life simpler
.macro lowcase s
mov s ,r0
call lowcas
.endm lowcase
.macro sleep time
calls suspend ,<time,#0>
.endm sleep
.macro tsleep ticks
calls suspend ,<#0,ticks>
.endm tsleep
.macro ttputstr s
mov r1 ,-(sp)
mov s ,r1
call doput
mov (sp)+ ,r1
.endm ttputstr
.macro ttputc c
clr -(sp)
bisb c ,(sp)
mov sp ,r0
calls binwri ,<r0,#1,#lun.ti>
tst (sp)+
.endm ttputc
.macro ttgetc wait
; lun.ti is the remote lun
.if b ,wait
.ift
calls xbinread,<#lun.ti,#0>
.iff
calls xbinread,<#lun.ti,wait>
.endc
.endm ttgetc
.macro waitfor s ,time,fail
.if b ,time
.ift
clr -(sp)
.iff
mov time ,-(sp)
.endc
mov s ,-(sp)
call waitfor
.if nb, fail
tst r0
beq fail
.endc
.endm waitfor
.macro waitc c ,time
clr -(sp)
mov sp ,r0
movb c ,(r0)
.if b ,time
.ift
clr -(sp)
.iff
mov time ,-(sp)
.endc
mov r0 ,-(sp)
call waitfor
tst (sp)+
.endm waitc
.macro didweget s,pat,status,ret,?b
.save
.psect string
$$ = .
.asciz /pat/
.restore
mov #$$ ,-(sp)
mov s ,-(sp)
call didweget
tst r0
beq b
mov status ,ret
b:
.endm didweget
remmod = ter$cc
.sbttl REDIAL command
.psect $code
.enabl lsb
c$redi::mov argbuf ,r3 ; /40/ argbuf address
mov phnum ,r2 ; /40/ address of phone number
mov #1 ,r4 ; /40/ default repeat count
tstb @r3 ; /40/ Any repeat count passed ?
beq 5$ ; /40/ No
calls l$val ,<r3> ; /40/ retry count
mov r1 ,r4 ; /40/ save repeat count
tst r0 ; /40/ success ?
beq 5$ ; /40/ yes
message <Invalid number!>,cr
br 90$ ; /40/ exit
5$: tstb @r2 ; /40/ Any real phone number today?
bne 10$ ; /40/ yes
message <No previous number!>,cr
br 90$ ; /40/ exit if no DIAL command
10$: message <Using: > ; /40/ echo the number we will use
print r2 ; /40/
message ; /40/ crlf
strcpy r3 ,r2 ; /40/ copy old phone num to 'argbuf'
20$: tst cccnt ; /40/ control C abort ?
bne 90$ ; /40/ Yes, exit this loop NOW
mov r4 ,-(sp) ; /40/ save looping counter
call c$dial ; /40/ no, try dialing
mov (sp)+ ,r4 ; /40/ restore looping counter
tst r0 ; /40/ success ?
beq 100$ ; /40/ yes
sob r4 ,20$ ; /40/ No, try again please
90$: mov #-1 ,r0 ; /40/ failure
inc status ; /45/ Set global flag also
100$: return
.dsabl lsb
set$mo::strcpy #modem ,argbuf
call findmodem
tst r0
bne 100$
mov #-1 ,r0
inc status ; /45/ Global flag also
return
100$: clr r0
return
.sbttl the DIAL command
.psect $code
.enabl lsb
c$dial::strcpy phnum ,argbuf ; /40/ save the phone number
tstb ttdial ; check for a real terminal name
bne 10$ ; ok
message <Please use the SET LINE command first>,cr
br 90$ ; exit
10$: tstb modem ; check for a SET MODEM command
bne 20$ ; ok
tst proflg ; /39/ is this a pro/350 ?
beq 15$ ; /39/ no, fatal error
cmpb ttdial ,#'X&137 ; /39/ check for XTn:
bne 15$ ; /39/ no
cmpb ttdial+1,#'T&137 ; /39/ if so, must be TMS on P/OS
bne 15$ ; /39/ no, so no modem type fatal
strcpy #modem ,protms+mod.str ; /39/ stuff 'PROTMS' in please
br 20$ ; /39/ lookup the modem now
15$: message <Please use the SET MODEM command first>,cr
br 90$
20$: call findnumber ; /45/ Perhaps a SET PHO NUM ?
bcs 90$ ; /51/
call findmodem ; do we know about this modem ?
mov r0 ,modtype ; save the address of descriptor
beq 90$ ; no luck, exit with failure
mov ext.dial(r0),r1 ; /39/ need external routine to dial?
beq 30$ ; /39/ no
jsr pc ,@r1 ; /39/ yes, call it then
br 120$ ; /39/ and exit
30$: mov dial.string(r0),r0 ; /39/ get dial formatting string addr
tstb @r0 ; /39/ anything there ?
bne 40$ ; /39/ yes
message <A dial formatting string has not been defined>,cr
br 90$ ; /39/ exit
40$: calls ttyini ,<#ttname,#lun.ti,#remmod>
tst r0 ; did we get a successful open on line?
bne 80$ ; no, emit some sort of error message
call tidias ; /45/ Set characteristics (TC.DLU)
call getatn ; try to get modems attention
tst r0 ; did getting modems attn succeed?
beq 90$ ; no
call dodial ; actually try to dial the number now
mov r0 ,-(sp) ; /45/ Save status return
call tidiar ; /45/ Reset characteristics
mov (sp)+ ,r0 ; /45/ Restore status return
tst r0 ; returns 1 for success, zero else
beq 90$ ; failure
br 100$ ; success, return(0) re normal k11
80$: direrr r0 ; emit an error message and exit
90$: mov #-1 ,r0
br 110$
100$: clr r0
110$: call 200$
120$: tst r0 ; /45/ Errors ?
beq 130$ ; /45/ No
inc status ; /45/ Yes, set into global flag
130$: return
200$: mov r0 ,-(sp)
calls ttyfin ,<#ttname,#lun.ti> ; close the terminal up now
mov (sp)+ ,r0
return
.dsabl lsb
.sbttl match type of modem
.enabl lsb
; FINDMODEM
;
; Passed: nothing, assumes MODEM name is in global modem::
;
; Return: r0 address of structure for the modem
; r0 = 0 if the modem type could not be found
;
; Remark: It might be better to call PRINTM to display messages
; to better control the case if we got spawned under RSX
; or RSTS so we could avoid I/O and instead return some
; status info.
findmo::tst $modtail ; /39/ Is the usre mode defined?
bne 5$ ; /39/ Yes
mov #usermd ,$modtail ; /39/ no, insert it please
5$: mov #modinf ,r3 ; get address of head of list
10$: strcmp #modem ,mod.str(r3) ; check for a match please
tst r0 ; a match
beq 80$ ; yes
mov mod.next(r3),r3 ; no, try the next one please
bne 10$ ; keep going
message <This modem type is unknown. The known modem types>,cr
message <are:>,cr
message
mov #modinf ,r3 ; now print the list of modems
20$: print mod.str(r3) ; first one
strlen mod.str(r3) ; /39/ length of modem type
sub #40 ,r0 ; /39/ tab over please
neg r0 ; /39/ make it > 0
30$: print #200$ ; /39/ a space
sob r0 ,30$ ; /39/ next please
print mod.com(r3) ; /39/ dump comment string
message ; cr/lf
mov mod.next(r3),r3 ; next one in list
bne 20$ ; ok
br 90$ ; exit with failure
80$: mov r3 ,r0 ; return address of structure
br 100$ ; bye
90$: clr r0 ; failure
100$: return ; bye
.save
.psect $Pdata ,d
200$: .byte 40,0
.restore
global <modem>
.dsabl lsb
.sbttl Look for defined phone numbers