forked from ResistanceVault/preservation-abbs20
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Node.asm
29275 lines (27488 loc) · 637 KB
/
Node.asm
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
******************************************************************************
****** ******
****** ABBS - Amiga Bulletin Board System ******
****** Written By Geir Inge Høsteng ******
****** ******
******************************************************************************
*****************************************************************
*
* NAME
* Node.asm
*
* DESCRIPTION
* Main source for nodes
*
* AUTHOR
* Jan Erik Olausen
*
* $Id: Node.asm 2.x 1997-2000 10:32:07 Jan Erik Olausen $
*
* MODIFICATION HISTORY
* $Log: Node.asm $
;; Revision 2.xx 2000/06/24 10:32:07 JEO
;; Initial revision
;;
*
*****************************************************************
NOLIST
include 'first.i'
; IFND __M68
include 'exec/types.i'
include 'exec/ports.i'
include 'exec/lists.i'
include 'exec/io.i'
include 'exec/memory.i'
include 'exec/tasks.i'
include 'exec/libraries.i'
include 'exec/execbase.i'
include 'libraries/dos.i'
include 'libraries/gadtools.i'
include 'devices/serial.i'
include 'devices/conunit.i'
include 'devices/timer.i'
include 'intuition/intuition.i'
include 'intuition/screens.i'
include 'dos/dosextens.i'
include 'dos/dos.i'
include 'dos/exall.i'
include 'dos/var.i'
include 'dos/dostags.i'
include 'graphics/gfxbase.i'
include 'graphics/text.i'
include 'utility/tagitem.i'
include 'libraries/asl.i'
include 'rexx/storage.i'
include 'utility/date.i'
; ENDC
include 'fifo.i'
include 'asm.i'
include 'bbs.i'
include 'Abbsfront.i'
include 'xpr.i'
include 'fse.i'
include 'node.i'
include 'tables.pro'
include 'tables.i'
include 'msg.pro'
include 'paragon.pro'
include 'transfer.pro'
include 'browse.pro'
include 'QWK.pro'
include 'rexx.pro'
include 'nodedefs.i'
include 'noderefs.i'
include 'NodeSupport.pro'
XREF _Make_conf_text
XREF _CheckInvited
XREF _WriteLineNr
XREF _PackUserDoFiles
XREF _JEO_NewFiles
;nobreak = 1
;exceptionhandler = 1
IFEQ sn-13
;NOINIT = 1
;nocarrier = 1 ; I transfer.asm også
;FullGrab = 1
ENDC
minwindowx = 272 ; obs også i tables.asm
minwindowy = 30 ; obs også i tables.asm
maxwindowx = -1 ; obs også i tables.asm
maxwindowy = -1 ; obs også i tables.asm
section kode,code
first jmp (main) ; Hopper til hovedprog start.
dc.b 0,'$VER: '
versionstr dc.b 'ABBS '
version
date
dc.b 0
*******************************************************************************
* *
* * * * * * * * * * * * * * * Kode for Noden(e) * * * * * * * * * * * * * * * *
* *
*******************************************************************************
cnop 0,4
nodestart
dc.l 16,0
nstart move.l (exebase),a6
move.l a7,a5 ; Liten hack for å huske start stack'en
jsrlib Forbid ; sikrer at vi starter alene
jsr (doallsetup) ; åpner, og initer alt
beq.b 9$ ; Noe gikk galt
1$ bsr nodemain ; tar en innlogging.
move.b #'6',d0
jsr (writeconchar)
tst.b (ShutdownNode,NodeBase) ; skal noden ned ?
beq.b 1$ ; nei, da tar vi en innlogging til
move.b #'0',d0
jsr (writeconchar)
jsr (doallshutdown) ; lukker og frigir alt
9$ rts ; ;wow. da er denne noden ferdig
nodehook
rts
IFEQ sn-13
checkalloweduser
lea (n_FirstConference+CStr,MainBase),a1
move.b (CommsPort+Nodemem,NodeBase),d0 ; Lokal node ?
beq.b 9$ ; Ja, da har vi lov uansett
move.l (Usernr+CU,NodeBase),d0 ; Er vi supersysop ?
cmp.l (SYSOPUsernr+CStr,MainBase),d0
beq.b 99$ ; Jepp, ikke lov.
moveq.l #0,d0
lea (u_almostendsave+CU,NodeBase),a0
1$ move.b (n_ConfName,a1),d1 ; conf her ?
beq.b 2$ ; nope
move.w (uc_Access,a0),d1
btst #ACCB_Sysop,d1 ; er vi sysop ?
bne.b 9$ ; ja, ut
2$ lea (ConferenceRecord_SIZEOF,a1),a1
lea (Userconf_seizeof,a0),a0
addq.l #1,d0
cmp.w (Maxconferences+CStr,MainBase),d0
bcs.b 1$
setz
9$ notz
99$ bne.b 999$
move.l a1,a0
jsr (writeerroro)
lea (nosysopheretext),a0
jsr (writeerroro)
move.b #Thrownout,(readcharstatus,NodeBase)
setz
999$ rts
ENDC
sysoploginjmp
lea (SYSOPpassword+CStr,MainBase),a0
move.b (a0),d0 ; har vi noe ?
beq nodemain1 ; nei, da dropper vi passord
moveq.l #1,d0 ; 2 forsøk
jsr (getpasswd)
beq endmain
bra.b nodemain1
nodemain
move.b #'7',d0
jsr (writeconchar)
jsr (initrun)
move.b #'8',d0
jsr (writeconchar)
jsr (waitforcaller)
beq endmain
mainnewuser
jsr (initrunlate)
jsr (login)
beq logout
bmi endmain
jsr (stoptimeouttimer)
IFEQ sn-13
bsr checkalloweduser
beq logout
ENDC
btst #DIVB_QuickMode,(Divmodes,NodeBase)
bne.b 1$
lea (postloginfname),a0
moveq.l #0,d0
jsr (typefilemaybeansi)
tst.b (readcharstatus,NodeBase)
bne endmain
1$ jsr (checkcarriercheckser)
beq endmain
jsr (checktimeinbetweenlogins)
beq logout
nodemain1
jsr (registerlogin)
jsr (typestat)
tst.b (readcharstatus,NodeBase) ; noe galt ?
bne logout ; ja
lea loginscrname,a0
sub.l a1,a1 ; ingen feilmelding
jsr (doarexxdoor)
tst.b (readcharstatus,NodeBase) ; noe galt ?
bne logout ; ja
bsr dopersonalloginscript
move.w #-1,(linesleft,NodeBase) ; Vi vil ikke ha noen more her..
moveq.l #0,d0 ; Joiner main
bsr joinnr
menu tst.b (readcharstatus,NodeBase) ; noe galt ?
bne logout ; ja
jsr (checktime)
beq logout
jsr (checkintermsgs)
beq.b 1$
jsr (outimage)
1$ jsr (checkreadptrs)
jsr (getprompttext)
jsr (readlineprompt)
beq nomenuinput
jsr (upword)
movem.l d2/d3,-(sp)
move.w (menunr,NodeBase),d1
lea (menus),a1
move.l (0,a1,d1.w),a1
jsr (scanchoices)
move.l d0,d2
move.l d1,d3
move.b (noglobal,NodeBase),d0
beq.b 4$
tst.l d3
beq.b 5$
moveq.l #0,d1
bra.b 3$
4$ lea (globalchtext),a1
jsr (scanchoices)
tst.l d1
bne.b 3$
tst.l d3
bne.b 3$
5$ movem.l (sp)+,d2/d3
bra notchoices
3$ lea (globaljmptable),a0
cmp.l d1,d3
bcs.b 2$
move.l d2,d0
lea (menujmps),a0
move.w (menunr,NodeBase),d1
move.l (0,a0,d1.w),a0
2$ movem.l (sp)+,d2/d3
subq.l #1,d0
asl.w #2,d0
move.l (0,a0,d0.w),a0
jsr (a0) ; Utfører funksjonen
move.b (readcharstatus,NodeBase),d0 ; Har det skjedd noe ?
beq menu ; Nei...
logout move.w #-1,(linesleft,NodeBase) ; Dropper all more saker ..
move.b #'1',d0
jsr (writeconchar)
jsr (hangup)
move.b #'2',d0
jsr (writeconchar)
moveq.l #1,d0 ; vi skal ta full logout
jsr (endrun)
move.b #'3',d0
jsr (writeconchar)
move.b (userok,NodeBase),d0
beq 3$
move.b #0,(userok,NodeBase)
jsr (unjoin) ; oppdaterer last read.
move.b #'4',d0
jsr (writeconchar)
bsr restorereadpointers
bsr deletereadpointersfile
move.b #'5',d0
jsr (writeconchar)
jsr (logoutsaveuser)
move.b #'6',d0
jsr (writeconchar)
; jsr updatetime ; gjøres i logoutsaveuser
move.w (TimeUsed+CU,NodeBase),d0
add.w (minchat,NodeBase),d0
add.w (minul,NodeBase),d0
sub.w (OldTimelimit,NodeBase),d0
bcc.b 7$
moveq.l #0,d0
7$
; move.w (TimeUsed+CU,NodeBase),d0
; sub.w (minul,NodeBase),d0 ; justerer for upload
; bcc.b 7$
; moveq.l #0,d0
; sub.w (OldTimelimit,NodeBase),d0 ; minutter i forige session
; bcc.b 6$
;7$ moveq.l #0,d0
6$ lea (logtimeusedtext),a0
bsr 20$
move.w (FTimeUsed+CU,NodeBase),d0
beq.b 5$
sub.w (OldFilelimit,NodeBase),d0 ; trekker fra forige session tiden
bcs.b 5$ ; overflow, sier null da => ingenting ..
; sub.w (minul,NodeBase),d0
; bcc.b 8$
; moveq.l #0,d0
8$ lea (logftimeusedtxt),a0
bsr 20$
5$ move.w (tmsgsread,NodeBase),d0
lea (logmsgreadtext),a1
bsr 10$
move.w (tmsgsdumped,NodeBase),d0
beq.b 4$
lea (logmsgdumedtext),a1
bsr 10$
4$ lea (lostcarriertext),a0
cmpi.b #NoCarrier,(readcharstatus,NodeBase)
beq 2$
lea (logfellasletext),a0
cmpi.b #Timeout,(readcharstatus,NodeBase)
beq.b 2$
lea (logthrownoutext),a0
cmpi.b #Thrownout,(readcharstatus,NodeBase)
beq.b 2$
lea (loglogouttext),a0
2$ lea (maintmptext,NodeBase),a1
jsr (strcopy)
subq.l #1,a1
lea (Name+CU,NodeBase),a0
jsr (strcopy)
lea (maintmptext,NodeBase),a0
jsr (writelogstartup)
3$ move.b #'1',d0
jsr (writeconchar)
bsr sendlogoutintermsg
move.b #'2',d0
jsr (writeconchar)
moveq.l #0,d0
move.w (NodeNumber,NodeBase),d0
jsr (connrtotext)
move.l a0,a1
lea (logutscriptname),a0
jsr (executedosscriptparam)
move.b #'3',d0
jsr (writeconchar)
jsr (getscratchpaddelfname) ; sletter scratchpad, safety
jsr (deletepattern)
jsr (cleanupfiles)
move.b #'b',d0
jsr (writeconchar)
jsr (saveconfig)
move.b #'4',d0
jsr (writeconchar)
moveq.l #0,d0
move.b d0,(active,NodeBase)
jsr (changenodestatus)
bra.b endmain
10$ push a1
lea (maintmptext,NodeBase),a0
jsr (konverterw)
lea (maintmptext,NodeBase),a0
pop a1
jmp (writelogtexttimed)
20$ push a0
lea (maintmptext,NodeBase),a0
jsr (konverterw)
lea (maintmptext,NodeBase),a1
pop a0
jmp (writelogtexttimed)
endmain
IFND DEMO
move.b (RealCommsPort,NodeBase),d0 ; Setter tilbake
beq.b 1$ ; ikke serial
move.b #-1,d1 ; fikk vi noen port
cmp.b d0,d1
beq.b 1$ ; vi hadde en..
cmp.b (CommsPort+Nodemem,NodeBase),d0 ; disablet ?
beq.b 1$
; move.b d0,(CommsPort+Nodemem,NodeBase) ; setter tilbake
; jsr (aapnemodem) ; hvorfor åpne igjen ???
jsr (stopserreadcheck)
1$
ENDC
jsr (stoptimeouttimer)
move.b #'5',d0
jsr (writeconchar)
jmp (stopconreadcheck)
notchoices
tst.b (readcharstatus,NodeBase)
bne logout
move.w (menunr,NodeBase),d0
lea (notchoiceschoic),a1
move.l (0,a1,d0.w),d0
beq 1$
move.l d0,a1
jsr (a1)
bmi.b 2$
tst.b (readcharstatus,NodeBase)
bne logout
bra menu
2$ tst.b (readcharstatus,NodeBase)
bne logout
1$ lea (invalidcmdtext),a0
move.b (XpertLevel+CU,NodeBase),d0 ; skal de ha lang text ?
cmpi.b #2,d0
bcc.b 3$ ; ja
lea (Notvalidcomtext),a0
jsr (writeerroro)
move.w (menunr,NodeBase),d0
lea (menus),a1
move.l (0,a1,d0.w),d0
move.l d0,a0
lea (globalchtext),a1
move.b (noglobal,NodeBase),d1
beq.b 4$
lea (nulltext),a1
4$ jsr (writetextformatted)
clr.b (readlinemore,NodeBase) ; flush'er input
bra.b 9$
3$ jsr (writeerroro)
9$ bra menu
nomenuinput
tst.b (readcharstatus,NodeBase)
bne logout
move.w (menunr,NodeBase),d0
lea (nomenuinputch),a0
move.l (0,a0,d0.w),d0
beq menu
move.l d0,a0
jsr (a0)
bne menu
tst.b (readcharstatus,NodeBase)
bne logout
bra menu
readmenunotchoices
push a2/d2
move.l a0,a2
jsr (inputnr)
beq.b 2$ ; ikke tall
andi.l #$ffff,d0
moveq.l #0,d1
move.w (confnr,NodeBase),d1
move.l d0,d2
jsr (typemsg)
bmi.b 1$
move.l d2,(currentmsg,NodeBase)
bra.b 8$
1$ lea (msgnotfoundtext),a0
jsr (writeerroro)
8$ moveq #1,d0
bra.b 99$
2$ jsr (justchecksysopaccess) ; er vi sysop ?
beq.b 9$ ; nei, da var det ihvertfall ukjennt.
move.l a2,a0
lea (readsecretchtxt),a1
jsr (scanchoices)
tst.l d1
beq.b 9$
subq.l #1,d0
asl.w #2,d0
lea (readsecrettable),a0
move.l (0,a0,d0.w),a0
jsr (a0) ; Utfører funksjonen
moveq #1,d0
bra.b 99$
9$ tst.b (readcharstatus,NodeBase)
bne 10$
moveq #-1,d0
99$ pop a2/d2
rts
10$ pop a2/d2
bra logout
markmenunotchoices
jsr (inputnr)
bne.b 3$
IFND DEMO
lea (sntext),a1
jsr (comparestrings)
bne.b 99$
move.l (snumber),d0
jsr (skrivnr)
jsr (outimage)
ENDC
bra.b 99$ ; Ikke noe tall
3$ jsr (allowmark)
bmi.b 9$
beq.b 1$
lea (cantmarkmsgtext),a0
jsr (writeerrori)
bra.b 2$
1$ lea (tmpmsgheader,NodeBase),a0
jsr (insertinqueue)
2$ bsr readmenu
9$ clrn
rts
99$ setn
rts
; execute the personal arexx loginscript, if any
dopersonalloginscript
link.w a3,#-80
move.b (UserScript+CU,NodeBase),d0
beq.b 9$ ; ingen script
move.l sp,a1
lea (ploginscrname),a0
jsr strcopy
subq.l #1,a1
lea (UserScript+CU,NodeBase),a0
jsr strcopy
subq.l #1,a1
lea (dotabbstext),a0
jsr strcopy
move.l sp,a0
sub.l a1,a1 ; ingen feilmelding
jsr (doarexxdoor)
9$ unlk a3
rts
*****************************************************************
* Global meny *
*****************************************************************
;#b
;#c
mainmenu
move.w #0,(menunr,NodeBase) ;Skifter til Main menu
rts
;#c
readmenu
move.w #4,(menunr,NodeBase) ;Skifter til Read menu
rts
;#c
utilitymenu
move.w #12,(menunr,NodeBase) ;Skifter til Utility menu
rts
;#c
chatmenu
move.w #28,(menunr,NodeBase) ;Skifter til chat menu
rts
;#c
miscmenu
move.w #44,(menunr,NodeBase) ;Skifter til misc menu
rts
;#c
dohelp lea helpscriptname,a0
lea sorrynohelptext,a1
jsr (doarexxdoor)
rts
;#c
help jsr (outimage)
move.w (menunr,NodeBase),d0
cmp.w #44,d0 ; er det misc meny ?
bne.b 1$
lea (miscmenuscrname),a0
jsr (getfilelen) ; har vi arexx script ?
beq.b 2$
lea (miscmenuscrname),a0
suba.l a1,a1 ; ingen feilmelding
bsr doarexxdoor ; tar arexx isteden...
bra.b 9$
2$ move.w (menunr,NodeBase),d0
1$ lea (menufiles),a0
move.l (0,a0,d0.w),a0
moveq.l #0,d0
jsr (typefilemaybeansi)
beq.b 9$
move.b (noglobal,NodeBase),d1
bne.b 9$
lea (globalmenufile),a0
moveq.l #0,d0
jsr (typefilemaybeansi)
9$ rts
;#c
Next lea (checkfmsgictext),a0
jsr (writetexto)
beq.b 9$
jsr (joinnextunreadconf)
bne.b 9$
lea (nonewiacmsgtext),a0
jsr (writetexto)
9$ rts
;#c
multijoin
push d2/d3/a2/a3/d4/d5
lea (checkconfstext),a0
jsr (writetexto)
beq 9$
move.w (confnr,NodeBase),d3 ; hvor vi startet
move.w d3,d2 ; Nåværende conf
lea (u_almostendsave+CU,NodeBase),a2
lea (n_FirstConference+CStr,MainBase),a3 ; kan brukeren join'e ?
1$ move.w d2,d0
jsr (getnextconfnrsub)
move.w d0,d1
subi.w #1,d1
add.w d1,d1 ; gjor om til confnr standard
cmp.w d3,d1 ; ferdig ?
beq 9$ ; jepp
move.w d1,d5
mulu #Userconf_seizeof/2,d5
move.w d1,d2 ; nåværende konfnr.
move.w (uc_Access,a2,d5.l),d1
btst #ACCB_Read,d1 ; Er vi medlem her ?
bne.b 1$ ; ja, tar neste
move.w d2,d5
mulu #ConferenceRecord_SIZEOF/2,d5
move.w (uc_Access,a2),d1
btst #ACCB_Sysop,d1 ; Er vi sysop i main ?
bne.b 2$ ; ja, da sjekker vi ikke VIP'en
move.w (n_ConfSW,a3,d5.l),d1
btst #CONFSWB_VIP,d1 ; Kan han join'e denne ?
bne.b 1$ ; nei
2$ move.w d0,d4 ; husker (confnr/2)-1
move.w d2,d0
jsr (typeconfinfo)
beq 9$
lea (conferecetext),a0
jsr (writetext)
lea (n_ConfName,a3,d5.l),a0
jsr (writetexto)
beq 9$
lea (wanttojoinctext),a0
suba.l a1,a1
moveq.l #1,d0 ; y er default
jsr (getyorn)
beq 8$ ; nei, eller noe galt
move.w d2,d0 ; join konf'en
bset #31,d0 ; bare bli medlem
jsr (joinnr)
lea (wanttoskipltext),a0
suba.l a1,a1
moveq.l #1,d0 ; y er default
jsr (getyorn)
beq.b 8$ ; nei, eller noe galt
move.l (n_ConfDefaultMsg,a3,d5.l),d0 ; tar en "M R"
move.w d2,d1
mulu #Userconf_seizeof/2,d1
move.l d0,(uc_LastRead,a2,d1.l)
bra 1$
8$ tst.b (readcharstatus,NodeBase)
beq 1$
9$ pop d2/d3/a2/a3/d4/d5
rts
;#c JEO
opendoor
push d2-d4/a2
link.w a3,#-80
move.l sp,a2
lea (erropendoortext),a0
move.l (rexbase),d0
beq 8$
move.l a2,a1 ; bygger opp setup filnavnet
lea (doorconfigfname),a0
move.w (NodeNumber,NodeBase),d0
jsr (fillinnodenr)
bsr 10$ ; leser inn fila
bne.b 100$ ; ok?
move.l a2,a1 ; Nope, vi bruker default 0
lea (doorconfigfname),a0 ; som er 0 fila
move.w #0,d0 ; nodenummer
jsr (fillinnodenr)
bsr 10$ ; leser inn fila
beq 8$ ; Error?
100$ tst.b (readlinemore,NodeBase) ; er det mere input ?
bne 1$
0$ move.b #0,(readlinemore,NodeBase) ; Sletter for sikkerhets skyld
; og skriver ut menu
lea (maintmptext,NodeBase),a1 ; bygger opp door menu filnavnet
lea (doormenufilname),a0
move.w (NodeNumber,NodeBase),d0
jsr (fillinnodenr)
lea (maintmptext,NodeBase),a0 ; Filnavn i a0
jsr (findfile)
lea (maintmptext,NodeBase),a0 ; skrive ut navn på nytt
bne 101$ ; funnet..
lea (maintmptext,NodeBase),a1 ; Ikke funnet, leser inn default
lea (doormenufilname),a0
move.w #0,d0 ; nodenummer 0 = default
jsr (fillinnodenr)
lea (maintmptext,NodeBase),a0 ; skriver ut menu da.
101$ moveq.l #0,d0
jsr (typefilemaybeall)
tst.b (readcharstatus,NodeBase)
notz
beq 9$
bsr 10$ ; leser inn fila igjen
beq 8$ ; error
1$ lea (nrdoortopentext),a0
jsr (readlineprompt)
beq 9$
jsr (atoi)
lea (musthavenrtext),a0
bmi.b 82$
beq 0$
move.l d0,d2
move.l (tmpmsgmem,NodeBase),a0
bsr findentrynr
beq 0$
move.l d2,d1
move.l a0,d2
move.w d0,d3 ; husker type
moveq.l #36,d0
jsr (changenodestatus)
lea (logopendoortext),a0
move.l d2,a1
jsr (writelogtexttimed)
move.l d2,a0
lea (erropendoortext),a1
cmpi.b #'P',d3 ; er det paragon dør ?
bne.b 2$
jsr (doparagondoor)
bra.b 4$
2$ cmpi.b #'A',d3 ; er det Arexx dør ?
bne.b 3$
bsr doarexxdoor
bra.b 4$
3$ cmpi.b #'S',d3 ; er det Shell dør ?
bne.b 7$
bsr doshelldoor
4$ moveq.l #4,d0
jsr (changenodestatus)
bra.b 9$
7$ lea (unknowformatext),a0
bra.b 82$
8$ lea (nodoronsystext),a0
82$ jsr (writeerroro)
9$ unlk a3
pop d2-d4/a2
rts
10$ move.l a2,d1 ; leser inn fila.
move.l #MODE_OLDFILE,d2
move.l (dosbase),a6
jsrlib Open
move.l d0,d4
beq.b 19$
move.l (msgmemsize,NodeBase),d3
move.l (tmpmsgmem,NodeBase),d2 ; Bruker tmpmsgmem til buffer
move.l d4,d1
jsrlib Read
exg d4,d1
jsrlib Close
moveq.l #-1,d0
cmp.l d0,d4 ; error ?
beq.b 19$ ; jepp
move.l (tmpmsgmem,NodeBase),a0
move.b #0,(0,a0,d4.l) ; markerer slutten
tst.l d4 ; var det noe ?
19$ move.l (exebase),a6
rts
; a0 = minne
; d0 = entry nr
; returnerer filnavn i a0, og type i d0
findentrynr
move.l d0,d1 ; linje nr.
1$ move.b (a0)+,d0
beq.b 9$ ; end of block
cmpi.b #' ',d0 ; skip'er space,
beq.b 1$
cmpi.b #9,d0 ; tab,
beq.b 1$
cmpi.b #10,d0 ; og linefeed
beq.b 1$
cmpi.b #';',d0
beq.b 2$ ; komentar
subi.b #1,d1 ; reduserer linje nr med 1
bne.b 2$ ; ikke denne linja, skiper.
move.b d0,d1 ; husker typen
move.b (a0)+,d0
beq.b 9$
cmpi.b #' ',d0 ; Skal ha en space eller
beq.b 3$
cmpi.b #9,d0 ; tab imellom
bne.b 9$
3$ move.b (a0)+,d0
beq.b 9$
cmpi.b #' ',d0 ; skip'er space
beq.b 3$
cmpi.b #9,d0 ; og tab
beq.b 3$
lea (-1,a0),a1 ; husker starten på navnet
5$ move.b (a0)+,d0 ; finner slutten
beq.b 4$
cmpi.b #' ',d0
beq.b 4$
cmpi.b #10,d0
beq.b 4$
cmpi.b #9,d0
bne.b 5$
4$ move.b #0,-(a0) ; markerer slutten
move.l a1,a0 ; returnerer navn
move.l d1,d0 ; og type
bra.b 9$
2$ move.b (a0)+,d0 ; skip'er til EOL
beq.b 9$
cmpi.b #10,d0
bne.b 2$
bra.b 1$ ; og tar ny linje
9$ rts
doshelldoor
push a2/d2-d4
link.w a3,#-30
move.l a0,a2 ; husker door navnet
jsr (updatetime)
lea (Name+CU,NodeBase),a0 ; setter opp locale variable Fullname
move.l a0,d2
jsr (strlen)
move.l d0,d3
move.l #localefullname,d1
move.l #GVF_LOCAL_ONLY,d4
move.l dosbase,a6
jsrlib SetVar
move.w (NodeNumber,NodeBase),d0 ; og Nodenr...
move.l sp,a0
jsr (konverterw)
move.l sp,a0
move.l a0,d2
jsr (strlen)
move.l d0,d3
move.l #localenodenr,d1
jsrlib SetVar
; move.w (NodeNumber,NodeBase),d0 ; og timeleft.
; move.l sp,a0
; jsr (konverterw)
; move.l sp,a0
; move.l a0,d2
; jsr (strlen)
; move.l d0,d3
; move.l #localetimeleft,d1
; jsrlib SetVar
move.l exebase,a6
move.l a2,a0 ; kjører selve door'en
bsr doshelldoorsub
move.l #localefullname,d1
move.l #GVF_LOCAL_ONLY,d2
move.l dosbase,a6
jsrlib DeleteVar
move.l #localenodenr,d1
jsrlib DeleteVar
move.l exebase,a6
unlk a3
pop a2/d2-d4
rts
GetChar move.l (exebase),a6
jsr (stoptimeouttimer)
move.l d1,d0
jsr (starttimeouttimersec) ; starter timer
jsr (readchar)
bne.b 9$ ; Fikk char, returnerer
tst.b (readcharstatus,NodeBase)
notz
beq.b 9$ ; hopper ut hvis vi fikk no carrier
moveq.l #-1,d0 ; fikk timer return
jsr (stoptimeouttimer)
9$ rts
; a0 = script name
; a1 = feilmelding
doarexxdoor
push a2/d2/d3/a3
move.l a0,d3 ; husker script name
move.l a1,a3 ; husker feilmelding
move.l (rexbase),d0
beq 9$ ; no rexx
move.l d0,a6
move.l (rexxport,NodeBase),a0
lea (Publicportname,NodeBase),a1
move.l a1,d0
lea (abbsextension),a1
jsrlib CreateRexxMsg ; lager Arexx melding
move.l a0,a2
move.l a3,a0 ; gjør klar feilmelding
tst.l d0
beq 8$ ; error
move.l #RXCOMM|(1<<RXFB_NOIO),(ACTION,a2)
move.l d3,a0
jsr (strlen)
move.l d3,a0
jsrlib CreateArgstring ; lager argstring
move.l a0,(ARG0,a2)
beq 6$ ; error
move.l (exebase),a6 ; sender melding til REXX
jsrlib Forbid
lea (rexxportname),a1
jsrlib FindPort
tst.l d0
beq.b 2$ ; opps, ingen port
move.l d0,a0
move.l a2,a1
jsrlib PutMsg
moveq.l #1,d0
2$ jsrlib Permit
tst.l d0
beq.b 6$
move.l (publicsigbit,NodeBase),d3 ; setter opp signalene
or.l (rexxsigbit,NodeBase),d3
or.l (intsigbit,NodeBase),d3
1$ move.l d3,d0
jsrlib Wait
move.l d0,d2
and.l (publicsigbit,NodeBase),d0
beq.b 4$
jsr (handlepublicport)
; bra.b 4$
; beq.b 1$ ; loooop var 5$....
; tst.b (readcharstatus,NodeBase) ; noe galt ?
; bne.b 5$ ; jepp.
4$ move.l d2,d0
and.l (intsigbit,NodeBase),d0 ; var det int bit ?
beq.b 10$
jsr (dointuition) ; behandler det.
; beq.b 5$
; tst.b (readcharstatus,NodeBase) ; noe galt ?
; bne.b 5$ ; jepp.