forked from g8bpq/OldLinBPQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AGWMon.asm
1646 lines (1182 loc) · 25.4 KB
/
AGWMon.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
PAGE 56,132
;
.386
;
; SEGMENT definitions and order
;
;* 32 Bit code
_TEXT SEGMENT DWORD USE32 PUBLIC 'CODE'
_TEXT ENDS
;* Contains 32 Bit data
_DATA SEGMENT DWORD PUBLIC 'DATA'
_DATA ENDS
ASSUME CS:FLAT, DS:FLAT, ES:FLAT, SS:FLAT
OFFSET32 EQU <OFFSET FLAT:>
_DATA SEGMENT
CR EQU 0DH
LF EQU 0AH
D10 DW 10
D60 DD 60
D3600 DD 3600
D86400 DD 86400
TIMESTAMP DD 0
NEWVALUE DW 0
WORD10 DW 10
WORD16 DW 16
;
; BASIC LINK LEVEL MESSAGE BUFFER LAYOUT
;
MESSAGE STRUC
MSGCHAIN DD ? ; CHAIN WORD
MSGPORT DB ? ; PORT
MSGLENGTH DW ? ; LENGTH
MSGDEST DB 7 DUP (?) ; DESTINATION
MSGORIGIN DB 7 DUP (?) ; ORIGIN
;
; MAY BE UP TO 56 BYTES OF DIGIS
;
MSGCONTROL DB ? ; CONTROL BYTE
MSGPID DB ? ; PROTOCOL IDENTIFIER
MSGDATA DB ? ; START OF LEVEL 2 MESSAGE
;
MESSAGE ENDS
;
;
;
; L4FLAGS DEFINITION
;
L4BUSY EQU 80H ; BNA - DONT SEND ANY MORE
L4NAK EQU 40H ; NEGATIVE RESPONSE FLAG
L4MORE EQU 20H ; MORE DATA FOLLOWS - FRAGMENTATION FLAG
L4CREQ EQU 1 ; CONNECT REQUEST
L4CACK EQU 2 ; CONNECT ACK
L4DREQ EQU 3 ; DISCONNECT REQUEST
L4DACK EQU 4 ; DISCONNECT ACK
L4INFO EQU 5 ; INFORMATION
L4IACK EQU 6 ; INFORMATION ACK
;
NULL EQU 00H
CR EQU 0DH
LF EQU 0AH
NETROM_PID EQU 0CFH
NODES_SIG EQU 0FFH
;
PORT_MSG DB ' Port=',NULL
NODES_MSG DB ' (NetRom Routing)',CR,NULL
NETROM_MSG DB ' NET/ROM',CR,' ',NULL
TO_MSG DB ' To ',NULL
TTL_MSG DB ' ttl=',NULL
AT_MSG DB ' at ',NULL
VIA_MSG DB ' via ',NULL
QUALITY_MSG DB ' qlty=',NULL
LEN_MSG DB ' Len=',0
PID_MSG DB ' pid=',NULL
MYCCT_MSG DB ' my'
CCT_MSG DB ' cct=',0
TIM_MSG DB ' t/o=',0
WINDOW DB ' w=',0
CONN_REQ_MSG DB ' <CON REQ>',NULL
CONN_ACK_MSG DB ' <CON ACK>',NULL
CONN_NAK_MSG DB ' <CON NAK> - BUSY',NULL
DISC_REQ_MSG DB ' <DISC REQ>',NULL
DISC_ACK_MSG DB ' <DISC ACK>',NULL
INFO_MSG DB ' <INFO S',NULL
INFO_ACK_MSG DB ' <INFO ACK R',NULL
DUFF_NET_MSG DB ' <????>',NULL
IP_MSG DB ' <IP> ',NULL
SABM_MSG DB 'SABM ',NULL
DISC_MSG DB 'DISC ',NULL
UA_MSG DB 'UA ',NULL
DM_MSG DB 'DM ',NULL
RR_MSG DB 'RR ',NULL
RNR_MSG DB 'RNR ',NULL
UI_MSG DB 'UI',NULL
FRMR_MSG DB 'FRMR ',NULL
REJ_MSG DB 'REJ ',NULL
;
; IP AND TCP BITS
;
IPMSG STRUC
;
; FORMAT OF IP HEADER
;
; NOTE THESE FIELDS ARE STORED HI ORDER BYTE FIRST (NOT NORMAL 8086 FORMAT)
;
VERLEN DB 0 ; 4 BITS VERSION, 4 BITS LENGTH
TOS DB 0 ; TYPE OF SERVICE
IPLENGTH DW 0 ; DATAGRAM LENGTH
IPID DW 0 ; IDENTIFICATION
FRAGWORD DW 0 ; 3 BITS FLAGS, 13 BITS OFFSET
IPTTL DB 0
IPPROTOCOL DB 0 ; HIGHER LEVEL PROTOCOL
IPCHECKSUM DW 0 ; HEADER CHECKSUM
IPSOURCE DD 0
IPDEST DD 0
;
; FORMAT OF TCP HEADER WITHIN AN IP DATAGRAM
;
; NOTE THESE FIELDS ARE STORED HI ORDER BYTE FIRST (NOT NORMAL 8086 FORMAT)
;
SOURCEPORT DW 0
DESTPORT DW 0
SEQNUM DD 0
ACKNUM DD 0
TCPCONTROL DB 0 ; 4 BITS DATA OFFSET 4 RESERVED
TCPFLAGS DB 0 ; (2 RESERVED) URG ACK PSH RST SYN FIN
TCPWINDOW DW 0
CHECKSUM DW 0
URGPTR DW 0
;
; OPTIONS AND/OR DATA MAY FOLLOW
;
TCPOPTIONS DB 4 DUP (0)
IPMSG ENDS
;
; TCPFLAGS BITS
;
FIN EQU 1B
SYN EQU 10B
RST EQU 100B
PSH EQU 1000B
ACK EQU 10000B
URG EQU 100000B
TCP DB 'TCP: ',0
ICMP DB 'ICMP: ',0
LEN DB ' LEN: ',0
SEQTEXT DB ' SEQ: ',0
ACKTEXT DB 'ACK: ',0
WINDTEXT DB 'WIN: ',0
SYNTEXT DB 'SYN ',0
FINTEXT DB 'FIN ',0
RSTTEXT DB 'RST ',0
PSHTEXT DB 'PSH ',0
ACKTEXT1 DB 'ACK ',0
URGTEXT DB 'URG ',0
BADSUM DB ' CHECKSUM ERROR ',0
;-----------------------------------------------------------------------------;
; Parameter area for received frame ;
;-----------------------------------------------------------------------------;
PORT_NO DB 0 ; Received port number 0 - 256
VERSION_NO DB 0 ; Version 1 or 2 1,2
POLL_FINAL DB 0 ; Poll or Final ? P,F
COMM_RESP DB 0 ; Command or Response C,R
FRAME_TYPE DB 0 ; Frame Type UI etc in Hex
PID DB 0 ; Protocol ID
FRAME_LENGTH DD 0 ; Length of frame 0 - 65...
NR DB 0 ; N(R) Flag
NS DB 0 ; N(S) Flag
INFO_FLAG DB 0 ; Information Packet ? 0 No, 1 Yes
OPCODE DB 0 ; L4 FRAME TYPE
FRMRFLAG DB 0
TRACEFLAG DB 1
MALL DB 1
HEADERLN DB 1
MCOM DB 1
MTX DB 1
MMASK DW 0FFFFH
;
; HDLC COMMANDS (WITHOUT P/F)
;
UI EQU 3
SABM EQU 2FH
DISC EQU 43H
DM EQU 0FH
UA EQU 63H
FRMR EQU 87H
RR EQU 1
RNR EQU 5
REJ EQU 9
;
PFBIT EQU 10H ; POLL/FINAL BIT IN CONTROL BYTE
CRLF DB 0DH,0AH
AX25CALL DB 7 DUP (0) ; WORK AREA FOR AX25 <> NORMAL CALL CONVERSION
NORMCALL DB 10 DUP (0) ; CALLSIGN IN NORMAL FORMAT
NORMLEN DD 0 ; LENGTH OF CALL IN NORMCALL
;
TENK DD 10000
DD 1000
WORD100 DD 100
DWORD10 DD 10
;
ACCUM DB 4 DUP (0)
CONVFLAG DB 0
SUPPRESS DB 0 ; ZERO SUPPRESS FLAG
SAVESI DD 0
SAVEDI DD 0
_DATA ENDS
; 2:Fm GM8BPQ-2 To NODES <UI pid=CF Len=49 >[18:49:56]
;FF BPQ (NetRom Routing)
; N5IN-9 N9 N5IN-3 152
; GB7CB GALA N5IN-3 151
; 1:Fm GM8BPQ To APU25N <UI pid=F0 Len=29 >[18:51:48]
;=5828.55N/00612.62W- {UIV32}
; 1:Fm GM8BPQ-1 To BPQ <SABM P>[09:09:51]
_TEXT SEGMENT PUBLIC 'CODE'
PUBLIC _AGWMONDECODE,_AGWMONOPTIONS
_AGWMONOPTIONS:
MOV MMASK,AX
MOV MTX,BL
MOV MCOM,CL
RET
_AGWMONDECODE:
;
; esi=message, edi=buffer, return length in ECX amd frame type in EAX
;
MOV SAVESI,ESI
MOV SAVEDI,EDI
MOV TIMESTAMP,EAX
cmp TRACEFLAG,0
jne TRACEOK
TRACERET:
ret
TRACEOK:
MOVZX ECX,MSGLENGTH[ESI]
;
; GET THE CONTROL BYTE, TO SEE IF THIS FRAME IS TO BE DISPLAYED
;
PUSH ESI
MOV ECX,9 ; MAX DIGIS + 1
CTRLLOOP:
TEST BYTE PTR MSGCONTROL-1[ESI],1
JNZ CTRLFOUND
ADD ESI,7
LOOP CTRLLOOP
;
; INVALID FRAME
;
POP ESI
MOV ECX,0
RET
CTRLFOUND:
MOV AL,MSGCONTROL[ESI]
POP ESI
;
TEST AL,1 ; I FRAME
JZ IFRAME
AND AL,NOT PFBIT ; CLEAR P/F
CMP AL,3 ; UI
JE OKTOTRACE ; ALWAYS DO UI
CMP AL,FRMR
JE OKTOTRACE ; ALWAYS DO FRMR
;
; USEQ/CONTROL - TRACE IF MCOM ON
;
CMP MCOM,0
JNE OKTOTRACE
MOV ECX,0
RET
;-----------------------------------------------------------------------------;
; Check for MALL ;
;-----------------------------------------------------------------------------;
IFRAME:
cmp MALL,0
jne OKTOTRACE
MOV ECX,0
ret
OKTOTRACE:
;
;-----------------------------------------------------------------------------;
; Get the port number of the received frame ;
;-----------------------------------------------------------------------------;
mov CL,MSGPORT[ESI]
mov PORT_NO,CL
TEST CL,80H
JZ NOT_TX
;
; TRANSMITTED FRAME - SEE IF MTX ON
;
CMP MTX,1
JE NOT_TX
MOV ECX,0
RET
NOT_TX:
AND CL,7FH ; MASK T/R BIT
DEC CL
MOV AX,1
SHL AX,CL ; SHIFT BIT UP
TEST MMASK,AX
JNZ TRACEOK1
MOV ECX,0
RET
TRACEOK1:
MOV FRMRFLAG,0
mov AH,MSGDEST+6[ESI]
mov AL,MSGORIGIN+6[ESI]
mov COMM_RESP,0 ; Clear Command/Response Flag
;-----------------------------------------------------------------------------;
; Is it a Poll/Final or Command/Response ;
;-----------------------------------------------------------------------------;
test AH,80H
mov COMM_RESP,'C'
jnz NOT_RESPONSE
mov COMM_RESP,'R'
NOT_RESPONSE:
;-----------------------------------------------------------------------------;
; Is this version 1 or 2 of AX25 ? ;
;-----------------------------------------------------------------------------;
xor AH,AL
test AH,80H
mov VERSION_NO,1
je VERSION_1
mov VERSION_NO,2
VERSION_1:
mov al,PORT_NO
and al,7fh
cmp AL,10
JAE @F
PUSH EAX
MOV AL,' '
CALL PUTCHAR
POP EAX
@@:
call DISPLAY_BYTE_1
MOV AL,':'
CALL PUTCHAR
MOV AL,'F'
CALL PUTCHAR
MOV AL,'m'
CALL PUTCHAR
MOV AL,' '
CALL PUTCHAR
;-----------------------------------------------------------------------------;
; Display Origin Callsign ;
;-----------------------------------------------------------------------------;
PUSH ESI
lea ESI,MSGORIGIN[ESI]
call CONVFROMAX25
mov ESI,OFFSET NORMCALL
call DISPADDR
POP ESI
PUSH ESI
mov EBX,OFFSET TO_MSG
call NORMSTR
;-----------------------------------------------------------------------------;
; Display Destination Callsign ;
;-----------------------------------------------------------------------------;
lea ESI,MSGDEST[ESI]
call CONVFROMAX25
mov ESI,OFFSET NORMCALL
call DISPADDR
pop ESI
movzx EAX,MSGLENGTH[ESI]
mov FRAME_LENGTH,EAX
mov CX,8 ; Max number of digi-peaters
;-----------------------------------------------------------------------------;
; Display any Digi-Peaters ;
;-----------------------------------------------------------------------------;
NEXT_DIGI:
test MSGORIGIN+6[ESI],1
jnz NO_MORE_DIGIS
add ESI,7
sub FRAME_LENGTH,7 ; Reduce length
push ESI
push ECX
lea ESI,MSGORIGIN[ESI]
call CONVFROMAX25 ; Convert to call
push EAX ; Last byte is in AH
mov AL,','
call PUTCHAR
mov ESI,OFFSET NORMCALL
call DISPADDR
pop EAX
test AH,80H
jz NOT_REPEATED
mov AL,'*'
call PUTCHAR
NOT_REPEATED:
pop ECX
pop ESI
loop NEXT_DIGI
NO_MORE_DIGIS:
MOV AL,' '
CALL PUTCHAR
;-----------------------------------------------------------------------------;
; If this is Version 2 get the Poll/Final Bit ;
;-----------------------------------------------------------------------------;
mov POLL_FINAL,0 ; Clear Poll/Final Flag
mov AL,MSGCONTROL[ESI] ; Get control byte
cmp COMM_RESP,'C'
jne NOT_COMM
test AL,PFBIT
je NOT_POLL
mov POLL_FINAL,'P'
NOT_POLL:
NOT_COMM:
cmp COMM_RESP,'R'
jne NOT_RESP
test AL,PFBIT
je NOT_FINAL
mov POLL_FINAL,'F'
NOT_FINAL:
NOT_RESP:
;-----------------------------------------------------------------------------;
; Start displaying the frame information ;
;-----------------------------------------------------------------------------;
and AL,NOT PFBIT ; Remove P/F bit
mov FRAME_TYPE,AL
mov AL,'<' ; Print "<"
call PUTCHAR
mov NR,0 ; Reset all the flags
mov NS,0
mov INFO_FLAG,0
mov AL,FRAME_TYPE
test AL,1
jne NOT_I_FRAME
;-----------------------------------------------------------------------------;
; Information frame ;
;-----------------------------------------------------------------------------;
mov AL,'I'
call PUTCHAR
mov AL,' '
call PUTCHAR
mov INFO_FLAG,1
mov NR,1
mov NS,1
jmp END_OF_TYPE
NOT_I_FRAME:
;-----------------------------------------------------------------------------;
; Un-numbered Information Frame ;
;-----------------------------------------------------------------------------;
cmp AL,UI
jne NOT_UI_FRAME
mov EBX,OFFSET UI_MSG
call NORMSTR
mov INFO_FLAG,1
jmp END_OF_TYPE
NOT_UI_FRAME:
test AL,10B
jne NOT_R_FRAME
;-----------------------------------------------------------------------------;
; Process supervisory frames ;
;-----------------------------------------------------------------------------;
mov NR,1 ; All supervisory frames have N(R)
and AL,0FH ; Mask the interesting bits
cmp AL,RR
jne NOT_RR_FRAME
mov EBX,OFFSET RR_MSG
call NORMSTR
jmp END_OF_TYPE
NOT_RR_FRAME:
cmp AL,RNR
jne NOT_RNR_FRAME
mov EBX,OFFSET RNR_MSG
call NORMSTR
jmp END_OF_TYPE
NOT_RNR_FRAME:
cmp AL,REJ
jne NOT_REJ_FRAME
mov EBX,OFFSET REJ_MSG
call NORMSTR
jmp END_OF_TYPE
NOT_REJ_FRAME:
mov NR,0 ; Don't display sequence number
mov AL,'?' ; Print "?"
call PUTCHAR
jmp END_OF_TYPE
;-----------------------------------------------------------------------------;
; Process all other frame types ;
;-----------------------------------------------------------------------------;
NOT_R_FRAME:
cmp AL,UA
jne NOT_UA_FRAME
mov EBX,OFFSET UA_MSG
call NORMSTR
jmp SHORT END_OF_TYPE
NOT_UA_FRAME:
cmp AL,DM
jne NOT_DM_FRAME
mov EBX,OFFSET DM_MSG
call NORMSTR
jmp SHORT END_OF_TYPE
NOT_DM_FRAME:
cmp AL,SABM
jne NOT_SABM_FRAME
mov EBX,OFFSET SABM_MSG
call NORMSTR
jmp SHORT END_OF_TYPE
NOT_SABM_FRAME:
cmp AL,DISC
jne NOT_DISC_FRAME
mov EBX,OFFSET DISC_MSG
call NORMSTR
jmp SHORT END_OF_TYPE
NOT_DISC_FRAME:
cmp AL,FRMR
jne NOT_FRMR_FRAME
mov EBX,OFFSET FRMR_MSG
call NORMSTR
MOV FRMRFLAG,1
jmp SHORT END_OF_TYPE
NOT_FRMR_FRAME:
mov AL,'?'
call PUTCHAR
END_OF_TYPE:
;----------------------------------------------------------------------------;
; If Version 2 Then display P/F C/R Information ;
;----------------------------------------------------------------------------;
IF 0
cmp VERSION_NO,2
jne NOT_VERSION_2
mov AL,' '
call PUTCHAR
mov AL,COMM_RESP ; Print Command/Response Flag
call PUTCHAR
ENDIF
cmp POLL_FINAL,0
je NO_POLL_FINAL
mov AL,POLL_FINAL ; Print Poll/Final Flag if Set
call PUTCHAR
mov AL,' '
call PUTCHAR
NO_POLL_FINAL:
NOT_VERSION_2:
;----------------------------------------------------------------------------;
; Display sequence numbers if applicable ;
;----------------------------------------------------------------------------;
cmp NR,1
jne NOT_NR_DATA
mov AL,'R'
call PUTCHAR
mov AL,FRAME_TYPE
rol AL,1
rol AL,1
rol AL,1
call DISPLAYSEQ
mov AL,' '
call PUTCHAR
NOT_NR_DATA:
cmp NS,1
jne NOT_NS_DATA
mov AL,'S'
call PUTCHAR
mov AL,FRAME_TYPE
ror AL,1
call DISPLAYSEQ
NOT_NS_DATA:
CMP INFO_FLAG,1
JNE NO_PID_LEN
mov EBX,OFFSET PID_MSG
call NORMSTR
PUSH ESI
lea ESI,MSGPID[ESI]
lodsb
POP ESI
CALL HEXOUT
mov EBX,OFFSET LEN_MSG
call NORMSTR
MOV EAX,FRAME_LENGTH
SUB EAX,23
CALL DISPLAY_BYTE_1
mov AL,' '
call PUTCHAR
NO_PID_LEN:
mov AL,'>'
call PUTCHAR
mov AL,'['
call PUTCHAR
;
; DISPLAY TIMESTAMP
;
MOV EAX,TIMESTAMP
mov EDX,0
DIV D86400
MOV EAX,EDX
MOV edx,0
DIV D3600
CALL DISPLAY_BYTE_2
MOV AL,':'
CALL PUTCHAR
MOV EAX,EDX
MOV EDX,0
DIV D60 ; MINS IN AX, SECS IN DX
PUSH DX
CALL DISPLAY_BYTE_2
MOV AL,':'
CALL PUTCHAR
POP AX ; SECS
CALL DISPLAY_BYTE_2
mov AL,']'
call PUTCHAR
CMP FRMRFLAG,0
JE NOTFRMR
;
; DISPLAY FRMR BYTES
;
lea ESI,MSGPID[ESI]
MOV ECX,3 ; TESTING
FRMRLOOP:
lodsb
CALL BYTE_TO_HEX
LOOP FRMRLOOP
JMP NO_INFO
NOTFRMR:
;----------------------------------------------------------------------------;
; Find the PID if an information frame ;
;----------------------------------------------------------------------------;
mov AL,0
cmp INFO_FLAG,1
jne NO_PID
lea ESI,MSGPID[ESI]
lodsb
NO_PID:
mov PID,AL
;----------------------------------------------------------------------------;
; Is this a NET/ROM message of any sort ? ;
;----------------------------------------------------------------------------;
MOV ECX,FRAME_LENGTH
cmp PID,NETROM_PID
je DISPLAY_NETROM
;----------------------------------------------------------------------------;
; Display the rest of the frame (If Any) ;
;----------------------------------------------------------------------------;
DISPLAY_INFO:
cmp INFO_FLAG,1 ; Is it an information packet ?
jne NO_INFO
XOR AL,AL ; IN CASE EMPTY
sub ECX,23
JCXZ NO_INFO ; EMPTY I FRAME
;
; PUT TEXT ON A NEW LINE
;
PUSH ECX
MOV AL,0DH
PUSH ESI
CALL PUTCHAR
POP ESI
POP ECX
SAMELN:
cmp ECX,257
jb LENGTH_OK
mov ECX,256
LENGTH_OK:
push ECX
lodsb
cmp AL,0AH
JE MONOK
CMP AL,0DH
JE MONOK
CMP AL,20H
JB SKIP_MON ; IGNORE OTHER CONTROLS
MONOK:
call PUTCHAR
SKIP_MON:
pop ECX
loop LENGTH_OK
NO_INFO:
;
; ADD CR UNLESS DATA ALREADY HAS ONE
;
CMP AL,CR
JE NOTANOTHER
ADD_CR:
mov AL,CR
call PUTCHAR
NOTANOTHER:
;
MOV ECX,EDI
SUB ECX,SAVEDI
MOVZX EAX,FRAME_TYPE
RET
;----------------------------------------------------------------------------;
; Display NET/ROM data ;
;----------------------------------------------------------------------------;
DISPLAY_NETROM:
MOV AL,CR
CALL PUTCHAR
lodsb
PUSH EAX
CALL HEXOUT
mov AL,' '
call PUTCHAR
POP EAX
cmp AL,NODES_SIG ; Check NODES message
JNE DISPLAY_NETROM_DATA
cmp FRAME_TYPE, 3
JNE DISPLAY_NETROM_DATA ; Not UI, so INP3
;----------------------------------------------------------------------------;
; Display NODES broadcast ;
;----------------------------------------------------------------------------;
push ECX
mov ECX,6
REP MOVSB ; ALIAS
mov EBX,OFFSET NODES_MSG
call NORMSTR
pop ECX
sub ECX,30 ; Header, mnemonic and signature length
NODES_LOOP:
cmp ECX,0
jbe NO_INFO
push ECX
push ESI ; Global push for each node
mov AL,' '
call PUTCHAR
mov AL,' '
call PUTCHAR
push ESI