diff options
| author | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
| commit | f647d78463c1250ce9c99af664615fafccf5e959 (patch) | |
| tree | 5b00428cef68aef1c9d407e2d4535687422419b6 /lib/ft8var | |
| parent | 0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff) | |
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'lib/ft8var')
54 files changed, 12681 insertions, 14449 deletions
diff --git a/lib/ft8var/agccft8.f90 b/lib/ft8var/agccft8.f90 index 749c2d15..1b88ca84 100755..100644 --- a/lib/ft8var/agccft8.f90 +++ b/lib/ft8var/agccft8.f90 @@ -1,81 +1,81 @@ -subroutine agccft8(nfa,nfb,forcedt)
-
- use ft8_mod1, only : dd8,twopi,lagccbail
- integer, parameter :: NFFT=1024,NSZ=426,NHSYM=178,NHSTEP=960 !3413 = NFFT*5000/12000
- ! nhsym=(npts-NFFT)/nhstep !number of half-symbols 178.96(6) = (180000-8192)/(1920/2)
- real*4 x11(NFFT),w11(NFFT),ss33(NSZ),s3(NHSYM)
- real, DIMENSION(:), ALLOCATABLE :: sa33
- integer, DIMENSION(:), ALLOCATABLE :: indx
- integer, intent(in) :: nfa,nfb
- complex c11(0:NFFT/2)
- logical(1) first
- equivalence (x11,c11)
- data first/.true./
- save first,w11
-
- if(first) then ! FFT window
- do k=1,NFFT
- w11(k)=sin(twopi*(k+2)/2048) ! 16384 = 2*NFFT
- enddo
- first=.false.
- endif
-
- fac1=1.1e-3 ! 7548, 9.6e-4 7540, 9.7e-4 7546, 9.8e-4 7543, 1.0e-3 7539, 1.2e-3 7534..7538, 1.3e-3 7547, 2.4e-3 7543
-
- if(nfb.lt.5000) then; nfblim=nfb; else; nfblim=4999; endif ! ss33 top index protection
- nf1=NFFT*nfa/12000+1; nf2=NFFT*nfblim/12000
- nmed=(nf2-nf1)/2; nsb=nf2-nf1+1
-
- allocate(sa33(nsb), STAT = nAllocateStatus1)
- if(nAllocateStatus1.ne.0) STOP "Not enough memory"
- allocate(indx(nsb), STAT = nAllocateStatus1)
- if(nAllocateStatus1.ne.0) STOP "Not enough memory"
-
- do j=1,10
- i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT)
- call four2avar(c11,NFFT,1,-1,0) !r2c forward FFT
- do i=nf1,nf2
- s33=ABS(c11(i)); ss33(i)=SQRT(s33)
- enddo
- sa33(1:nsb)=ss33(nf1:nf2)
- call indexx(sa33(1:nsb),nsb,indx)
- smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif
- enddo
-
- do j=169,178
- i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT)
- call four2avar(c11,NFFT,1,-1,0) !r2c forward FFT
- do i=nf1,nf2
- s33=ABS(c11(i)); ss33(i)=SQRT(s33)
- enddo
- sa33(1:nsb)=ss33(nf1:nf2)
- call indexx(sa33(1:nsb),nsb,indx)
- smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif
- enddo
-
- deallocate (sa33, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
- deallocate (indx, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
-
- s3min1=minval(s3(1:10)); s3min2=minval(s3(169:178)); s3min=min(s3min1,s3min2)
- s3max1=maxval(s3(1:10)); s3max2=maxval(s3(169:178)); s3max=max(s3max1,s3max2)
- if(s3min.lt.0.1) then; s3min=1.0; s3max=1.0; endif
- s3ratio=s3max/s3min
-
- lagccbail=.false.
-! 2.0dB delta
- if(s3ratio.lt.1.26) then; lagccbail=.true.; return; endif
-
- k=1
- do j=1,10
- dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960
- enddo
- k=1+168*960
- do j=169,178
- dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960
- enddo
- dd8(170881:171650)=dd8(170881:171650)/s3(178); dd8(171651:180000)=0.
-
- return
+subroutine agccft8(nfa,nfb,forcedt) + + use ft8_mod1, only : dd8,twopi,lagccbail + integer, parameter :: NFFT=1024,NSZ=426,NHSYM=178,NHSTEP=960 !3413 = NFFT*5000/12000 + ! nhsym=(npts-NFFT)/nhstep !number of half-symbols 178.96(6) = (180000-8192)/(1920/2) + real*4 x11(NFFT),w11(NFFT),ss33(NSZ),s3(NHSYM) + real, DIMENSION(:), ALLOCATABLE :: sa33 + integer, DIMENSION(:), ALLOCATABLE :: indx + integer, intent(in) :: nfa,nfb + complex c11(0:NFFT/2) + logical(1) first + equivalence (x11,c11) + data first/.true./ + save first,w11 + + if(first) then ! FFT window + do k=1,NFFT + w11(k)=sin(twopi*(k+2)/2048) ! 16384 = 2*NFFT + enddo + first=.false. + endif + + fac1=1.1e-3 ! 7548, 9.6e-4 7540, 9.7e-4 7546, 9.8e-4 7543, 1.0e-3 7539, 1.2e-3 7534..7538, 1.3e-3 7547, 2.4e-3 7543 + + if(nfb.lt.5000) then; nfblim=nfb; else; nfblim=4999; endif ! ss33 top index protection + nf1=NFFT*nfa/12000+1; nf2=NFFT*nfblim/12000 + nmed=(nf2-nf1)/2; nsb=nf2-nf1+1 + + allocate(sa33(nsb), STAT = nAllocateStatus1) + if(nAllocateStatus1.ne.0) STOP "Not enough memory" + allocate(indx(nsb), STAT = nAllocateStatus1) + if(nAllocateStatus1.ne.0) STOP "Not enough memory" + + do j=1,10 + i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT) + call four2avar(c11,NFFT,1,-1,0) !r2c forward FFT + do i=nf1,nf2 + s33=ABS(c11(i)); ss33(i)=SQRT(s33) + enddo + sa33(1:nsb)=ss33(nf1:nf2) + call indexx(sa33(1:nsb),nsb,indx) + smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif + enddo + + do j=169,178 + i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT) + call four2avar(c11,NFFT,1,-1,0) !r2c forward FFT + do i=nf1,nf2 + s33=ABS(c11(i)); ss33(i)=SQRT(s33) + enddo + sa33(1:nsb)=ss33(nf1:nf2) + call indexx(sa33(1:nsb),nsb,indx) + smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif + enddo + + deallocate (sa33, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + deallocate (indx, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + + s3min1=minval(s3(1:10)); s3min2=minval(s3(169:178)); s3min=min(s3min1,s3min2) + s3max1=maxval(s3(1:10)); s3max2=maxval(s3(169:178)); s3max=max(s3max1,s3max2) + if(s3min.lt.0.1) then; s3min=1.0; s3max=1.0; endif + s3ratio=s3max/s3min + + lagccbail=.false. +! 2.0dB delta + if(s3ratio.lt.1.26) then; lagccbail=.true.; return; endif + + k=1 + do j=1,10 + dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960 + enddo + k=1+168*960 + do j=169,178 + dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960 + enddo + dd8(170881:171650)=dd8(170881:171650)/s3(178); dd8(171651:180000)=0. + + return end subroutine agccft8
\ No newline at end of file diff --git a/lib/ft8var/baddatavar.f90 b/lib/ft8var/baddatavar.f90 index 77e5121a..4da2dd28 100755..100644 --- a/lib/ft8var/baddatavar.f90 +++ b/lib/ft8var/baddatavar.f90 @@ -1,32 +1,32 @@ -logical function baddatavar()
-
- use jt65_mod6
-
- ninterval=1200
- j=0
- smin=1.e30
- smax=-smin
- iz=49*12000/ninterval
- nadd=ninterval/60
-
- ! 3457-4800 range: cover broken data being observed under Windows XP
- if(abs(dd(4200)).lt.0.1) dd(4200)=1.0
-
- do i=1,iz
- sq=0.
- do n=1,ninterval,60
- j=j+60
- x=dd(j)
- sq=sq + x*x
- enddo
- rms=sqrt(sq/nadd)
- smin=min(smin,rms)
- smax=max(smax,rms)
- enddo
-
- sratio=smax/(smin+1.e-30)
- baddatavar=.false.
- if(sratio.gt.1.e30) baddatavar=.true.
-
- return
-end function baddatavar
+logical function baddatavar() + + use jt65_mod6 + + ninterval=1200 + j=0 + smin=1.e30 + smax=-smin + iz=49*12000/ninterval + nadd=ninterval/60 + + ! 3457-4800 range: cover broken data being observed under Windows XP + if(abs(dd(4200)).lt.0.1) dd(4200)=1.0 + + do i=1,iz + sq=0. + do n=1,ninterval,60 + j=j+60 + x=dd(j) + sq=sq + x*x + enddo + rms=sqrt(sq/nadd) + smin=min(smin,rms) + smax=max(smax,rms) + enddo + + sratio=smax/(smin+1.e-30) + baddatavar=.false. + if(sratio.gt.1.e30) baddatavar=.true. + + return +end function baddatavar diff --git a/lib/ft8var/bpdecode174_91var.f90 b/lib/ft8var/bpdecode174_91var.f90 index 999499f0..adb1484a 100755..100644 --- a/lib/ft8var/bpdecode174_91var.f90 +++ b/lib/ft8var/bpdecode174_91var.f90 @@ -1,117 +1,117 @@ -subroutine bpdecode174_91var(llr,apmask,maxiterations,message77,cw,nharderror,iter)
-!
-! A log-domain belief propagation decoder for the (174,91) code.
-!
-use iso_c_binding, only: c_loc,c_size_t
-use crc
-integer, parameter:: N=174, K=91, M=N-K
-integer*1 cw(N)
-integer*1, intent(in) :: apmask(N)
-integer*1 decoded(K)
-integer*1 message77(77)
-integer nrw(M),ncw
-integer Nm(7,M)
-integer Mn(3,N) ! 3 checks per bit
-integer synd(M)
-real tov(3,N)
-real toc(7,M)
-real tanhtoc(7,M)
-real zn(N)
-real, intent(in) :: llr(N)
-real Tmn
-
-include "ldpc_174_91_c_reordered_parity.f90"
-
-nclast=0
-decoded=0
-toc=0
-tov=0
-tanhtoc=0
-! initialize messages to checks
-do j=1,M
- do i=1,nrw(j)
- toc(i,j)=llr((Nm(i,j)))
- enddo
-enddo
-
-ncnt=0
-
-do iter=0,maxiterations
-
-! Update bit log likelihood ratios (tov=0 in iteration 0).
- do i=1,N
- if( apmask(i) .ne. 1 ) then
- zn(i)=llr(i)+sum(tov(1:ncw,i))
- else
- zn(i)=llr(i)
- endif
- enddo
-
-! Check to see if we have a codeword (check before we do any iteration).
- cw=0
- where( zn .gt. 0. ) cw=1
- ncheck=0
- do i=1,M
- synd(i)=sum(cw(Nm(1:nrw(i),i)))
- if( mod(synd(i),2) .ne. 0 ) ncheck=ncheck+1
-! if( mod(synd(i),2) .ne. 0 ) write(*,*) 'check ',i,' unsatisfied'
- enddo
-! write(*,*) 'number of unsatisfied parity checks ',ncheck
- if( ncheck .eq. 0 ) then ! we have a codeword - if crc is good, return it
- decoded=cw(1:K)
- call chkcrc14a(decoded,nbadcrc)
- nharderror=count( (2*cw-1)*llr .lt. 0.0 )
- if(nbadcrc.eq.0) then
- message77=decoded(1:77)
- return
- endif
- endif
-
- if( iter.gt.0 ) then ! this code block implements an early stopping criterion
-! if( iter.gt.10000 ) then ! this code block implements an early stopping criterion
- nd=ncheck-nclast
- if( nd .lt. 0 ) then ! # of unsatisfied parity checks decreased
- ncnt=0 ! reset counter
- else
- ncnt=ncnt+1
- endif
-! write(*,*) iter,ncheck,nd,ncnt
- if( ncnt .ge. 5 .and. iter .ge. 10 .and. ncheck .gt. 15) then
- nharderror=-1
- return
- endif
- endif
- nclast=ncheck
-
-! Send messages from bits to check nodes
- do j=1,M
- do i=1,nrw(j)
- ibj=Nm(i,j)
- toc(i,j)=zn(ibj)
- do kk=1,ncw ! subtract off what the bit had received from the check
- if( Mn(kk,ibj) .eq. j ) then
- toc(i,j)=toc(i,j)-tov(kk,ibj)
- endif
- enddo
- enddo
- enddo
-
-! send messages from check nodes to variable nodes
- do i=1,M
- tanhtoc(1:7,i)=tanh(-toc(1:7,i)/2)
- enddo
-
- do j=1,N
- do i=1,ncw
- ichk=Mn(i,j) ! Mn(:,j) are the checks that include bit j
- Tmn=product(tanhtoc(1:nrw(ichk),ichk),mask=Nm(1:nrw(ichk),ichk).ne.j)
- call platanh(-Tmn,y)
-! y=atanh(-Tmn)
- tov(i,j)=2*y
- enddo
- enddo
-
-enddo
-nharderror=-1
-return
-end subroutine bpdecode174_91var
+subroutine bpdecode174_91var(llr,apmask,maxiterations,message77,cw,nharderror,iter) +! +! A log-domain belief propagation decoder for the (174,91) code. +! +use iso_c_binding, only: c_loc,c_size_t +use crc +integer, parameter:: N=174, K=91, M=N-K +integer*1 cw(N) +integer*1, intent(in) :: apmask(N) +integer*1 decoded(K) +integer*1 message77(77) +integer nrw(M),ncw +integer Nm(7,M) +integer Mn(3,N) ! 3 checks per bit +integer synd(M) +real tov(3,N) +real toc(7,M) +real tanhtoc(7,M) +real zn(N) +real, intent(in) :: llr(N) +real Tmn + +include "ldpc_174_91_c_reordered_parity.f90" + +nclast=0 +decoded=0 +toc=0 +tov=0 +tanhtoc=0 +! initialize messages to checks +do j=1,M + do i=1,nrw(j) + toc(i,j)=llr((Nm(i,j))) + enddo +enddo + +ncnt=0 + +do iter=0,maxiterations + +! Update bit log likelihood ratios (tov=0 in iteration 0). + do i=1,N + if( apmask(i) .ne. 1 ) then + zn(i)=llr(i)+sum(tov(1:ncw,i)) + else + zn(i)=llr(i) + endif + enddo + +! Check to see if we have a codeword (check before we do any iteration). + cw=0 + where( zn .gt. 0. ) cw=1 + ncheck=0 + do i=1,M + synd(i)=sum(cw(Nm(1:nrw(i),i))) + if( mod(synd(i),2) .ne. 0 ) ncheck=ncheck+1 +! if( mod(synd(i),2) .ne. 0 ) write(*,*) 'check ',i,' unsatisfied' + enddo +! write(*,*) 'number of unsatisfied parity checks ',ncheck + if( ncheck .eq. 0 ) then ! we have a codeword - if crc is good, return it + decoded=cw(1:K) + call chkcrc14a(decoded,nbadcrc) + nharderror=count( (2*cw-1)*llr .lt. 0.0 ) + if(nbadcrc.eq.0) then + message77=decoded(1:77) + return + endif + endif + + if( iter.gt.0 ) then ! this code block implements an early stopping criterion +! if( iter.gt.10000 ) then ! this code block implements an early stopping criterion + nd=ncheck-nclast + if( nd .lt. 0 ) then ! # of unsatisfied parity checks decreased + ncnt=0 ! reset counter + else + ncnt=ncnt+1 + endif +! write(*,*) iter,ncheck,nd,ncnt + if( ncnt .ge. 5 .and. iter .ge. 10 .and. ncheck .gt. 15) then + nharderror=-1 + return + endif + endif + nclast=ncheck + +! Send messages from bits to check nodes + do j=1,M + do i=1,nrw(j) + ibj=Nm(i,j) + toc(i,j)=zn(ibj) + do kk=1,ncw ! subtract off what the bit had received from the check + if( Mn(kk,ibj) .eq. j ) then + toc(i,j)=toc(i,j)-tov(kk,ibj) + endif + enddo + enddo + enddo + +! send messages from check nodes to variable nodes + do i=1,M + tanhtoc(1:7,i)=tanh(-toc(1:7,i)/2) + enddo + + do j=1,N + do i=1,ncw + ichk=Mn(i,j) ! Mn(:,j) are the checks that include bit j + Tmn=product(tanhtoc(1:nrw(ichk),ichk),mask=Nm(1:nrw(ichk),ichk).ne.j) + call platanh(-Tmn,y) +! y=atanh(-Tmn) + tov(i,j)=2*y + enddo + enddo + +enddo +nharderror=-1 +return +end subroutine bpdecode174_91var diff --git a/lib/ft8var/call_q.f90 b/lib/ft8var/call_q.f90 index 9cbad578..a9b0379e 100755..100644 --- a/lib/ft8var/call_q.f90 +++ b/lib/ft8var/call_q.f90 @@ -1,10 +1,10 @@ -
-! call may not start from 'Q', zero and two digits
- if(call_a(1:1).eq.'Q' .or. call_b(1:1).eq.'Q') then
- nbadcrc=1; msg37=' '; return; endif
- if(call_a(1:1).eq.'0' .or. call_b(1:1).eq.'0') then
- nbadcrc=1; msg37=' '; return; endif
- if(call_a(1:1).ge.'0' .and. call_a(1:1).le.'9' .and. call_a(2:2).ge.'0' .and. call_a(2:2).le.'9') then
- nbadcrc=1; msg37=' '; return; endif
- if(call_b(1:1).ge.'0' .and. call_b(1:1).le.'9' .and. call_b(2:2).ge.'0' .and. call_b(2:2).le.'9') then
+ +! call may not start from 'Q', zero and two digits + if(call_a(1:1).eq.'Q' .or. call_b(1:1).eq.'Q') then + nbadcrc=1; msg37=' '; return; endif + if(call_a(1:1).eq.'0' .or. call_b(1:1).eq.'0') then + nbadcrc=1; msg37=' '; return; endif + if(call_a(1:1).ge.'0' .and. call_a(1:1).le.'9' .and. call_a(2:2).ge.'0' .and. call_a(2:2).le.'9') then + nbadcrc=1; msg37=' '; return; endif + if(call_b(1:1).ge.'0' .and. call_b(1:1).le.'9' .and. call_b(2:2).ge.'0' .and. call_b(2:2).le.'9') then nbadcrc=1; msg37=' '; return; endif
\ No newline at end of file diff --git a/lib/ft8var/callsign_q.f90 b/lib/ft8var/callsign_q.f90 index 5e453a3f..a3a9e002 100755..100644 --- a/lib/ft8var/callsign_q.f90 +++ b/lib/ft8var/callsign_q.f90 @@ -1,26 +1,26 @@ -
-! call may not start from 'Q', zero and two digits
- if(callsign(1:1).eq.'Q' .or. callsign(1:1).eq.'0' .or. callsign(1:1).eq.'/') then
- nbadcrc=1; msg37=' '; return; endif
-
- if(callsign(1:1).ge.'0' .and. callsign(1:1).le.'9') then
- if(callsign(2:2).ge.'0' .and. callsign(2:2).le.'9') then
- nbadcrc=1; msg37=' '; return; endif
- if(callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' .and. callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z' &
- .and. callsign(4:4).ge.'A' .and. callsign(4:4).le.'Z') then
- nbadcrc=1; msg37=' '; return; endif
- endif
-
- if(callsign(1:1).ge.'A' .and. callsign(1:1).le.'Z') then
- if(callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' &
- .and. callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z') then
- nbadcrc=1; msg37=' '; return; endif
- endif
-
- if(callsign(1:1).ge.'0' .and. callsign(1:1).le.'9') then
- if(callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' &
- .and. callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z') then
- if(callsign(1:3).ne.'3DA' .and. callsign(1:3).ne.'3XY') then
- nbadcrc=1; msg37=' '; return; endif
- endif
+ +! call may not start from 'Q', zero and two digits + if(callsign(1:1).eq.'Q' .or. callsign(1:1).eq.'0' .or. callsign(1:1).eq.'/') then + nbadcrc=1; msg37=' '; return; endif + + if(callsign(1:1).ge.'0' .and. callsign(1:1).le.'9') then + if(callsign(2:2).ge.'0' .and. callsign(2:2).le.'9') then + nbadcrc=1; msg37=' '; return; endif + if(callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' .and. callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z' & + .and. callsign(4:4).ge.'A' .and. callsign(4:4).le.'Z') then + nbadcrc=1; msg37=' '; return; endif + endif + + if(callsign(1:1).ge.'A' .and. callsign(1:1).le.'Z') then + if(callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' & + .and. callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z') then + nbadcrc=1; msg37=' '; return; endif + endif + + if(callsign(1:1).ge.'0' .and. callsign(1:1).le.'9') then + if(callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' & + .and. callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z') then + if(callsign(1:3).ne.'3DA' .and. callsign(1:3).ne.'3XY') then + nbadcrc=1; msg37=' '; return; endif + endif endif
\ No newline at end of file diff --git a/lib/ft8var/chkfalse8var.f90 b/lib/ft8var/chkfalse8var.f90 index fc2a9840..d70306dc 100755..100644 --- a/lib/ft8var/chkfalse8var.f90 +++ b/lib/ft8var/chkfalse8var.f90 @@ -1,603 +1,603 @@ -subroutine chkfalse8var(msg37,i3,n3,nbadcrc,iaptype,lcall1hash)
-
- use ft8_mod1, only : mycall,hiscall,hisgrid4
- character msg37*37,decoded*22,callsign*12,calltmp*12,call_a*12,call_b*12, &
- grid*12,callmask6*6
- character*6 mask6(3)
- integer, intent(in) :: i3,n3
- logical(1) falsedec,lchkcall,lgvalid,lwrongcall
- logical(1), intent(in) :: lcall1hash
- data mask6/'001000','101000','011000'/
-
- call_a=''
- call_b=''
-! iaptype=0 non-AP decoder
-! iaptype=1 CQ message AP decoder
-
-! i3 n3 Bits Total Message type
-! ---------------------------------------------------------------------------------------
-! 0 0 FREE TEXT MSG 71 71
-! 0 1 K1ABC RR73; W9XYZ <KH1/KH7Z> -12 28 28 10 5 71 DXpedition Mode
-! 0 2 PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 70 EU VHF contest (2)
-! 0 2 PA3XYZ 520093 IO91NP 28 1 1 3 12 25 70 EU VHF contest (2)
-! 0 3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day
-! 0 3 WA9XYZ KA1ABC 7D EMA 28 28 1 4 3 7 71 ARRL Field Day
-! 0 3 WA9XYZ G8ABC 1D DX 28 28 1 4 3 7 71 ARRL Field Day
-! 0 4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day
-! 0 5 123456789ABCDEF012 71 71 Telemetry (18 hex)
-! 0 5 7123456789ABCDEF01 71 71 Telemetry (18 hex)
-! 0 5 71234567 71 71 Telemetry (18 hex)
-! 0 5 81234567 71 71 Telemetry (18 hex)
-! 0 5 8123456789ABCDEF01 71 71 Telemetry (18 hex)
-! 1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg, with std or non std callsign
-! 1 WA9XYZ KA1ABC R-11 28 1 28 1 1 15 74 Standard msg, with std or non std callsign
-! 1 CQ 039 P30KJE/R DR46
-! 2 PA1XYZ/P GM4ABC/P R FN42 28 1 28 1 1 15 74 EU VHF Contest
-! 2 CQ 039 P30KJE/P DR46
-! 3 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest
-! 3 TU; W9XYZ G8ABC R 559 0013 1 28 28 1 3 13 74 ARRL RTTY (DX)
-! 4 <WA9XYZ> PJ4/KA1ABC RR73 13 58 1 2 74 Nonstandard call
-! 4 <WA9XYZ> PJ4/KA1ABC 13 58 1 2 74 Nonstandard call
-! 4 PJ4/KA1ABC <WA9XYZ> RRR 13 58 1 2 74 Nonstandard call
-! 4 CQ ZW5STAYHOME 13 58 1 2 74 Nonstandard call
-
-! 'CQ 5NGX46MFKUE' 'CQ 53HDFKJEASD' 'CQ HDF53KJEASD' i3=4 n3=1
-! -23 0.3 1482 ~ CQ EQ3YCI/KVNA i3=4 n3=1
-! -23 -1.3 CQ P28Z58W/77M i3=4 n3=1
- if(msg37(1:3).eq.'CQ ') then
- callsign=''
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if(i3.eq.4) then
- islash=index(msg37,'/')
- if(islash.le.0) then
- callsign=trim(msg37(ispc1+1:))
- nlencall=len_trim(callsign)
- if(nlencall.lt.1) return
- ispccall=index(callsign,' ')
-! CQ 9D6T0GA4 Z space inside callsign of any length: protocol violation, or last char is digit
- if(ispccall.lt.nlencall .or. callsign(nlencall:nlencall).lt.':') then
- go to 900
- endif
- else
- if(islash.gt.ispc1 .and. islash.lt.ispc2) then
- if(islash-ispc1.le.ispc2-islash) then
- callsign=msg37(islash+1:ispc2-1)
- else
- callsign=msg37(ispc1+1:islash-1)
- endif
- endif
- endif
-
- include 'callsign_q.f90'
-
- if(islash.gt.0) then
- falsedec=.false.
- call chkflscallvar('CQ ',callsign,falsedec)
- if(falsedec) go to 900
- else
- nlen=len_trim(callsign)
- if(nlen.ge.10) then
- falsedec=.false.
- call chklong8(callsign,falsedec)
- if(falsedec) go to 900
- else if(nlen.eq.6 .and. index(callsign,'/').lt.1) then
-! 'CQ VK6ZRW' protocol violation, i3 for stdcall shall be equal to 1
- do i=1,6
- if(callsign(i:i).gt.'/' .and. callsign(i:i).lt.':') then
- callmask6(i:i)='1'
- else
- callmask6(i:i)='0'
- endif
- enddo
-
- falsedec=.false.
- do i=1,3
- if(callmask6.eq.mask6(i)) then
- falsedec=.true.
- exit
- endif ! standard callsign, false decode
- enddo
- if(falsedec) go to 900
- endif
- endif
-
-! i=1 AP mask iaptype 1 false decodes
-! -23 0.9 2630 ~ CQ P5RXL MK92 *
-! -24 0.3 550 ~ CQ DZ0BIL/R AD94 *
-! -7 0.2 400 ~ CQ LI9NAI/R CF97 * in some noisy setups such decodes possible with a high SNR
-
- else if(iaptype.eq.1) then
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- if(msg37(ispc2-2:ispc2-1).eq.'/R' .or. &
- msg37(ispc2-2:ispc2-1).eq.'/P') then
- callsign=msg37(ispc1+1:ispc2-3)
- else
- callsign=msg37(ispc1+1:ispc2-1)
- endif
-
- include 'callsign_q.f90'
-
- grid=''
- if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. &
- msg37(ispc2+1:ispc2+1).lt.'S' .and. &
- msg37(ispc2+2:ispc2+2).gt.'@' .and. &
- msg37(ispc2+2:ispc2+2).lt.'S' .and. &
- msg37(ispc2+3:ispc2+3).lt.':' .and. &
- msg37(ispc2+4:ispc2+4).lt.':') grid=msg37(ispc2+1:ispc3-1)
- if(len_trim(grid).eq.4) then
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) go to 900
- endif
- endif
-
- if(i3.eq.4) then
-! CQ Y09Q7/SS60M i3=4 n3=1
- callsign=''
- callsign=trim(msg37(4:))
- islash=index(callsign,'/')
- islash2=index(callsign(islash+1:),'/')
- nlencall=len_trim(callsign)
- if(nlencall.eq.11 .and. islash.gt.0 .and. islash2.lt.1) then
-
- if(islash.lt.7) then
- if((callsign(islash+1:islash+1).lt.':' .and. &
- callsign(islash+2:islash+2).lt.':') .or. &
- callsign(islash+1:islash+1).eq.'Q' .or. &
- callsign(nlencall:nlencall).lt.':') go to 900
- endif
-
- if(islash.gt.5) then
- if(callsign(islash-1:islash-1).lt.':' .or. &
- (callsign(1:1).lt.':' .and. callsign(2:2).lt.':') .or. &
- callsign(1:1).eq.'Q') go to 900
- endif
-
- if(islash.gt.4 .and. islash.lt.8) then
- call_a=''
- call_b=''
- call_a=callsign(1:islash-1)
- call_b=callsign(islash+1:)
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) go to 900
- endif
- endif
- endif
-
-! CQ 039 P30KJE/R DR46 i3=1 n3=5
-! CQ 039 P30KJE/P DR46 i3=2 n3=5
- if(msg37(4:4).lt.':' .and. msg37(4:4).gt.'/' .and. msg37(7:7).eq.' ' &
- .and. (i3.eq.1 .or. i3.eq.2)) then
- islash=index(msg37,'/')
- if(islash.gt.10 .and. islash.lt.15) then
- callsign=''
- grid=''
- callsign=msg37(8:islash-1)
- grid=msg37(islash+3:islash+6)
- nlengrid=len_trim(grid)
- if(nlengrid.eq.4 .and. grid(1:1).gt.'@' .and. grid(4:4).lt.':') then
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) go to 900
- endif
- falsedec=.false.
- call chkflscallvar('MYCALL ',callsign,falsedec)
- if(falsedec) go to 900
- endif
- endif
-
-! CQ CJ3OPE/R FP61 i3=1
-! CQ KU3XIK NN41
- if(i3.eq.1 .and. iaptype.eq.0) then
- callsign=''
- grid=''
- islash=index(msg37,'/R ')
- if(islash.gt.6) then
- callsign=msg37(4:islash-1)
- grid=msg37(islash+3:islash+6)
- else if(islash.lt.1) then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- if(len_trim(msg37).eq.ispc3-1) then
- callsign=msg37(ispc1+1:ispc2-1)
- grid=msg37(ispc2+1:ispc3-1)
- else
- return ! 4-word message, will be processed in ft8bvar.f90
- endif
- endif
- nlengrid=len_trim(grid)
- if(nlengrid.eq.4 .and. grid(1:1).gt.'@' .and. grid(4:4).lt.':') then
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) go to 900
- endif
-
- if(islash.gt.6) then
- falsedec=.false.
- call chkflscallvar('MYCALL ',callsign,falsedec)
- if(falsedec) go to 900
- endif
- endif
-
- return ! prevent further checking if message starts from 'CQ '
-! TO DO via patterns: '175715 -18 -0.1 2519 ~ CQ P2PSR6UWBHS'
- endif
-
- if(iaptype.eq.2) then ! message starts with user's callsign, 2nd callsign is random
-! ES1JA JA1QZQ/R R GD47
-! UA3ALE A70DDN/R OF23
-! ES6DO NH4CXV MA87
-! EA1AHY PW1BSL R GR47 i3=1
-! ES6DO ST0VQA R174 invalid message, can not be transmitted
-
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- callsign=''
- grid=''
- callsign=msg37(ispc1+1:ispc2-1)
- islash=index(callsign,'/R')
- if(islash.gt.3) then
- calltmp=' '
- calltmp=callsign(1:islash-1)
- callsign=calltmp
- endif
-
- include 'callsign_q.f90'
-
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- indxr=index(msg37,' R ')
- if(indxr.gt.7) then
- ispc4=index(msg37((ispc3+1):),' ')+ispc3
- if(ispc4-ispc3.eq.5) then
- if(msg37(ispc3+1:ispc3+1).gt.'@' .and. &
- msg37(ispc3+1:ispc3+1).lt.'S' .and. &
- msg37(ispc3+2:ispc3+2).gt.'@' .and. &
- msg37(ispc3+2:ispc3+2).lt.'S' .and. &
- msg37(ispc3+3:ispc3+3).lt.':' .and. &
- msg37(ispc3+4:ispc3+4).lt.':') then
- grid=msg37(ispc3+1:ispc4-1)
- else ! invalid message
- go to 900
- endif
- endif
- else if(indxr.lt.1) then
- if(ispc3-ispc2.eq.5) then
- if(msg37(ispc2+1:ispc2+1).gt.'@' .and. &
- msg37(ispc2+1:ispc2+1).lt.'S' .and. &
- msg37(ispc2+2:ispc2+2).gt.'@' .and. &
- msg37(ispc2+2:ispc2+2).lt.'S' .and. &
- msg37(ispc2+3:ispc2+3).lt.':' .and. &
- msg37(ispc2+4:ispc2+4).lt.':') then
- grid=msg37(ispc2+1:ispc3-1)
- else ! invalid message
- go to 900
- endif
- endif
- endif
- if(len_trim(grid).eq.4) then
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) go to 900
- endif
-
- return ! no need in other checks
- endif
-
- if(iaptype.eq.40) then ! AP mask '<mycall> ??? ???'
-! JH4PUL/3 BG4NSA RQ43 * reported false decodes
-! JH4PUL/3 M06FLK R AE10 * at least it is possible to transmit the message
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- callsign=''
- grid=''
- callsign=msg37(ispc1+1:ispc2-1)
-
- include 'callsign_q.f90'
-
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- indxr=index(msg37,' R ')
- if(indxr.gt.7) then
- ispc4=index(msg37((ispc3+1):),' ')+ispc3
- if(ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc3+1).gt.'@' .and. &
- msg37(ispc3+1:ispc3+1).lt.'S' .and. &
- msg37(ispc3+2:ispc3+2).gt.'@' .and. &
- msg37(ispc3+2:ispc3+2).lt.'S' .and. &
- msg37(ispc3+3:ispc3+3).lt.':' .and. &
- msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1)
- else if(indxr.lt.1) then
- if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. &
- msg37(ispc2+1:ispc2+1).lt.'S' .and. &
- msg37(ispc2+2:ispc2+2).gt.'@' .and. &
- msg37(ispc2+2:ispc2+2).lt.'S' .and. &
- msg37(ispc2+3:ispc2+3).lt.':' .and. &
- msg37(ispc2+4:ispc2+4).lt.':') grid=msg37(ispc2+1:ispc3-1)
- endif
-
- if(len_trim(grid).eq.4) then
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) go to 900
- endif
- return ! no need in other checks for iaptype 40
- endif
-
-! RV6ARZ CX7CO R NI25 ! mycall hiscall ??? AP mask false decode, both callsigns are correct, checking for valid grid
-! ES6DO TK60CNES R MJ79 ! non standard DXCall, iaptype 11
-! UA0ZZZ AA1AAA/1 R GC45 ! non standard DXCall, iaptype 11
-! JH4PUL/3 HB9CEX R PN76 * ! non standard mycall, iaptype 41
-! JH4PUL/3 JT1DN HB30 * ! non standard mycall, iaptype 41
-
- if(iaptype.eq.3 .or. iaptype.eq.11 .or. iaptype.eq.21 .or. iaptype.eq.41) then
- indxr=index(msg37,' R ')
- if(iaptype.eq.21 .and. indxr.gt.0) go to 900 ! invalid message in Hound mode
- islash1=index(msg37,'/')
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if(ispc1.gt.3 .and. ispc2.gt.7) then
- if(islash1.lt.ispc1 .or. (islash1.eq.ispc2-2 .and. &
- msg37(ispc2-1:ispc2-1).lt.':' )) then ! AA1AAA/1 can be first or 2nd callsign
- if(msg37(1:ispc1-1).eq.mycall .and. &
- msg37(ispc1+1:ispc2-1).eq.hiscall) then
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- grid=''
- if(indxr.gt.7) then
- ispc4=index(msg37((ispc3+1):),' ')+ispc3
- if(ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc3+1).gt.'@' &
- .and. msg37(ispc3+1:ispc3+1).lt.'S' .and. &
- msg37(ispc3+2:ispc3+2).gt.'@' .and. &
- msg37(ispc3+2:ispc3+2).lt.'S' .and. &
- msg37(ispc3+3:ispc3+3).lt.':' .and. &
- msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1)
- else if(indxr.lt.1) then
- if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' &
- .and. msg37(ispc2+1:ispc2+1).lt.'S' .and. &
- msg37(ispc2+2:ispc2+2).gt.'@' .and. &
- msg37(ispc2+2:ispc2+2).lt.'S' .and. &
- msg37(ispc2+3:ispc2+3).lt.':' .and. &
- msg37(ispc2+4:ispc2+4).lt.':') grid=msg37(ispc2+1:ispc3-1)
- endif
-
- if(len_trim(grid).eq.4 .and. grid.ne.hisgrid4) then
- ! correctly decoded contest message
- if(iaptype.eq.21) then
- if(grid.eq.'RR73') then
- ! AP mask 'mybcall hisbcall ???' can trigger RR73 message
- return
- else
- go to 900
- endif
- endif
- call chkgridvar(hiscall,grid,lchkcall,lgvalid,lwrongcall)
- if(grid.eq.'RR73') then
- lgvalid = .true.
- else
- if(.not.lgvalid) go to 900
- endif
- endif
- endif
- endif
- endif
- return ! no need in other checks
- endif
-
- if((i3.ge.1 .and. i3.le.3) .and. (index(msg37,' R ').gt.0 .or. &
- index(msg37,'/R ').gt.0 .or. index(msg37,'/P ').gt.0)) then
-
-! i3=1: 'VF5RMP/P OW3ATG/P R MF' '378YYA/R 9H5PQU R OL53'
-! i3=2: 'YT4MEY/P WL8QEW R IR03'
-! i3=1: 'ER2XXD 8L7UWC R 529 26'
-! i3=3 n3=1: '1M8JSH TI0CZQ R 539 42'
-! i3=2 n3=5: 'DQ2VF/P J2OON KG37'
-! 'N40RTH AD2WPI/R MG62'
-
- islash1=index(msg37,'/')
- call_a=''
- call_b=''
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if(islash1.lt.1 .and. ispc1.gt.3 .and. ispc2.gt.7) then
- call_a=msg37(1:ispc1-1)
- call_b=msg37(ispc1+1:ispc2-1)
- if(call_b.ne.hiscall) then
- include 'call_q.f90'
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) go to 900
- endif
- endif
-
- if(islash1.gt.0 .and. ispc1.gt.3 .and. ispc2.gt.7) then
- islash2=index(msg37((islash1+1):),'/')+islash1
- if(islash1.gt.ispc1) then
- call_a=msg37(1:ispc1-1)
- call_b=msg37(ispc1+1:islash1-1)
- else
- call_a=msg37(1:islash1-1)
- if(islash2.gt.islash1) then
- call_b=msg37(ispc1+1:islash2-1)
- else
- call_b=msg37(ispc1+1:ispc2-1)
- endif
- endif
- include 'call_q.f90'
- if(call_a.ne.mycall .and. call_b.ne.hiscall) then
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) go to 900
- endif
- endif
- endif
-
-! i3=1 n3=4
-! 000189 -23 0.4 300 ~ <...> QG6GFE CQ14
-! 110015 -21 -0.0 2050 ~ <...> NF7OEX CP03
-! check if grid is correct for call_2
-
- if(lcall1hash .and. i3.eq.1) then
- ! hash can be associated with a valid callsign in the table
- ispc1=index(msg37,' ')
- if(msg37(1:ispc1-1).ne.mycall) then
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- callsign=''
- grid=''
- callsign=msg37(ispc1+1:ispc2-1)
- islash=index(callsign,'/')
- if(islash.lt.1) then
- include 'callsign_q.f90'
- if(callsign.ne.hiscall) then
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. &
- msg37(ispc2+1:ispc2+1).lt.'S' .and. &
- msg37(ispc2+2:ispc2+2).gt.'@' .and. &
- msg37(ispc2+2:ispc2+2).lt.'S' .and. &
- msg37(ispc2+3:ispc2+3).lt.':' .and. &
- msg37(ispc2+4:ispc2+4).lt.':') then
- grid=msg37(ispc2+1:ispc3-1)
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) go to 900
- endif
- endif
- endif
- endif
- endif
-
-! i3=1 n3=1 '4P6NPC 5M5UJG BK49'
-! i3=3 n3=1 '8Z7TLB JQ0OTZ 589 02'
-! i3=0 n3=3 'CE3NTP 4C2DWN 5E ONE'
-
- if(iaptype.ne.2) then
- if(((i3.eq.1 .or. i3.eq.3) .and. index(msg37,' R ').le.0 .and. &
- index(msg37,'/').le.0) .or. (i3.eq.0 .and. n3.eq.3)) then
- if(msg37(1:2).eq.'<.') go to 2
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if(ispc1.gt.3 .and. ispc2.gt.7) then
- call_a=msg37(1:ispc1-1)
- if(call_a.eq.mycall) go to 2 ! exception to incoming calls
- call_b=msg37(ispc1+1:ispc2-1)
- include 'call_q.f90'
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) go to 900
- endif
- endif
- endif
-
-2 continue
-
- if(i3.eq.4) then
- ibrace1=index(msg37,'<.')
- if(index(msg37,'<.').gt.4) then
- callsign=''
- callsign=msg37(1:ibrace1-2)
- islash=index(callsign,'/')
- nlencall=len_trim(callsign)
- if(nlencall.lt.1) go to 4
-
-! i3=4 n3=2 '6397X6JN637 <...> RRR'
-! 'R 5QCDOIY9 <...> RR73'
- if(index(trim(callsign),' ').gt.0 .or. (islash.lt.1 .and. &
- callsign(nlencall:nlencall).lt.':')) go to 900
- include 'callsign_q.f90'
- falsedec=.false.
- call chklong8(callsign,falsedec)
- if(falsedec) go to 900
- endif
- if(msg37(1:2).eq.'<.' .or. index(msg37,'.>').gt.4) then
-!'<...> 104J71MFOT9 RR73'
-! i3=4 n3=0 '<...> /7ZZZZ/ /8'
-! i3=4 n3=2 '<...> 6HGLDZ 5IN2 RRR'
- callsign=''
- nlenmsg=len_trim(msg37)
- if(msg37(1:2).eq.'<.') then
- if(msg37(nlenmsg-4:nlenmsg).eq.' RR73') then
- callsign=msg37(7:nlenmsg-5)
- else if(msg37(nlenmsg-2:nlenmsg).eq.' 73') then
- callsign=msg37(7:nlenmsg-3)
- else if(msg37(nlenmsg-3:nlenmsg).eq.' RRR') then
- callsign=msg37(7:nlenmsg-4)
- else
- callsign=msg37(7:nlenmsg)
- endif
- else
- ibracket=index(msg37,'<.')
- callsign=msg37(1:ibracket-2)
- endif
- nlencall=len_trim(callsign)
- if(nlencall.gt.0) then
- ispace=index(callsign(1:nlencall),' ')
- islash=index(callsign,'/')
- if(ispace.gt.0 .or. (islash.lt.1 .and. &
- callsign(nlencall:nlencall).lt.':') .or. &
- islash.eq.nlencall) go to 900
-
-! KY2HTW/0O5M <...> i3=4 n3=0
- if(islash.gt.4) then
- islash2=index(callsign(islash+1:),'/')
- if(nlencall.eq.11 .and. islash2.lt.1) then
- if(islash.lt.7) then
- if((callsign(islash+1:islash+1).lt.':' .and. &
- callsign(islash+2:islash+2).lt.':') .or. &
- callsign(islash+1:islash+1).eq.'Q' .or. &
- callsign(nlencall:nlencall).lt.':') go to 900
- endif
-
- if(islash.gt.5) then
- if(callsign(islash-1:islash-1).lt.':' .or. &
- (callsign(1:1).lt.':' .and.callsign(2:2).lt.':') &
- .or. callsign(1:1).eq.'Q') go to 900
- endif
-
- if(islash.gt.4 .and. islash.lt.8) then
- call_a=''
- call_b=''
- call_a=callsign(1:islash-1)
- call_b=callsign(islash+1:)
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) go to 900
- endif
- endif
- endif
- include 'callsign_q.f90'
- falsedec=.false.
- call chklong8(callsign,falsedec)
- if(falsedec) go to 900
- endif
- endif
-! '<...> T99LMF GC41' need to understand how to check such message
- endif
-
-4 continue
-
- if(i3.eq.3 .and. msg37(1:3).eq.'TU;') then
-!i3=3 n3=3 'TU; QV4UPP 632TGU 529'
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- if(ispc2.gt.7 .and. ispc3.gt.11) then
- call_a=msg37(ispc1+1:ispc2-1)
- call_b=msg37(ispc2+1:ispc3-1)
- include 'call_q.f90'
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) go to 900
- endif
- endif
-
- if(i3.eq.0 .and. n3.eq.0) then
-! 'J/.ZM1R-D1Q89'
- if(index(msg37,'/.').gt.0) go to 900
- decoded=msg37(1:22)
- falsedec=.false.
- call filtersfreevar(decoded,falsedec)
- if(falsedec) go to 900
- endif
-
-! CQ_RLXA 551626 ^J65XI
- if(i3.eq.0 .and. (msg37(1:3).eq.'CQ_' .or. index(msg37,'^').gt.0)) go to 900
- go to 999
-
-900 nbadcrc=1
- msg37=''
-
-999 return
-end subroutine chkfalse8var
+subroutine chkfalse8var(msg37,i3,n3,nbadcrc,iaptype,lcall1hash) + + use ft8_mod1, only : mycall,hiscall,hisgrid4 + character msg37*37,decoded*22,callsign*12,calltmp*12,call_a*12,call_b*12, & + grid*12,callmask6*6 + character*6 mask6(3) + integer, intent(in) :: i3,n3 + logical(1) falsedec,lchkcall,lgvalid,lwrongcall + logical(1), intent(in) :: lcall1hash + data mask6/'001000','101000','011000'/ + + call_a='' + call_b='' +! iaptype=0 non-AP decoder +! iaptype=1 CQ message AP decoder + +! i3 n3 Bits Total Message type +! --------------------------------------------------------------------------------------- +! 0 0 FREE TEXT MSG 71 71 +! 0 1 K1ABC RR73; W9XYZ <KH1/KH7Z> -12 28 28 10 5 71 DXpedition Mode +! 0 2 PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 70 EU VHF contest (2) +! 0 2 PA3XYZ 520093 IO91NP 28 1 1 3 12 25 70 EU VHF contest (2) +! 0 3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day +! 0 3 WA9XYZ KA1ABC 7D EMA 28 28 1 4 3 7 71 ARRL Field Day +! 0 3 WA9XYZ G8ABC 1D DX 28 28 1 4 3 7 71 ARRL Field Day +! 0 4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day +! 0 5 123456789ABCDEF012 71 71 Telemetry (18 hex) +! 0 5 7123456789ABCDEF01 71 71 Telemetry (18 hex) +! 0 5 71234567 71 71 Telemetry (18 hex) +! 0 5 81234567 71 71 Telemetry (18 hex) +! 0 5 8123456789ABCDEF01 71 71 Telemetry (18 hex) +! 1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg, with std or non std callsign +! 1 WA9XYZ KA1ABC R-11 28 1 28 1 1 15 74 Standard msg, with std or non std callsign +! 1 CQ 039 P30KJE/R DR46 +! 2 PA1XYZ/P GM4ABC/P R FN42 28 1 28 1 1 15 74 EU VHF Contest +! 2 CQ 039 P30KJE/P DR46 +! 3 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest +! 3 TU; W9XYZ G8ABC R 559 0013 1 28 28 1 3 13 74 ARRL RTTY (DX) +! 4 <WA9XYZ> PJ4/KA1ABC RR73 13 58 1 2 74 Nonstandard call +! 4 <WA9XYZ> PJ4/KA1ABC 13 58 1 2 74 Nonstandard call +! 4 PJ4/KA1ABC <WA9XYZ> RRR 13 58 1 2 74 Nonstandard call +! 4 CQ ZW5STAYHOME 13 58 1 2 74 Nonstandard call + +! 'CQ 5NGX46MFKUE' 'CQ 53HDFKJEASD' 'CQ HDF53KJEASD' i3=4 n3=1 +! -23 0.3 1482 ~ CQ EQ3YCI/KVNA i3=4 n3=1 +! -23 -1.3 CQ P28Z58W/77M i3=4 n3=1 + if(msg37(1:3).eq.'CQ ') then + callsign='' + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if(i3.eq.4) then + islash=index(msg37,'/') + if(islash.le.0) then + callsign=trim(msg37(ispc1+1:)) + nlencall=len_trim(callsign) + if(nlencall.lt.1) return + ispccall=index(callsign,' ') +! CQ 9D6T0GA4 Z space inside callsign of any length: protocol violation, or last char is digit + if(ispccall.lt.nlencall .or. callsign(nlencall:nlencall).lt.':') then + go to 900 + endif + else + if(islash.gt.ispc1 .and. islash.lt.ispc2) then + if(islash-ispc1.le.ispc2-islash) then + callsign=msg37(islash+1:ispc2-1) + else + callsign=msg37(ispc1+1:islash-1) + endif + endif + endif + + include 'callsign_q.f90' + + if(islash.gt.0) then + falsedec=.false. + call chkflscallvar('CQ ',callsign,falsedec) + if(falsedec) go to 900 + else + nlen=len_trim(callsign) + if(nlen.ge.10) then + falsedec=.false. + call chklong8(callsign,falsedec) + if(falsedec) go to 900 + else if(nlen.eq.6 .and. index(callsign,'/').lt.1) then +! 'CQ VK6ZRW' protocol violation, i3 for stdcall shall be equal to 1 + do i=1,6 + if(callsign(i:i).gt.'/' .and. callsign(i:i).lt.':') then + callmask6(i:i)='1' + else + callmask6(i:i)='0' + endif + enddo + + falsedec=.false. + do i=1,3 + if(callmask6.eq.mask6(i)) then + falsedec=.true. + exit + endif ! standard callsign, false decode + enddo + if(falsedec) go to 900 + endif + endif + +! i=1 AP mask iaptype 1 false decodes +! -23 0.9 2630 ~ CQ P5RXL MK92 * +! -24 0.3 550 ~ CQ DZ0BIL/R AD94 * +! -7 0.2 400 ~ CQ LI9NAI/R CF97 * in some noisy setups such decodes possible with a high SNR + + else if(iaptype.eq.1) then + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + if(msg37(ispc2-2:ispc2-1).eq.'/R' .or. & + msg37(ispc2-2:ispc2-1).eq.'/P') then + callsign=msg37(ispc1+1:ispc2-3) + else + callsign=msg37(ispc1+1:ispc2-1) + endif + + include 'callsign_q.f90' + + grid='' + if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. & + msg37(ispc2+1:ispc2+1).lt.'S' .and. & + msg37(ispc2+2:ispc2+2).gt.'@' .and. & + msg37(ispc2+2:ispc2+2).lt.'S' .and. & + msg37(ispc2+3:ispc2+3).lt.':' .and. & + msg37(ispc2+4:ispc2+4).lt.':') grid=msg37(ispc2+1:ispc3-1) + if(len_trim(grid).eq.4) then + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) go to 900 + endif + endif + + if(i3.eq.4) then +! CQ Y09Q7/SS60M i3=4 n3=1 + callsign='' + callsign=trim(msg37(4:)) + islash=index(callsign,'/') + islash2=index(callsign(islash+1:),'/') + nlencall=len_trim(callsign) + if(nlencall.eq.11 .and. islash.gt.0 .and. islash2.lt.1) then + + if(islash.lt.7) then + if((callsign(islash+1:islash+1).lt.':' .and. & + callsign(islash+2:islash+2).lt.':') .or. & + callsign(islash+1:islash+1).eq.'Q' .or. & + callsign(nlencall:nlencall).lt.':') go to 900 + endif + + if(islash.gt.5) then + if(callsign(islash-1:islash-1).lt.':' .or. & + (callsign(1:1).lt.':' .and. callsign(2:2).lt.':') .or. & + callsign(1:1).eq.'Q') go to 900 + endif + + if(islash.gt.4 .and. islash.lt.8) then + call_a='' + call_b='' + call_a=callsign(1:islash-1) + call_b=callsign(islash+1:) + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) go to 900 + endif + endif + endif + +! CQ 039 P30KJE/R DR46 i3=1 n3=5 +! CQ 039 P30KJE/P DR46 i3=2 n3=5 + if(msg37(4:4).lt.':' .and. msg37(4:4).gt.'/' .and. msg37(7:7).eq.' ' & + .and. (i3.eq.1 .or. i3.eq.2)) then + islash=index(msg37,'/') + if(islash.gt.10 .and. islash.lt.15) then + callsign='' + grid='' + callsign=msg37(8:islash-1) + grid=msg37(islash+3:islash+6) + nlengrid=len_trim(grid) + if(nlengrid.eq.4 .and. grid(1:1).gt.'@' .and. grid(4:4).lt.':') then + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) go to 900 + endif + falsedec=.false. + call chkflscallvar('MYCALL ',callsign,falsedec) + if(falsedec) go to 900 + endif + endif + +! CQ CJ3OPE/R FP61 i3=1 +! CQ KU3XIK NN41 + if(i3.eq.1 .and. iaptype.eq.0) then + callsign='' + grid='' + islash=index(msg37,'/R ') + if(islash.gt.6) then + callsign=msg37(4:islash-1) + grid=msg37(islash+3:islash+6) + else if(islash.lt.1) then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + if(len_trim(msg37).eq.ispc3-1) then + callsign=msg37(ispc1+1:ispc2-1) + grid=msg37(ispc2+1:ispc3-1) + else + return ! 4-word message, will be processed in ft8bvar.f90 + endif + endif + nlengrid=len_trim(grid) + if(nlengrid.eq.4 .and. grid(1:1).gt.'@' .and. grid(4:4).lt.':') then + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) go to 900 + endif + + if(islash.gt.6) then + falsedec=.false. + call chkflscallvar('MYCALL ',callsign,falsedec) + if(falsedec) go to 900 + endif + endif + + return ! prevent further checking if message starts from 'CQ ' +! TO DO via patterns: '175715 -18 -0.1 2519 ~ CQ P2PSR6UWBHS' + endif + + if(iaptype.eq.2) then ! message starts with user's callsign, 2nd callsign is random +! ES1JA JA1QZQ/R R GD47 +! UA3ALE A70DDN/R OF23 +! ES6DO NH4CXV MA87 +! EA1AHY PW1BSL R GR47 i3=1 +! ES6DO ST0VQA R174 invalid message, can not be transmitted + + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + callsign='' + grid='' + callsign=msg37(ispc1+1:ispc2-1) + islash=index(callsign,'/R') + if(islash.gt.3) then + calltmp=' ' + calltmp=callsign(1:islash-1) + callsign=calltmp + endif + + include 'callsign_q.f90' + + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + indxr=index(msg37,' R ') + if(indxr.gt.7) then + ispc4=index(msg37((ispc3+1):),' ')+ispc3 + if(ispc4-ispc3.eq.5) then + if(msg37(ispc3+1:ispc3+1).gt.'@' .and. & + msg37(ispc3+1:ispc3+1).lt.'S' .and. & + msg37(ispc3+2:ispc3+2).gt.'@' .and. & + msg37(ispc3+2:ispc3+2).lt.'S' .and. & + msg37(ispc3+3:ispc3+3).lt.':' .and. & + msg37(ispc3+4:ispc3+4).lt.':') then + grid=msg37(ispc3+1:ispc4-1) + else ! invalid message + go to 900 + endif + endif + else if(indxr.lt.1) then + if(ispc3-ispc2.eq.5) then + if(msg37(ispc2+1:ispc2+1).gt.'@' .and. & + msg37(ispc2+1:ispc2+1).lt.'S' .and. & + msg37(ispc2+2:ispc2+2).gt.'@' .and. & + msg37(ispc2+2:ispc2+2).lt.'S' .and. & + msg37(ispc2+3:ispc2+3).lt.':' .and. & + msg37(ispc2+4:ispc2+4).lt.':') then + grid=msg37(ispc2+1:ispc3-1) + else ! invalid message + go to 900 + endif + endif + endif + if(len_trim(grid).eq.4) then + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) go to 900 + endif + + return ! no need in other checks + endif + + if(iaptype.eq.40) then ! AP mask '<mycall> ??? ???' +! JH4PUL/3 BG4NSA RQ43 * reported false decodes +! JH4PUL/3 M06FLK R AE10 * at least it is possible to transmit the message + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + callsign='' + grid='' + callsign=msg37(ispc1+1:ispc2-1) + + include 'callsign_q.f90' + + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + indxr=index(msg37,' R ') + if(indxr.gt.7) then + ispc4=index(msg37((ispc3+1):),' ')+ispc3 + if(ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc3+1).gt.'@' .and. & + msg37(ispc3+1:ispc3+1).lt.'S' .and. & + msg37(ispc3+2:ispc3+2).gt.'@' .and. & + msg37(ispc3+2:ispc3+2).lt.'S' .and. & + msg37(ispc3+3:ispc3+3).lt.':' .and. & + msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1) + else if(indxr.lt.1) then + if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. & + msg37(ispc2+1:ispc2+1).lt.'S' .and. & + msg37(ispc2+2:ispc2+2).gt.'@' .and. & + msg37(ispc2+2:ispc2+2).lt.'S' .and. & + msg37(ispc2+3:ispc2+3).lt.':' .and. & + msg37(ispc2+4:ispc2+4).lt.':') grid=msg37(ispc2+1:ispc3-1) + endif + + if(len_trim(grid).eq.4) then + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) go to 900 + endif + return ! no need in other checks for iaptype 40 + endif + +! RV6ARZ CX7CO R NI25 ! mycall hiscall ??? AP mask false decode, both callsigns are correct, checking for valid grid +! ES6DO TK60CNES R MJ79 ! non standard DXCall, iaptype 11 +! UA0ZZZ AA1AAA/1 R GC45 ! non standard DXCall, iaptype 11 +! JH4PUL/3 HB9CEX R PN76 * ! non standard mycall, iaptype 41 +! JH4PUL/3 JT1DN HB30 * ! non standard mycall, iaptype 41 + + if(iaptype.eq.3 .or. iaptype.eq.11 .or. iaptype.eq.21 .or. iaptype.eq.41) then + indxr=index(msg37,' R ') + if(iaptype.eq.21 .and. indxr.gt.0) go to 900 ! invalid message in Hound mode + islash1=index(msg37,'/') + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if(ispc1.gt.3 .and. ispc2.gt.7) then + if(islash1.lt.ispc1 .or. (islash1.eq.ispc2-2 .and. & + msg37(ispc2-1:ispc2-1).lt.':' )) then ! AA1AAA/1 can be first or 2nd callsign + if(msg37(1:ispc1-1).eq.mycall .and. & + msg37(ispc1+1:ispc2-1).eq.hiscall) then + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + grid='' + if(indxr.gt.7) then + ispc4=index(msg37((ispc3+1):),' ')+ispc3 + if(ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc3+1).gt.'@' & + .and. msg37(ispc3+1:ispc3+1).lt.'S' .and. & + msg37(ispc3+2:ispc3+2).gt.'@' .and. & + msg37(ispc3+2:ispc3+2).lt.'S' .and. & + msg37(ispc3+3:ispc3+3).lt.':' .and. & + msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1) + else if(indxr.lt.1) then + if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' & + .and. msg37(ispc2+1:ispc2+1).lt.'S' .and. & + msg37(ispc2+2:ispc2+2).gt.'@' .and. & + msg37(ispc2+2:ispc2+2).lt.'S' .and. & + msg37(ispc2+3:ispc2+3).lt.':' .and. & + msg37(ispc2+4:ispc2+4).lt.':') grid=msg37(ispc2+1:ispc3-1) + endif + + if(len_trim(grid).eq.4 .and. grid.ne.hisgrid4) then + ! correctly decoded contest message + if(iaptype.eq.21) then + if(grid.eq.'RR73') then + ! AP mask 'mybcall hisbcall ???' can trigger RR73 message + return + else + go to 900 + endif + endif + call chkgridvar(hiscall,grid,lchkcall,lgvalid,lwrongcall) + if(grid.eq.'RR73') then + lgvalid = .true. + else + if(.not.lgvalid) go to 900 + endif + endif + endif + endif + endif + return ! no need in other checks + endif + + if((i3.ge.1 .and. i3.le.3) .and. (index(msg37,' R ').gt.0 .or. & + index(msg37,'/R ').gt.0 .or. index(msg37,'/P ').gt.0)) then + +! i3=1: 'VF5RMP/P OW3ATG/P R MF' '378YYA/R 9H5PQU R OL53' +! i3=2: 'YT4MEY/P WL8QEW R IR03' +! i3=1: 'ER2XXD 8L7UWC R 529 26' +! i3=3 n3=1: '1M8JSH TI0CZQ R 539 42' +! i3=2 n3=5: 'DQ2VF/P J2OON KG37' +! 'N40RTH AD2WPI/R MG62' + + islash1=index(msg37,'/') + call_a='' + call_b='' + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if(islash1.lt.1 .and. ispc1.gt.3 .and. ispc2.gt.7) then + call_a=msg37(1:ispc1-1) + call_b=msg37(ispc1+1:ispc2-1) + if(call_b.ne.hiscall) then + include 'call_q.f90' + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) go to 900 + endif + endif + + if(islash1.gt.0 .and. ispc1.gt.3 .and. ispc2.gt.7) then + islash2=index(msg37((islash1+1):),'/')+islash1 + if(islash1.gt.ispc1) then + call_a=msg37(1:ispc1-1) + call_b=msg37(ispc1+1:islash1-1) + else + call_a=msg37(1:islash1-1) + if(islash2.gt.islash1) then + call_b=msg37(ispc1+1:islash2-1) + else + call_b=msg37(ispc1+1:ispc2-1) + endif + endif + include 'call_q.f90' + if(call_a.ne.mycall .and. call_b.ne.hiscall) then + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) go to 900 + endif + endif + endif + +! i3=1 n3=4 +! 000189 -23 0.4 300 ~ <...> QG6GFE CQ14 +! 110015 -21 -0.0 2050 ~ <...> NF7OEX CP03 +! check if grid is correct for call_2 + + if(lcall1hash .and. i3.eq.1) then + ! hash can be associated with a valid callsign in the table + ispc1=index(msg37,' ') + if(msg37(1:ispc1-1).ne.mycall) then + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + callsign='' + grid='' + callsign=msg37(ispc1+1:ispc2-1) + islash=index(callsign,'/') + if(islash.lt.1) then + include 'callsign_q.f90' + if(callsign.ne.hiscall) then + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. & + msg37(ispc2+1:ispc2+1).lt.'S' .and. & + msg37(ispc2+2:ispc2+2).gt.'@' .and. & + msg37(ispc2+2:ispc2+2).lt.'S' .and. & + msg37(ispc2+3:ispc2+3).lt.':' .and. & + msg37(ispc2+4:ispc2+4).lt.':') then + grid=msg37(ispc2+1:ispc3-1) + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) go to 900 + endif + endif + endif + endif + endif + +! i3=1 n3=1 '4P6NPC 5M5UJG BK49' +! i3=3 n3=1 '8Z7TLB JQ0OTZ 589 02' +! i3=0 n3=3 'CE3NTP 4C2DWN 5E ONE' + + if(iaptype.ne.2) then + if(((i3.eq.1 .or. i3.eq.3) .and. index(msg37,' R ').le.0 .and. & + index(msg37,'/').le.0) .or. (i3.eq.0 .and. n3.eq.3)) then + if(msg37(1:2).eq.'<.') go to 2 + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if(ispc1.gt.3 .and. ispc2.gt.7) then + call_a=msg37(1:ispc1-1) + if(call_a.eq.mycall) go to 2 ! exception to incoming calls + call_b=msg37(ispc1+1:ispc2-1) + include 'call_q.f90' + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) go to 900 + endif + endif + endif + +2 continue + + if(i3.eq.4) then + ibrace1=index(msg37,'<.') + if(index(msg37,'<.').gt.4) then + callsign='' + callsign=msg37(1:ibrace1-2) + islash=index(callsign,'/') + nlencall=len_trim(callsign) + if(nlencall.lt.1) go to 4 + +! i3=4 n3=2 '6397X6JN637 <...> RRR' +! 'R 5QCDOIY9 <...> RR73' + if(index(trim(callsign),' ').gt.0 .or. (islash.lt.1 .and. & + callsign(nlencall:nlencall).lt.':')) go to 900 + include 'callsign_q.f90' + falsedec=.false. + call chklong8(callsign,falsedec) + if(falsedec) go to 900 + endif + if(msg37(1:2).eq.'<.' .or. index(msg37,'.>').gt.4) then +!'<...> 104J71MFOT9 RR73' +! i3=4 n3=0 '<...> /7ZZZZ/ /8' +! i3=4 n3=2 '<...> 6HGLDZ 5IN2 RRR' + callsign='' + nlenmsg=len_trim(msg37) + if(msg37(1:2).eq.'<.') then + if(msg37(nlenmsg-4:nlenmsg).eq.' RR73') then + callsign=msg37(7:nlenmsg-5) + else if(msg37(nlenmsg-2:nlenmsg).eq.' 73') then + callsign=msg37(7:nlenmsg-3) + else if(msg37(nlenmsg-3:nlenmsg).eq.' RRR') then + callsign=msg37(7:nlenmsg-4) + else + callsign=msg37(7:nlenmsg) + endif + else + ibracket=index(msg37,'<.') + callsign=msg37(1:ibracket-2) + endif + nlencall=len_trim(callsign) + if(nlencall.gt.0) then + ispace=index(callsign(1:nlencall),' ') + islash=index(callsign,'/') + if(ispace.gt.0 .or. (islash.lt.1 .and. & + callsign(nlencall:nlencall).lt.':') .or. & + islash.eq.nlencall) go to 900 + +! KY2HTW/0O5M <...> i3=4 n3=0 + if(islash.gt.4) then + islash2=index(callsign(islash+1:),'/') + if(nlencall.eq.11 .and. islash2.lt.1) then + if(islash.lt.7) then + if((callsign(islash+1:islash+1).lt.':' .and. & + callsign(islash+2:islash+2).lt.':') .or. & + callsign(islash+1:islash+1).eq.'Q' .or. & + callsign(nlencall:nlencall).lt.':') go to 900 + endif + + if(islash.gt.5) then + if(callsign(islash-1:islash-1).lt.':' .or. & + (callsign(1:1).lt.':' .and.callsign(2:2).lt.':') & + .or. callsign(1:1).eq.'Q') go to 900 + endif + + if(islash.gt.4 .and. islash.lt.8) then + call_a='' + call_b='' + call_a=callsign(1:islash-1) + call_b=callsign(islash+1:) + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) go to 900 + endif + endif + endif + include 'callsign_q.f90' + falsedec=.false. + call chklong8(callsign,falsedec) + if(falsedec) go to 900 + endif + endif +! '<...> T99LMF GC41' need to understand how to check such message + endif + +4 continue + + if(i3.eq.3 .and. msg37(1:3).eq.'TU;') then +!i3=3 n3=3 'TU; QV4UPP 632TGU 529' + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + if(ispc2.gt.7 .and. ispc3.gt.11) then + call_a=msg37(ispc1+1:ispc2-1) + call_b=msg37(ispc2+1:ispc3-1) + include 'call_q.f90' + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) go to 900 + endif + endif + + if(i3.eq.0 .and. n3.eq.0) then +! 'J/.ZM1R-D1Q89' + if(index(msg37,'/.').gt.0) go to 900 + decoded=msg37(1:22) + falsedec=.false. + call filtersfreevar(decoded,falsedec) + if(falsedec) go to 900 + endif + +! CQ_RLXA 551626 ^J65XI + if(i3.eq.0 .and. (msg37(1:3).eq.'CQ_' .or. index(msg37,'^').gt.0)) go to 900 + go to 999 + +900 nbadcrc=1 + msg37='' + +999 return +end subroutine chkfalse8var diff --git a/lib/ft8var/chkflscallvar.f90 b/lib/ft8var/chkflscallvar.f90 index ff7fe643..1c7e5d88 100755..100644 --- a/lib/ft8var/chkflscallvar.f90 +++ b/lib/ft8var/chkflscallvar.f90 @@ -1,18 +1,18 @@ -subroutine chkflscallvar(call_a,call_b,falsedec)
-
- character*12 call_a,call_b
- logical(1) falsedec,lfound
-
- if(call_a(1:2).eq.'<.') return
- falsedec=.true.; lfound=.false.
-!print *,"11","'"//call_a//"'","'"//call_b//"'"
- if(call_a.eq.'MYCALL ' .or. call_a.eq.'CQ ') then
- call searchcallsvar(call_b," ",lfound); if(lfound) falsedec=.false.
- else if(call_b(1:1).eq.'<') then
- call searchcallsvar(call_a," ",lfound); if(lfound) falsedec=.false.
- else
- call searchcallsvar(call_a,call_b,lfound); if(lfound) falsedec=.false.
- endif
-
- return
+subroutine chkflscallvar(call_a,call_b,falsedec) + + character*12 call_a,call_b + logical(1) falsedec,lfound + + if(call_a(1:2).eq.'<.') return + falsedec=.true.; lfound=.false. +!print *,"11","'"//call_a//"'","'"//call_b//"'" + if(call_a.eq.'MYCALL ' .or. call_a.eq.'CQ ') then + call searchcallsvar(call_b," ",lfound); if(lfound) falsedec=.false. + else if(call_b(1:1).eq.'<') then + call searchcallsvar(call_a," ",lfound); if(lfound) falsedec=.false. + else + call searchcallsvar(call_a,call_b,lfound); if(lfound) falsedec=.false. + endif + + return end subroutine chkflscallvar
\ No newline at end of file diff --git a/lib/ft8var/chkgridvar.f90 b/lib/ft8var/chkgridvar.f90 index f9f88813..dfaf1075 100755..100644 --- a/lib/ft8var/chkgridvar.f90 +++ b/lib/ft8var/chkgridvar.f90 @@ -1,3392 +1,3392 @@ -subroutine chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
-
- character, intent(in) :: callsign*12,grid*12
- logical(1) lchkcall,lgvalid,lwrongcall
-
-lchkcall=.false.; lgvalid=.false.; lwrongcall=.false.
-
-if(grid(1:1).gt.'@' .and. grid(1:1).lt.'J') then
- if(grid(1:1).eq.'A' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'E') .or. grid(2:2).eq.'M' .or. grid(2:2).eq.'N' .or. &
- grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'B' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'G') .or. grid(2:2).eq.'M' .or. grid(2:2).eq.'N' .or. &
- grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'C' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'G') .or. &
- (grid(2:2).eq.'G' .and. grid(3:3).gt.'7' .and. grid(4:4).lt.'4') .or. &
- (grid(2:2).eq.'I' .and. grid(3:3).gt.'0' .and. grid(4:4).gt.'1') .or. &
- (grid(2:2).gt.'I' .and. grid(2:2).lt.'M') .or. grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'D' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'G') .or. (grid(2:2).gt.'G'.and.grid(2:2).lt.'K').or. &
- (grid(2:2).eq.'G' .and. grid(3:4).ne.'52' .and. grid(3:4).ne.'73') .or. &
- grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'E' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'C') .or. &
- (grid(2:2).eq.'C' .and. grid(3:4).ne.'41') .or. (grid(2:2).eq.'F' .and. grid(3:4).ne.'96') .or. &
- (grid(2:2).gt.'C' .and. grid(2:2).lt.'F') .or. (grid(2:2).eq.'G' .and. grid(3:4).ne.'93') .or.grid(2:2).eq.'H'.or. &
- grid(2:2).eq.'Q' .or. (grid(2:2).eq.'R' .and. grid(3:4).ne.'60'))) then; lchkcall=.true. ! VY0
-
- else if(grid(1:1).eq.'F' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. (grid(2:2).eq.'Q'.and.grid(3:3).lt.'3').or. &
- grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'G' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'C') .or. (grid(2:2).gt.'K'.and.grid(2:2).lt.'N').or. &
- (grid(2:2).eq.'K' .and. grid(3:3).gt.'0') .or. (grid(2:2).eq.'N' .and. grid(3:3).gt.'3') .or. &
- (grid(2:2).eq.'Q' .and. grid(4:4).gt.'4') .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'H' .and. (grid(2:2).eq.'A' .or. (grid(2:2).eq.'B' .and. grid(3:4).ne.'22') .or. & ! LU1ZG in HB22QD
- grid(2:2).eq.'C' .or. (grid(2:2).gt.'D'.and.grid(2:2).lt.'H') .or. &
- grid(2:2).eq.'J' .or. grid(2:2).eq.'L' .or. grid(2:2).eq.'N' .or. grid(2:2).eq.'O' .or. &
- (grid(2:2).eq.'K' .and. grid(3:3).lt.'7') .or. (grid(2:2).eq.'M' .and. grid(4:4).lt.'6') .or. &
- (grid(2:2).eq.'Q' .and. grid(4:4).gt.'0') .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'I' .and. (grid(2:2).eq.'A' .or. (grid(2:2).gt.'B' .and. grid(2:2).lt.'F') .or. &
- (grid(2:2).eq.'B' .and. grid(3:4).ne.'59') .or. & ! DP0GVN
- (grid(2:2).eq.'F' .and. grid(3:4).ne.'32') .or. grid(2:2).eq.'G' .or. (grid(2:2).eq.'H' .and.grid(3:3).ne.'7').or. &
- (grid(2:2).eq.'I' .and. grid(3:4).ne.'22') .or. (grid(2:2).eq.'O' .and. grid(3:3).lt.'3') .or. &
- (grid(2:2).eq.'P' .and. grid(4:4).gt.'7') .or. (grid(2:2).eq.'Q' .and. grid(4:4).gt.'1') .or. grid(2:2).eq.'R')) &
- then; lchkcall=.true.
- endif
-
-else if(grid(1:1).gt.'I' .and. grid(1:1).lt.'S') then
-
- if(grid(1:1).eq.'J' .and. (grid(2:2).eq.'C' .or. &
- (grid(2:2).eq.'A' .and. grid(3:4).ne.'00') .or. & ! KC4AAA
- (grid(2:2).eq.'B' .and. grid(3:4).ne.'59') .or. & ! Novolazarevskaya
- (grid(2:2).eq.'D' .and. grid(3:4).ne.'15') .or. grid(2:2).eq.'E' .or. (grid(2:2).eq.'F' .and. grid(3:3).lt.'8') .or. &
- (grid(2:2).eq.'G' .and. grid(3:3).lt.'6') .or. (grid(2:2).eq.'H' .and. grid(3:3).lt.'5') .or. &
- (grid(2:2).eq.'I' .and. grid(3:3).lt.'2') .or. (grid(2:2).eq.'R' .and. grid(4:4).gt.'0'))) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'K' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'C') .or. &
- (grid(2:2).eq.'C' .and. grid(3:4).ne.'90') .or. grid(2:2).eq.'D' .or. & ! 8J1RL
- (grid(2:2).eq.'E' .and. grid(3:4).ne.'83' .and. grid(3:4).ne.'93') .or. (grid(2:2).eq.'F' .and. grid(4:4).lt.'5') .or. &
- (grid(2:2).eq.'R' .and. grid(4:4).gt.'0'))) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'L' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'E') .or. &
- (grid(2:2).eq.'E' .and. grid(3:4).ne.'53' .and. grid(3:4).ne.'54' .and. grid(3:4).ne.'63') .or. grid(2:2).eq.'F' .or. &
- (grid(2:2).eq.'G' .and. grid(4:4).lt.'4') .or. (grid(2:2).eq.'J' .and. grid(3:3).gt.'5') .or. &
- (grid(2:2).eq.'Q' .and. grid(4:4).lt.'5' .and. grid(4:4).lt.'9') .or. &
- (grid(2:2).eq.'R' .and. grid(4:4).gt.'1'))) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'M' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. &
- (grid(2:2).eq.'D' .and. grid(3:4).ne.'66' .and. grid(3:4).ne.'67' .and. grid(3:4).ne.'49') .or. &
- (grid(2:2).eq.'E' .and. grid(3:4).ne.'40' .and. grid(3:4).ne.'41' .and. grid(3:4).ne.'50') .or. &
- (grid(2:2).eq.'F' .and. grid(3:4).ne.'81' .and. grid(3:4).ne.'82') .or. grid(2:2).eq.'G' .or. &
- (grid(2:2).eq.'H' .and. grid(3:4).ne.'10') .or. (grid(2:2).eq.'I' .and. grid(3:3).lt.'5') .or. &
- (grid(2:2).eq.'J' .and. grid(3:3).lt.'6') .or. (grid(2:2).eq.'K' .and. grid(3:3).lt.'5') .or. &
- (grid(2:2).eq.'R' .and. grid(4:4).gt.'1'))) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'N' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'H') .or. &
- (grid(2:2).eq.'H' .and. grid(3:4).ne.'87' .and. grid(3:4).ne.'88') .or. &
- (grid(2:2).eq.'I' .and. grid(3:3).lt.'9' .and. grid(3:4).ne.'89') .or. &
- (grid(2:2).eq.'J' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6') .or. &
- (grid(2:2).eq.'R' .and. grid(4:4).gt.'1'))) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'O' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'F') .or. &
- (grid(2:2).eq.'F' .and. grid(3:3).lt.'7') .or. (grid(2:2).eq.'G' .and. grid(3:3).lt.'6') .or. &
- (grid(2:2).eq.'H' .and. grid(3:4).ne.'90' .and. grid(3:4).ne.'92' .and. grid(3:4).ne.'29' .and. grid(3:4).ne.'99').or. &
- grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'P' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'F') .or. (grid(2:2).eq.'F'.and.grid(4:4).lt.'2').or. &
- (grid(2:2).eq.'K' .and. grid(3:3).gt.'3' .and. grid(3:4).ne.'90') .or. &
- (grid(2:2).eq.'Q' .and. grid(4:4).gt.'6') .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'Q' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. &
- (grid(2:2).eq.'D' .and. grid(3:4).ne.'94' .and. grid(3:4).ne.'95') .or. (grid(2:2).eq.'E' .and. grid(4:4).lt.'6') .or. &
- (grid(2:2).eq.'F' .and. grid(3:3).gt.'6' .and. grid(3:4).ne.'98') .or. &
- (grid(2:2).eq.'K' .and. grid(3:3).gt.'2' .and. grid(3:4).ne.'36') .or. &
- (grid(2:2).eq.'L' .and. grid(3:3).gt.'2' .and. grid(3:4).ne.'64' .and. grid(3:4).ne.'74') .or. &
- (grid(2:2).eq.'M' .and. grid(3:3).gt.'0' .and. grid(3:4).ne.'19') .or. &
- (grid(2:2).eq.'N' .and. grid(3:3).gt.'7') .or. &
- (grid(2:2).eq.'Q' .and. grid(4:4).gt.'7') .or. grid(2:2).eq.'R')) then; lchkcall=.true.
-
- else if(grid(1:1).eq.'R' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. &
- (grid(2:2).eq.'D' .and. grid(3:4).ne.'47' .and. grid(3:4).ne.'29' .and. grid(3:4).ne.'39') .or. &
- (grid(2:2).eq.'K' .and. grid(4:4).gt.'4' .and. grid(3:4).ne.'39') .or. (grid(2:2).gt.'K' .and. grid(2:2).lt.'O') .or. &
- (grid(2:2).eq.'O' .and. grid(4:4).eq.'0') .or. (grid(2:2).eq.'Q' .and. grid(4:4).gt.'1') .or. grid(2:2).eq.'R')) &
- then; lchkcall=.true.
- endif
-
-else if (grid(1:1).gt.'/' .and. grid(1:1).lt.':') then ! 0..9
- lchkcall=.true.
-endif
-
-if(.not.lchkcall) then
-
- if(callsign(1:1).gt.'K' .and. callsign(1:1).lt.'[') then; go to 2
- else if(callsign(1:1).gt.'/' .and. callsign(1:1).lt.':') then; go to 4
- endif
-
- if(callsign(1:1).eq.'A') then
-
-! USA AA..AL,K,N,W
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'M') then
- if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. &
- (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. &
- grid(1:2).eq.'BP' .or. &
- (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- grid(1:4).eq.'FK28' .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. &
- (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. &
- grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. &
- grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. &
- (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. &
- grid(3:4).eq.'63')) .or. &
- grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. &
- grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. &
- grid(1:4).eq.'CP00') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' &
- .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. &
- grid(3:4).eq.'14')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false.
- else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. &
- grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. &
- grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. &
- ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. &
- grid(3:4).eq.'22')) then; lgvalid=.false.
- else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false.
- endif
-endif
-
-! Australia AX,VH..VN,VZ
- else if(callsign(1:2).eq.'AX') then
- if((grid(1:2).eq.'QG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. &
- (grid(1:2).eq.'QF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. &
- (grid(1:2).eq.'PF' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'OF' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'QE' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and.grid(4:4).gt.'5'.and. grid(4:4).lt.':').or. &
- grid(3:4).eq.'19')) .or. &
- (grid(1:2).eq.'QH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'OG' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. &
- grid(1:2).eq.'PG' .or. grid(1:2).eq.'PH') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'QF' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') then; lgvalid=.false.
- else if(grid(1:2).eq.'PF' .and. ((grid(3:3).gt.'/'.and.grid(3:3).lt.'8'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. &
- (grid(4:4).eq.'5' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7') .or. grid(3:4).eq.'57')) then; lgvalid=.false.
- else if(grid(1:4).eq.'OF74') then; lgvalid=.false.
- else if(grid(1:2).eq.'QH' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. grid(3:4).eq.'09')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OG' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'69')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PH' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':' .and. &
- grid(4:4).ne.'5' .and. grid(4:4).ne.'6') .or. &
- (grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'59' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'89')) then; lgvalid=.false.
- endif
-endif
-
-! Pakistan 6P..6S, AP..AS
- else if(callsign(2:2).gt.'O' .and. callsign(2:2).lt.'T') then
- if((grid(1:2).eq.'MM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. &
- grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) .or. &
- (grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'33'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'MM' .and. grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') then; lgvalid=.false.
- else if(grid(1:2).eq.'ML' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'07')) then; lgvalid=.false.
- endif
-endif
-
-! Spain AM..AO,EA..EH
- else if(callsign(1:1).eq.'A' .and. callsign(2:2).gt.'L' .and. callsign(2:2).lt.'P') then
- if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4' .and. &
- grid(3:4).ne.'50').or. &
- (grid(1:2).eq.'IM' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'12' .or. grid(3:4).eq.'13' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85')) .or. &
- (grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'20')) .or. &
- (grid(1:2).eq.'JM' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or.grid(3:4).eq.'19'.or.grid(3:4).eq.'29')).or. &
- (grid(1:2).eq.'IL' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. &
- (grid(4:4).eq.'8' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. grid(3:4).eq.'39'))) lgvalid=.true.
-
-! Botswana 8O,A2
- else if(callsign(1:2).eq.'A2') then
- if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- (grid(1:2).eq.'KH' .and. (grid(3:4).eq.'22' .or. grid(3:4).eq.'30')) .or. &
- (grid(1:2).eq.'KG' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'47'))) lgvalid=.true.
-
-! Tonga A3
- else if(callsign(1:2).eq.'A3') then
- if((grid(1:2).eq.'AG' .and. (grid(3:4).eq.'28' .or.grid(3:4).eq.'29'.or.grid(3:4).eq.'06'.or.grid(3:4).eq.'07')).or. &
- (grid(1:2).eq.'AH' .and. (grid(3:4).eq.'21' .or.grid(3:4).eq.'31'.or.grid(3:4).eq.'24'.or.grid(3:4).eq.'34'))) &
- lgvalid=.true.
-
-! Oman A4
- else if(callsign(1:2).eq.'A4') then
- if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'LK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-! Bhutan A5
- else if(callsign(1:2).eq.'A5') then
- if(grid(1:2).eq.'NL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.'9') &
- lgvalid=.true.
-
-! United Arab Emirates A6
- else if(callsign(1:2).eq.'A6') then
- if(grid(1:2).eq.'LL' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and.grid(4:4).gt.'1'.and.grid(4:4).lt.'6').or. &
- grid(3:4).eq.'53' .or. grid(3:4).eq.'54')) lgvalid=.true.
-
-! Qatar A7
- else if(callsign(1:2).eq.'A7') then
- if((grid(1:3).eq.'LL5' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.'7') .or. grid(1:4).eq.'LL65') lgvalid=.true.
-
-! Bahrain A9
- else if(callsign(1:2).eq.'A9') then
- if(grid(1:3).eq.'LL5' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.'7') lgvalid=.true.
-
-! Argentina AY,AZ, L1..L9, LO..LW
- else if(callsign(1:2).eq.'AY' .or. callsign(1:2).eq.'AZ') then
- if((grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FF' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'FE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9') .or. &
- (grid(1:2).eq.'FD' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'GC07' .or. grid(1:4).eq.'GC16') lgvalid=.true. ! LU1ZB in GC16
-
-if(lgvalid) then
- if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FG' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'57')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GG' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. &
- grid(3:4).eq.'35')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FE' .and. ((grid(3:3).eq.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. &
- (grid(3:3).eq.'3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'70' .or. grid(3:4).eq.'73')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'2'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'8').or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':'))) then; lgvalid=.false.
- endif
-endif
-
-! India 8T..8Y,AT..AW,VT..VW
- else if(callsign(1:1).eq.'A' .and. callsign(2:2).gt.'S' .and. callsign(2:2).lt.'X') then
- if((grid(1:2).eq.'MJ' .and. (grid(3:4).eq.'99' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'88' .or. &
- grid(3:4).eq.'68')).or. &
- (grid(1:2).eq.'MK' .and. ((grid(3:3).gt.'5'.and.grid(3:3).lt.':').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. &
- (grid(1:2).eq.'NK' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or.grid(3:4).eq.'39')).or. &
- (grid(1:2).eq.'ML' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(1:4).eq.'NM00') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'MK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'5') then; lgvalid=.false.
- else if(grid(1:2).eq.'NK' .and. (grid(3:4).eq.'26' .or. grid(3:4).eq.'27')) then; lgvalid=.false.
- else if(grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'4'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'5'.or.grid(4:4).eq.'8'.or. &
- grid(4:4).eq.'9')) .or. grid(3:4).eq.'58' .or. grid(3:4).eq.'59')) then; lgvalid=.false.
- else if(grid(1:2).eq.'NL' .and. ((grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(4:4).eq.'8' .and. grid(3:3).gt.'0' .and. grid(4:4).lt.'5') .or.grid(3:4).eq.'40')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MM' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'62')) then; lgvalid=.false.
- endif
-endif
-
-! Liberia 5L,5M,6Z,A8,D5,EL
- else if(callsign(1:2).eq.'A8') then
- if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' .and. &
- grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true.
-
- endif ! 'A'
-
- else if(callsign(1:1).eq.'B') then
- if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall
-! China, Taiwan B, 3H..3U, XS
- if(grid(1:2).eq.'OL' .or. &
- (grid(1:2).eq.'PL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. grid(1:2).eq.'OM' .or. &
- (grid(1:2).eq.'PM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. &
- (grid(1:2).eq.'PN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8') .or. &
- (grid(1:2).eq.'PO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- (grid(1:2).eq.'OK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or.grid(3:4).eq.'59')).or. &
- grid(1:2).eq.'ON' .or. grid(1:4).eq.'OO90' .or. grid(1:4).eq.'OO91' .or. grid(1:2).eq.'NN' .or. grid(1:2).eq.'NM'.or. &
- (grid(1:2).eq.'NL' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'MN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':')) lgvalid=.true.
-
-if(lgvalid) then
-! grid exceptions for Taiwan BM,BN,BO,BP,BQ,BU,BV,BW,BX
- if((callsign(2:2).gt.'L' .and. callsign(2:2).lt.'R') .or. (callsign(2:2).gt.'T' .and. callsign(2:2).lt.'Y')) then
- if(grid(1:4).ne.'PL04' .and. grid(1:4).ne.'PL03' .and. grid(1:4).ne.'PL05' .and. grid(1:4).ne.'PL02' .and. &
- grid(1:4).ne.'PL01' .and. grid(1:4).ne.'OL93' .and. grid(1:4).ne.'PL15' .and. grid(1:4).ne.'OL80') lgvalid=.false.
- endif
-endif
-if(lgvalid) then
- if(grid(1:2).eq.'NL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7'.and. &
- grid(3:4).ne.'83' .and. grid(3:4).ne.'84' .and. grid(3:4).ne.'85') .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'87')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'ON' .and.((grid(3:3).gt.'/'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- (grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':') .or. &
- grid(3:4).eq.'76' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PN' .and. ((grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. &
- grid(3:4).eq.'40' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'59' .or. &
- grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MM' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).eq.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'OL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'0') .or. &
- grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) then; lgvalid=.false.
- endif
-endif
-if(.not.lgvalid) then
-! Spratly Islands 1S,9M0,BM9S,BN9S,BO9S,BP9S,BQ9S,BU9S,BV9S,BW9S,BX9S
- if(callsign(3:4).eq.'9S' .and. ((callsign(2:2).gt.'K' .and. callsign(2:2).lt.'R') .or. (callsign(2:2).gt.'T'.and. &
- callsign(2:2).lt.'Y'))) then
- if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-endif
-
- endif ! 'B'
-
- else if(callsign(1:1).eq.'C') then
-
- ! Chile 3G,CA..CE,XQ,XR
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'F') then
- if((grid(1:2).eq.'FF' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'FG' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8'))) .or. &
- (grid(1:2).eq.'FE' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'52')) .or. &
- (grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'53' .or. grid(3:4).eq.'85')) .or. &
- grid(1:4).eq.'EF96' .or. grid(1:4).eq.'FF06' .or. grid(1:4).eq.'EG93' .or. grid(1:4).eq.'FG03' .or. &
- grid(1:4).eq.'DG52' .or. grid(1:4).eq.'DG73') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FF' .and. grid(3:3).eq.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') then; lgvalid=.false.
- else if(grid(1:2).eq.'FE' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'29')) then; lgvalid=.false.
- endif
-endif
-
-! Cuba CL,CM,CO,T4
- else if(callsign(1:2).eq.'CL' .or. callsign(1:2).eq.'CM' .or. callsign(1:2).eq.'CO') then
- if((grid(1:2).eq.'EL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. grid(1:4).eq.'FK19') lgvalid=.true.
-
-! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO
- else if((callsign(2:2).gt.'E' .and. callsign(2:2).lt.'L').or. callsign(1:2).eq.'CY' .or. callsign(1:2).eq.'CZ') then
- if((grid(1:2).eq.'CN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'EN' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. grid(1:2).eq.'CO' .or. &
- (grid(1:2).eq.'GN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- grid(1:2).eq.'FO' .or. grid(1:2).eq.'EO' .or. grid(1:2).eq.'DO' .or. &
- (grid(1:2).eq.'GO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'DN'.and. grid(4:4).gt.'8' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'CP' .or. grid(1:2).eq.'DP' .or. grid(1:2).eq.'EP' .or. &
- (grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'96')) .or. &
- (grid(1:2).eq.'EQ' .and. (grid(3:4).eq.'15' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'24' .or.grid(3:4).eq.'71'.or. &
- grid(3:4).eq.'73' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'86' .or.grid(3:4).eq.'96')).or. &
- (grid(1:2).eq.'FR' .and. (grid(3:4).eq.'71' .or. grid(3:4).eq.'82')) .or. &
- (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'12')) .or. grid(1:4).eq.'GN03' .or. &
- grid(1:4).eq.'FN93' .or. grid(1:4).eq.'ER60' .or. grid(1:4).eq.'DQ10' .or. grid(1:4).eq.'CQ71') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'EO' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and.grid(4:4).lt.':').or. &
- (grid(4:4).eq.'7' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9') .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'CO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. &
- grid(4:4).lt.'8').or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'30'.or.grid(3:4).eq.'31'.or. &
- grid(3:4).eq.'40')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EP' .and. ((grid(4:4).eq.'0' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. &
- (grid(4:4).eq.'1' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9') .or. &
- (grid(4:4).eq.'2' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'CN' .and. (grid(3:4).eq.'68' .or. grid(3:4).eq.'98')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. &
- grid(4:4).lt.'8') .or. grid(3:4).eq.'04')) then; lgvalid=.false.
- endif
-endif
-
-! Portugal, Madeira, Azores CQ..CU
- else if(callsign(2:2).gt.'P' .and. callsign(2:2).lt.'U') then
- if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'IM' .and. grid(3:3).gt.'4' .and. ((grid(3:3).lt.'7' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'12' .or. grid(3:4).eq.'13' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20')) .or. &
- (grid(1:2).eq.'HM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'76'))) lgvalid=.true.
-
-! Uruguay CV..CX
- else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'Y') then
- if(grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') &
- lgvalid=.true.
-
-! Bolivia CP
- else if(callsign(1:2).eq.'CP') then
- if((grid(1:2).eq.'FH' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'GH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. &
- (grid(1:2).eq.'FI' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'70')) .or. &
- (grid(1:2).eq.'GG' .and. (grid(3:4).eq.'09' .or. grid(3:4).eq.'19'))) lgvalid=.true.
-
-! Nauru C2, Andorra C3
- else if((callsign(1:2).eq.'C2' .and. grid(1:4).eq.'RI39') .or. (callsign(1:2).eq.'C3' .and. grid(1:4).eq.'JN02')) then
- lgvalid=.true.
-
-! Morocco 5C..5G,CN
- else if(callsign(1:2).eq.'CN') then
- if((grid(1:2).eq.'IM' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'69' .or. grid(3:4).eq.'79'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:3).eq.'IM9' .and. (grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. grid(4:4).eq.'5')) then; lgvalid=.false.
- else if(grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0' .and. &
- grid(4:4).lt.'6') .or. (grid(4:4).eq.'1' .or. grid(4:4).eq.'3' .or. grid(4:4).eq.':') .or. &
- (grid(4:4).eq.'2' .or. grid(4:4).eq.'6' .or. grid(4:4).eq.':') .or. &
- grid(3:4).eq.'31' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- endif
-endif
-
-! Cyprus 5B,C4,H2,P3
- else if(callsign(1:2).eq.'C4') then
- if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. &
- (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true.
-
- ! The Gambia C5
- else if(callsign(1:2).eq.'C5' .and. grid(1:2).eq.'IK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. &
- grid(4:4).eq.'3') then
- lgvalid=.true.
-
- ! Bahamas C6
- else if(callsign(1:2).eq.'C6' .and. grid(1:2).eq.'FL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. &
- grid(4:4).gt.'1' .and. grid(4:4).lt.'7') then
- lgvalid=.true.
-
- ! Mozambique C8,C9
- else if(callsign(1:2).eq.'C8' .or. callsign(1:2).eq.'C9') then
- if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KH' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'LH' .and. grid(3:3).eq.'1' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':')) lgvalid=.true.
-
-! not valid callsigns 'C'
- else if(callsign(2:2).eq.'0' .or. callsign(2:2).eq.'1' .or. callsign(2:2).eq.'7') then
- lwrongcall=.true.; return
-
- endif ! 'C'
-
- else if(callsign(1:1).eq.'D') then
-
-! Fed. Rep. of Germany DA..DR, Y2..Y9
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'S') then
- if((grid(1:2).eq.'JO' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'45')) .or. &
- (grid(1:2).eq.'JN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'IB59') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'JO' .and. ((grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. &
- grid(3:4).eq.'35')) lgvalid=.false.
-endif
-
-! Republic of Korea 6K,6L,6M,6N,D7,D8,D9,DS,DT,HL
- else if(callsign(1:2).eq.'DS' .or. callsign(1:2).eq.'DT' .or. &
- (callsign(2:2).gt.'6' .and. callsign(2:2).lt.':')) then
- if((grid(1:3).eq.'PM3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') .or. &
- (grid(1:3).eq.'PM4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9') .or. &
- grid(1:4).eq.'PM24' .or. grid(1:4).eq.'PM57' .or. grid(1:4).eq.'GC07') lgvalid=.true. ! DT8A in GC07OS South Shetland Islands
-
-! Philippines 4D,4E,4F,4G,4H,4I,DU,DV,DW,DX,DY,DZ
- else if(callsign(2:2).gt.'T' .and. callsign(2:2).lt.'[') then
- if((grid(1:2).eq.'PK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. &
- (grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'04')) .or. &
- (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'OK' .and. grid(3:3).eq.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. &
- (grid(1:2).eq.'PL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. &
- grid(1:4).eq.'OK70' .or. grid(1:4).eq.'OK71') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PK' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'2' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'PJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'15')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false.
- endif
-endif
-
-! D0,D1 prefixes in transmitted message, mapping is required to prevent treating it as false decodes
- else if(callsign(1:2).eq.'D0' .or. callsign(1:2).eq.'D1') then
- if(grid(1:3).eq.'KN8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':' .or. &
- grid(1:3).eq.'KN9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':' .or. &
- grid(1:4).eq.'LN08' .or. grid(1:4).eq.'LN09') lgvalid=.true.
-
-! Angola D2,D3
- else if(callsign(1:2).eq.'D2' .or. callsign(1:2).eq.'D3') then
- if((grid(1:2).eq.'JI' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'JH' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KH' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'01' .or. grid(3:4).eq.'28')) .or. &
- (grid(1:3).eq.'KI0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:3).eq.'JH5' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true.
-
-! Cape Verde D4
- else if(callsign(1:2).eq.'D4' .and. ((grid(1:3).eq.'HK7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- (grid(1:3).eq.'HK8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7'))) then
- lgvalid=.true.
-
-! Liberia 5L,5M,6Z,A8,D5,EL
- else if(callsign(1:2).eq.'D5') then
- if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' .and. &
- grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true.
-
-! Comoros D6
- else if(callsign(1:2).eq.'D6' .and. grid(1:2).eq.'LH' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'18' .or. &
- grid(3:4).eq.'27')) then
- lgvalid=.true.
-
- endif ! 'D'
-
- else if(callsign(1:1).eq.'E') then
-
-! Spain AM..AO,EA..EH
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'I') then
- if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4'.and. &
- grid(3:4).ne.'50') .or. &
- (grid(1:2).eq.'IM' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'12' .or. grid(3:4).eq.'13' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85')) .or. &
- (grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'20')) .or. &
- (grid(1:2).eq.'JM' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or.grid(3:4).eq.'19'.or.grid(3:4).eq.'29')).or. &
- (grid(1:2).eq.'IL' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. &
- (grid(4:4).eq.'8' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. grid(3:4).eq.'39'))) lgvalid=.true.
-
-! Ukraine EM..EO,UR..UZ
- else if(callsign(2:2).gt.'L' .and. callsign(2:2).lt.'P') then
- if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KO' .and. (grid(3:4).eq.'81' .or. grid(3:4).eq.'91')) then; lgvalid=.false.
- else if(grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'0'.and.grid(3:3).lt.'4'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'7').or. &
- grid(3:4).eq.'95' .or. grid(3:4).eq.'96')) then; lgvalid=.false.
- endif
-endif
-
-! Ireland EI,EJ
- else if(callsign(1:2).eq.'EI' .or. callsign(1:2).eq.'EJ') then
- if(grid(1:2).eq.'IO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'6') &
- lgvalid=.true.
-
-! Thailand E2,HS
- else if(callsign(1:2).eq.'E2') then
- if((grid(1:2).eq.'OK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'9').or. &
- grid(3:4).eq.'09')) .or. &
- (grid(1:2).eq.'NK' .and. ((grid(3:3).gt.'8' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'87' .or. grid(3:4).eq.'88'.or. &
- grid(3:4).eq.'89')) .or. &
- (grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'88' .or. grid(3:4).eq.'89')) .or. &
- (grid(1:2).eq.'OJ' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or.grid(3:4).eq.'16')).or. &
- grid(1:4).eq.'NL90' .or. grid(1:4).eq.'OL00') lgvalid=.true.
-
-! Eritrea E3
- else if(callsign(1:2).eq.'E3') then
- if((grid(1:2).eq.'KK' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7')) &
- lgvalid=.true.
-
-! Palestine E4
- else if(callsign(1:2).eq.'E4' .and. (grid(1:4).eq.'KM71' .or. grid(1:4).eq.'KM72')) then
- lgvalid=.true.
-
-! North Cook and South Cook Islands E5
- else if(callsign(1:2).eq.'E5') then
- if((grid(1:2).eq.'BH' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. &
- (grid(1:2).eq.'BG' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09'.or.grid(3:4).eq.'18'.or.grid(3:4).eq.'19')) .or. &
- (grid(1:2).eq.'AH' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'79'.or.grid(3:4).eq.'81'.or.grid(3:4).eq.'86' .or. &
- grid(3:4).eq.'99')) .or. &
- (grid(1:2).eq.'BI' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01'.or.grid(3:4).eq.'10'.or.grid(3:4).eq.'11'))) &
- lgvalid=.true.
-
-! Niue E6
- else if(callsign(1:2).eq.'E6') then
- if(grid(1:4).eq.'AH50' .or. grid(1:4).eq.'AH51') lgvalid=.true.
-
-! Bosnia-Herzegovina E7
- else if(callsign(1:2).eq.'E7') then
- if(grid(1:2).eq.'JN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'6' .and. &
- grid(3:4).ne.'72' .and. grid(3:4).ne.'73') lgvalid=.true.
-
-! Belarus EU,EV,EW
- else if(callsign(2:2).gt.'T' .and. callsign(2:2).lt.'X') then
- if(grid(1:2).eq.'KO' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'7') &
- lgvalid=.true.
-
-! Estonia ES
- else if(callsign(1:2).eq.'ES') then
- if((grid(1:2).eq.'KO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'KO49') lgvalid=.true.
-
-! Moldova ER
- else if(callsign(1:2).eq.'ER') then
- if((grid(1:2).eq.'KN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9').or. &
- grid(1:4).eq.'KN56') lgvalid=.true.
-
-! Armenia EK
- else if(callsign(1:2).eq.'EK') then
- if((grid(1:2).eq.'LN' .and. (grid(3:4).eq.'10' .or. grid(3:4).eq.'11' .or. grid(3:4).eq.'20' .or. &
- grid(3:4).eq.'21')) .or. &
- (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'29' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'38'))) lgvalid=.true.
-
-! Kyrgyzstan EX
- else if(callsign(1:2).eq.'EX') then
- if((grid(1:2).eq.'MN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-! Tajikistan EY
- else if(callsign(1:2).eq.'EY') then
- if((grid(1:2).eq.'MM' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'MN' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'50'))) lgvalid=.true.
-
-! Turkmenistan EZ
- else if(callsign(1:2).eq.'EZ') then
- if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'LN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'MN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2')) &
- lgvalid=.true.
-
-! Liberia 5L,5M,6Z,A8,D5,EL
- else if(callsign(1:2).eq.'EL') then
- if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' .and. &
- grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true.
-
-! Iran 9B..9D,EP,EQ
- else if(callsign(1:2).eq.'EP' .or. callsign(1:2).eq.'EQ') then
- if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'LL' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'49' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) .or. &
- (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':' .and. &
- grid(3:4).ne.'15' .and. grid(3:4).ne.'19') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'LM' .and. ((grid(3:3).eq.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4') .or. &
- (grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':' .and. &
- grid(3:4).ne.'78' .and. grid(3:4).ne.'88'))) lgvalid=.false.
-endif
-
-! Ethiopia 9E,9F,ET
- else if(callsign(1:2).eq.'ET') then
- if((grid(1:2).eq.'LJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5')) &
- lgvalid=.true.
-
-! not valid callsigns E0 E1 E8 E9
- else if(callsign(2:2).eq.'0' .or. callsign(2:2).eq.'1' .or. callsign(2:2).eq.'8' .or. callsign(2:2).eq.'9') then
- lwrongcall=.true.; return
-
- endif ! 'E'
-
- else if(callsign(1:1).eq.'F') then
-
-! France F,FA..FF,FI,FL,FN,FQ,FU,FV,FX,FZ,HW..HY,TH,TM,TP,TQ,TV
- if((callsign(2:2).gt.'/' .and. callsign(2:2).lt.':') .or. (callsign(2:2).gt.'@' .and. callsign(2:2).lt.'G') .or. &
- callsign(2:2).eq.'I' .or. callsign(2:2).eq.'L' .or. callsign(2:2).eq.'N' .or. callsign(2:2).eq.'Q' .or. &
- callsign(2:2).eq.'U' .or. callsign(2:2).eq.'V' .or. callsign(2:2).eq.'X' .or. callsign(2:2).eq.'Z') then
- if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'IN7' .and. (grid(4:4).eq.'7' .or. grid(4:4).eq.'8')) .or. &
- (grid(1:2).eq.'JN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'JN4' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. &
- grid(1:4).eq.'JN02' .or. grid(1:4).eq.'JN12' .or. grid(1:4).eq.'IN92' .or. &
- (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'11'))) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'IN' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) lgvalid=.false.
-endif
-
-! Martinique FM,TO
- else if(callsign(1:2).eq.'FM' .and. grid(1:4).eq.'FK94') then
- lgvalid=.true.
-
-! Guadeloupe FG,TO
- else if(callsign(1:2).eq.'FG') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'96' .or. grid(3:4).eq.'95')) lgvalid=.true.
-
-! St. Pierre & Miquelon FP
- else if(callsign(1:2).eq.'FP') then
- if(grid(1:2).eq.'GN' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) lgvalid=.true.
-
-! St. Martin FS,TO
- else if(callsign(1:2).eq.'FS' .and. grid(1:4).eq.'FK88') then
- lgvalid=.true.
-
-! St. Barthelemy FJ,TO
- else if(callsign(1:2).eq.'FJ' .and. grid(1:4).eq.'FK87') then
- lgvalid=.true.
-
-! French Guiana FY
- else if(callsign(1:2).eq.'FY') then
- if(grid(1:2).eq.'GJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'6') &
- lgvalid=.true.
-
-! Reunion Island FR,TO
- else if(callsign(1:2).eq.'FR') then
- if(grid(1:2).eq.'LG' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'78')) lgvalid=.true.
-
-! New Caledonia FK
- else if(callsign(1:2).eq.'FK') then
- if((grid(1:2).eq.'RG' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'RH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'RG' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'67'))) lgvalid=.true.
-
-! Chesterfield Islands FK,TX
- else if(callsign(1:2).eq.'FK') then
- if((grid(1:2).eq.'QH' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91')) .or. grid(1:4).eq.'QG98') lgvalid=.true.
-
-! Mayotte FH
- else if(callsign(1:2).eq.'FH') then
- if(grid(1:2).eq.'LH' .and. (grid(3:4).eq.'27' .or. grid(3:4).eq.'26')) lgvalid=.true.
-
-! Glorioso, Juan de Nova, Europa, Tromelin, Crozet, Kerguelen, Amsterdam & St. Paul Islands FT
- else if(callsign(1:2).eq.'FT') then
- if((grid(1:2).eq.'LH' .and. (grid(3:4).eq.'38' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'74')) .or. &
- (grid(1:2).eq.'LE' .and. (grid(3:4).eq.'53' .or. grid(3:4).eq.'54' .or. grid(3:4).eq.'63')) .or. &
- (grid(1:2).eq.'ME' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'50')) .or. &
- (grid(1:2).eq.'MF' .and. (grid(3:4).eq.'81' .or. grid(3:4).eq.'82')) .or. &
- grid(1:4).eq.'LG07' .or. grid(1:4).eq.'KG98') lgvalid=.true.
-
-! French Polynesia, Austral, Marquesas, Clipperton Islands FO,TX
- else if(callsign(1:2).eq.'FO') then
- if((grid(1:2).eq.'BH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'BG' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'BI9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'CI' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) .or. &
- grid(1:4).eq.'CH09' .or. grid(1:4).eq.'DK50') lgvalid=.true.
-
-! Wallis & Futuna Islands FW,TW
- else if(callsign(1:2).eq.'FW') then
- if(grid(1:2).eq.'AH' .and. (grid(3:4).eq.'05' .or. grid(3:4).eq.'16')) lgvalid=.true.
-
- endif ! 'F'
-
-! UK GB,GX / 2E,G,M / 2D,GD,GT,MD,MT / 2I,GI,GN,MI,MN / 2J,GH,GJ,MH,MJ / 2A,2M,GM,GS,MA,MM,MS / 2U,GP,GU,MP,MU / 2W,GC,GW,MC,MW
- else if(callsign(1:1).eq.'G') then
- if((grid(1:2).eq.'IO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. &
- (grid(1:3).eq.'JO0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- grid(1:4).eq.'IP90' .or. grid(1:4).eq.'IN69' .or. grid(1:4).eq.'IN89' .or. grid(1:4).eq.'IO37') lgvalid=.true.
-
-if(lgvalid .and. grid(1:2).eq.'IO') then
- if((grid(1:3).eq.'IO5' .and. grid(4:4).ne.'4' .and. grid(4:4).ne.'7') .or. &
- (grid(1:3).eq.'IO6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'96' .or. grid(3:4).eq.'98') lgvalid=.false.
-endif
-
- else if(callsign(1:1).eq.'H') then
-
-! Hungary HA,HG
- if(callsign(1:2).eq.'HA' .or. callsign(1:2).eq.'HG') then
- if((grid(1:2).eq.'JN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'9' .and. &
- grid(3:4).ne.'16')) lgvalid=.true.
-
-! Switzerland, Liechtenstein HB,HE
- else if(callsign(1:2).eq.'HB' .or. callsign(1:2).eq.'HE') then
- if(((grid(1:3).eq.'JN3' .or. grid(1:3).eq.'JN4') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8') .or. &
- grid(1:4).eq.'JN56') lgvalid=.true.
-
-! Thailand E2,HS
- else if(callsign(1:2).eq.'HS') then
- if((grid(1:2).eq.'OK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'9').or. &
- grid(3:4).eq.'09')) .or. &
- (grid(1:2).eq.'NK' .and. ((grid(3:3).gt.'8' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'87' .or. grid(3:4).eq.'88'.or. &
- grid(3:4).eq.'89')) .or. &
- (grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'88' .or. grid(3:4).eq.'89')) .or. &
- (grid(1:2).eq.'OJ' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or.grid(3:4).eq.'16')).or. &
- grid(1:4).eq.'NL90' .or. grid(1:4).eq.'OL00') lgvalid=.true.
-
-! Cyprus 5B,C4,H2,P3
- else if(callsign(1:2).eq.'H2') then
- if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. &
- (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true.
-
-! Poland 3Z,HF,SN..SR
- else if(callsign(1:2).eq.'HF') then
- if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'20')) .or. &
- grid(1:4).eq.'KN09' .or. grid(1:4).eq.'KN19' .or. grid(1:4).eq.'KO20' .or. grid(1:4).eq.'JN99' .or. &
- grid(1:4).eq.'JN89') lgvalid=.true.
-
-! Nicaragua H6,H7,HT,YN
- else if(callsign(1:2).eq.'H6' .or. callsign(1:2).eq.'H7' .or. callsign(1:2).eq.'HT') then
- if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') &
- lgvalid=.true.
-
-! Ecuador HC HD
- else if(callsign(1:2).eq.'HC' .or. callsign(1:2).eq.'HD') then
- if((grid(1:2).eq.'FI' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'05' .or. grid(3:4).eq.'06')) .or. &
- (grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3'.and.grid(4:4).eq.'0').or.grid(3:4).eq.'01')).or. &
- (grid(1:2).eq.'EI' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'49' .or. grid(3:4).eq.'59' .or. grid(3:4).eq.'48' .or. grid(3:4).eq.'58')) .or. &
- (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'40'))) lgvalid=.true.
-
-! Haiti 4V,HH
- else if(callsign(1:2).eq.'HH') then
- if((grid(1:2).eq.'FK' .and. (grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'48' .or. &
- grid(3:4).eq.'49')) .or. grid(1:4).eq.'FL30') lgvalid=.true.
-
-! Dominican Republic HI
- else if(callsign(1:2).eq.'HI') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or. &
- grid(3:4).eq.'59' .or. grid(3:4).eq.'47')) lgvalid=.true.
-
-! Republic of Korea 6K,6L,6M,6N,D7,D8,D9,DS,DT,HL
- else if(callsign(1:2).eq.'HL') then
- if((grid(1:3).eq.'PM3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') .or. &
- (grid(1:3).eq.'PM4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9') .or. &
- grid(1:4).eq.'PM24' .or. grid(1:4).eq.'PM57' .or. grid(1:4).eq.'GC07') lgvalid=.true. ! DT8A in GC07OS South Shetland Islands
-
-! Colombia 5J,5K,HJ,HK
- else if(callsign(1:2).eq.'HK' .or. callsign(1:2).eq.'HJ') then
- if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7') .or. &
- grid(3:4).eq.'01' .or. grid(3:4).eq.'02' .or. grid(3:4).eq.'03')) .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3' .and. &
- grid(3:4).ne.'22') .or. &
- (grid(1:2).eq.'FI' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'6' .and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'45' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'56') .and.grid(3:4).ne.'27').or. &
- (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'94')) .or. grid(1:4).eq.'EK92') lgvalid=.true.
-
-! Saudi Arabia 7Z,8Z,HZ
- else if(callsign(1:2).eq.'HZ') then
- if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8').or. &
- (grid(1:2).eq.'KL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. &
- (grid(1:2).eq.'KM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'2') .or. &
- grid(1:4).eq.'KM92') lgvalid=.true.
-
-! Panama 3E,3F,H3,H8,H9,HO,HP
- else if(callsign(2:2).eq.'P' .or. callsign(2:2).eq.'3' .or. callsign(2:2).eq.'8' .or. &
- callsign(2:2).eq.'9' .or. callsign(2:2).eq.'O') then
- if((grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or. grid(3:4).eq.'17' .or. &
- grid(3:4).eq.'18')) .or. &
- (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'88' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'97' .or. &
- grid(3:4).eq.'98' .or. grid(3:4).eq.'99'))) lgvalid=.true.
-
-! Honduras HQ,HR
- else if(callsign(2:2).eq.'R' .or. callsign(2:2).eq.'Q') then
- if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'2' .and.grid(4:4).lt.'7'.and. &
- grid(3:4).ne.'56' .and. grid(3:4).ne.'83') lgvalid=.true.
-
-! Iraq HN,YI
- else if(callsign(1:2).eq.'HN') then
- if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'KM' .and.(grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) .or. &
- (grid(1:2).eq.'LL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-! El Salvador HU,YS
- else if(callsign(1:2).eq.'HU') then
- if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'53' .or. grid(3:4).eq.'54' .or. grid(3:4).eq.'63' .or. grid(3:4).eq.'43')) &
- lgvalid=.true.
-
-! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU
- else if(callsign(1:2).eq.'H5') then
- if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. &
- (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. &
- grid(3:4).ne.'85') .or. &
- (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false.
-endif
-
-! France F,FA..FF,FI,FL,FN,FQ,FU,FV,FX,FZ,HW..HY,TH,TM,TP,TQ,TV
- else if(callsign(2:2).gt.'V' .and. callsign(2:2).lt.'Z') then
- if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'IN7' .and. (grid(4:4).eq.'7' .or. grid(4:4).eq.'8')) .or. &
- (grid(1:2).eq.'JN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'JN4' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. &
- grid(1:4).eq.'JN02' .or. grid(1:4).eq.'JN12' .or. grid(1:4).eq.'IN92' .or. &
- (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'11'))) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'IN' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) lgvalid=.false.
-endif
-
-! not valid callsigns
- else if(callsign(1:2).eq.'H1') then
- lwrongcall=.true.; return
-
- endif ! 'H'
-
-! Italy, Sardinia I
- else if(callsign(1:1).eq.'I') then
- if((grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'40' .or. grid(3:4).eq.'41')) .or. &
- (grid(1:2).eq.'JM' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'65' .or. grid(3:4).eq.'56'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'JM' .and. (grid(3:4).eq.'69' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'96' .or. grid(3:4).eq.'97' .or. &
- grid(3:4).eq.'98')) then; lgvalid=.false.
- else if(grid(1:2).eq.'JN' .and. &
- ((grid(3:3).eq.'7' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'8' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'9' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'50')) then; lgvalid=.false.
- endif
-endif
-
- else if(callsign(1:1).eq.'J') then
-
-! Japan 7J..7N,8J..8N,JA,JE..JS
- if(callsign(1:2).eq.'JA' .or. (callsign(2:2).gt.'D' .and. callsign(2:2).lt.'T')) then
- if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:3).eq.'QM0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'QN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:3).eq.'PN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'PL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'QM19' .or. grid(1:4).eq.'KC90') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and.grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3'.and.grid(3:4).ne.'62').or. &
- grid(3:4).eq.'45' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'56' .or.grid(3:4).eq.'88' .or. &
- grid(3:4).eq.'89')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PL'.and.((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'59')) then; lgvalid=.false.
- else if(grid(1:2).eq.'QN'.and.((grid(3:3).eq.'2'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'1'.or.grid(4:4).eq.'5')).or. &
- grid(3:4).eq.'10')) then; lgvalid=.false.
- endif
-endif
-
-! Greece J4,SV..SZ
- else if(callsign(1:2).eq.'J4') then
- if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'46' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'14').and.grid(3:4).ne.'05').or. &
- grid(1:4).eq.'JM99' .or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. (grid(4:4).eq.'0' .or. grid(4:4).eq.'1'))) &
- lgvalid=.true.
-
-! Djibouti J2
- else if(callsign(1:2).eq.'J2') then
- if(grid(1:2).eq.'LK' .and. (grid(3:4).eq.'01' .or. grid(3:4).eq.'11' .or. grid(3:4).eq.'12')) lgvalid=.true.
-
-! Grenada J3
- else if(callsign(1:2).eq.'J3') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'92' .or. grid(3:4).eq.'91')) lgvalid=.true.
-
-! Guinea-Bissau J5
- else if(callsign(1:2).eq.'J5') then
- if(grid(1:2).eq.'IK' .and. (grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'11' .or. &
- grid(3:4).eq.'12' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'20')) lgvalid=.true.
-
-! St. Lucia J6
- else if(callsign(1:2).eq.'J6') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'94')) lgvalid=.true.
-
-! Dominica J7
- else if(callsign(1:2).eq.'J7' .and. grid(1:4).eq.'FK95') then
- lgvalid=.true.
-
-! St. Vincent J8
- else if(callsign(1:2).eq.'J8') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'92')) lgvalid=.true.
-
-! Ogasawara and Minami Torishima JD1
- else if(callsign(1:3).eq.'JD1') then
- if(grid(1:2).eq.'QL' .and. (grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) &
- lgvalid=.true.
-
-! Mongolia JT..JV
- else if(callsign(2:2).eq.'T' .or. callsign(2:2).eq.'U' .or. callsign(2:2).eq.'V') then
- if((grid(1:2).eq.'ON' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'NN' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'NO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'OO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'OO' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'70'))) lgvalid=.true.
-
-! Svalbard, Bear Island JW
- else if(callsign(1:2).eq.'JW') then
- if((grid(1:2).eq.'JQ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KQ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JR' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0') .or. &
- (grid(1:2).eq.'KR' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'0') .or. &
- grid(1:4).eq.'JQ94') lgvalid=.true.
-
-! Jan Mayen JX
- else if(callsign(1:2).eq.'JX') then
- if(grid(1:2).eq.'IQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'61')) lgvalid=.true.
-
-! Jordan JY
- else if(callsign(1:2).eq.'JY') then
- if((grid(1:2).eq.'KM' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. &
- (grid(1:2).eq.'KL' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'89'))) lgvalid=.true.
-
-! not valid callsigns
- else if(callsign(2:2).eq.'B' .or. callsign(2:2).eq.'C' .or. callsign(2:2).eq.'1' .or. &
- callsign(2:2).eq.'9' .or. callsign(2:2).eq.'Z' .or. &
- (callsign(1:2).eq.'JD' .and. callsign(3:3).gt.'1' .and. callsign(3:3).lt.':')) then
- lwrongcall=.true.; return
-
- endif ! 'J'
-
-! USA AA..AL,K,N,W
- else if(callsign(1:1).eq.'K') then
- if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall
- if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. &
- (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. &
- grid(1:2).eq.'BP' .or. &
- (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- grid(1:4).eq.'FK28' .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. &
- (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. &
- grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. &
- grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. &
- (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. &
- grid(3:4).eq.'63')) .or. &
- grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. &
- grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. &
- grid(1:4).eq.'CP00') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' &
- .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. &
- grid(3:4).eq.'14')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false.
- else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. &
- grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. &
- grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. &
- ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. &
- grid(3:4).eq.'22')) then; lgvalid=.false.
- else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false.
- endif
-endif
-
- endif ! end of block A..K
-
-2 if(callsign(1:1).eq.'L') then
-
-! Norway LA..LN
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'O') then
- if((grid(1:2).eq.'JO' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'37')) .or. &
- (grid(1:2).eq.'JP' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'KP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KQ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- grid(1:4).eq.'JQ90') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'JP' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- (grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. &
- grid(3:4).eq.'23' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'58' .or. &
- grid(3:4).eq.'59' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'97')) then; lgvalid=.false.
- else if(grid(1:2).eq.'KP' .and. grid(4:4).eq.'8' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') then; lgvalid=.false.
- else if(grid(1:2).eq.'KQ' .and. (grid(3:4).eq.'01' .or. grid(3:4).eq.'51')) then; lgvalid=.false.
- endif
-endif
-
-! Argentina AY,AZ, L1..L9, LO..LW
- else if(callsign(2:2).gt.'N' .and. callsign(2:2).lt.'X') then
- if((grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FF' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'FE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9') .or. &
- (grid(1:2).eq.'FD' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'GC07' .or. grid(1:4).eq.'GC16') lgvalid=.true. ! LU1ZB in GC16
-
-if(lgvalid) then
- if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FG' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'57')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GG' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. &
- grid(3:4).eq.'35')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FE' .and. ((grid(3:3).eq.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. &
- (grid(3:3).eq.'3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'70' .or. grid(3:4).eq.'73')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'2'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'8').or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':'))) then; lgvalid=.false.
- endif
-endif
-
-! Luxemburg LX
- else if(callsign(1:2).eq.'LX') then
- if((grid(1:2).eq.'JN' .and. (grid(3:4).eq.'29' .or. grid(3:4).eq.'39')) .or. &
- (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30'))) lgvalid=.true.
-
-! Lithuania LY
- else if(callsign(1:2).eq.'LY') then
- if(grid(1:2).eq.'KO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7') &
- lgvalid=.true.
-
-! Bulgaria LZ
- else if(callsign(1:2).eq.'LZ') then
- if(grid(1:2).eq.'KN' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'5') &
- lgvalid=.true.
-
-! Argentina AY,AZ, L1..L9, LO..LW
- else if(callsign(2:2).gt.'0' .and. callsign(2:2).lt.':') then
- if((grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FF' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'FE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9') .or. &
- (grid(1:2).eq.'FD' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'GC07' .or. grid(1:4).eq.'GC16') lgvalid=.true. ! LU1ZB in GC16
-
-if(lgvalid) then
- if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FG' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'57')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GG' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. &
- grid(3:4).eq.'35')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FE' .and. ((grid(3:3).eq.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. &
- (grid(3:3).eq.'3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'70' .or. grid(3:4).eq.'73')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'2'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'8').or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':'))) then; lgvalid=.false.
- endif
-endif
-
-! not valid callsigns
- else if(callsign(1:2).eq.'L0') then
- lwrongcall=.true.; return
-
- endif ! 'L'
-
-! UK GB,GX / 2E,G,M / 2D,GD,GT,MD,MT / 2I,GI,GN,MI,MN / 2J,GH,GJ,MH,MJ / 2A,2M,GM,GS,MA,MM,MS / 2U,GP,GU,MP,MU / 2W,GC,GW,MC,MW
- else if(callsign(1:1).eq.'M') then
- if((grid(1:2).eq.'IO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. &
- (grid(1:3).eq.'JO0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- grid(1:4).eq.'IP90' .or. grid(1:4).eq.'IN69' .or. grid(1:4).eq.'IN89' .or. grid(1:4).eq.'IO37') lgvalid=.true.
-
-if(lgvalid .and. grid(1:2).eq.'IO') then
- if((grid(1:3).eq.'IO5' .and. grid(4:4).ne.'4' .and. grid(4:4).ne.'7') .or. &
- (grid(1:3).eq.'IO6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'96' .or. grid(3:4).eq.'98') lgvalid=.false.
-endif
-
-! USA AA..AL,K,N,W
- else if(callsign(1:1).eq.'N') then
- if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall
- if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. &
- (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. &
- grid(1:2).eq.'BP' .or. &
- (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- grid(1:4).eq.'FK28' .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. &
- (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. &
- grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. &
- grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. &
- (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. &
- grid(3:4).eq.'63')) .or. &
- grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. &
- grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. &
- grid(1:4).eq.'CP00') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' &
- .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. &
- grid(3:4).eq.'14')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false.
- else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. &
- grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. &
- grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. &
- ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. &
- grid(3:4).eq.'22')) then; lgvalid=.false.
- else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false.
- endif
-endif
-
- else if(callsign(1:1).eq.'O') then
-
-! Finland OF..OJ
- if(callsign(2:2).gt.'E' .and. callsign(2:2).lt.'K') then
- if((grid(1:2).eq.'KP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6') .or. &
- grid(1:4).eq.'JP90' .or. grid(1:4).eq.'KO09' .or. grid(1:4).eq.'KO19' .or. grid(1:4).eq.'KQ30') lgvalid=.true.
-
-! Belgium ON..OT
- else if(callsign(2:2).gt.'M' .and. callsign(2:2).lt.'U') then
- if((grid(1:2).eq.'JO' .and. (grid(3:4).eq.'10' .or. grid(3:4).eq.'11' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. &
- grid(3:4).eq.'30')) .or. grid(1:4).eq.'JN29') lgvalid=.true.
-
-! Austria OE
- else if(callsign(1:2).eq.'OE') then
- if(grid(1:2).eq.'JN' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'9') &
- lgvalid=.true.
-
-! Czech Republic OK,OL
- else if(callsign(2:2).eq.'K' .or. callsign(2:2).eq.'L') then
- if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0').or. &
- (grid(1:2).eq.'JN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'JO71') lgvalid=.true.
-
-! Slovak Republic OM
- else if(callsign(1:2).eq.'OM') then
- if((grid(1:2).eq.'JN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-! Denmark 5P,5Q,OU,OV,OZ
- else if(callsign(2:2).eq.'Z' .or. callsign(2:2).eq.'U' .or. callsign(2:2).eq.'V') then
- if(grid(1:2).eq.'JO' .and. &
- ((grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'75' .or. grid(3:4).eq.'76')) lgvalid=.true.
-
-! Lebanon OD
- else if(callsign(1:2).eq.'OD') then
- if(grid(1:2).eq.'KM' .and. (grid(3:4).eq.'73' .or. grid(3:4).eq.'74' .or. grid(3:4).eq.'84')) lgvalid=.true.
-
-! Peru 4T,OA..OC
- else if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'D') then
- if((grid(1:2).eq.'FH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(1:3).eq.'EI9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7')) lgvalid=.true.
-
-! Greenland OX,XP
- else if(callsign(1:2).eq.'OX' .or. callsign(1:2).eq.'XP') then
- if((grid(1:2).eq.'GP' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'HP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'HQ90' .or. &
- (grid(1:2).eq.'GQ' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'41' .or.grid(3:4).eq.'22'.or. &
- grid(3:4).eq.'14' .or. grid(3:4).eq.'12')) .or. &
- (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'67' .or. grid(3:4).eq.'57' .or.grid(3:4).eq.'56'.or. &
- grid(3:4).eq.'38'))) lgvalid=.true.
-
-! not valid callsigns O0..O9
- else if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':') then
- lwrongcall=.true.; return
-
- endif ! 'O'
-
- else if(callsign(1:1).eq.'P') then
-
-! Netherlands PA..PI
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then
- if(((grid(1:3).eq.'JO2' .or. grid(1:3).eq.'JO3') .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- grid(1:4).eq.'JO11') lgvalid=.true.
-
-! Brazil PP..PY, ZV..ZZ
- else if(callsign(1:1).eq.'P' .and. callsign(2:2).gt.'O' .and. callsign(2:2).lt.'Z') then
- if((grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'09')) .or. &
- (grid(1:2).eq.'HI' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6'.and. &
- grid(3:4).ne.'25') .or. grid(3:4).eq.'06' .or. grid(3:4).eq.'07' .or. grid(3:4).eq.'36')) .or. &
- (grid(1:2).eq.'HH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. &
- (grid(1:2).eq.'GH' .and. grid(3:4).ne.'01') .or. grid(1:2).eq.'GI' .or. &
- (grid(1:2).eq.'GF' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'36')) .or. &
- (grid(1:2).eq.'GJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. &
- grid(3:4).eq.'04' .or. grid(3:4).eq.'44')) .or. &
- (grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'95')) .or. &
- (grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'93' .or. grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) .or. &
- grid(1:4).eq.'HG59' .or. grid(1:4).eq.'HJ50') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. &
- grid(4:4).lt.'6' .and. grid(3:4).ne.'64' .and. grid(3:4).ne.'65') .or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'HH' .and. (grid(3:3).eq.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GI' .and. ((grid(3:3).gt.'7'.and.grid(3:3).lt.':'.and.grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'27')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GJ' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'52' .or. &
- grid(3:4).eq.'53')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'5'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'76' .or. grid(3:4).eq.'68')) then; lgvalid=.false.
- endif
-endif
-
-! Papua New Guinea P2
- else if(callsign(1:2).eq.'P2') then
- if((grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or.&
- (grid(1:2).eq.'QH' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-! Cyprus 5B,C4,H2,P3
- else if(callsign(1:2).eq.'P3') then
- if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. &
- (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true.
-
-! Aruba P4
- else if(callsign(1:2).eq.'P4' .and. (grid(1:4).eq.'FK42' .or. grid(1:4).eq.'FK52')) then
- lgvalid=.true.
-
-! DPR of Korea P5..P9
- else if(callsign(2:2).gt.'4' .and. callsign(2:2).lt.':') then
- if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or.&
- (grid(1:2).eq.'PN' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) &
- lgvalid=.true.
-
-! Curacao, Bonaire, Saba & St. Eustatius, Sint Maarten PJ
- else if(callsign(1:2).eq.'PJ' .and. &
- ((callsign(3:3).eq.'2' .or. callsign(3:3).eq.'4') .and. grid(1:4).eq.'FK52') .or. &
- ((callsign(3:3).eq.'5' .or. callsign(3:3).eq.'6') .and. grid(1:4).eq.'FK87') .or. &
- ((callsign(3:3).eq.'7' .or. callsign(3:3).eq.'8' .or. callsign(3:3).eq.'0') .and. grid(1:4).eq.'FK88')) then
- lgvalid=.true.
-
-! Suriname PZ
- else if(callsign(1:2).eq.'PZ') then
- if(grid(1:2).eq.'GJ' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'6') &
- lgvalid=.true.
-
-! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH
- else if(callsign(2:2).gt.'J' .and. callsign(2:2).lt.'P') then
- if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'OI' .and. .not.(grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4') &
- .and. .not.(grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'0')) .or. &
- (grid(1:2).eq.'PI' .and. .not.(grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0')) .or. &
- (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false.
- else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6') .or. &
- (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. &
- grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OJ' .and. ((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5').or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. &
- grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'61' .or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. &
- grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or.grid(3:4).eq.'29')) then
- lgvalid=.false.
- endif
-endif
-
-! not valid callsigns
- else if(callsign(1:2).eq.'P1' .or. callsign(1:2).eq.'P0') then
- lwrongcall=.true.; return
-
- endif ! 'P'
-
-! Russia
- else if(callsign(1:1).eq.'R') then
- if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':').or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'6'))) .or. &
- grid(1:2).eq.'LO' .or. grid(1:2).eq.'MO' .or. grid(1:2).eq.'NO' .or. &
- (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'30')) .or. grid(1:2).eq.'NP' &
- .or. grid(1:2).eq.'OO' .or. grid(1:2).eq.'PO' .or. grid(1:2).eq.'LP' .or. grid(1:2).eq.'MP' .or. &
- (grid(1:2).eq.'PN' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- grid(3:4).eq.'39' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or.grid(1:4).eq.'MQ60'.or. &
- (grid(1:2).eq.'QN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. &
- (grid(1:2).eq.'QO' .and. (grid(3:3).eq.'0' .or. grid(3:3).eq.'1' .or. grid(3:3).eq.'8' .or. grid(3:3).eq.'9' .or. &
- grid(3:4).eq.'49' .or. grid(3:4).eq.'59')) .or. grid(1:4).eq.'JO94' .or. &
- grid(1:2).eq.'OP' .or. grid(1:2).eq.'PP' .or. grid(1:4).eq.'JB59' .or. grid(1:4).eq.'NQ03' .or. &
- (grid(1:2).eq.'RP' .and. (grid(3:4).eq.'59' .or. grid(3:4).eq.'84'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- grid(3:4).eq.'35' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'60' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'61')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'LO' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'60')) then; lgvalid=.false.
- else if(grid(1:2).eq.'LN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'1') .or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'48')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'9'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. &
- (grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).eq.'3'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'KN' .and. (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. ((grid(4:4).gt.'6' .and. &
- grid(4:4).lt.':') .or. grid(4:4).eq.'3'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'42' .or. grid(3:4).eq.'43' .or. grid(3:4).eq.'99')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OO' .and. grid(3:4).eq.'00') then; lgvalid=.false.
- else if(grid(1:2).eq.'PO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'0') .or. &
- grid(3:4).eq.'11' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21')) then; lgvalid=.false.
- else if(grid(1:2).eq.'LP' .and. grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. &
- grid(3:3).ne.'4' .and. grid(3:3).ne.'5') then; lgvalid=.false.
- else if(grid(1:2).eq.'PN' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'83' .or. grid(3:4).eq.'93' .or. &
- grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- endif
-endif
-
- else if(callsign(1:1).eq.'S') then
-
-! Sweden 7S,8S,SA..SM
- if(callsign(1:1).eq.'S' .and. callsign(2:2).gt.'@' .and. callsign(2:2).lt.'N') then
- if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JP' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'25'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'JO' .and. (grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- else if(grid(1:2).eq.'JP' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. grid(3:4).eq.'89' .or. &
- grid(3:4).eq.'99')) then; lgvalid=.false.
- else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'14')) then; lgvalid=.false.
- endif
-endif
-
-! Poland 3Z,HF,SN..SR
- else if(callsign(1:1).eq.'S' .and. callsign(2:2).gt.'M' .and. callsign(2:2).lt.'S') then
- if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'20')) .or. &
- grid(1:4).eq.'KN09' .or. grid(1:4).eq.'KN19' .or. grid(1:4).eq.'KO20' .or. grid(1:4).eq.'JN99' .or. &
- grid(1:4).eq.'JN89') lgvalid=.true.
-
-! Greece J4,SV..SZ
- else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'[') then
- if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'46' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'14').and.grid(3:4).ne.'05').or. &
- grid(1:4).eq.'JM99' .or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. (grid(4:4).eq.'0' .or. grid(4:4).eq.'1'))) &
- lgvalid=.true.
-
-! Slovenia S5
- else if(callsign(1:2).eq.'S5') then
- if(grid(1:2).eq.'JN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'7') &
- lgvalid=.true.
-
-! Singapore 9V,S6
- else if(callsign(1:2).eq.'9V') then
- if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) lgvalid=.true.
-
-! Western Sahara S0
- else if(callsign(1:2).eq.'S0') then
- if(grid(1:2).eq.'IL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') &
- lgvalid=.true.
-
-! Bangladesh S2,S3
- else if(callsign(1:2).eq.'S2' .or. callsign(1:2).eq.'S3') then
- if(grid(1:2).eq.'NL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'7') &
- lgvalid=.true.
-
-! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU
- else if(callsign(1:2).eq.'S4' .or. callsign(1:2).eq.'S8') then
- if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. &
- (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. &
- grid(3:4).ne.'85') .or. &
- (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false.
-endif
-
-! Seychelles S7
- else if(callsign(1:2).eq.'S7') then
- if((grid(1:2).eq.'LI' .and. (grid(3:4).eq.'75' .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'74' .or. grid(3:4).eq.'64' &
- .or. grid(3:4).eq.'63' .or. grid(3:4).eq.'82' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'30'))&
- .or. (grid(1:2).eq.'LH' .and. (grid(3:4).eq.'59' .or. grid(3:4).eq.'39'))) lgvalid=.true.
-
-! Sao Tome & Principe S9
- else if(callsign(1:2).eq.'S9' .and. (grid(1:4).eq.'JJ30' .or. grid(1:4).eq.'JJ31')) then
- lgvalid=.true.
-
-! Sudan 6T,6U,ST
- else if(callsign(1:2).eq.'ST') then
- if((grid(1:2).eq.'KK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'KL' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- grid(1:4).eq.'KJ79') lgvalid=.true.
-
-! not valid callsigns
- else if(callsign(1:2).eq.'S1') then
- lwrongcall=.true.; return
-
- endif ! 'S'
-
- else if(callsign(1:1).eq.'T') then
-
-! Turkey TA..TC,YM
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'D') then
- if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'85')) .or. &
- (grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'20' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'72')) .or. &
- (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':'.and. &
- grid(3:4).ne.'16')) lgvalid=.true.
-
-! Iceland TF
- else if(callsign(1:2).eq.'TF') then
- if((grid(1:2).eq.'HP' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7').or. &
- (grid(1:2).eq.'IP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7')) &
- lgvalid=.true.
-
-! Corsica TK
- else if(callsign(1:2).eq.'TK') then
- if(grid(1:3).eq.'JN4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') lgvalid=.true.
-
-! Gabon TR
- else if(callsign(1:2).eq.'TR') then
- if(callsign(1:5).eq.'TR8CA' .or. &
- (grid(1:2).eq.'JJ' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or. &
- (grid(1:2).eq.'JI' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'56'))) lgvalid=.true.
-
-! Tunisia 3V,TS
- else if(callsign(1:2).eq.'TS') then
- if(grid(1:2).eq.'JM' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') &
- lgvalid=.true.
-
-! Guatemala TD,TG
- else if(callsign(1:2).eq.'TG' .or. callsign(1:2).eq.'TD') then
- if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'8') &
- lgvalid=.true.
-
-! Costa Rica, Cocos Island TE,TI
- else if(callsign(1:2).eq.'TI' .or. callsign(1:2).eq.'TE') then
- if((grid(1:2).eq.'EK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'EJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'EJ65') lgvalid=.true.
-
-! Afghanistan T6,YA
- else if(callsign(1:2).eq.'T6') then
- if((grid(1:2).eq.'MM' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(3:4).eq.'9')) lgvalid=.true.
-
-! San Marino T7
- else if(callsign(1:2).eq.'T7' .and. grid(1:4).eq.'JN63') then
- lgvalid=.true.
-
-! Palau T8
- else if(callsign(1:2).eq.'T8') then
- if(grid(1:2).eq.'PJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'9') &
- lgvalid=.true.
-
-! Cuba CL,CM,CO,T4
- else if(callsign(1:2).eq.'T4') then
- if((grid(1:2).eq.'EL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. grid(1:4).eq.'FK19') lgvalid=.true.
-
-! Martinique, Guadeloupe, St. Martin, St. Barthelemy, Reunion Island FM,FG,FS,FJ,FR TO
- else if(callsign(1:2).eq.'TO') then
- if((grid(1:3).eq.'FK9' .and. (grid(4:4).eq.'6' .or. grid(4:4).eq.'5' .or. grid(4:4).eq.'4')) .or. &
- (grid(1:3).eq.'FK8' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'7')) .or. &
- (grid(1:2).eq.'LG' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'78'))) lgvalid=.true.
-
-! Tuvalu
- else if(callsign(1:2).eq.'T2') then
- if((grid(1:2).eq.'RI' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'82' .or.grid(3:4).eq.'83'.or. &
- grid(3:4).eq.'84')) .or. grid(1:4).eq.'RH99') lgvalid=.true.
-
-! Kiribati, Banana Island
- else if(callsign(1:2).eq.'T3') then
- if(grid(1:1).eq.'R') then
- if((grid(1:3).eq.'RJ6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- (grid(1:3).eq.'RI7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- grid(1:4).eq.'RI49' .or. grid(1:4).eq.'RI87' .or. grid(1:4).eq.'RI88') lgvalid=.true.
- else if(grid(1:1).eq.'A') then
- if((grid(1:2).eq.'AI' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'4' .and. &
- grid(4:4).lt.'8') .or. grid(1:4).eq.'AJ94') lgvalid=.true.
- else if(grid(1:1).eq.'B') then
- if(grid(1:4).eq.'BJ03' .or. grid(1:4).eq.'BJ11' .or. grid(1:4).eq.'BJ12' .or. &
- (grid(1:3).eq.'BI2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. &
- grid(1:4).eq.'BH48' .or. grid(1:4).eq.'BH49' .or. grid(1:4).eq.'BI40') lgvalid=.true.
- endif
-
-! Cameroon
- else if(callsign(1:2).eq.'TJ') then
- if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) &
- lgvalid=.true.
-
-! Central African Republic
- else if(callsign(1:2).eq.'TL') then
- if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).eq.'0')) lgvalid=.true.
-
-! Republic of the Congo
- else if(callsign(1:2).eq.'TN') then
- if((grid(1:2).eq.'JI' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) &
- lgvalid=.true.
-
-! Chad
- else if(callsign(1:2).eq.'TT') then
- if((grid(1:2).eq.'JK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'JJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'KJ09' .or. &
- (grid(1:2).eq.'KK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. &
- (grid(1:2).eq.'JL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. &
- (grid(1:2).eq.'KL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2')) &
- lgvalid=.true.
-
-! Cote d'Ivoire:
- else if(callsign(1:2).eq.'TU') then
- if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'IK' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'70' .or. grid(3:4).eq.'50'))) lgvalid=.true.
-
-! Benin:
- else if(callsign(1:2).eq.'TY') then
- if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) &
- lgvalid=.true.
-
-! Mali:
- else if(callsign(1:2).eq.'TZ') then
- if((grid(1:2).eq.'IK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'IL' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'JL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2')) &
- lgvalid=.true.
-
-! Chesterfield, French Polynesia, Austral, Marquesas, Clipperton Islands FK,TX
- else if(callsign(1:2).eq.'TX') then
- if((grid(1:2).eq.'QH' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91')) .or. grid(1:4).eq.'QG98' .or. &
- (grid(1:2).eq.'BH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'BG' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'BI9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'CI' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) .or. &
- grid(1:4).eq.'CH09' .or. grid(1:4).eq.'DK50') lgvalid=.true.
-
-! Wallis & Futuna Islands FW,TW
- else if(callsign(1:2).eq.'TW') then
- if(grid(1:2).eq.'AH' .and. (grid(3:4).eq.'05' .or. grid(3:4).eq.'16')) lgvalid=.true.
-
-! France F,FA..FF,FI,FL,FN,FQ,FU,FV,FX,FZ,HW..HY,TH,TM,TP,TQ,TV
- else if(callsign(2:2).eq.'H' .or. callsign(2:2).eq.'M' .or. callsign(2:2).eq.'P' .or. callsign(2:2).eq.'Q' .or. &
- callsign(2:2).eq.'V') then
- if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'IN7' .and. (grid(4:4).eq.'7' .or. grid(4:4).eq.'8')) .or. &
- (grid(1:2).eq.'JN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:3).eq.'JN4' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. &
- grid(1:4).eq.'JN02' .or. grid(1:4).eq.'JN12' .or. grid(1:4).eq.'IN92' .or. &
- (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'11'))) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'IN' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) lgvalid=.false.
-endif
-
-! not valid callsigns
- else if(callsign(1:2).eq.'T1' .or. callsign(1:2).eq.'T0') then
- lwrongcall=.true.; return
-
- endif ! 'T'
-
- else if(callsign(1:1).eq.'U') then
-
-! Russia R, U0..U9, UA..UI
- if((callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') .or. &
- (callsign(2:2).gt.'/' .and. callsign(2:2).lt.':')) then
- if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':').or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'6'))) .or. &
- grid(1:2).eq.'LO' .or. grid(1:2).eq.'MO' .or. grid(1:2).eq.'NO' .or. &
- (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'30')) .or. grid(1:2).eq.'NP' &
- .or. grid(1:2).eq.'OO' .or. grid(1:2).eq.'PO' .or. grid(1:2).eq.'LP' .or. grid(1:2).eq.'MP' .or. &
- (grid(1:2).eq.'PN' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- grid(3:4).eq.'39' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or.grid(1:4).eq.'MQ60'.or. &
- (grid(1:2).eq.'QN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. &
- (grid(1:2).eq.'QO' .and. (grid(3:3).eq.'0' .or. grid(3:3).eq.'1' .or. grid(3:3).eq.'8' .or. grid(3:3).eq.'9' .or. &
- grid(3:4).eq.'49' .or. grid(3:4).eq.'59')) .or. grid(1:4).eq.'JO94' .or. &
- grid(1:2).eq.'OP' .or. grid(1:2).eq.'PP' .or. grid(1:4).eq.'JB59' .or. grid(1:4).eq.'NQ03' .or. &
- (grid(1:2).eq.'RP' .and. (grid(3:4).eq.'59' .or. grid(3:4).eq.'84'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- grid(3:4).eq.'35' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'60' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'61')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'LO' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'60')) then; lgvalid=.false.
- else if(grid(1:2).eq.'LN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'1') .or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'48')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'9'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. &
- (grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).eq.'3'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'KN' .and. (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. ((grid(4:4).gt.'6' .and. &
- grid(4:4).lt.':') .or. grid(4:4).eq.'3'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'42' .or. grid(3:4).eq.'43' .or. grid(3:4).eq.'99')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OO' .and. grid(3:4).eq.'00') then; lgvalid=.false.
- else if(grid(1:2).eq.'PO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'0') .or. &
- grid(3:4).eq.'11' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21')) then; lgvalid=.false.
- else if(grid(1:2).eq.'LP' .and. grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. &
- grid(3:3).ne.'4' .and. grid(3:3).ne.'5') then; lgvalid=.false.
- else if(grid(1:2).eq.'PN' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'83' .or. grid(3:4).eq.'93' .or. &
- grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- endif
-endif
-
-! Ukraine EM..EO,UR..UZ
- else if(callsign(2:2).gt.'Q' .and. callsign(2:2).lt.'[') then
- if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or. &
- (grid(1:2).eq.'KN' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KO' .and. (grid(3:4).eq.'81' .or. grid(3:4).eq.'91')) then; lgvalid=.false.
- else if(grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'0'.and.grid(3:3).lt.'4'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'7').or. &
- grid(3:4).eq.'95' .or. grid(3:4).eq.'96')) then; lgvalid=.false.
- endif
-endif
-
-! Kazakhstan UN..UQ
- else if(callsign(2:2).gt.'M' .and. callsign(2:2).lt.'R') then
- if((grid(1:2).eq.'MN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'MO' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'LN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'LO' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'NN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'NO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or.grid(3:4).eq.'10'.or.grid(3:4).eq.'20')).or. &
- (grid(1:2).eq.'MO' .and. (grid(3:4).eq.'45' .or. grid(3:4).eq.'55')) .or. &
- (grid(1:2).eq.'MN' .and. ((grid(4:4).eq.'1' .and. (grid(3:3).eq.'3' .or.grid(3:3).eq.'4'.or.grid(3:3).eq.'5')).or. &
- grid(3:4).eq.'40')) .or. &
- (grid(1:3).eq.'NN0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true.
-
- endif ! 'U'
-
- else if(callsign(1:1).eq.'V') then
-
-! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO
- if((callsign(2:2).gt.'@' .and. callsign(2:2).lt.'H') .or. callsign(1:2).eq.'VO' .or. callsign(1:2).eq.'VX' .or. &
- callsign(1:2).eq.'VY') then
- if((grid(1:2).eq.'CN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'EN' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. grid(1:2).eq.'CO' .or. &
- (grid(1:2).eq.'GN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- grid(1:2).eq.'FO' .or. grid(1:2).eq.'EO' .or. grid(1:2).eq.'DO' .or. &
- (grid(1:2).eq.'GO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'DN'.and. grid(4:4).gt.'8' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'CP' .or. grid(1:2).eq.'DP' .or. grid(1:2).eq.'EP' .or. &
- (grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'96')) .or. &
- (grid(1:2).eq.'EQ' .and. (grid(3:4).eq.'15' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'24' .or.grid(3:4).eq.'71'.or. &
- grid(3:4).eq.'73' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'86' .or.grid(3:4).eq.'96')).or. &
- (grid(1:2).eq.'FR' .and. (grid(3:4).eq.'71' .or. grid(3:4).eq.'82')) .or. &
- (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'12')) .or. grid(1:4).eq.'GN03' .or. &
- grid(1:4).eq.'FN93' .or. grid(1:4).eq.'ER60' .or. grid(1:4).eq.'DQ10' .or. grid(1:4).eq.'CQ71') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'EO' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and.grid(4:4).lt.':').or. &
- (grid(4:4).eq.'7' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9') .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'CO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. &
- grid(4:4).lt.'8').or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'30'.or.grid(3:4).eq.'31'.or. &
- grid(3:4).eq.'40')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EP' .and. ((grid(4:4).eq.'0' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. &
- (grid(4:4).eq.'1' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9') .or. &
- (grid(4:4).eq.'2' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'CN' .and. (grid(3:4).eq.'68' .or. grid(3:4).eq.'98')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. &
- grid(4:4).lt.'8') .or. grid(3:4).eq.'04')) then; lgvalid=.false.
- endif
-endif
-
-! Australia AX,VH..VN,VZ
- else if((callsign(2:2).gt.'G' .and. callsign(2:2).lt.'O') .or. callsign(1:2).eq.'VZ') then
- if((grid(1:2).eq.'QG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. &
- (grid(1:2).eq.'QF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. &
- (grid(1:2).eq.'PF' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'OF' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'QE' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'19')) .or. &
- (grid(1:2).eq.'QH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'OG' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. &
- grid(1:2).eq.'PG' .or. grid(1:2).eq.'PH' .or. &
-! Heard Island, Macquarie Island
- (callsign(1:3).eq.'VK0' .and. &
- ((grid(1:2).eq.'MD' .and. (grid(3:4).eq.'66' .or. grid(3:4).eq.'67')) .or. &
- (grid(1:2).eq.'QD' .and. (grid(3:4).eq.'95' .or. grid(3:4).eq.'94')))) .or. &
-! Cocos (Keeling) Islands, Lord Howe Island, Mellish Reef, Norfolk Island, Willis Island VK9
- (callsign(1:3).eq.'VK9' .and. &
- ((grid(1:2).eq.'NH' .and. (grid(3:4).eq.'87' .or. grid(3:4).eq.'88')) .or. &
- grid(1:4).eq.'QF98' .or. grid(1:4).eq.'OH29' .or. &
- (grid(1:2).eq.'RG' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31')) .or. &
- (grid(1:2).eq.'QH' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'1' .and. &
- grid(4:4).lt.'5')))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'QF' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') then; lgvalid=.false.
- else if(grid(1:2).eq.'PF' .and. ((grid(3:3).gt.'/'.and.grid(3:3).lt.'8'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. &
- (grid(4:4).eq.'5' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7') .or. grid(3:4).eq.'57')) then; lgvalid=.false.
- else if(grid(1:4).eq.'OF74') then; lgvalid=.false.
- else if(grid(1:2).eq.'QH' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. grid(3:4).eq.'09')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OG' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'69')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PH' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':' .and. &
- grid(4:4).ne.'5' .and. grid(4:4).ne.'6') .or. &
- (grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'59' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'89')) then; lgvalid=.false.
- endif
-endif
-
-! India 8T..8Y,AT..AW,VT..VW
- else if(callsign(2:2).gt.'S' .and. callsign(2:2).lt.'X') then
- if((grid(1:2).eq.'MJ' .and. (grid(3:4).eq.'99' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'88' .or. &
- grid(3:4).eq.'68')).or. &
- (grid(1:2).eq.'MK' .and. ((grid(3:3).gt.'5'.and.grid(3:3).lt.':').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. &
- (grid(1:2).eq.'NK' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or.grid(3:4).eq.'39')).or. &
- (grid(1:2).eq.'ML' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(1:4).eq.'NM00') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'MK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'5') then; lgvalid=.false.
- else if(grid(1:2).eq.'NK' .and. (grid(3:4).eq.'26' .or. grid(3:4).eq.'27')) then; lgvalid=.false.
- else if(grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'4'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'5'.or.grid(4:4).eq.'8'.or. &
- grid(4:4).eq.'9')) .or. grid(3:4).eq.'58' .or. grid(3:4).eq.'59')) then; lgvalid=.false.
- else if(grid(1:2).eq.'NL' .and. ((grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(4:4).eq.'8' .and. grid(3:3).gt.'0' .and. grid(4:4).lt.'5') .or.grid(3:4).eq.'40')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MM' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'62')) then; lgvalid=.false.
- endif
-endif
-
-! Hong Kong VR
- else if(callsign(1:2).eq.'VR'.and. (grid(1:2).eq.'OL' .and. (grid(3:4).eq.'72' .or. grid(3:4).eq.'62'))) then
- lgvalid=.true.
-
-! Antigua & Barbuda V2
- else if(callsign(1:2).eq.'V2') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'86' .or. grid(3:4).eq.'97')) lgvalid=.true.
-
-! Belize V3
- else if(callsign(1:2).eq.'V3') then
- if((grid(1:2).eq.'EK' .and. grid(3:3).eq.'5' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'EK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'9')) lgvalid=.true.
-
-! St. Kitts & Nevis V4
- else if(callsign(1:2).eq.'V4' .and. grid(1:4).eq.'FK87') then
- lgvalid=.true.
-
-! Namibia V5
- else if(callsign(1:2).eq.'V5') then
- if((grid(1:2).eq.'JG' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JH' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'KG' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09')).or. &
- (grid(1:2).eq.'KH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) &
- lgvalid=.true.
-
-! Micronesia V6
- else if(callsign(1:2).eq.'V6') then
- if((grid(1:2).eq.'PJ' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'QJ' .and. ((grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. grid(3:4).eq.'71' .or. &
- grid(3:4).eq.'73')) .or. &
- (grid(1:2).eq.'RJ' .and. (grid(3:4).eq.'06' .or. grid(3:4).eq.'15')) .or. grid(1:4).eq.'PK90') lgvalid=.true.
-
-! Marshall Islands V7
- else if(callsign(1:2).eq.'V7') then
- if((grid(1:2).eq.'RJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'RK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. &
- grid(4:4).lt.'3') .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'39'))) lgvalid=.true.
-
-! Brunei Darussalam V8
- else if(callsign(1:2).eq.'V8') then
- if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'74' .or. grid(3:4).eq.'75')) lgvalid=.true.
-
-! Bermuda VP9
- else if(callsign(1:3).eq.'VP9' .and. grid(1:4).eq.'FM72') then
- lgvalid=.true.
-
-! Chagos Islands VQ9
- else if(callsign(1:3).eq.'VQ9') then
- if(grid(1:2).eq.'MI' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') &
- lgvalid=.true.
-
-! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU
- else if(callsign(1:2).eq.'V9') then
- if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. &
- (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. &
- grid(3:4).ne.'85') .or. &
- (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false.
-endif
-
-! Anguilla, Montserrat, British Virgin Islands VP2
- else if(callsign(1:3).eq.'VP2' .and. &
- (grid(1:2).eq.'FK' .and. (grid(3:4).eq.'88' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'78'))) then
- lgvalid=.true.
-
-! Turks & Caicos Islands VP5
- else if((callsign(1:3).eq.'VP5' .or. callsign(1:3).eq.'VQ5') .and. &
- (grid(1:2).eq.'FL' .and. (grid(3:4).eq.'31' .or. grid(3:4).eq.'41'))) then
- lgvalid=.true.
-
-! Pitcairn Island, Ducie Island VP6
- else if(callsign(1:3).eq.'VP6' .and. (grid(1:2).eq.'CG' .and. (grid(3:4).eq.'55' .or. grid(3:4).eq.'44' .or. &
- grid(3:4).eq.'46' .or. grid(3:4).eq.'75'))) then
- lgvalid=.true.
-
-! Falkland Islands, South Georgia Island, South Shetland Islands, South Orkney Islands, South Sandwich Islands VP8
- else if(callsign(1:3).eq.'VP8') then
- if((grid(1:2).eq.'FD' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9').or. &
- grid(1:4).eq.'GD86' .or. &
- (grid(1:2).eq.'HD' .and. ((grid(3:4).eq.'15' .or. grid(3:4).eq.'25' .or.grid(3:4).eq.'05' .or.grid(3:4).eq.'16'.or. &
- grid(3:4).eq.'06') .or. (grid(1:3).eq.'HD6' .and.(grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) .or. &
- grid(1:4).eq.'HD53')) .or. &
- grid(1:4).eq.'GC69' .or. grid(1:4).eq.'GC79') lgvalid=.true.
-
-! not valid callsigns
- else if(callsign(1:2).eq.'V1' .or. callsign(1:2).eq.'V0') then
- lwrongcall=.true.; return
-
- endif ! 'V'
-
-! USA AA..AL,K,N,W
- else if(callsign(1:1).eq.'W') then
- if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall
- if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. &
- (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. &
- (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. &
- grid(1:2).eq.'BP' .or. &
- (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- grid(1:4).eq.'FK28' .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. &
- (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. &
- grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. &
- grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. &
- (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. &
- grid(3:4).eq.'63')) .or. &
- grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. &
- grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. &
- grid(1:4).eq.'CP00') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' &
- .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. &
- grid(3:4).eq.'14')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. &
- ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false.
- else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. &
- (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. &
- grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. &
- grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. &
- ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. &
- grid(3:4).eq.'22')) then; lgvalid=.false.
- else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false.
- endif
-endif
-
- else if(callsign(1:1).eq.'X') then
-
-! Mexico, Revillagigedo 4A..4C, 6D..6J, XA..XI
- if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then
- if((grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.':').or.grid(3:4).eq.'08'.or.grid(3:4).eq.'09')).or. &
- (grid(1:2).eq.'EL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'EK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'34')) .or. &
- (grid(1:2).eq.'DM' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'DK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'DK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'38'))) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2') .or. &
- grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'33' .or. grid(3:4).eq.'60')) then
- lgvalid=.false.
- else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'17' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'32' .or. &
- grid(3:4).eq.'62')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'05' .or.grid(3:4).eq.'65'.or.grid(3:4).eq.'66'.or.grid(3:4).eq.'67'.or. &
- grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'2') then; lgvalid=.false.
- else if(grid(1:2).eq.'DK' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'86')) then; lgvalid=.false.
- endif
-endif
-
-! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO
- else if(callsign(1:1).eq.'X' .and. callsign(2:2).gt.'I' .and. callsign(2:2).lt.'P') then
- if((grid(1:2).eq.'CN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'EN' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. grid(1:2).eq.'CO' .or. &
- (grid(1:2).eq.'GN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- grid(1:2).eq.'FO' .or. grid(1:2).eq.'EO' .or. grid(1:2).eq.'DO' .or. &
- (grid(1:2).eq.'GO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'DN'.and. grid(4:4).gt.'8' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'CP' .or. grid(1:2).eq.'DP' .or. grid(1:2).eq.'EP' .or. &
- (grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'96')) .or. &
- (grid(1:2).eq.'EQ' .and. (grid(3:4).eq.'15' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'24' .or.grid(3:4).eq.'71'.or. &
- grid(3:4).eq.'73' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'86' .or.grid(3:4).eq.'96')).or. &
- (grid(1:2).eq.'FR' .and. (grid(3:4).eq.'71' .or. grid(3:4).eq.'82')) .or. &
- (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'12')) .or. grid(1:4).eq.'GN03' .or. &
- grid(1:4).eq.'FN93' .or. grid(1:4).eq.'ER60' .or. grid(1:4).eq.'DQ10' .or. grid(1:4).eq.'CQ71') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'EO' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and.grid(4:4).lt.':').or. &
- (grid(4:4).eq.'7' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9') .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'CO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. &
- grid(4:4).lt.'8').or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'30'.or.grid(3:4).eq.'31'.or. &
- grid(3:4).eq.'40')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EP' .and. ((grid(4:4).eq.'0' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. &
- (grid(4:4).eq.'1' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9') .or. &
- (grid(4:4).eq.'2' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'CN' .and. (grid(3:4).eq.'68' .or. grid(3:4).eq.'98')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. &
- grid(4:4).lt.'8') .or. grid(3:4).eq.'04')) then; lgvalid=.false.
- endif
-endif
-
-! Burkina Faso XT
- else if(callsign(1:2).eq.'XT') then
- if((grid(1:2).eq.'IK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'IJ' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'89'))) &
- lgvalid=.true.
-
-! Cambodia XU
- else if(callsign(1:2).eq.'XU') then
- if(grid(1:2).eq.'OK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') &
- lgvalid=.true.
-
-! Vietnam 3W,XV
- else if(callsign(1:2).eq.'XV') then
- if((grid(1:2).eq.'OL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'OK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. &
- grid(1:4).eq.'OJ19' .or. grid(1:4).eq.'OL41' .or. grid(1:4).eq.'OL23') lgvalid=.true.
-
-! Laos XW
- else if(callsign(1:2).eq.'XW') then
- if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'OL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) &
- lgvalid=.true.
-
-! Macao XX9
- else if(callsign(1:3).eq.'XX9' .and. grid(1:4).eq.'OL62') then
- lgvalid=.true.
-
- ! Chile 3G,CA..CE,XQ,XR
- else if(callsign(1:2).eq.'XQ' .or. callsign(1:2).eq.'XR') then
- if((grid(1:2).eq.'FF' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'FG' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8'))) .or. &
- (grid(1:2).eq.'FE' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'52')) .or. &
- (grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'53' .or. grid(3:4).eq.'85')) .or. &
- grid(1:4).eq.'EF96' .or. grid(1:4).eq.'FF06' .or. grid(1:4).eq.'EG93' .or. grid(1:4).eq.'FG03' .or. &
- grid(1:4).eq.'DG52' .or. grid(1:4).eq.'DG73') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FF' .and. grid(3:3).eq.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') then; lgvalid=.false.
- else if(grid(1:2).eq.'FE' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'29')) then; lgvalid=.false.
- endif
-endif
-
-! Myanmar XY,XZ
- else if(callsign(1:2).eq.'XY' .or. callsign(1:2).eq.'XZ') then
- if((grid(1:2).eq.'NK' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'NL' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'OL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01'))) &
- lgvalid=.true.
-
-! Greenland OX,XP
- else if(callsign(1:2).eq.'XP') then
- if((grid(1:2).eq.'GP' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'HP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'HQ90' .or. &
- (grid(1:2).eq.'GQ' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'41' .or.grid(3:4).eq.'22'.or. &
- grid(3:4).eq.'14' .or. grid(3:4).eq.'12')) .or. &
- (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'67' .or. grid(3:4).eq.'57' .or.grid(3:4).eq.'56'.or. &
- grid(3:4).eq.'38'))) lgvalid=.true.
-
-! China, Taiwan B, 3H..3U, XS
- else if(callsign(1:2).eq.'XS') then
- if(grid(1:2).eq.'OL' .or. &
- (grid(1:2).eq.'PL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. grid(1:2).eq.'OM' .or. &
- (grid(1:2).eq.'PM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. &
- (grid(1:2).eq.'PN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8') .or. &
- (grid(1:2).eq.'PO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- (grid(1:2).eq.'OK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or.grid(3:4).eq.'59')).or. &
- grid(1:2).eq.'ON' .or. grid(1:4).eq.'OO90' .or. grid(1:4).eq.'OO91' .or. grid(1:2).eq.'NN' .or. grid(1:2).eq.'NM'.or. &
- (grid(1:2).eq.'NL' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'MN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':')) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'NL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7'.and. &
- grid(3:4).ne.'83' .and. grid(3:4).ne.'84' .and. grid(3:4).ne.'85') .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'87')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'ON' .and.((grid(3:3).gt.'/'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- (grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':') .or. &
- grid(3:4).eq.'76' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PN' .and. ((grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. &
- grid(3:4).eq.'40' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'59' .or. &
- grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MM' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).eq.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'OL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'0') .or. &
- grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) then; lgvalid=.false.
- endif
-endif
-
-! not valid callsigns X0...X9
- else if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':') then
- lwrongcall=.true.; return
-
- endif ! 'X'
-
- else if(callsign(1:1).eq.'Y') then
-
-! Romania YO..YR
- if(callsign(2:2).gt.'N' .and. callsign(2:2).lt.'S') then
- if(grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') &
- lgvalid=.true.
-
-! Serbia YU,YT
- else if(callsign(2:2).eq.'U' .or. callsign(2:2).eq.'T') then
- if((grid(1:3).eq.'JN9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. &
- (grid(1:3).eq.'KN0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7') .or. &
- (grid(1:3).eq.'KN1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true.
-
-! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH
- else if(callsign(2:2).gt.'A' .and. callsign(2:2).lt.'I') then
- if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- grid(1:2).eq.'OI' .or. grid(1:2).eq.'PI' .or. &
- (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false.
- else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6').or. &
- (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1'.or. &
- grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OJ'.and.((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. &
- grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PI' .and.(grid(3:4).eq.'61'.or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. &
- grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'29')) &
- then; lgvalid=.false.
- endif
-endif
-
-! Venezuela, Aves Island YV..YY 4M
- else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'Z') then
- if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'60' .or. grid(3:4).eq.'70')) .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- grid(1:4).eq.'FK85') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7' .and. &
- grid(3:4).ne.'57') .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'32' .or.grid(3:4).eq.'72'.or.grid(3:4).eq.'82'.or.grid(3:4).eq.'92'.or. &
- grid(3:4).eq.'91')) then; lgvalid=.false.
- endif
-endif
-
-! Latvia YL
- else if(callsign(1:2).eq.'YL') then
- if((grid(1:2).eq.'KO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'KO' .and. (grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'28'))) &
- lgvalid=.true.
-
-! Afghanistan T6,YA
- else if(callsign(1:2).eq.'YA') then
- if((grid(1:2).eq.'MM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(3:4).eq.'9')) lgvalid=.true.
-
-! Iraq HN,YI
- else if(callsign(1:2).eq.'YI') then
- if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'KM' .and.(grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) .or. &
- (grid(1:2).eq.'LL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-! Vanuatu YJ
- else if(callsign(1:2).eq.'YJ') then
- if((grid(1:2).eq.'RH' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- grid(1:4).eq.'RG49' .or. grid(1:4).eq.'RH50' .or. grid(1:4).eq.'RH36') lgvalid=.true.
-
-! Syria 6C,YK
- else if(callsign(1:2).eq.'YK') then
- if((grid(1:2).eq.'KM' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7').or. &
- (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8')) &
- lgvalid=.true.
-
-! Turkey TA..TC,YM
- else if(callsign(1:2).eq.'YM') then
- if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'85')) .or. &
- (grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'20' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'72')) .or. &
- (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':'.and. &
- grid(3:4).ne.'16')) lgvalid=.true.
-
-! Nicaragua H6,H7,HT,YN
- else if(callsign(1:2).eq.'YN') then
- if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') &
- lgvalid=.true.
-
-! El Salvador YS,HU
- else if(callsign(1:2).eq.'YS') then
- if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'53' .or. grid(3:4).eq.'54' .or. grid(3:4).eq.'63' .or. grid(3:4).eq.'43')) &
- lgvalid=.true.
-
-! Fed. Rep. of Germany DA..DR, Y2..Y9
- else if(callsign(1:1).eq.'Y' .and. callsign(2:2).gt.'1' .and. callsign(2:2).lt.':') then
- if((grid(1:2).eq.'JO' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'45')) .or. &
- (grid(1:2).eq.'JN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. &
- grid(1:4).eq.'IB59') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'JO' .and. ((grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. &
- grid(3:4).eq.'35')) lgvalid=.false.
-endif
-
-! not valid callsigns Y1,Y0
- else if(callsign(1:2).eq.'Y1' .or. callsign(1:2).eq.'Y0') then
- lwrongcall=.true.; return
-
- endif ! 'Y'
-
- else if(callsign(1:1).eq.'Z') then
-
-! North Macedonia Z3
- if(callsign(1:2).eq.'Z3') then
- if((grid(1:3).eq.'KN0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- grid(1:4).eq.'KN11' .or. grid(1:4).eq.'KN11') lgvalid=.true.
-
-! Republic of Kosovo Z6
- else if(callsign(1:2).eq.'Z6' .and. (grid(1:4).eq.'KN02' .or. grid(1:4).eq.'KN03')) then
- lgvalid=.true.
-
-! New Zealand, Chatham Islands, Kermadec Islands, N.Z. Subantarctic Is. ZK ZL ZM
- else if(callsign(2:2).gt.'J' .and. callsign(2:2).lt.'N') then
- if((grid(1:2).eq.'RF' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'RE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. &
- grid(1:4).eq.'AE16' .or. grid(1:4).eq.'AE15' .or. grid(1:4).eq.'RE31' .or. grid(1:4).eq.'RE90' .or. &
- grid(1:4).eq.'RE92' .or. grid(1:4).eq.'AF10' .or. grid(1:4).eq.'AG09' .or. grid(1:4).eq.'AG08' .or. &
- grid(1:4).eq.'RD29' .or. grid(1:4).eq.'RD39' .or. grid(1:4).eq.'RD47') lgvalid=.true.
-
-! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU
- else if(callsign(2:2).gt.'Q' .and. callsign(2:2).lt.'V') then
- if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. &
- (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. &
- grid(3:4).ne.'85') .or. &
- (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. &
- (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false.
-endif
-
-! Paraguay ZP
- else if(callsign(1:2).eq.'ZP') then
- if((grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- grid(1:4).eq.'FH90' .or. grid(1:4).eq.'GH00' .or. grid(1:4).eq.'FG95') lgvalid=.true.
-
-! Albania ZA
- else if(callsign(1:2).eq.'ZA') then
- if((grid(1:3).eq.'JN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:3).eq.'KN0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- grid(1:4).eq.'JM99' .or. grid(1:4).eq.'KM09') lgvalid=.true.
-
-! Gibraltar ZB,ZG
- else if((callsign(1:2).eq.'ZB' .or. callsign(1:2).eq.'ZG') .and. grid(1:4).eq.'IM76') then
- lgvalid=.true.
-
-! UK Base Areas in Cyprus
- else if(callsign(1:3).eq.'ZC4' .and. grid(1:4).eq.'KM64') then
- lgvalid=.true.
-
-! Zimbabwe Z2
- else if(callsign(1:2).eq.'Z2') then
- if((grid(1:2).eq.'KH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'KG' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-! Republic of South Sudan Z8
- else if(callsign(1:2).eq.'Z8') then
- if((grid(1:2).eq.'KJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) &
- lgvalid=.true.
-
-! St. Helena ZD7
- else if(callsign(1:3).eq.'ZD7' .and. (grid(1:4).eq.'IH74' .or. grid(1:4).eq.'IH73')) then
- lgvalid=.true.
-
-! Ascension Island ZD8
- else if(callsign(1:3).eq.'ZD8' .and. grid(1:4).eq.'II22') then
- lgvalid=.true.
-
-! Tristan da Cunha & Gough ZD9
- else if(callsign(1:3).eq.'ZD9' .and. (grid(1:4).eq.'IF32' .or. grid(1:4).eq.'IE49' .or. grid(1:4).eq.'IE59')) then
- lgvalid=.true.
-
-! Cayman Islands ZF
- else if(callsign(1:2).eq.'ZF' .and. (grid(1:4).eq.'EK99' .or. grid(1:4).eq.'FK09')) then
- lgvalid=.true.
-
-! Tokelau Islands ZK3
- else if(callsign(1:3).eq.'ZK3' .and. (grid(1:4).eq.'AI31' .or. grid(1:4).eq.'AI40')) then
- lgvalid=.true.
-
-! Brazil PP..PY, ZV..ZZ
- else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'[') then
- if((grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'09')) .or. &
- (grid(1:2).eq.'HI' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6'.and. &
- grid(3:4).ne.'25') .or. grid(3:4).eq.'06' .or. grid(3:4).eq.'07' .or. grid(3:4).eq.'36')) .or. &
- (grid(1:2).eq.'HH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. &
- (grid(1:2).eq.'GH' .and. grid(3:4).ne.'01') .or. grid(1:2).eq.'GI' .or. &
- (grid(1:2).eq.'GF' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'36')) .or. &
- (grid(1:2).eq.'GJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. &
- grid(3:4).eq.'04' .or. grid(3:4).eq.'44')) .or. &
- (grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'95')) .or. &
- (grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'93' .or. grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) .or. &
- grid(1:4).eq.'HG59' .or. grid(1:4).eq.'HJ50') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. &
- grid(4:4).lt.'6' .and. grid(3:4).ne.'64' .and. grid(3:4).ne.'65') .or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'HH' .and. (grid(3:3).eq.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GI' .and. ((grid(3:3).gt.'7'.and.grid(3:3).lt.':'.and.grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'27')) then; lgvalid=.false.
- else if(grid(1:2).eq.'GJ' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'52' .or. &
- grid(3:4).eq.'53')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'5'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'76' .or. grid(3:4).eq.'68')) then; lgvalid=.false.
- endif
-endif
-
-! not valid callsigns Z1 Z7 Z9
- else if(callsign(2:2).eq.'1' .or. callsign(2:2).eq.'7' .or. callsign(2:2).eq.'9') then
- lwrongcall=.true.; return
-
- endif ! 'Z'
-
- endif ! end of block L..Z
-
-4 if(callsign(1:1).eq.'1') then
-
-! Sov Mil Order of Malta 1A
- if(callsign(1:2).eq.'1A' .and. grid(1:4).eq.'JN61') then
- lgvalid=.true.
-
-! 1B
- else if(callsign(1:2).eq.'1B') then
- if((grid(1:3).eq.'KM6' .or. grid(1:3).eq.'KM7') .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'6') lgvalid=.true.
-
-! Spratly Islands 1S,9M0,BM9S,BN9S,BO9S,BP9S,BQ9S,BU9S,BV9S,BW9S,BX9S
- else if(callsign(1:2).eq.'1S') then
- if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-! not valid callsigns 1C..1R 1T..1Z
- else if((callsign(2:2).gt.'B' .and. callsign(2:2).lt.'S') .or. (callsign(2:2).gt.'S' .and. callsign(2:2).lt.'[')) then
- lwrongcall=.true.; return
-
- endif ! '1'
-
- else if(callsign(1:1).eq.'2') then
-
-! UK GB / 2E,G,M / 2D,GD,GT,MD,MT / 2I,GI,GN,MI,MN / 2J,GH,GJ,MH,MJ / 2A,2M,GM,GS,MA,MM,MS / 2U,GP,GU,MP,MU / 2W,GC,GW,MC,MW
- if(callsign(2:2).eq.'E' .or. callsign(2:2).eq.'A' .or. callsign(2:2).eq.'M' .or. callsign(2:2).eq.'W' .or. &
- callsign(2:2).eq.'I' .or. callsign(2:2).eq.'J' .or. callsign(2:2).eq.'U' .or. callsign(2:2).eq.'D') then
- if((grid(1:2).eq.'IO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. &
- (grid(1:3).eq.'JO0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- grid(1:4).eq.'IP90' .or. grid(1:4).eq.'IN69' .or. grid(1:4).eq.'IN89' .or. grid(1:4).eq.'IO37') lgvalid=.true.
-
-if(lgvalid .and. grid(1:2).eq.'IO') then
- if((grid(1:3).eq.'IO5' .and. grid(4:4).ne.'4' .and. grid(4:4).ne.'7') .or. &
- (grid(1:3).eq.'IO6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- grid(3:4).eq.'96' .or. grid(3:4).eq.'98') lgvalid=.false.
-endif
-
-! not valid callsigns other 2x
- else
- lwrongcall=.true.; return
-
- endif ! '2'
-
- else if(callsign(1:1).eq.'3') then
-
-! Poland 3Z,HF,SN..SR
- if(callsign(1:2).eq.'3Z') then
- if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'20')) .or. &
- grid(1:4).eq.'KN09' .or. grid(1:4).eq.'KN19' .or. grid(1:4).eq.'KO20' .or. grid(1:4).eq.'JN99' .or. &
- grid(1:4).eq.'JN89') lgvalid=.true.
-
-! Monaco 3A
- else if(callsign(1:2).eq.'3A' .and. grid(1:4).eq.'JN33') then
- lgvalid=.true.
-
- ! Chile 3G,CA..CE,XQ,XR
- else if(callsign(1:2).eq.'3G') then
- if((grid(1:2).eq.'FF' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'FG' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8'))) .or. &
- (grid(1:2).eq.'FE' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(3:4).eq.'52')) .or. &
- (grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'53' .or. grid(3:4).eq.'85')) .or. &
- grid(1:4).eq.'EF96' .or. grid(1:4).eq.'FF06' .or. grid(1:4).eq.'EG93' .or. grid(1:4).eq.'FG03' .or. &
- grid(1:4).eq.'DG52' .or. grid(1:4).eq.'DG73') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FF' .and. grid(3:3).eq.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') then; lgvalid=.false.
- else if(grid(1:2).eq.'FE' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'29')) then; lgvalid=.false.
- endif
-endif
-
-! Agalega & St. Brandon 3B6,3B7
- else if((callsign(1:3).eq.'3B6' .or. callsign(1:3).eq.'3B7') .and. (grid(1:4).eq.'LH89' .or. grid(1:4).eq.'LH93')) then
- lgvalid=.true.
-
-! Mauritius 3B8
- else if(callsign(1:3).eq.'3B8' .and. (grid(1:4).eq.'LG89' .or. grid(1:4).eq.'LH80')) then
- lgvalid=.true.
-
-! Rodriguez Island 3B9
- else if(callsign(1:3).eq.'3B9' .and. grid(1:4).eq.'MH10') then
- lgvalid=.true.
-
-! Equatorial Guinea 3C, Annobon Island 3C0
- else if(callsign(1:2).eq.'3C') then
- if((grid(1:3).eq.'JJ4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. grid(1:4).eq.'JJ51' .or. &
- grid(1:4).eq.'JJ52' .or. grid(1:4).eq.'JI28') lgvalid=.true.
-
-! Fiji, Conway Reef, Rotuma Island 3D2
- else if(callsign(1:3).eq.'3D2') then
- if((grid(1:2).eq.'RH' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. &
- (grid(1:3).eq.'AH0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- grid(1:4).eq.'RG78' .or. grid(1:4).eq.'AG08' .or. grid(1:4).eq.'AG09') lgvalid=.true.
-
-! Kingdom of eSwatini 3DA
- else if(callsign(1:3).eq.'3DA') then
- if((grid(1:3).eq.'KG5' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. grid(1:4).eq.'KG63' .or. &
- grid(1:4).eq.'KG64') lgvalid=.true.
-
-! Tunisia 3V,TS
- else if(callsign(1:2).eq.'3V') then
- if(grid(1:2).eq.'JM' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') &
- lgvalid=.true.
-
-! Vietnam 3W,XV
- else if(callsign(1:2).eq.'3W') then
- if((grid(1:2).eq.'OL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'OK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. &
- grid(1:4).eq.'OJ19' .or. grid(1:4).eq.'OL41' .or. grid(1:4).eq.'OL23') lgvalid=.true.
-
-! Guinea 3X
- else if(callsign(1:2).eq.'3X') then
- if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'IK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. &
- grid(1:4).eq.'IJ39') lgvalid=.true.
-
-! Bouvet, Peter 1st Island 3Y
- else if(callsign(1:3).eq.'3Y' .and. (grid(1:4).eq.'JD15' .or. grid(1:4).eq.'EC41')) then
- lgvalid=.true.
-
-! Panama 3E,3F,H3,H8,H9,HO,HP
- else if(callsign(2:2).eq.'E' .or. callsign(2:2).eq.'F') then
- if((grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or. grid(3:4).eq.'17' .or. &
- grid(3:4).eq.'18')) .or. &
- (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'88' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'97' .or. &
- grid(3:4).eq.'98' .or. grid(3:4).eq.'99'))) lgvalid=.true.
-
-! China, Taiwan B, 3H..3U, XS
- else if(callsign(2:2).gt.'G' .and. callsign(2:2).lt.'V') then
- if(len_trim(callsign).gt.5) return ! checkcall
- if(grid(1:2).eq.'OL' .or. &
- (grid(1:2).eq.'PL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. grid(1:2).eq.'OM' .or. &
- (grid(1:2).eq.'PM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. &
- (grid(1:2).eq.'PN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8') .or. &
- (grid(1:2).eq.'PO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. &
- (grid(1:2).eq.'OK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or.grid(3:4).eq.'59')).or. &
- grid(1:2).eq.'ON' .or. grid(1:4).eq.'OO90' .or. grid(1:4).eq.'OO91' .or. grid(1:2).eq.'NN' .or. grid(1:2).eq.'NM'.or. &
- (grid(1:2).eq.'NL' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'MN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':')) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'NL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7'.and. &
- grid(3:4).ne.'83' .and. grid(3:4).ne.'84' .and. grid(3:4).ne.'85') .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'87')) &
- then; lgvalid=.false.
- else if(grid(1:2).eq.'ON' .and.((grid(3:3).gt.'/'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- (grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':') .or. &
- grid(3:4).eq.'76' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PN' .and. ((grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. &
- (grid(3:3).eq.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. &
- grid(3:4).eq.'40' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'59' .or. &
- grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MM' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8') .or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).eq.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'OL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'0') .or. &
- grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) then; lgvalid=.false.
- endif
-endif
-
- endif ! '3'
-
- else if(callsign(1:1).eq.'4') then
-
-! Venezuela, Aves Island YV..YY 4M
- if(callsign(1:2).eq.'4M') then
- if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'60' .or. grid(3:4).eq.'70')) .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- grid(1:4).eq.'FK85') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7' .and. &
- grid(3:4).ne.'57') .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) then; lgvalid=.false.
- else if(grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'32' .or.grid(3:4).eq.'72'.or.grid(3:4).eq.'82'.or.grid(3:4).eq.'92'.or. &
- grid(3:4).eq.'91')) then; lgvalid=.false.
- endif
-endif
-
-! Israel 4X, 4Z
- else if(callsign(1:2).eq.'4X' .or. callsign(1:2).eq.'4Z') then
- if((grid(1:3).eq.'KM7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. grid(1:4).eq.'KL79') lgvalid=.true.
-
-! Montenegro 4O
- else if(callsign(1:2).eq.'4O') then
- if((grid(1:3).eq.'JN9' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. grid(1:4).eq.'KN02' .or. &
- grid(1:4).eq.'KN03') lgvalid=.true.
-
-! Sri Lanka 4P,4Q,4R,4S
- else if(callsign(2:2).gt.'O' .and. callsign(2:2).lt.'T') then
- if((grid(1:3).eq.'MJ9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- (grid(1:3).eq.'NJ0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':')) lgvalid=.true.
-
-! Philippines 4D,4E,4F,4G,4H,4I,DU,DV,DW,DX,DY,DZ
- else if(callsign(2:2).gt.'C' .and. callsign(2:2).lt.'J') then
- if((grid(1:2).eq.'PK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. &
- (grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'04')) .or. &
- (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'OK' .and. grid(3:3).eq.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. &
- (grid(1:2).eq.'PL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. &
- grid(1:4).eq.'OK70' .or. grid(1:4).eq.'OK71') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PK' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. &
- (grid(3:3).eq.'2' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':'))) then; lgvalid=.false.
- else if(grid(1:2).eq.'PJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'15')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false.
- endif
-endif
-
-! Azerbaijan 4J, 4K
- else if(callsign(1:2).eq.'4J' .or. callsign(1:2).eq.'4J') then
- if((grid(1:2).eq.'LN' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'LM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. &
- grid(1:4).eq.'LN50') lgvalid=.true.
-
-! Georgia 4L
- else if(callsign(1:2).eq.'4J' .or. callsign(1:2).eq.'4J') then
- if(grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') &
- lgvalid=.true.
-
-! ITU HQ, United Nations HQ, Vienna Intl Ctr
- else if(callsign(2:2).eq.'U' .and. &
- (callsign(1:6).eq.'4U1ITU' .or. callsign(1:5).eq.'4U1UN' .or. callsign(1:6).eq.'4U1VIC' .or. &
- grid(1:4).eq.'JN88')) then
- lgvalid=.true.
-
-! Mexico, Revillagigedo 4A..4C, 6D..6J, XA..XI
- else if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'D') then
- if((grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.':').or.grid(3:4).eq.'08'.or.grid(3:4).eq.'09')).or. &
- (grid(1:2).eq.'EL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'EK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'34')) .or. &
- (grid(1:2).eq.'DM' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'DK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'DK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'38'))) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2') .or. &
- grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'33' .or. grid(3:4).eq.'60')) then
- lgvalid=.false.
- else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'17' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'32' .or. &
- grid(3:4).eq.'62')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'05' .or.grid(3:4).eq.'65'.or.grid(3:4).eq.'66'.or.grid(3:4).eq.'67'.or. &
- grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'2') then; lgvalid=.false.
- else if(grid(1:2).eq.'DK' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'86')) then; lgvalid=.false.
- endif
-endif
-
-! Haiti 4V,HH
- else if(callsign(1:2).eq.'4V') then
- if((grid(1:2).eq.'FK' .and. (grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'48' .or. &
- grid(3:4).eq.'49')) .or. grid(1:4).eq.'FL30') lgvalid=.true.
-
-! Timor - Leste 4W
- else if(callsign(1:2).eq.'4W') then
- if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'31')) lgvalid=.true.
-
-! Peru 4T,OA..OC
- else if(callsign(1:2).eq.'4T') then
- if((grid(1:2).eq.'FH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'FI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(1:3).eq.'EI9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7')) lgvalid=.true.
-
- endif ! '4'
-
- else if(callsign(1:1).eq.'5') then
-
-! Denmark 5P,5Q,OU,OV,OZ
- if(callsign(1:2).eq.'5P' .or. callsign(1:2).eq.'5Q') then
- if(grid(1:2).eq.'JO' .and. &
- ((grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'75' .or. grid(3:4).eq.'76')) lgvalid=.true.
-
-! Cyprus 5B,C4,H2,P3
- else if(callsign(1:2).eq.'5B') then
- if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. &
- (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true.
-
-! Morocco 5C..5G,CN
- else if(callsign(2:2).gt.'B' .and. callsign(2:2).lt.'H') then
- if((grid(1:2).eq.'IM' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. &
- (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'6'.and.grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'69' .or. grid(3:4).eq.'79'))) lgvalid=.true.
-
-! Libya 5A
- else if(callsign(1:2).eq.'5A') then
- if((grid(1:2).eq.'JM' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'/' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'KM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'JL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. &
- (grid(1:2).eq.'JM' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'53')) .or. &
- grid(1:4).eq.'JL91' .or. grid(1:4).eq.'KK19') lgvalid=.true.
-
-! Tanzania 5H, 5I
- else if(callsign(1:2).eq.'5H' .or. callsign(1:2).eq.'5I') then
- if((grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'KH' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-! Colombia 5J,5K,HJ,HK
- else if(callsign(1:2).eq.'5K' .or. callsign(1:2).eq.'5J') then
- if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7') .or. &
- grid(3:4).eq.'01' .or. grid(3:4).eq.'02' .or. grid(3:4).eq.'03')) .or. &
- (grid(1:2).eq.'FK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3' .and. &
- grid(3:4).ne.'22') .or. &
- (grid(1:2).eq.'FI' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'6' .and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'45' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'56') .and.grid(3:4).ne.'27').or. &
- (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'94')) .or. grid(1:4).eq.'EK92') lgvalid=.true.
-
-! Liberia 5L,5M,6Z,A8,D5,EL
- else if(callsign(1:2).eq.'5L' .or. callsign(1:2).eq.'5M') then
- if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and.grid(4:4).lt.'9'.and. &
- grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true.
-
-! Nigeria 5N,5O
- else if(callsign(1:2).eq.'5N' .or. callsign(1:2).eq.'5O') then
- if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) &
- lgvalid=.true.
-
-! Madagascar 5R,5S,6X
- else if(callsign(1:2).eq.'5R' .or. callsign(1:2).eq.'5S') then
- if((grid(1:2).eq.'LH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. &
- (grid(1:2).eq.'LG' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(1:2).eq.'LH' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'47' .or. grid(3:4).eq.'48')) lgvalid=.true.
-
-! Mauritania 5T
- else if(callsign(1:2).eq.'5T') then
- if((grid(1:2).eq.'IK' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'8'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'34' .or. grid(3:4).eq.'44')) .or. &
- (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. &
- grid(3:4).eq.'56' .or. grid(3:4).eq.'66' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'75'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'IK' .and. grid(3:4).eq.'15' .or. grid(3:4).eq.'25') then
- lgvalid=.false.
- else if(grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'6').or. &
- grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false.
- endif
-endif
-
-! Niger 5U
- else if(callsign(1:2).eq.'5U') then
- if((grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. &
- grid(1:4).eq.'JK11' .or. &
- grid(1:2).eq.'JL' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'53' .or. grid(3:4).eq.'63')) &
- lgvalid=.true.
-
-! Togo 5V
- else if(callsign(1:2).eq.'5V') then
- if((grid(1:3).eq.'JJ0' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'JK' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) .or. &
- (grid(1:2).eq.'IK' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91'))) lgvalid=.true.
-
-! Samoa 5W
- else if(callsign(1:2).eq.'5W') then
- if(grid(1:2).eq.'AH' .and. (grid(3:4).eq.'36' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'45')) lgvalid=.true.
-
-! Uganda 5X
- else if(callsign(1:2).eq.'5X') then
- if((grid(1:2).eq.'KJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. &
- (grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9') .or. &
- (grid(1:2).eq.'KJ' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'64' .or. grid(3:4).eq.'74')) .or. &
- (grid(1:2).eq.'KI' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'58'))) &
- lgvalid=.true.
-
-! Kenya 5Y,5Z
- else if(callsign(1:2).eq.'5Z' .or. callsign(1:2).eq.'5Y') then
- if((grid(1:2).eq.'KI' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'LI' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'LJ' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- grid(1:4).eq.'KJ60' .or. grid(1:4).eq.'KI69') lgvalid=.true.
-
- endif ! '5'
-
- else if(callsign(1:1).eq.'6') then
-
-! Syria 6C,YK
- if(callsign(1:2).eq.'6C') then
- if((grid(1:2).eq.'KM' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'7').or. &
- (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8')) &
- lgvalid=.true.
-
-! Mexico, Revillagigedo 4A..4C, 6D..6J, XA..XI
- else if(callsign(2:2).gt.'C' .and. callsign(2:2).lt.'K') then
- if((grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.':').or.grid(3:4).eq.'08'.or.grid(3:4).eq.'09')).or. &
- (grid(1:2).eq.'EL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. &
- (grid(1:2).eq.'EK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'34')) .or. &
- (grid(1:2).eq.'DM' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. &
- (grid(1:2).eq.'DK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'DK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'38'))) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2') .or. &
- grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'33' .or. grid(3:4).eq.'60')) then
- lgvalid=.false.
- else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.'8').or. &
- grid(3:4).eq.'17' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'32' .or. &
- grid(3:4).eq.'62')) then; lgvalid=.false.
- else if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'05' .or.grid(3:4).eq.'65'.or.grid(3:4).eq.'66'.or.grid(3:4).eq.'67'.or. &
- grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'DM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'2') then; lgvalid=.false.
- else if(grid(1:2).eq.'DK' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'86')) then; lgvalid=.false.
- endif
-endif
-
-! Republic of Korea 6K,6L,6M,6N,D7,D8,D9,DS,DT,HL
- else if(callsign(1:1).eq.'6' .and. callsign(2:2).gt.'J' .and. callsign(2:2).lt.'O') then
- if((grid(1:3).eq.'PM3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') .or. &
- (grid(1:3).eq.'PM4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9') .or. &
- grid(1:4).eq.'PM24' .or. grid(1:4).eq.'PM57' .or. grid(1:4).eq.'GC07') lgvalid=.true. ! DT8A in GC07OS South Shetland Islands
-
-! Senegal 6V,6W
- else if(callsign(1:2).eq.'6V' .or. callsign(1:2).eq.'6W') then
- if(grid(1:2).eq.'IK' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'7').or. &
- grid(3:4).eq.'42' .or. grid(3:4).eq.'43')) lgvalid=.true.
-
-! Madagascar 5R,5S,6X
- else if(callsign(1:2).eq.'6X') then
- if((grid(1:2).eq.'LH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. &
- (grid(1:2).eq.'LG' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(1:2).eq.'LH' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'47' .or. grid(3:4).eq.'48')) lgvalid=.true.
-
-! Jamaica 6Y
- else if(callsign(1:2).eq.'6Y') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'06')) &
- lgvalid=.true.
-
-! Sudan 6T,6U,ST
- else if(callsign(2:2).eq.'T' .or. callsign(2:2).eq.'U') then
- if((grid(1:2).eq.'KK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'KL' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(1:4).eq.'KJ79') lgvalid=.true.
-
-! Pakistan 6P..6S, AP..AS
- else if(callsign(2:2).gt.'O' .and. callsign(2:2).lt.'T') then
- if((grid(1:2).eq.'MM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. &
- grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) .or. &
- (grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'33'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'MM' .and. grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') then; lgvalid=.false.
- else if(grid(1:2).eq.'ML' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. &
- grid(3:4).eq.'07')) then; lgvalid=.false.
- endif
-endif
-
-! Liberia 5L,5M,6Z,A8,D5,EL
- else if(callsign(1:2).eq.'6Z') then
- if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and.grid(4:4).lt.'9'.and. &
- grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true.
-
- endif ! '6'
-
- else if(callsign(1:1).eq.'7') then
-
-! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH
- if(callsign(1:1).eq.'7' .and. callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then
- if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'OI' .and. .not.(grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'4') &
- .and. .not.(grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'0')) .or. &
- (grid(1:2).eq.'PI' .and. .not.(grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0')) .or. &
- (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false.
- else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6') .or. &
- (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. &
- grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OJ' .and. ((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5').or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. &
- grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'61' .or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. &
- grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or.grid(3:4).eq.'29')) then
- lgvalid=.false.
- endif
-endif
-
-! Japan 7J..7N,8J..8N,JA,JE..JS
- else if(callsign(1:1).eq.'7' .and. callsign(2:2).gt.'I' .and. callsign(2:2).lt.'O') then
- if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:3).eq.'QM0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'QN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. &
- (grid(1:3).eq.'PN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'PL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(1:4).eq.'QM19' .or. grid(1:4).eq.'KC90') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and.grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3'.and.grid(3:4).ne.'62').or. &
- grid(3:4).eq.'45' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'56' .or.grid(3:4).eq.'88' .or. &
- grid(3:4).eq.'89')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PL'.and.((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'59')) then; lgvalid=.false.
- else if(grid(1:2).eq.'QN'.and.((grid(3:3).eq.'2'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'1'.or.grid(4:4).eq.'5')).or. &
- grid(3:4).eq.'10')) then; lgvalid=.false.
- endif
-endif
-
-! Yemen 7O
- else if(callsign(1:2).eq.'7O') then
- if(grid(1:2).eq.'LK' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and.grid(4:4).gt.'2'.and.grid(4:4).lt.'9').or. &
- grid(3:4).eq.'05' .or. grid(3:4).eq.'06' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'22')) lgvalid=.true.
-
-! Lesotho 7P
- else if(callsign(1:2).eq.'7P') then
- if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'KF' .and. (grid(3:4).eq.'39' .or. grid(3:4).eq.'49'))) lgvalid=.true.
-
-! Malawi 7Q
- else if(callsign(1:2).eq.'7Q') then
- if((grid(1:2).eq.'KH' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(1:4).eq.'KI60' .or. (grid(1:3).eq.'KH7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true.
-
-! Sweden 7S,8S,SA..SM
- else if(callsign(1:2).eq.'7S') then
- if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JP' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'25'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'JO' .and. (grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- else if(grid(1:2).eq.'JP' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. grid(3:4).eq.'89' .or. &
- grid(3:4).eq.'99')) then; lgvalid=.false.
- else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'14')) then; lgvalid=.false.
- endif
-endif
-
-! Algeria 7R, 7T..7Y
- else if(callsign(1:2).eq.'7R' .or. callsign(2:2).gt.'S' .and. callsign(2:2).lt.'Z') then
- if((grid(1:2).eq.'JM' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'5'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. &
- grid(3:4).eq.'37') .and. grid(3:4).ne.'43') .or. &
- (grid(1:2).eq.'IM' .and. ((grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'6').or. &
- grid(3:4).eq.'70')) .or. &
- (grid(1:2).eq.'JL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- grid(3:3).eq.'5' .and. grid(3:3).lt.'1' .and. grid(4:4).eq.'5')) .or. &
- (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'92')) .or. &
- (grid(1:2).eq.'JK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'IL' .and. ((grid(3:3).eq.'5' .and. grid(3:3).lt.'2' .and. grid(4:4).eq.'6') .or. &
- grid(3:4).eq.'63' .or. grid(3:4).eq.'64' .or. grid(3:4).eq.'73')) lgvalid=.false.
-endif
-
-! Saudi Arabia 7Z,8Z,HZ
- else if(callsign(1:2).eq.'7Z') then
- if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8').or. &
- (grid(1:2).eq.'KL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. &
- (grid(1:2).eq.'KM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'2') .or. &
- grid(1:4).eq.'KM92') lgvalid=.true.
-
- endif ! '7'
-
- else if(callsign(1:1).eq.'8') then
-
-! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH
- if(callsign(1:1).eq.'8' .and. callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then
- if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'OI' .and. .not.(grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'4') &
- .and. .not.(grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'0')) .or. &
- (grid(1:2).eq.'PI' .and. .not.(grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0')) .or. &
- (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. &
- (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false.
- else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6') .or. &
- (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. &
- grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. &
- grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OJ' .and. ((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. &
- (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5').or. &
- grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false.
- else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. &
- (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. &
- grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'61' .or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. &
- grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or.grid(3:4).eq.'29')) then
- lgvalid=.false.
- endif
-endif
-
-! Japan 7J..7N,8J..8N,JA,JE..JS
- else if(callsign(1:1).eq.'8' .and. callsign(2:2).gt.'I' .and. callsign(2:2).lt.'O') then
- if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:3).eq.'QM0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'QN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. &
- (grid(1:3).eq.'PN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. &
- (grid(1:2).eq.'PL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- grid(1:4).eq.'QM19' .or. grid(1:4).eq.'KC90') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'PM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and.grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3'.and.grid(3:4).ne.'62').or. &
- grid(3:4).eq.'45' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'56' .or.grid(3:4).eq.'88' .or. &
- grid(3:4).eq.'89')) then; lgvalid=.false.
- else if(grid(1:2).eq.'PL'.and.((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'59')) then; lgvalid=.false.
- else if(grid(1:2).eq.'QN'.and.((grid(3:3).eq.'2'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'1'.or.grid(4:4).eq.'5')).or. &
- grid(3:4).eq.'10')) then; lgvalid=.false.
- endif
-endif
-
-! Botswana 8O,A2
- else if(callsign(1:2).eq.'8O') then
- if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. &
- (grid(1:2).eq.'KH' .and. (grid(3:4).eq.'22' .or. grid(3:4).eq.'30')) .or. &
- (grid(1:2).eq.'KG' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'47'))) lgvalid=.true.
-
-! Barbados 8P
- else if(callsign(1:2).eq.'8P' .and. grid(1:4).eq.'GK03') then
- lgvalid=.true.
-
-! Maldives 8Q
- else if(callsign(1:2).eq.'8Q') then
- if((grid(1:3).eq.'MJ6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. grid(1:4).eq.'MI69') lgvalid=.true.
-
-! Guyana 8R
- else if(callsign(1:2).eq.'8R') then
- if((grid(1:2).eq.'GJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'9').or. &
- (grid(1:3).eq.'FJ9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8')) lgvalid=.true.
-
-! Sweden 7S,8S,SA..SM
- else if(callsign(1:2).eq.'8S') then
- if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. &
- (grid(1:2).eq.'JP' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. &
- (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'25'))) lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'JO' .and. (grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) then; lgvalid=.false.
- else if(grid(1:2).eq.'JP' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. &
- (grid(3:3).eq.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. grid(3:4).eq.'89' .or. &
- grid(3:4).eq.'99')) then; lgvalid=.false.
- else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'14')) then; lgvalid=.false.
- endif
-endif
-
-! India 8T..8Y,AT..AW,VT..VW
- else if(callsign(2:2).gt.'S' .and. callsign(2:2).lt.'Z') then
- if((grid(1:2).eq.'MJ' .and. (grid(3:4).eq.'99' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'88' .or. &
- grid(3:4).eq.'68')).or. &
- (grid(1:2).eq.'MK' .and. ((grid(3:3).gt.'5'.and.grid(3:3).lt.':').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. &
- (grid(1:2).eq.'NK' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'6') .or. &
- (grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or.grid(3:4).eq.'39')).or. &
- (grid(1:2).eq.'ML' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(1:4).eq.'NM00') lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'MK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'5') then; lgvalid=.false.
- else if(grid(1:2).eq.'NK' .and. (grid(3:4).eq.'26' .or. grid(3:4).eq.'27')) then; lgvalid=.false.
- else if(grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'4'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'5'.or.grid(4:4).eq.'8'.or. &
- grid(4:4).eq.'9')) .or. grid(3:4).eq.'58' .or. grid(3:4).eq.'59')) then; lgvalid=.false.
- else if(grid(1:2).eq.'NL' .and. ((grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(4:4).lt.'5') .or. &
- (grid(4:4).eq.'8' .and. grid(3:3).gt.'0' .and. grid(4:4).lt.'5') .or.grid(3:4).eq.'40')) then; lgvalid=.false.
- else if(grid(1:2).eq.'MM' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'62')) then; lgvalid=.false.
- endif
-endif
-
-! Saudi Arabia 7Z,8Z,HZ
- else if(callsign(1:2).eq.'8Z') then
- if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8').or. &
- (grid(1:2).eq.'KL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':') .or. &
- (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. &
- (grid(1:2).eq.'KM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'2') .or. &
- grid(1:4).eq.'KM92') lgvalid=.true.
-
- endif ! '8'
-
- else if(callsign(1:1).eq.'9') then
-
-! Croatia 9A
- if(callsign(1:2).eq.'9A') then
- if(grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and.grid(4:4).gt.'1'.and.grid(4:4).lt.'6').or. &
- grid(3:4).eq.'64' .or. grid(3:4).eq.'65' .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86') .and. grid(3:4).ne.'93') &
- lgvalid=.true.
-
-! Malta 9H
- else if(callsign(1:2).eq.'9H') then
- if(grid(1:2).eq.'JM' .and. (grid(3:4).eq.'75' .or. grid(3:4).eq.'76')) lgvalid=.true.
-
-! West Malaysia, East Malaysia 9M,9W
- else if(callsign(1:2).eq.'9M' .or. callsign(1:2).eq.'9W') then
- if(grid(1:4).eq.'NJ96' .or. (grid(1:2).eq.'OJ' .and. &
- (((grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. (grid(3:3).gt.'4' .and.grid(3:3).lt.':')) .and. &
- grid(4:4).gt.'0'.and.grid(4:4).lt.'7') .or. &
- grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'87')) lgvalid=.true.
-
-! Kuwait 9K
- else if(callsign(1:2).eq.'9K') then
- if((grid(1:2).eq.'LL' .and. (grid(3:4).eq.'39' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'38' .or. &
- grid(3:4).eq.'48')) .or. &
- (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'40'))) lgvalid=.true.
-
-! Singapore 9V,S6
- else if(callsign(1:2).eq.'9V') then
- if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) lgvalid=.true.
-
-! Trinidad & Tobago 9Y,9Z
- else if(callsign(1:2).eq.'9Y' .or. callsign(1:2).eq.'9Z') then
- if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91')) lgvalid=.true.
-
-! Nepal 9N
- else if(callsign(1:2).eq.'9N') then
- if((grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'NM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10'))) lgvalid=.true.
-
-! Ghana 9G
- else if(callsign(1:2).eq.'9G') then
- if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- (grid(1:3).eq.'JJ0' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'IK' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0').or. &
- (grid(1:4).eq.'JK00' .or. grid(1:4).eq.'JJ84' .or. grid(1:4).eq.'JJ94')) lgvalid=.true.
-
-! Zambia 9I,9J
- else if(callsign(1:2).eq.'9J' .or. callsign(1:2).eq.'9I') then
- if((grid(1:2).eq.'KH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. &
- grid(1:4).eq.'KH31') lgvalid=.true.
-
-! Sierra Leone 9L
- else if(callsign(1:2).eq.'9L') then
- if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. &
- grid(1:4).eq.'IJ46') lgvalid=.true.
-
-! Dem. Rep. of the Congo 9O..9T
- else if(callsign(2:2).gt.'N' .and. callsign(2:2).lt.'U') then
- if((grid(1:2).eq.'JI' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.'8'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'6').or. &
- grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':') .or. grid(3:4).eq.'81').or. &
- (grid(1:2).eq.'KI' .and. ((grid(3:3).gt.'/'.and.grid(3:3).lt.'5').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. &
- (grid(1:2).eq.'KJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'25' .or. grid(3:4).eq.'35')) .or. &
- (grid(1:2).eq.'JJ' .and. ((grid(3:3).gt.'8' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- grid(3:4).eq.'80' .or. grid(3:4).eq.'81' .or. grid(3:4).eq.'95')) .or. &
- (grid(1:2).eq.'KH' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'5'.and.grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'37' .or. grid(3:4).eq.'47' .or. grid(3:4).eq.'46'))) lgvalid=.true.
-
-! Burundi 9U
- else if(callsign(1:2).eq.'9U') then
- if(grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.'8') &
- lgvalid=.true.
-
-! Rwanda 9X
- else if(callsign(1:2).eq.'9X') then
- if(grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.'9') &
- lgvalid=.true.
-
-! Spratly Islands 1S,9M0,BM9S,BN9S,BO9S,BP9S,BQ9S,BU9S,BV9S,BW9S,BX9S
- else if(callsign(1:3).eq.'9M0') then
- if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. &
- (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) &
- lgvalid=.true.
-
-! Iran 9B..9D,EP,EQ
- else if(callsign(2:2).gt.'A' .and. callsign(2:2).lt.'E') then
- if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. &
- (grid(1:2).eq.'LL' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. &
- grid(3:4).eq.'49' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) .or. &
- (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':'.and. &
- grid(3:4).ne.'15' .and. grid(3:4).ne.'19') .or. &
- (grid(1:2).eq.'MM' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) &
- lgvalid=.true.
-
-if(lgvalid) then
- if(grid(1:2).eq.'LM' .and. ((grid(3:3).eq.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4') .or. &
- (grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':' .and. &
- grid(3:4).ne.'78' .and. grid(3:4).ne.'88'))) lgvalid=.false.
-endif
-
-! Ethiopia 9E,9F,ET
- else if(callsign(1:2).eq.'9E' .or. callsign(1:2).eq.'9F') then
- if((grid(1:2).eq.'LJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. &
- (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. &
- (grid(1:2).eq.'KK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5')) &
- lgvalid=.true.
-
- endif ! '9'
-
- endif ! end of block 1..9
-endif
-
- return
-end subroutine chkgridvar
+subroutine chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + + character, intent(in) :: callsign*12,grid*12 + logical(1) lchkcall,lgvalid,lwrongcall + +lchkcall=.false.; lgvalid=.false.; lwrongcall=.false. + +if(grid(1:1).gt.'@' .and. grid(1:1).lt.'J') then + if(grid(1:1).eq.'A' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'E') .or. grid(2:2).eq.'M' .or. grid(2:2).eq.'N' .or. & + grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'B' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'G') .or. grid(2:2).eq.'M' .or. grid(2:2).eq.'N' .or. & + grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'C' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'G') .or. & + (grid(2:2).eq.'G' .and. grid(3:3).gt.'7' .and. grid(4:4).lt.'4') .or. & + (grid(2:2).eq.'I' .and. grid(3:3).gt.'0' .and. grid(4:4).gt.'1') .or. & + (grid(2:2).gt.'I' .and. grid(2:2).lt.'M') .or. grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'D' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'G') .or. (grid(2:2).gt.'G'.and.grid(2:2).lt.'K').or. & + (grid(2:2).eq.'G' .and. grid(3:4).ne.'52' .and. grid(3:4).ne.'73') .or. & + grid(2:2).eq.'Q' .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'E' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'C') .or. & + (grid(2:2).eq.'C' .and. grid(3:4).ne.'41') .or. (grid(2:2).eq.'F' .and. grid(3:4).ne.'96') .or. & + (grid(2:2).gt.'C' .and. grid(2:2).lt.'F') .or. (grid(2:2).eq.'G' .and. grid(3:4).ne.'93') .or.grid(2:2).eq.'H'.or. & + grid(2:2).eq.'Q' .or. (grid(2:2).eq.'R' .and. grid(3:4).ne.'60'))) then; lchkcall=.true. ! VY0 + + else if(grid(1:1).eq.'F' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. (grid(2:2).eq.'Q'.and.grid(3:3).lt.'3').or. & + grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'G' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'C') .or. (grid(2:2).gt.'K'.and.grid(2:2).lt.'N').or. & + (grid(2:2).eq.'K' .and. grid(3:3).gt.'0') .or. (grid(2:2).eq.'N' .and. grid(3:3).gt.'3') .or. & + (grid(2:2).eq.'Q' .and. grid(4:4).gt.'4') .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'H' .and. (grid(2:2).eq.'A' .or. (grid(2:2).eq.'B' .and. grid(3:4).ne.'22') .or. & ! LU1ZG in HB22QD + grid(2:2).eq.'C' .or. (grid(2:2).gt.'D'.and.grid(2:2).lt.'H') .or. & + grid(2:2).eq.'J' .or. grid(2:2).eq.'L' .or. grid(2:2).eq.'N' .or. grid(2:2).eq.'O' .or. & + (grid(2:2).eq.'K' .and. grid(3:3).lt.'7') .or. (grid(2:2).eq.'M' .and. grid(4:4).lt.'6') .or. & + (grid(2:2).eq.'Q' .and. grid(4:4).gt.'0') .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'I' .and. (grid(2:2).eq.'A' .or. (grid(2:2).gt.'B' .and. grid(2:2).lt.'F') .or. & + (grid(2:2).eq.'B' .and. grid(3:4).ne.'59') .or. & ! DP0GVN + (grid(2:2).eq.'F' .and. grid(3:4).ne.'32') .or. grid(2:2).eq.'G' .or. (grid(2:2).eq.'H' .and.grid(3:3).ne.'7').or. & + (grid(2:2).eq.'I' .and. grid(3:4).ne.'22') .or. (grid(2:2).eq.'O' .and. grid(3:3).lt.'3') .or. & + (grid(2:2).eq.'P' .and. grid(4:4).gt.'7') .or. (grid(2:2).eq.'Q' .and. grid(4:4).gt.'1') .or. grid(2:2).eq.'R')) & + then; lchkcall=.true. + endif + +else if(grid(1:1).gt.'I' .and. grid(1:1).lt.'S') then + + if(grid(1:1).eq.'J' .and. (grid(2:2).eq.'C' .or. & + (grid(2:2).eq.'A' .and. grid(3:4).ne.'00') .or. & ! KC4AAA + (grid(2:2).eq.'B' .and. grid(3:4).ne.'59') .or. & ! Novolazarevskaya + (grid(2:2).eq.'D' .and. grid(3:4).ne.'15') .or. grid(2:2).eq.'E' .or. (grid(2:2).eq.'F' .and. grid(3:3).lt.'8') .or. & + (grid(2:2).eq.'G' .and. grid(3:3).lt.'6') .or. (grid(2:2).eq.'H' .and. grid(3:3).lt.'5') .or. & + (grid(2:2).eq.'I' .and. grid(3:3).lt.'2') .or. (grid(2:2).eq.'R' .and. grid(4:4).gt.'0'))) then; lchkcall=.true. + + else if(grid(1:1).eq.'K' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'C') .or. & + (grid(2:2).eq.'C' .and. grid(3:4).ne.'90') .or. grid(2:2).eq.'D' .or. & ! 8J1RL + (grid(2:2).eq.'E' .and. grid(3:4).ne.'83' .and. grid(3:4).ne.'93') .or. (grid(2:2).eq.'F' .and. grid(4:4).lt.'5') .or. & + (grid(2:2).eq.'R' .and. grid(4:4).gt.'0'))) then; lchkcall=.true. + + else if(grid(1:1).eq.'L' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'E') .or. & + (grid(2:2).eq.'E' .and. grid(3:4).ne.'53' .and. grid(3:4).ne.'54' .and. grid(3:4).ne.'63') .or. grid(2:2).eq.'F' .or. & + (grid(2:2).eq.'G' .and. grid(4:4).lt.'4') .or. (grid(2:2).eq.'J' .and. grid(3:3).gt.'5') .or. & + (grid(2:2).eq.'Q' .and. grid(4:4).lt.'5' .and. grid(4:4).lt.'9') .or. & + (grid(2:2).eq.'R' .and. grid(4:4).gt.'1'))) then; lchkcall=.true. + + else if(grid(1:1).eq.'M' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. & + (grid(2:2).eq.'D' .and. grid(3:4).ne.'66' .and. grid(3:4).ne.'67' .and. grid(3:4).ne.'49') .or. & + (grid(2:2).eq.'E' .and. grid(3:4).ne.'40' .and. grid(3:4).ne.'41' .and. grid(3:4).ne.'50') .or. & + (grid(2:2).eq.'F' .and. grid(3:4).ne.'81' .and. grid(3:4).ne.'82') .or. grid(2:2).eq.'G' .or. & + (grid(2:2).eq.'H' .and. grid(3:4).ne.'10') .or. (grid(2:2).eq.'I' .and. grid(3:3).lt.'5') .or. & + (grid(2:2).eq.'J' .and. grid(3:3).lt.'6') .or. (grid(2:2).eq.'K' .and. grid(3:3).lt.'5') .or. & + (grid(2:2).eq.'R' .and. grid(4:4).gt.'1'))) then; lchkcall=.true. + + else if(grid(1:1).eq.'N' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'H') .or. & + (grid(2:2).eq.'H' .and. grid(3:4).ne.'87' .and. grid(3:4).ne.'88') .or. & + (grid(2:2).eq.'I' .and. grid(3:3).lt.'9' .and. grid(3:4).ne.'89') .or. & + (grid(2:2).eq.'J' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6') .or. & + (grid(2:2).eq.'R' .and. grid(4:4).gt.'1'))) then; lchkcall=.true. + + else if(grid(1:1).eq.'O' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'F') .or. & + (grid(2:2).eq.'F' .and. grid(3:3).lt.'7') .or. (grid(2:2).eq.'G' .and. grid(3:3).lt.'6') .or. & + (grid(2:2).eq.'H' .and. grid(3:4).ne.'90' .and. grid(3:4).ne.'92' .and. grid(3:4).ne.'29' .and. grid(3:4).ne.'99').or. & + grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'P' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'F') .or. (grid(2:2).eq.'F'.and.grid(4:4).lt.'2').or. & + (grid(2:2).eq.'K' .and. grid(3:3).gt.'3' .and. grid(3:4).ne.'90') .or. & + (grid(2:2).eq.'Q' .and. grid(4:4).gt.'6') .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'Q' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. & + (grid(2:2).eq.'D' .and. grid(3:4).ne.'94' .and. grid(3:4).ne.'95') .or. (grid(2:2).eq.'E' .and. grid(4:4).lt.'6') .or. & + (grid(2:2).eq.'F' .and. grid(3:3).gt.'6' .and. grid(3:4).ne.'98') .or. & + (grid(2:2).eq.'K' .and. grid(3:3).gt.'2' .and. grid(3:4).ne.'36') .or. & + (grid(2:2).eq.'L' .and. grid(3:3).gt.'2' .and. grid(3:4).ne.'64' .and. grid(3:4).ne.'74') .or. & + (grid(2:2).eq.'M' .and. grid(3:3).gt.'0' .and. grid(3:4).ne.'19') .or. & + (grid(2:2).eq.'N' .and. grid(3:3).gt.'7') .or. & + (grid(2:2).eq.'Q' .and. grid(4:4).gt.'7') .or. grid(2:2).eq.'R')) then; lchkcall=.true. + + else if(grid(1:1).eq.'R' .and. ((grid(2:2).gt.'@' .and. grid(2:2).lt.'D') .or. & + (grid(2:2).eq.'D' .and. grid(3:4).ne.'47' .and. grid(3:4).ne.'29' .and. grid(3:4).ne.'39') .or. & + (grid(2:2).eq.'K' .and. grid(4:4).gt.'4' .and. grid(3:4).ne.'39') .or. (grid(2:2).gt.'K' .and. grid(2:2).lt.'O') .or. & + (grid(2:2).eq.'O' .and. grid(4:4).eq.'0') .or. (grid(2:2).eq.'Q' .and. grid(4:4).gt.'1') .or. grid(2:2).eq.'R')) & + then; lchkcall=.true. + endif + +else if (grid(1:1).gt.'/' .and. grid(1:1).lt.':') then ! 0..9 + lchkcall=.true. +endif + +if(.not.lchkcall) then + + if(callsign(1:1).gt.'K' .and. callsign(1:1).lt.'[') then; go to 2 + else if(callsign(1:1).gt.'/' .and. callsign(1:1).lt.':') then; go to 4 + endif + + if(callsign(1:1).eq.'A') then + +! USA AA..AL,K,N,W + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'M') then + if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. & + (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. & + grid(1:2).eq.'BP' .or. & + (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + grid(1:4).eq.'FK28' .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. & + (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. & + grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. & + grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. & + (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. & + grid(3:4).eq.'63')) .or. & + grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. & + grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. & + grid(1:4).eq.'CP00') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' & + .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. & + grid(3:4).eq.'14')) then; lgvalid=.false. + else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false. + else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false. + else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false. + else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false. + else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false. + else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false. + else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. & + grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. & + grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. & + ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. & + grid(3:4).eq.'22')) then; lgvalid=.false. + else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false. + endif +endif + +! Australia AX,VH..VN,VZ + else if(callsign(1:2).eq.'AX') then + if((grid(1:2).eq.'QG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. & + (grid(1:2).eq.'QF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. & + (grid(1:2).eq.'PF' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'OF' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'QE' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and.grid(4:4).gt.'5'.and. grid(4:4).lt.':').or. & + grid(3:4).eq.'19')) .or. & + (grid(1:2).eq.'QH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'OG' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. & + grid(1:2).eq.'PG' .or. grid(1:2).eq.'PH') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'QF' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') then; lgvalid=.false. + else if(grid(1:2).eq.'PF' .and. ((grid(3:3).gt.'/'.and.grid(3:3).lt.'8'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. & + (grid(4:4).eq.'5' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7') .or. grid(3:4).eq.'57')) then; lgvalid=.false. + else if(grid(1:4).eq.'OF74') then; lgvalid=.false. + else if(grid(1:2).eq.'QH' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. grid(3:4).eq.'09')) then; lgvalid=.false. + else if(grid(1:2).eq.'OG' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'69')) then; lgvalid=.false. + else if(grid(1:2).eq.'PH' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':' .and. & + grid(4:4).ne.'5' .and. grid(4:4).ne.'6') .or. & + (grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'59' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'89')) then; lgvalid=.false. + endif +endif + +! Pakistan 6P..6S, AP..AS + else if(callsign(2:2).gt.'O' .and. callsign(2:2).lt.'T') then + if((grid(1:2).eq.'MM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. & + grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) .or. & + (grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'33'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'MM' .and. grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') then; lgvalid=.false. + else if(grid(1:2).eq.'ML' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'07')) then; lgvalid=.false. + endif +endif + +! Spain AM..AO,EA..EH + else if(callsign(1:1).eq.'A' .and. callsign(2:2).gt.'L' .and. callsign(2:2).lt.'P') then + if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4' .and. & + grid(3:4).ne.'50').or. & + (grid(1:2).eq.'IM' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'12' .or. grid(3:4).eq.'13' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85')) .or. & + (grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'20')) .or. & + (grid(1:2).eq.'JM' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or.grid(3:4).eq.'19'.or.grid(3:4).eq.'29')).or. & + (grid(1:2).eq.'IL' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. & + (grid(4:4).eq.'8' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. grid(3:4).eq.'39'))) lgvalid=.true. + +! Botswana 8O,A2 + else if(callsign(1:2).eq.'A2') then + if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'KH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + (grid(1:2).eq.'KH' .and. (grid(3:4).eq.'22' .or. grid(3:4).eq.'30')) .or. & + (grid(1:2).eq.'KG' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'47'))) lgvalid=.true. + +! Tonga A3 + else if(callsign(1:2).eq.'A3') then + if((grid(1:2).eq.'AG' .and. (grid(3:4).eq.'28' .or.grid(3:4).eq.'29'.or.grid(3:4).eq.'06'.or.grid(3:4).eq.'07')).or. & + (grid(1:2).eq.'AH' .and. (grid(3:4).eq.'21' .or.grid(3:4).eq.'31'.or.grid(3:4).eq.'24'.or.grid(3:4).eq.'34'))) & + lgvalid=.true. + +! Oman A4 + else if(callsign(1:2).eq.'A4') then + if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + (grid(1:2).eq.'LK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +! Bhutan A5 + else if(callsign(1:2).eq.'A5') then + if(grid(1:2).eq.'NL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.'9') & + lgvalid=.true. + +! United Arab Emirates A6 + else if(callsign(1:2).eq.'A6') then + if(grid(1:2).eq.'LL' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and.grid(4:4).gt.'1'.and.grid(4:4).lt.'6').or. & + grid(3:4).eq.'53' .or. grid(3:4).eq.'54')) lgvalid=.true. + +! Qatar A7 + else if(callsign(1:2).eq.'A7') then + if((grid(1:3).eq.'LL5' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.'7') .or. grid(1:4).eq.'LL65') lgvalid=.true. + +! Bahrain A9 + else if(callsign(1:2).eq.'A9') then + if(grid(1:3).eq.'LL5' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.'7') lgvalid=.true. + +! Argentina AY,AZ, L1..L9, LO..LW + else if(callsign(1:2).eq.'AY' .or. callsign(1:2).eq.'AZ') then + if((grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FF' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:2).eq.'FE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9') .or. & + (grid(1:2).eq.'FD' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'GC07' .or. grid(1:4).eq.'GC16') lgvalid=.true. ! LU1ZB in GC16 + +if(lgvalid) then + if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) then; lgvalid=.false. + else if(grid(1:2).eq.'FG' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'57')) then; lgvalid=.false. + else if(grid(1:2).eq.'GG' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. & + grid(3:4).eq.'35')) then; lgvalid=.false. + else if(grid(1:2).eq.'FE' .and. ((grid(3:3).eq.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. & + (grid(3:3).eq.'3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'70' .or. grid(3:4).eq.'73')) then; lgvalid=.false. + else if(grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'2'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'8').or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':'))) then; lgvalid=.false. + endif +endif + +! India 8T..8Y,AT..AW,VT..VW + else if(callsign(1:1).eq.'A' .and. callsign(2:2).gt.'S' .and. callsign(2:2).lt.'X') then + if((grid(1:2).eq.'MJ' .and. (grid(3:4).eq.'99' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'88' .or. & + grid(3:4).eq.'68')).or. & + (grid(1:2).eq.'MK' .and. ((grid(3:3).gt.'5'.and.grid(3:3).lt.':').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. & + (grid(1:2).eq.'NK' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or.grid(3:4).eq.'39')).or. & + (grid(1:2).eq.'ML' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(1:4).eq.'NM00') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'MK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'5') then; lgvalid=.false. + else if(grid(1:2).eq.'NK' .and. (grid(3:4).eq.'26' .or. grid(3:4).eq.'27')) then; lgvalid=.false. + else if(grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'4'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'5'.or.grid(4:4).eq.'8'.or. & + grid(4:4).eq.'9')) .or. grid(3:4).eq.'58' .or. grid(3:4).eq.'59')) then; lgvalid=.false. + else if(grid(1:2).eq.'NL' .and. ((grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(4:4).eq.'8' .and. grid(3:3).gt.'0' .and. grid(4:4).lt.'5') .or.grid(3:4).eq.'40')) then; lgvalid=.false. + else if(grid(1:2).eq.'MM' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'62')) then; lgvalid=.false. + endif +endif + +! Liberia 5L,5M,6Z,A8,D5,EL + else if(callsign(1:2).eq.'A8') then + if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' .and. & + grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true. + + endif ! 'A' + + else if(callsign(1:1).eq.'B') then + if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall +! China, Taiwan B, 3H..3U, XS + if(grid(1:2).eq.'OL' .or. & + (grid(1:2).eq.'PL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. grid(1:2).eq.'OM' .or. & + (grid(1:2).eq.'PM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. & + (grid(1:2).eq.'PN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8') .or. & + (grid(1:2).eq.'PO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + (grid(1:2).eq.'OK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or.grid(3:4).eq.'59')).or. & + grid(1:2).eq.'ON' .or. grid(1:4).eq.'OO90' .or. grid(1:4).eq.'OO91' .or. grid(1:2).eq.'NN' .or. grid(1:2).eq.'NM'.or. & + (grid(1:2).eq.'NL' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'MN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':')) lgvalid=.true. + +if(lgvalid) then +! grid exceptions for Taiwan BM,BN,BO,BP,BQ,BU,BV,BW,BX + if((callsign(2:2).gt.'L' .and. callsign(2:2).lt.'R') .or. (callsign(2:2).gt.'T' .and. callsign(2:2).lt.'Y')) then + if(grid(1:4).ne.'PL04' .and. grid(1:4).ne.'PL03' .and. grid(1:4).ne.'PL05' .and. grid(1:4).ne.'PL02' .and. & + grid(1:4).ne.'PL01' .and. grid(1:4).ne.'OL93' .and. grid(1:4).ne.'PL15' .and. grid(1:4).ne.'OL80') lgvalid=.false. + endif +endif +if(lgvalid) then + if(grid(1:2).eq.'NL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7'.and. & + grid(3:4).ne.'83' .and. grid(3:4).ne.'84' .and. grid(3:4).ne.'85') .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'87')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'ON' .and.((grid(3:3).gt.'/'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + (grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':') .or. & + grid(3:4).eq.'76' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'PN' .and. ((grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. & + grid(3:4).eq.'40' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'59' .or. & + grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'MM' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).eq.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5'))) then; lgvalid=.false. + else if(grid(1:2).eq.'OL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'0') .or. & + grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) then; lgvalid=.false. + endif +endif +if(.not.lgvalid) then +! Spratly Islands 1S,9M0,BM9S,BN9S,BO9S,BP9S,BQ9S,BU9S,BV9S,BW9S,BX9S + if(callsign(3:4).eq.'9S' .and. ((callsign(2:2).gt.'K' .and. callsign(2:2).lt.'R') .or. (callsign(2:2).gt.'T'.and. & + callsign(2:2).lt.'Y'))) then + if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) & + lgvalid=.true. +endif + + endif ! 'B' + + else if(callsign(1:1).eq.'C') then + + ! Chile 3G,CA..CE,XQ,XR + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'F') then + if((grid(1:2).eq.'FF' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'FG' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8'))) .or. & + (grid(1:2).eq.'FE' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'52')) .or. & + (grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'53' .or. grid(3:4).eq.'85')) .or. & + grid(1:4).eq.'EF96' .or. grid(1:4).eq.'FF06' .or. grid(1:4).eq.'EG93' .or. grid(1:4).eq.'FG03' .or. & + grid(1:4).eq.'DG52' .or. grid(1:4).eq.'DG73') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FF' .and. grid(3:3).eq.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') then; lgvalid=.false. + else if(grid(1:2).eq.'FE' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'29')) then; lgvalid=.false. + endif +endif + +! Cuba CL,CM,CO,T4 + else if(callsign(1:2).eq.'CL' .or. callsign(1:2).eq.'CM' .or. callsign(1:2).eq.'CO') then + if((grid(1:2).eq.'EL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. grid(1:4).eq.'FK19') lgvalid=.true. + +! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO + else if((callsign(2:2).gt.'E' .and. callsign(2:2).lt.'L').or. callsign(1:2).eq.'CY' .or. callsign(1:2).eq.'CZ') then + if((grid(1:2).eq.'CN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'EN' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. grid(1:2).eq.'CO' .or. & + (grid(1:2).eq.'GN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + grid(1:2).eq.'FO' .or. grid(1:2).eq.'EO' .or. grid(1:2).eq.'DO' .or. & + (grid(1:2).eq.'GO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'DN'.and. grid(4:4).gt.'8' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'CP' .or. grid(1:2).eq.'DP' .or. grid(1:2).eq.'EP' .or. & + (grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'96')) .or. & + (grid(1:2).eq.'EQ' .and. (grid(3:4).eq.'15' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'24' .or.grid(3:4).eq.'71'.or. & + grid(3:4).eq.'73' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'86' .or.grid(3:4).eq.'96')).or. & + (grid(1:2).eq.'FR' .and. (grid(3:4).eq.'71' .or. grid(3:4).eq.'82')) .or. & + (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'12')) .or. grid(1:4).eq.'GN03' .or. & + grid(1:4).eq.'FN93' .or. grid(1:4).eq.'ER60' .or. grid(1:4).eq.'DQ10' .or. grid(1:4).eq.'CQ71') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'EO' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and.grid(4:4).lt.':').or. & + (grid(4:4).eq.'7' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9') .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'CO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. & + grid(4:4).lt.'8').or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'30'.or.grid(3:4).eq.'31'.or. & + grid(3:4).eq.'40')) then; lgvalid=.false. + else if(grid(1:2).eq.'EP' .and. ((grid(4:4).eq.'0' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. & + (grid(4:4).eq.'1' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9') .or. & + (grid(4:4).eq.'2' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8'))) then; lgvalid=.false. + else if(grid(1:2).eq.'CN' .and. (grid(3:4).eq.'68' .or. grid(3:4).eq.'98')) then; lgvalid=.false. + else if(grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. & + grid(4:4).lt.'8') .or. grid(3:4).eq.'04')) then; lgvalid=.false. + endif +endif + +! Portugal, Madeira, Azores CQ..CU + else if(callsign(2:2).gt.'P' .and. callsign(2:2).lt.'U') then + if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'IM' .and. grid(3:3).gt.'4' .and. ((grid(3:3).lt.'7' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'12' .or. grid(3:4).eq.'13' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20')) .or. & + (grid(1:2).eq.'HM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'76'))) lgvalid=.true. + +! Uruguay CV..CX + else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'Y') then + if(grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') & + lgvalid=.true. + +! Bolivia CP + else if(callsign(1:2).eq.'CP') then + if((grid(1:2).eq.'FH' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'GH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. & + (grid(1:2).eq.'FI' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'70')) .or. & + (grid(1:2).eq.'GG' .and. (grid(3:4).eq.'09' .or. grid(3:4).eq.'19'))) lgvalid=.true. + +! Nauru C2, Andorra C3 + else if((callsign(1:2).eq.'C2' .and. grid(1:4).eq.'RI39') .or. (callsign(1:2).eq.'C3' .and. grid(1:4).eq.'JN02')) then + lgvalid=.true. + +! Morocco 5C..5G,CN + else if(callsign(1:2).eq.'CN') then + if((grid(1:2).eq.'IM' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'69' .or. grid(3:4).eq.'79'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:3).eq.'IM9' .and. (grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. grid(4:4).eq.'5')) then; lgvalid=.false. + else if(grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0' .and. & + grid(4:4).lt.'6') .or. (grid(4:4).eq.'1' .or. grid(4:4).eq.'3' .or. grid(4:4).eq.':') .or. & + (grid(4:4).eq.'2' .or. grid(4:4).eq.'6' .or. grid(4:4).eq.':') .or. & + grid(3:4).eq.'31' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + endif +endif + +! Cyprus 5B,C4,H2,P3 + else if(callsign(1:2).eq.'C4') then + if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. & + (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true. + + ! The Gambia C5 + else if(callsign(1:2).eq.'C5' .and. grid(1:2).eq.'IK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. & + grid(4:4).eq.'3') then + lgvalid=.true. + + ! Bahamas C6 + else if(callsign(1:2).eq.'C6' .and. grid(1:2).eq.'FL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. & + grid(4:4).gt.'1' .and. grid(4:4).lt.'7') then + lgvalid=.true. + + ! Mozambique C8,C9 + else if(callsign(1:2).eq.'C8' .or. callsign(1:2).eq.'C9') then + if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KH' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'LH' .and. grid(3:3).eq.'1' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':')) lgvalid=.true. + +! not valid callsigns 'C' + else if(callsign(2:2).eq.'0' .or. callsign(2:2).eq.'1' .or. callsign(2:2).eq.'7') then + lwrongcall=.true.; return + + endif ! 'C' + + else if(callsign(1:1).eq.'D') then + +! Fed. Rep. of Germany DA..DR, Y2..Y9 + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'S') then + if((grid(1:2).eq.'JO' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'45')) .or. & + (grid(1:2).eq.'JN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'IB59') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'JO' .and. ((grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. & + grid(3:4).eq.'35')) lgvalid=.false. +endif + +! Republic of Korea 6K,6L,6M,6N,D7,D8,D9,DS,DT,HL + else if(callsign(1:2).eq.'DS' .or. callsign(1:2).eq.'DT' .or. & + (callsign(2:2).gt.'6' .and. callsign(2:2).lt.':')) then + if((grid(1:3).eq.'PM3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') .or. & + (grid(1:3).eq.'PM4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9') .or. & + grid(1:4).eq.'PM24' .or. grid(1:4).eq.'PM57' .or. grid(1:4).eq.'GC07') lgvalid=.true. ! DT8A in GC07OS South Shetland Islands + +! Philippines 4D,4E,4F,4G,4H,4I,DU,DV,DW,DX,DY,DZ + else if(callsign(2:2).gt.'T' .and. callsign(2:2).lt.'[') then + if((grid(1:2).eq.'PK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. & + (grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'04')) .or. & + (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'OK' .and. grid(3:3).eq.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. & + (grid(1:2).eq.'PL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. & + grid(1:4).eq.'OK70' .or. grid(1:4).eq.'OK71') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PK' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'2' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':'))) then; lgvalid=.false. + else if(grid(1:2).eq.'PJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'15')) then; lgvalid=.false. + else if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false. + endif +endif + +! D0,D1 prefixes in transmitted message, mapping is required to prevent treating it as false decodes + else if(callsign(1:2).eq.'D0' .or. callsign(1:2).eq.'D1') then + if(grid(1:3).eq.'KN8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':' .or. & + grid(1:3).eq.'KN9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':' .or. & + grid(1:4).eq.'LN08' .or. grid(1:4).eq.'LN09') lgvalid=.true. + +! Angola D2,D3 + else if(callsign(1:2).eq.'D2' .or. callsign(1:2).eq.'D3') then + if((grid(1:2).eq.'JI' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'JH' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KH' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'01' .or. grid(3:4).eq.'28')) .or. & + (grid(1:3).eq.'KI0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:3).eq.'JH5' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true. + +! Cape Verde D4 + else if(callsign(1:2).eq.'D4' .and. ((grid(1:3).eq.'HK7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + (grid(1:3).eq.'HK8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7'))) then + lgvalid=.true. + +! Liberia 5L,5M,6Z,A8,D5,EL + else if(callsign(1:2).eq.'D5') then + if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' .and. & + grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true. + +! Comoros D6 + else if(callsign(1:2).eq.'D6' .and. grid(1:2).eq.'LH' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'18' .or. & + grid(3:4).eq.'27')) then + lgvalid=.true. + + endif ! 'D' + + else if(callsign(1:1).eq.'E') then + +! Spain AM..AO,EA..EH + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'I') then + if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4'.and. & + grid(3:4).ne.'50') .or. & + (grid(1:2).eq.'IM' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'12' .or. grid(3:4).eq.'13' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85')) .or. & + (grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'20')) .or. & + (grid(1:2).eq.'JM' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or.grid(3:4).eq.'19'.or.grid(3:4).eq.'29')).or. & + (grid(1:2).eq.'IL' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. & + (grid(4:4).eq.'8' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. grid(3:4).eq.'39'))) lgvalid=.true. + +! Ukraine EM..EO,UR..UZ + else if(callsign(2:2).gt.'L' .and. callsign(2:2).lt.'P') then + if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KO' .and. (grid(3:4).eq.'81' .or. grid(3:4).eq.'91')) then; lgvalid=.false. + else if(grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'0'.and.grid(3:3).lt.'4'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'7').or. & + grid(3:4).eq.'95' .or. grid(3:4).eq.'96')) then; lgvalid=.false. + endif +endif + +! Ireland EI,EJ + else if(callsign(1:2).eq.'EI' .or. callsign(1:2).eq.'EJ') then + if(grid(1:2).eq.'IO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'6') & + lgvalid=.true. + +! Thailand E2,HS + else if(callsign(1:2).eq.'E2') then + if((grid(1:2).eq.'OK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'9').or. & + grid(3:4).eq.'09')) .or. & + (grid(1:2).eq.'NK' .and. ((grid(3:3).gt.'8' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'87' .or. grid(3:4).eq.'88'.or. & + grid(3:4).eq.'89')) .or. & + (grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'88' .or. grid(3:4).eq.'89')) .or. & + (grid(1:2).eq.'OJ' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or.grid(3:4).eq.'16')).or. & + grid(1:4).eq.'NL90' .or. grid(1:4).eq.'OL00') lgvalid=.true. + +! Eritrea E3 + else if(callsign(1:2).eq.'E3') then + if((grid(1:2).eq.'KK' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7')) & + lgvalid=.true. + +! Palestine E4 + else if(callsign(1:2).eq.'E4' .and. (grid(1:4).eq.'KM71' .or. grid(1:4).eq.'KM72')) then + lgvalid=.true. + +! North Cook and South Cook Islands E5 + else if(callsign(1:2).eq.'E5') then + if((grid(1:2).eq.'BH' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. & + (grid(1:2).eq.'BG' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09'.or.grid(3:4).eq.'18'.or.grid(3:4).eq.'19')) .or. & + (grid(1:2).eq.'AH' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'79'.or.grid(3:4).eq.'81'.or.grid(3:4).eq.'86' .or. & + grid(3:4).eq.'99')) .or. & + (grid(1:2).eq.'BI' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01'.or.grid(3:4).eq.'10'.or.grid(3:4).eq.'11'))) & + lgvalid=.true. + +! Niue E6 + else if(callsign(1:2).eq.'E6') then + if(grid(1:4).eq.'AH50' .or. grid(1:4).eq.'AH51') lgvalid=.true. + +! Bosnia-Herzegovina E7 + else if(callsign(1:2).eq.'E7') then + if(grid(1:2).eq.'JN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'6' .and. & + grid(3:4).ne.'72' .and. grid(3:4).ne.'73') lgvalid=.true. + +! Belarus EU,EV,EW + else if(callsign(2:2).gt.'T' .and. callsign(2:2).lt.'X') then + if(grid(1:2).eq.'KO' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'7') & + lgvalid=.true. + +! Estonia ES + else if(callsign(1:2).eq.'ES') then + if((grid(1:2).eq.'KO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'KO49') lgvalid=.true. + +! Moldova ER + else if(callsign(1:2).eq.'ER') then + if((grid(1:2).eq.'KN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9').or. & + grid(1:4).eq.'KN56') lgvalid=.true. + +! Armenia EK + else if(callsign(1:2).eq.'EK') then + if((grid(1:2).eq.'LN' .and. (grid(3:4).eq.'10' .or. grid(3:4).eq.'11' .or. grid(3:4).eq.'20' .or. & + grid(3:4).eq.'21')) .or. & + (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'29' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'38'))) lgvalid=.true. + +! Kyrgyzstan EX + else if(callsign(1:2).eq.'EX') then + if((grid(1:2).eq.'MN' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9')) lgvalid=.true. + +! Tajikistan EY + else if(callsign(1:2).eq.'EY') then + if((grid(1:2).eq.'MM' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'MN' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'50'))) lgvalid=.true. + +! Turkmenistan EZ + else if(callsign(1:2).eq.'EZ') then + if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'LN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'MN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2')) & + lgvalid=.true. + +! Liberia 5L,5M,6Z,A8,D5,EL + else if(callsign(1:2).eq.'EL') then + if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' .and. & + grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true. + +! Iran 9B..9D,EP,EQ + else if(callsign(1:2).eq.'EP' .or. callsign(1:2).eq.'EQ') then + if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'LL' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'49' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) .or. & + (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':' .and. & + grid(3:4).ne.'15' .and. grid(3:4).ne.'19') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'LM' .and. ((grid(3:3).eq.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4') .or. & + (grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':' .and. & + grid(3:4).ne.'78' .and. grid(3:4).ne.'88'))) lgvalid=.false. +endif + +! Ethiopia 9E,9F,ET + else if(callsign(1:2).eq.'ET') then + if((grid(1:2).eq.'LJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5')) & + lgvalid=.true. + +! not valid callsigns E0 E1 E8 E9 + else if(callsign(2:2).eq.'0' .or. callsign(2:2).eq.'1' .or. callsign(2:2).eq.'8' .or. callsign(2:2).eq.'9') then + lwrongcall=.true.; return + + endif ! 'E' + + else if(callsign(1:1).eq.'F') then + +! France F,FA..FF,FI,FL,FN,FQ,FU,FV,FX,FZ,HW..HY,TH,TM,TP,TQ,TV + if((callsign(2:2).gt.'/' .and. callsign(2:2).lt.':') .or. (callsign(2:2).gt.'@' .and. callsign(2:2).lt.'G') .or. & + callsign(2:2).eq.'I' .or. callsign(2:2).eq.'L' .or. callsign(2:2).eq.'N' .or. callsign(2:2).eq.'Q' .or. & + callsign(2:2).eq.'U' .or. callsign(2:2).eq.'V' .or. callsign(2:2).eq.'X' .or. callsign(2:2).eq.'Z') then + if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'IN7' .and. (grid(4:4).eq.'7' .or. grid(4:4).eq.'8')) .or. & + (grid(1:2).eq.'JN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'JN4' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. & + grid(1:4).eq.'JN02' .or. grid(1:4).eq.'JN12' .or. grid(1:4).eq.'IN92' .or. & + (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'11'))) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'IN' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) lgvalid=.false. +endif + +! Martinique FM,TO + else if(callsign(1:2).eq.'FM' .and. grid(1:4).eq.'FK94') then + lgvalid=.true. + +! Guadeloupe FG,TO + else if(callsign(1:2).eq.'FG') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'96' .or. grid(3:4).eq.'95')) lgvalid=.true. + +! St. Pierre & Miquelon FP + else if(callsign(1:2).eq.'FP') then + if(grid(1:2).eq.'GN' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) lgvalid=.true. + +! St. Martin FS,TO + else if(callsign(1:2).eq.'FS' .and. grid(1:4).eq.'FK88') then + lgvalid=.true. + +! St. Barthelemy FJ,TO + else if(callsign(1:2).eq.'FJ' .and. grid(1:4).eq.'FK87') then + lgvalid=.true. + +! French Guiana FY + else if(callsign(1:2).eq.'FY') then + if(grid(1:2).eq.'GJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'6') & + lgvalid=.true. + +! Reunion Island FR,TO + else if(callsign(1:2).eq.'FR') then + if(grid(1:2).eq.'LG' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'78')) lgvalid=.true. + +! New Caledonia FK + else if(callsign(1:2).eq.'FK') then + if((grid(1:2).eq.'RG' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'RH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'RG' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'67'))) lgvalid=.true. + +! Chesterfield Islands FK,TX + else if(callsign(1:2).eq.'FK') then + if((grid(1:2).eq.'QH' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91')) .or. grid(1:4).eq.'QG98') lgvalid=.true. + +! Mayotte FH + else if(callsign(1:2).eq.'FH') then + if(grid(1:2).eq.'LH' .and. (grid(3:4).eq.'27' .or. grid(3:4).eq.'26')) lgvalid=.true. + +! Glorioso, Juan de Nova, Europa, Tromelin, Crozet, Kerguelen, Amsterdam & St. Paul Islands FT + else if(callsign(1:2).eq.'FT') then + if((grid(1:2).eq.'LH' .and. (grid(3:4).eq.'38' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'74')) .or. & + (grid(1:2).eq.'LE' .and. (grid(3:4).eq.'53' .or. grid(3:4).eq.'54' .or. grid(3:4).eq.'63')) .or. & + (grid(1:2).eq.'ME' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'50')) .or. & + (grid(1:2).eq.'MF' .and. (grid(3:4).eq.'81' .or. grid(3:4).eq.'82')) .or. & + grid(1:4).eq.'LG07' .or. grid(1:4).eq.'KG98') lgvalid=.true. + +! French Polynesia, Austral, Marquesas, Clipperton Islands FO,TX + else if(callsign(1:2).eq.'FO') then + if((grid(1:2).eq.'BH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:2).eq.'BG' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'BI9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'CI' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) .or. & + grid(1:4).eq.'CH09' .or. grid(1:4).eq.'DK50') lgvalid=.true. + +! Wallis & Futuna Islands FW,TW + else if(callsign(1:2).eq.'FW') then + if(grid(1:2).eq.'AH' .and. (grid(3:4).eq.'05' .or. grid(3:4).eq.'16')) lgvalid=.true. + + endif ! 'F' + +! UK GB,GX / 2E,G,M / 2D,GD,GT,MD,MT / 2I,GI,GN,MI,MN / 2J,GH,GJ,MH,MJ / 2A,2M,GM,GS,MA,MM,MS / 2U,GP,GU,MP,MU / 2W,GC,GW,MC,MW + else if(callsign(1:1).eq.'G') then + if((grid(1:2).eq.'IO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. & + (grid(1:3).eq.'JO0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + grid(1:4).eq.'IP90' .or. grid(1:4).eq.'IN69' .or. grid(1:4).eq.'IN89' .or. grid(1:4).eq.'IO37') lgvalid=.true. + +if(lgvalid .and. grid(1:2).eq.'IO') then + if((grid(1:3).eq.'IO5' .and. grid(4:4).ne.'4' .and. grid(4:4).ne.'7') .or. & + (grid(1:3).eq.'IO6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'96' .or. grid(3:4).eq.'98') lgvalid=.false. +endif + + else if(callsign(1:1).eq.'H') then + +! Hungary HA,HG + if(callsign(1:2).eq.'HA' .or. callsign(1:2).eq.'HG') then + if((grid(1:2).eq.'JN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9').or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'9' .and. & + grid(3:4).ne.'16')) lgvalid=.true. + +! Switzerland, Liechtenstein HB,HE + else if(callsign(1:2).eq.'HB' .or. callsign(1:2).eq.'HE') then + if(((grid(1:3).eq.'JN3' .or. grid(1:3).eq.'JN4') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8') .or. & + grid(1:4).eq.'JN56') lgvalid=.true. + +! Thailand E2,HS + else if(callsign(1:2).eq.'HS') then + if((grid(1:2).eq.'OK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'9').or. & + grid(3:4).eq.'09')) .or. & + (grid(1:2).eq.'NK' .and. ((grid(3:3).gt.'8' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'87' .or. grid(3:4).eq.'88'.or. & + grid(3:4).eq.'89')) .or. & + (grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'88' .or. grid(3:4).eq.'89')) .or. & + (grid(1:2).eq.'OJ' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or.grid(3:4).eq.'16')).or. & + grid(1:4).eq.'NL90' .or. grid(1:4).eq.'OL00') lgvalid=.true. + +! Cyprus 5B,C4,H2,P3 + else if(callsign(1:2).eq.'H2') then + if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. & + (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true. + +! Poland 3Z,HF,SN..SR + else if(callsign(1:2).eq.'HF') then + if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'20')) .or. & + grid(1:4).eq.'KN09' .or. grid(1:4).eq.'KN19' .or. grid(1:4).eq.'KO20' .or. grid(1:4).eq.'JN99' .or. & + grid(1:4).eq.'JN89') lgvalid=.true. + +! Nicaragua H6,H7,HT,YN + else if(callsign(1:2).eq.'H6' .or. callsign(1:2).eq.'H7' .or. callsign(1:2).eq.'HT') then + if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') & + lgvalid=.true. + +! Ecuador HC HD + else if(callsign(1:2).eq.'HC' .or. callsign(1:2).eq.'HD') then + if((grid(1:2).eq.'FI' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'05' .or. grid(3:4).eq.'06')) .or. & + (grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3'.and.grid(4:4).eq.'0').or.grid(3:4).eq.'01')).or. & + (grid(1:2).eq.'EI' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'49' .or. grid(3:4).eq.'59' .or. grid(3:4).eq.'48' .or. grid(3:4).eq.'58')) .or. & + (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'40'))) lgvalid=.true. + +! Haiti 4V,HH + else if(callsign(1:2).eq.'HH') then + if((grid(1:2).eq.'FK' .and. (grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'48' .or. & + grid(3:4).eq.'49')) .or. grid(1:4).eq.'FL30') lgvalid=.true. + +! Dominican Republic HI + else if(callsign(1:2).eq.'HI') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or. & + grid(3:4).eq.'59' .or. grid(3:4).eq.'47')) lgvalid=.true. + +! Republic of Korea 6K,6L,6M,6N,D7,D8,D9,DS,DT,HL + else if(callsign(1:2).eq.'HL') then + if((grid(1:3).eq.'PM3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') .or. & + (grid(1:3).eq.'PM4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9') .or. & + grid(1:4).eq.'PM24' .or. grid(1:4).eq.'PM57' .or. grid(1:4).eq.'GC07') lgvalid=.true. ! DT8A in GC07OS South Shetland Islands + +! Colombia 5J,5K,HJ,HK + else if(callsign(1:2).eq.'HK' .or. callsign(1:2).eq.'HJ') then + if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7') .or. & + grid(3:4).eq.'01' .or. grid(3:4).eq.'02' .or. grid(3:4).eq.'03')) .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3' .and. & + grid(3:4).ne.'22') .or. & + (grid(1:2).eq.'FI' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'6' .and.grid(4:4).lt.':').or. & + grid(3:4).eq.'45' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'56') .and.grid(3:4).ne.'27').or. & + (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'94')) .or. grid(1:4).eq.'EK92') lgvalid=.true. + +! Saudi Arabia 7Z,8Z,HZ + else if(callsign(1:2).eq.'HZ') then + if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8').or. & + (grid(1:2).eq.'KL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. & + (grid(1:2).eq.'KM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'2') .or. & + grid(1:4).eq.'KM92') lgvalid=.true. + +! Panama 3E,3F,H3,H8,H9,HO,HP + else if(callsign(2:2).eq.'P' .or. callsign(2:2).eq.'3' .or. callsign(2:2).eq.'8' .or. & + callsign(2:2).eq.'9' .or. callsign(2:2).eq.'O') then + if((grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or. grid(3:4).eq.'17' .or. & + grid(3:4).eq.'18')) .or. & + (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'88' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'97' .or. & + grid(3:4).eq.'98' .or. grid(3:4).eq.'99'))) lgvalid=.true. + +! Honduras HQ,HR + else if(callsign(2:2).eq.'R' .or. callsign(2:2).eq.'Q') then + if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'2' .and.grid(4:4).lt.'7'.and. & + grid(3:4).ne.'56' .and. grid(3:4).ne.'83') lgvalid=.true. + +! Iraq HN,YI + else if(callsign(1:2).eq.'HN') then + if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'KM' .and.(grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) .or. & + (grid(1:2).eq.'LL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).eq.'9')) lgvalid=.true. + +! El Salvador HU,YS + else if(callsign(1:2).eq.'HU') then + if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'53' .or. grid(3:4).eq.'54' .or. grid(3:4).eq.'63' .or. grid(3:4).eq.'43')) & + lgvalid=.true. + +! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU + else if(callsign(1:2).eq.'H5') then + if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. & + (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. & + grid(3:4).ne.'85') .or. & + (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false. +endif + +! France F,FA..FF,FI,FL,FN,FQ,FU,FV,FX,FZ,HW..HY,TH,TM,TP,TQ,TV + else if(callsign(2:2).gt.'V' .and. callsign(2:2).lt.'Z') then + if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'IN7' .and. (grid(4:4).eq.'7' .or. grid(4:4).eq.'8')) .or. & + (grid(1:2).eq.'JN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'JN4' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. & + grid(1:4).eq.'JN02' .or. grid(1:4).eq.'JN12' .or. grid(1:4).eq.'IN92' .or. & + (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'11'))) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'IN' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) lgvalid=.false. +endif + +! not valid callsigns + else if(callsign(1:2).eq.'H1') then + lwrongcall=.true.; return + + endif ! 'H' + +! Italy, Sardinia I + else if(callsign(1:1).eq.'I') then + if((grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'40' .or. grid(3:4).eq.'41')) .or. & + (grid(1:2).eq.'JM' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'65' .or. grid(3:4).eq.'56'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'JM' .and. (grid(3:4).eq.'69' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'96' .or. grid(3:4).eq.'97' .or. & + grid(3:4).eq.'98')) then; lgvalid=.false. + else if(grid(1:2).eq.'JN' .and. & + ((grid(3:3).eq.'7' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'8' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'9' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'50')) then; lgvalid=.false. + endif +endif + + else if(callsign(1:1).eq.'J') then + +! Japan 7J..7N,8J..8N,JA,JE..JS + if(callsign(1:2).eq.'JA' .or. (callsign(2:2).gt.'D' .and. callsign(2:2).lt.'T')) then + if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:3).eq.'QM0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'QN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:3).eq.'PN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'PL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'QM19' .or. grid(1:4).eq.'KC90') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and.grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3'.and.grid(3:4).ne.'62').or. & + grid(3:4).eq.'45' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'56' .or.grid(3:4).eq.'88' .or. & + grid(3:4).eq.'89')) then; lgvalid=.false. + else if(grid(1:2).eq.'PL'.and.((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'59')) then; lgvalid=.false. + else if(grid(1:2).eq.'QN'.and.((grid(3:3).eq.'2'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'1'.or.grid(4:4).eq.'5')).or. & + grid(3:4).eq.'10')) then; lgvalid=.false. + endif +endif + +! Greece J4,SV..SZ + else if(callsign(1:2).eq.'J4') then + if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'46' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'14').and.grid(3:4).ne.'05').or. & + grid(1:4).eq.'JM99' .or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. (grid(4:4).eq.'0' .or. grid(4:4).eq.'1'))) & + lgvalid=.true. + +! Djibouti J2 + else if(callsign(1:2).eq.'J2') then + if(grid(1:2).eq.'LK' .and. (grid(3:4).eq.'01' .or. grid(3:4).eq.'11' .or. grid(3:4).eq.'12')) lgvalid=.true. + +! Grenada J3 + else if(callsign(1:2).eq.'J3') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'92' .or. grid(3:4).eq.'91')) lgvalid=.true. + +! Guinea-Bissau J5 + else if(callsign(1:2).eq.'J5') then + if(grid(1:2).eq.'IK' .and. (grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'11' .or. & + grid(3:4).eq.'12' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'20')) lgvalid=.true. + +! St. Lucia J6 + else if(callsign(1:2).eq.'J6') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'94')) lgvalid=.true. + +! Dominica J7 + else if(callsign(1:2).eq.'J7' .and. grid(1:4).eq.'FK95') then + lgvalid=.true. + +! St. Vincent J8 + else if(callsign(1:2).eq.'J8') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'92')) lgvalid=.true. + +! Ogasawara and Minami Torishima JD1 + else if(callsign(1:3).eq.'JD1') then + if(grid(1:2).eq.'QL' .and. (grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) & + lgvalid=.true. + +! Mongolia JT..JV + else if(callsign(2:2).eq.'T' .or. callsign(2:2).eq.'U' .or. callsign(2:2).eq.'V') then + if((grid(1:2).eq.'ON' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'NN' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'NO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'OO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'OO' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'70'))) lgvalid=.true. + +! Svalbard, Bear Island JW + else if(callsign(1:2).eq.'JW') then + if((grid(1:2).eq.'JQ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KQ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JR' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0') .or. & + (grid(1:2).eq.'KR' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'0') .or. & + grid(1:4).eq.'JQ94') lgvalid=.true. + +! Jan Mayen JX + else if(callsign(1:2).eq.'JX') then + if(grid(1:2).eq.'IQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'61')) lgvalid=.true. + +! Jordan JY + else if(callsign(1:2).eq.'JY') then + if((grid(1:2).eq.'KM' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. & + (grid(1:2).eq.'KL' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'89'))) lgvalid=.true. + +! not valid callsigns + else if(callsign(2:2).eq.'B' .or. callsign(2:2).eq.'C' .or. callsign(2:2).eq.'1' .or. & + callsign(2:2).eq.'9' .or. callsign(2:2).eq.'Z' .or. & + (callsign(1:2).eq.'JD' .and. callsign(3:3).gt.'1' .and. callsign(3:3).lt.':')) then + lwrongcall=.true.; return + + endif ! 'J' + +! USA AA..AL,K,N,W + else if(callsign(1:1).eq.'K') then + if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall + if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. & + (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. & + grid(1:2).eq.'BP' .or. & + (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + grid(1:4).eq.'FK28' .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. & + (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. & + grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. & + grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. & + (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. & + grid(3:4).eq.'63')) .or. & + grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. & + grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. & + grid(1:4).eq.'CP00') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' & + .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. & + grid(3:4).eq.'14')) then; lgvalid=.false. + else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false. + else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false. + else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false. + else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false. + else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false. + else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false. + else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. & + grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. & + grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. & + ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. & + grid(3:4).eq.'22')) then; lgvalid=.false. + else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false. + endif +endif + + endif ! end of block A..K + +2 if(callsign(1:1).eq.'L') then + +! Norway LA..LN + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'O') then + if((grid(1:2).eq.'JO' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'37')) .or. & + (grid(1:2).eq.'JP' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'KP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KQ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + grid(1:4).eq.'JQ90') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'JP' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + (grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. & + grid(3:4).eq.'23' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'58' .or. & + grid(3:4).eq.'59' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'97')) then; lgvalid=.false. + else if(grid(1:2).eq.'KP' .and. grid(4:4).eq.'8' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') then; lgvalid=.false. + else if(grid(1:2).eq.'KQ' .and. (grid(3:4).eq.'01' .or. grid(3:4).eq.'51')) then; lgvalid=.false. + endif +endif + +! Argentina AY,AZ, L1..L9, LO..LW + else if(callsign(2:2).gt.'N' .and. callsign(2:2).lt.'X') then + if((grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FF' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:2).eq.'FE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9') .or. & + (grid(1:2).eq.'FD' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'GC07' .or. grid(1:4).eq.'GC16') lgvalid=.true. ! LU1ZB in GC16 + +if(lgvalid) then + if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) then; lgvalid=.false. + else if(grid(1:2).eq.'FG' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'57')) then; lgvalid=.false. + else if(grid(1:2).eq.'GG' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. & + grid(3:4).eq.'35')) then; lgvalid=.false. + else if(grid(1:2).eq.'FE' .and. ((grid(3:3).eq.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. & + (grid(3:3).eq.'3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'70' .or. grid(3:4).eq.'73')) then; lgvalid=.false. + else if(grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'2'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'8').or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':'))) then; lgvalid=.false. + endif +endif + +! Luxemburg LX + else if(callsign(1:2).eq.'LX') then + if((grid(1:2).eq.'JN' .and. (grid(3:4).eq.'29' .or. grid(3:4).eq.'39')) .or. & + (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30'))) lgvalid=.true. + +! Lithuania LY + else if(callsign(1:2).eq.'LY') then + if(grid(1:2).eq.'KO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7') & + lgvalid=.true. + +! Bulgaria LZ + else if(callsign(1:2).eq.'LZ') then + if(grid(1:2).eq.'KN' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'5') & + lgvalid=.true. + +! Argentina AY,AZ, L1..L9, LO..LW + else if(callsign(2:2).gt.'0' .and. callsign(2:2).lt.':') then + if((grid(1:2).eq.'GF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FF' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FG' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:2).eq.'FE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9') .or. & + (grid(1:2).eq.'FD' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'GC07' .or. grid(1:4).eq.'GC16') lgvalid=.true. ! LU1ZB in GC16 + +if(lgvalid) then + if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'16' .or. grid(3:4).eq.'17')) then; lgvalid=.false. + else if(grid(1:2).eq.'FG' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'57')) then; lgvalid=.false. + else if(grid(1:2).eq.'GG' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. & + grid(3:4).eq.'35')) then; lgvalid=.false. + else if(grid(1:2).eq.'FE' .and. ((grid(3:3).eq.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. & + (grid(3:3).eq.'3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'70' .or. grid(3:4).eq.'73')) then; lgvalid=.false. + else if(grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'2'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'8').or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':'))) then; lgvalid=.false. + endif +endif + +! not valid callsigns + else if(callsign(1:2).eq.'L0') then + lwrongcall=.true.; return + + endif ! 'L' + +! UK GB,GX / 2E,G,M / 2D,GD,GT,MD,MT / 2I,GI,GN,MI,MN / 2J,GH,GJ,MH,MJ / 2A,2M,GM,GS,MA,MM,MS / 2U,GP,GU,MP,MU / 2W,GC,GW,MC,MW + else if(callsign(1:1).eq.'M') then + if((grid(1:2).eq.'IO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. & + (grid(1:3).eq.'JO0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + grid(1:4).eq.'IP90' .or. grid(1:4).eq.'IN69' .or. grid(1:4).eq.'IN89' .or. grid(1:4).eq.'IO37') lgvalid=.true. + +if(lgvalid .and. grid(1:2).eq.'IO') then + if((grid(1:3).eq.'IO5' .and. grid(4:4).ne.'4' .and. grid(4:4).ne.'7') .or. & + (grid(1:3).eq.'IO6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'96' .or. grid(3:4).eq.'98') lgvalid=.false. +endif + +! USA AA..AL,K,N,W + else if(callsign(1:1).eq.'N') then + if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall + if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. & + (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. & + grid(1:2).eq.'BP' .or. & + (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + grid(1:4).eq.'FK28' .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. & + (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. & + grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. & + grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. & + (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. & + grid(3:4).eq.'63')) .or. & + grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. & + grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. & + grid(1:4).eq.'CP00') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' & + .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. & + grid(3:4).eq.'14')) then; lgvalid=.false. + else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false. + else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false. + else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false. + else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false. + else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false. + else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false. + else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. & + grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. & + grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. & + ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. & + grid(3:4).eq.'22')) then; lgvalid=.false. + else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false. + endif +endif + + else if(callsign(1:1).eq.'O') then + +! Finland OF..OJ + if(callsign(2:2).gt.'E' .and. callsign(2:2).lt.'K') then + if((grid(1:2).eq.'KP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6') .or. & + grid(1:4).eq.'JP90' .or. grid(1:4).eq.'KO09' .or. grid(1:4).eq.'KO19' .or. grid(1:4).eq.'KQ30') lgvalid=.true. + +! Belgium ON..OT + else if(callsign(2:2).gt.'M' .and. callsign(2:2).lt.'U') then + if((grid(1:2).eq.'JO' .and. (grid(3:4).eq.'10' .or. grid(3:4).eq.'11' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. & + grid(3:4).eq.'30')) .or. grid(1:4).eq.'JN29') lgvalid=.true. + +! Austria OE + else if(callsign(1:2).eq.'OE') then + if(grid(1:2).eq.'JN' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'9') & + lgvalid=.true. + +! Czech Republic OK,OL + else if(callsign(2:2).eq.'K' .or. callsign(2:2).eq.'L') then + if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0').or. & + (grid(1:2).eq.'JN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'JO71') lgvalid=.true. + +! Slovak Republic OM + else if(callsign(1:2).eq.'OM') then + if((grid(1:2).eq.'JN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +! Denmark 5P,5Q,OU,OV,OZ + else if(callsign(2:2).eq.'Z' .or. callsign(2:2).eq.'U' .or. callsign(2:2).eq.'V') then + if(grid(1:2).eq.'JO' .and. & + ((grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'75' .or. grid(3:4).eq.'76')) lgvalid=.true. + +! Lebanon OD + else if(callsign(1:2).eq.'OD') then + if(grid(1:2).eq.'KM' .and. (grid(3:4).eq.'73' .or. grid(3:4).eq.'74' .or. grid(3:4).eq.'84')) lgvalid=.true. + +! Peru 4T,OA..OC + else if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'D') then + if((grid(1:2).eq.'FH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(1:3).eq.'EI9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7')) lgvalid=.true. + +! Greenland OX,XP + else if(callsign(1:2).eq.'OX' .or. callsign(1:2).eq.'XP') then + if((grid(1:2).eq.'GP' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'HP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'HQ90' .or. & + (grid(1:2).eq.'GQ' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'41' .or.grid(3:4).eq.'22'.or. & + grid(3:4).eq.'14' .or. grid(3:4).eq.'12')) .or. & + (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'67' .or. grid(3:4).eq.'57' .or.grid(3:4).eq.'56'.or. & + grid(3:4).eq.'38'))) lgvalid=.true. + +! not valid callsigns O0..O9 + else if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':') then + lwrongcall=.true.; return + + endif ! 'O' + + else if(callsign(1:1).eq.'P') then + +! Netherlands PA..PI + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then + if(((grid(1:3).eq.'JO2' .or. grid(1:3).eq.'JO3') .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + grid(1:4).eq.'JO11') lgvalid=.true. + +! Brazil PP..PY, ZV..ZZ + else if(callsign(1:1).eq.'P' .and. callsign(2:2).gt.'O' .and. callsign(2:2).lt.'Z') then + if((grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'09')) .or. & + (grid(1:2).eq.'HI' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6'.and. & + grid(3:4).ne.'25') .or. grid(3:4).eq.'06' .or. grid(3:4).eq.'07' .or. grid(3:4).eq.'36')) .or. & + (grid(1:2).eq.'HH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. & + (grid(1:2).eq.'GH' .and. grid(3:4).ne.'01') .or. grid(1:2).eq.'GI' .or. & + (grid(1:2).eq.'GF' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'36')) .or. & + (grid(1:2).eq.'GJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. & + grid(3:4).eq.'04' .or. grid(3:4).eq.'44')) .or. & + (grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'95')) .or. & + (grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'93' .or. grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) .or. & + grid(1:4).eq.'HG59' .or. grid(1:4).eq.'HJ50') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. & + grid(4:4).lt.'6' .and. grid(3:4).ne.'64' .and. grid(3:4).ne.'65') .or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7'))) then; lgvalid=.false. + else if(grid(1:2).eq.'HH' .and. (grid(3:3).eq.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) then; lgvalid=.false. + else if(grid(1:2).eq.'GI' .and. ((grid(3:3).gt.'7'.and.grid(3:3).lt.':'.and.grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'27')) then; lgvalid=.false. + else if(grid(1:2).eq.'GJ' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'52' .or. & + grid(3:4).eq.'53')) then; lgvalid=.false. + else if(grid(1:2).eq.'FJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') & + then; lgvalid=.false. + else if(grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') & + then; lgvalid=.false. + else if(grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'5'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'76' .or. grid(3:4).eq.'68')) then; lgvalid=.false. + endif +endif + +! Papua New Guinea P2 + else if(callsign(1:2).eq.'P2') then + if((grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or.& + (grid(1:2).eq.'QH' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +! Cyprus 5B,C4,H2,P3 + else if(callsign(1:2).eq.'P3') then + if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. & + (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true. + +! Aruba P4 + else if(callsign(1:2).eq.'P4' .and. (grid(1:4).eq.'FK42' .or. grid(1:4).eq.'FK52')) then + lgvalid=.true. + +! DPR of Korea P5..P9 + else if(callsign(2:2).gt.'4' .and. callsign(2:2).lt.':') then + if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or.& + (grid(1:2).eq.'PN' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) & + lgvalid=.true. + +! Curacao, Bonaire, Saba & St. Eustatius, Sint Maarten PJ + else if(callsign(1:2).eq.'PJ' .and. & + ((callsign(3:3).eq.'2' .or. callsign(3:3).eq.'4') .and. grid(1:4).eq.'FK52') .or. & + ((callsign(3:3).eq.'5' .or. callsign(3:3).eq.'6') .and. grid(1:4).eq.'FK87') .or. & + ((callsign(3:3).eq.'7' .or. callsign(3:3).eq.'8' .or. callsign(3:3).eq.'0') .and. grid(1:4).eq.'FK88')) then + lgvalid=.true. + +! Suriname PZ + else if(callsign(1:2).eq.'PZ') then + if(grid(1:2).eq.'GJ' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'6') & + lgvalid=.true. + +! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH + else if(callsign(2:2).gt.'J' .and. callsign(2:2).lt.'P') then + if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'OI' .and. .not.(grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4') & + .and. .not.(grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'0')) .or. & + (grid(1:2).eq.'PI' .and. .not.(grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0')) .or. & + (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false. + else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6') .or. & + (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. & + grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + else if(grid(1:2).eq.'OJ' .and. ((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5').or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false. + else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. & + grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'61' .or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. & + grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or.grid(3:4).eq.'29')) then + lgvalid=.false. + endif +endif + +! not valid callsigns + else if(callsign(1:2).eq.'P1' .or. callsign(1:2).eq.'P0') then + lwrongcall=.true.; return + + endif ! 'P' + +! Russia + else if(callsign(1:1).eq.'R') then + if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':').or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'6'))) .or. & + grid(1:2).eq.'LO' .or. grid(1:2).eq.'MO' .or. grid(1:2).eq.'NO' .or. & + (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'30')) .or. grid(1:2).eq.'NP' & + .or. grid(1:2).eq.'OO' .or. grid(1:2).eq.'PO' .or. grid(1:2).eq.'LP' .or. grid(1:2).eq.'MP' .or. & + (grid(1:2).eq.'PN' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + grid(3:4).eq.'39' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or.grid(1:4).eq.'MQ60'.or. & + (grid(1:2).eq.'QN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. & + (grid(1:2).eq.'QO' .and. (grid(3:3).eq.'0' .or. grid(3:3).eq.'1' .or. grid(3:3).eq.'8' .or. grid(3:3).eq.'9' .or. & + grid(3:4).eq.'49' .or. grid(3:4).eq.'59')) .or. grid(1:4).eq.'JO94' .or. & + grid(1:2).eq.'OP' .or. grid(1:2).eq.'PP' .or. grid(1:4).eq.'JB59' .or. grid(1:4).eq.'NQ03' .or. & + (grid(1:2).eq.'RP' .and. (grid(3:4).eq.'59' .or. grid(3:4).eq.'84'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + grid(3:4).eq.'35' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'60' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'61')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'LO' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'60')) then; lgvalid=.false. + else if(grid(1:2).eq.'LN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'1') .or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'48')) then; lgvalid=.false. + else if(grid(1:2).eq.'MO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'9'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. & + (grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).eq.'3'))) then; lgvalid=.false. + else if(grid(1:2).eq.'KN' .and. (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. ((grid(4:4).gt.'6' .and. & + grid(4:4).lt.':') .or. grid(4:4).eq.'3'))) then; lgvalid=.false. + else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'42' .or. grid(3:4).eq.'43' .or. grid(3:4).eq.'99')) then; lgvalid=.false. + else if(grid(1:2).eq.'OO' .and. grid(3:4).eq.'00') then; lgvalid=.false. + else if(grid(1:2).eq.'PO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'0') .or. & + grid(3:4).eq.'11' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21')) then; lgvalid=.false. + else if(grid(1:2).eq.'LP' .and. grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. & + grid(3:3).ne.'4' .and. grid(3:3).ne.'5') then; lgvalid=.false. + else if(grid(1:2).eq.'PN' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'83' .or. grid(3:4).eq.'93' .or. & + grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + endif +endif + + else if(callsign(1:1).eq.'S') then + +! Sweden 7S,8S,SA..SM + if(callsign(1:1).eq.'S' .and. callsign(2:2).gt.'@' .and. callsign(2:2).lt.'N') then + if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JP' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. & + (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'25'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'JO' .and. (grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + else if(grid(1:2).eq.'JP' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. grid(3:4).eq.'89' .or. & + grid(3:4).eq.'99')) then; lgvalid=.false. + else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'14')) then; lgvalid=.false. + endif +endif + +! Poland 3Z,HF,SN..SR + else if(callsign(1:1).eq.'S' .and. callsign(2:2).gt.'M' .and. callsign(2:2).lt.'S') then + if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'20')) .or. & + grid(1:4).eq.'KN09' .or. grid(1:4).eq.'KN19' .or. grid(1:4).eq.'KO20' .or. grid(1:4).eq.'JN99' .or. & + grid(1:4).eq.'JN89') lgvalid=.true. + +! Greece J4,SV..SZ + else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'[') then + if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'46' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'14').and.grid(3:4).ne.'05').or. & + grid(1:4).eq.'JM99' .or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. (grid(4:4).eq.'0' .or. grid(4:4).eq.'1'))) & + lgvalid=.true. + +! Slovenia S5 + else if(callsign(1:2).eq.'S5') then + if(grid(1:2).eq.'JN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'7') & + lgvalid=.true. + +! Singapore 9V,S6 + else if(callsign(1:2).eq.'9V') then + if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) lgvalid=.true. + +! Western Sahara S0 + else if(callsign(1:2).eq.'S0') then + if(grid(1:2).eq.'IL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') & + lgvalid=.true. + +! Bangladesh S2,S3 + else if(callsign(1:2).eq.'S2' .or. callsign(1:2).eq.'S3') then + if(grid(1:2).eq.'NL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'7') & + lgvalid=.true. + +! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU + else if(callsign(1:2).eq.'S4' .or. callsign(1:2).eq.'S8') then + if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. & + (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. & + grid(3:4).ne.'85') .or. & + (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false. +endif + +! Seychelles S7 + else if(callsign(1:2).eq.'S7') then + if((grid(1:2).eq.'LI' .and. (grid(3:4).eq.'75' .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'74' .or. grid(3:4).eq.'64' & + .or. grid(3:4).eq.'63' .or. grid(3:4).eq.'82' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'30'))& + .or. (grid(1:2).eq.'LH' .and. (grid(3:4).eq.'59' .or. grid(3:4).eq.'39'))) lgvalid=.true. + +! Sao Tome & Principe S9 + else if(callsign(1:2).eq.'S9' .and. (grid(1:4).eq.'JJ30' .or. grid(1:4).eq.'JJ31')) then + lgvalid=.true. + +! Sudan 6T,6U,ST + else if(callsign(1:2).eq.'ST') then + if((grid(1:2).eq.'KK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'KL' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + grid(1:4).eq.'KJ79') lgvalid=.true. + +! not valid callsigns + else if(callsign(1:2).eq.'S1') then + lwrongcall=.true.; return + + endif ! 'S' + + else if(callsign(1:1).eq.'T') then + +! Turkey TA..TC,YM + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'D') then + if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'85')) .or. & + (grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'20' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'72')) .or. & + (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':'.and. & + grid(3:4).ne.'16')) lgvalid=.true. + +! Iceland TF + else if(callsign(1:2).eq.'TF') then + if((grid(1:2).eq.'HP' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7').or. & + (grid(1:2).eq.'IP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7')) & + lgvalid=.true. + +! Corsica TK + else if(callsign(1:2).eq.'TK') then + if(grid(1:3).eq.'JN4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') lgvalid=.true. + +! Gabon TR + else if(callsign(1:2).eq.'TR') then + if(callsign(1:5).eq.'TR8CA' .or. & + (grid(1:2).eq.'JJ' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or. & + (grid(1:2).eq.'JI' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'56'))) lgvalid=.true. + +! Tunisia 3V,TS + else if(callsign(1:2).eq.'TS') then + if(grid(1:2).eq.'JM' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') & + lgvalid=.true. + +! Guatemala TD,TG + else if(callsign(1:2).eq.'TG' .or. callsign(1:2).eq.'TD') then + if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'8') & + lgvalid=.true. + +! Costa Rica, Cocos Island TE,TI + else if(callsign(1:2).eq.'TI' .or. callsign(1:2).eq.'TE') then + if((grid(1:2).eq.'EK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'EJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'EJ65') lgvalid=.true. + +! Afghanistan T6,YA + else if(callsign(1:2).eq.'T6') then + if((grid(1:2).eq.'MM' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. & + (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(3:4).eq.'9')) lgvalid=.true. + +! San Marino T7 + else if(callsign(1:2).eq.'T7' .and. grid(1:4).eq.'JN63') then + lgvalid=.true. + +! Palau T8 + else if(callsign(1:2).eq.'T8') then + if(grid(1:2).eq.'PJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'9') & + lgvalid=.true. + +! Cuba CL,CM,CO,T4 + else if(callsign(1:2).eq.'T4') then + if((grid(1:2).eq.'EL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. grid(1:4).eq.'FK19') lgvalid=.true. + +! Martinique, Guadeloupe, St. Martin, St. Barthelemy, Reunion Island FM,FG,FS,FJ,FR TO + else if(callsign(1:2).eq.'TO') then + if((grid(1:3).eq.'FK9' .and. (grid(4:4).eq.'6' .or. grid(4:4).eq.'5' .or. grid(4:4).eq.'4')) .or. & + (grid(1:3).eq.'FK8' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'7')) .or. & + (grid(1:2).eq.'LG' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'78'))) lgvalid=.true. + +! Tuvalu + else if(callsign(1:2).eq.'T2') then + if((grid(1:2).eq.'RI' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'82' .or.grid(3:4).eq.'83'.or. & + grid(3:4).eq.'84')) .or. grid(1:4).eq.'RH99') lgvalid=.true. + +! Kiribati, Banana Island + else if(callsign(1:2).eq.'T3') then + if(grid(1:1).eq.'R') then + if((grid(1:3).eq.'RJ6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + (grid(1:3).eq.'RI7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + grid(1:4).eq.'RI49' .or. grid(1:4).eq.'RI87' .or. grid(1:4).eq.'RI88') lgvalid=.true. + else if(grid(1:1).eq.'A') then + if((grid(1:2).eq.'AI' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'4' .and. & + grid(4:4).lt.'8') .or. grid(1:4).eq.'AJ94') lgvalid=.true. + else if(grid(1:1).eq.'B') then + if(grid(1:4).eq.'BJ03' .or. grid(1:4).eq.'BJ11' .or. grid(1:4).eq.'BJ12' .or. & + (grid(1:3).eq.'BI2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. & + grid(1:4).eq.'BH48' .or. grid(1:4).eq.'BH49' .or. grid(1:4).eq.'BI40') lgvalid=.true. + endif + +! Cameroon + else if(callsign(1:2).eq.'TJ') then + if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) & + lgvalid=.true. + +! Central African Republic + else if(callsign(1:2).eq.'TL') then + if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).eq.'0')) lgvalid=.true. + +! Republic of the Congo + else if(callsign(1:2).eq.'TN') then + if((grid(1:2).eq.'JI' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) & + lgvalid=.true. + +! Chad + else if(callsign(1:2).eq.'TT') then + if((grid(1:2).eq.'JK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'JJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'KJ09' .or. & + (grid(1:2).eq.'KK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. & + (grid(1:2).eq.'JL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4').or. & + (grid(1:2).eq.'KL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2')) & + lgvalid=.true. + +! Cote d'Ivoire: + else if(callsign(1:2).eq.'TU') then + if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'IK' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'70' .or. grid(3:4).eq.'50'))) lgvalid=.true. + +! Benin: + else if(callsign(1:2).eq.'TY') then + if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) & + lgvalid=.true. + +! Mali: + else if(callsign(1:2).eq.'TZ') then + if((grid(1:2).eq.'IK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'IL' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'JL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2')) & + lgvalid=.true. + +! Chesterfield, French Polynesia, Austral, Marquesas, Clipperton Islands FK,TX + else if(callsign(1:2).eq.'TX') then + if((grid(1:2).eq.'QH' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91')) .or. grid(1:4).eq.'QG98' .or. & + (grid(1:2).eq.'BH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:2).eq.'BG' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'BI9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'CI' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) .or. & + grid(1:4).eq.'CH09' .or. grid(1:4).eq.'DK50') lgvalid=.true. + +! Wallis & Futuna Islands FW,TW + else if(callsign(1:2).eq.'TW') then + if(grid(1:2).eq.'AH' .and. (grid(3:4).eq.'05' .or. grid(3:4).eq.'16')) lgvalid=.true. + +! France F,FA..FF,FI,FL,FN,FQ,FU,FV,FX,FZ,HW..HY,TH,TM,TP,TQ,TV + else if(callsign(2:2).eq.'H' .or. callsign(2:2).eq.'M' .or. callsign(2:2).eq.'P' .or. callsign(2:2).eq.'Q' .or. & + callsign(2:2).eq.'V') then + if((grid(1:2).eq.'IN' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'IN7' .and. (grid(4:4).eq.'7' .or. grid(4:4).eq.'8')) .or. & + (grid(1:2).eq.'JN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:3).eq.'JN4' .and. (grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. & + grid(1:4).eq.'JN02' .or. grid(1:4).eq.'JN12' .or. grid(1:4).eq.'IN92' .or. & + (grid(1:2).eq.'JO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'11'))) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'IN' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) lgvalid=.false. +endif + +! not valid callsigns + else if(callsign(1:2).eq.'T1' .or. callsign(1:2).eq.'T0') then + lwrongcall=.true.; return + + endif ! 'T' + + else if(callsign(1:1).eq.'U') then + +! Russia R, U0..U9, UA..UI + if((callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') .or. & + (callsign(2:2).gt.'/' .and. callsign(2:2).lt.':')) then + if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':').or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'6'))) .or. & + grid(1:2).eq.'LO' .or. grid(1:2).eq.'MO' .or. grid(1:2).eq.'NO' .or. & + (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'30')) .or. grid(1:2).eq.'NP' & + .or. grid(1:2).eq.'OO' .or. grid(1:2).eq.'PO' .or. grid(1:2).eq.'LP' .or. grid(1:2).eq.'MP' .or. & + (grid(1:2).eq.'PN' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + grid(3:4).eq.'39' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or.grid(1:4).eq.'MQ60'.or. & + (grid(1:2).eq.'QN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. & + (grid(1:2).eq.'QO' .and. (grid(3:3).eq.'0' .or. grid(3:3).eq.'1' .or. grid(3:3).eq.'8' .or. grid(3:3).eq.'9' .or. & + grid(3:4).eq.'49' .or. grid(3:4).eq.'59')) .or. grid(1:4).eq.'JO94' .or. & + grid(1:2).eq.'OP' .or. grid(1:2).eq.'PP' .or. grid(1:4).eq.'JB59' .or. grid(1:4).eq.'NQ03' .or. & + (grid(1:2).eq.'RP' .and. (grid(3:4).eq.'59' .or. grid(3:4).eq.'84'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + grid(3:4).eq.'35' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'60' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'61')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'LO' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'60')) then; lgvalid=.false. + else if(grid(1:2).eq.'LN' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'1') .or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'48')) then; lgvalid=.false. + else if(grid(1:2).eq.'MO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'9'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. & + (grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).eq.'3'))) then; lgvalid=.false. + else if(grid(1:2).eq.'KN' .and. (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. ((grid(4:4).gt.'6' .and. & + grid(4:4).lt.':') .or. grid(4:4).eq.'3'))) then; lgvalid=.false. + else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'42' .or. grid(3:4).eq.'43' .or. grid(3:4).eq.'99')) then; lgvalid=.false. + else if(grid(1:2).eq.'OO' .and. grid(3:4).eq.'00') then; lgvalid=.false. + else if(grid(1:2).eq.'PO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'0') .or. & + grid(3:4).eq.'11' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21')) then; lgvalid=.false. + else if(grid(1:2).eq.'LP' .and. grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. & + grid(3:3).ne.'4' .and. grid(3:3).ne.'5') then; lgvalid=.false. + else if(grid(1:2).eq.'PN' .and. (grid(3:4).eq.'56' .or. grid(3:4).eq.'83' .or. grid(3:4).eq.'93' .or. & + grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + endif +endif + +! Ukraine EM..EO,UR..UZ + else if(callsign(2:2).gt.'Q' .and. callsign(2:2).lt.'[') then + if((grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'52' .or. grid(3:4).eq.'62')) .or. & + (grid(1:2).eq.'KN' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KO' .and. (grid(3:4).eq.'81' .or. grid(3:4).eq.'91')) then; lgvalid=.false. + else if(grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'0'.and.grid(3:3).lt.'4'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.'7').or. & + grid(3:4).eq.'95' .or. grid(3:4).eq.'96')) then; lgvalid=.false. + endif +endif + +! Kazakhstan UN..UQ + else if(callsign(2:2).gt.'M' .and. callsign(2:2).lt.'R') then + if((grid(1:2).eq.'MN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'MO' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'LN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'LO' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'NN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'NO' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or.grid(3:4).eq.'10'.or.grid(3:4).eq.'20')).or. & + (grid(1:2).eq.'MO' .and. (grid(3:4).eq.'45' .or. grid(3:4).eq.'55')) .or. & + (grid(1:2).eq.'MN' .and. ((grid(4:4).eq.'1' .and. (grid(3:3).eq.'3' .or.grid(3:3).eq.'4'.or.grid(3:3).eq.'5')).or. & + grid(3:4).eq.'40')) .or. & + (grid(1:3).eq.'NN0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true. + + endif ! 'U' + + else if(callsign(1:1).eq.'V') then + +! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO + if((callsign(2:2).gt.'@' .and. callsign(2:2).lt.'H') .or. callsign(1:2).eq.'VO' .or. callsign(1:2).eq.'VX' .or. & + callsign(1:2).eq.'VY') then + if((grid(1:2).eq.'CN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'EN' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. grid(1:2).eq.'CO' .or. & + (grid(1:2).eq.'GN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + grid(1:2).eq.'FO' .or. grid(1:2).eq.'EO' .or. grid(1:2).eq.'DO' .or. & + (grid(1:2).eq.'GO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'DN'.and. grid(4:4).gt.'8' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'CP' .or. grid(1:2).eq.'DP' .or. grid(1:2).eq.'EP' .or. & + (grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'96')) .or. & + (grid(1:2).eq.'EQ' .and. (grid(3:4).eq.'15' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'24' .or.grid(3:4).eq.'71'.or. & + grid(3:4).eq.'73' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'86' .or.grid(3:4).eq.'96')).or. & + (grid(1:2).eq.'FR' .and. (grid(3:4).eq.'71' .or. grid(3:4).eq.'82')) .or. & + (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'12')) .or. grid(1:4).eq.'GN03' .or. & + grid(1:4).eq.'FN93' .or. grid(1:4).eq.'ER60' .or. grid(1:4).eq.'DQ10' .or. grid(1:4).eq.'CQ71') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'EO' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and.grid(4:4).lt.':').or. & + (grid(4:4).eq.'7' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9') .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'CO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. & + grid(4:4).lt.'8').or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'30'.or.grid(3:4).eq.'31'.or. & + grid(3:4).eq.'40')) then; lgvalid=.false. + else if(grid(1:2).eq.'EP' .and. ((grid(4:4).eq.'0' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. & + (grid(4:4).eq.'1' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9') .or. & + (grid(4:4).eq.'2' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8'))) then; lgvalid=.false. + else if(grid(1:2).eq.'CN' .and. (grid(3:4).eq.'68' .or. grid(3:4).eq.'98')) then; lgvalid=.false. + else if(grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. & + grid(4:4).lt.'8') .or. grid(3:4).eq.'04')) then; lgvalid=.false. + endif +endif + +! Australia AX,VH..VN,VZ + else if((callsign(2:2).gt.'G' .and. callsign(2:2).lt.'O') .or. callsign(1:2).eq.'VZ') then + if((grid(1:2).eq.'QG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. & + (grid(1:2).eq.'QF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7') .or. & + (grid(1:2).eq.'PF' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'OF' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'QE' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'19')) .or. & + (grid(1:2).eq.'QH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'OG' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. & + grid(1:2).eq.'PG' .or. grid(1:2).eq.'PH' .or. & +! Heard Island, Macquarie Island + (callsign(1:3).eq.'VK0' .and. & + ((grid(1:2).eq.'MD' .and. (grid(3:4).eq.'66' .or. grid(3:4).eq.'67')) .or. & + (grid(1:2).eq.'QD' .and. (grid(3:4).eq.'95' .or. grid(3:4).eq.'94')))) .or. & +! Cocos (Keeling) Islands, Lord Howe Island, Mellish Reef, Norfolk Island, Willis Island VK9 + (callsign(1:3).eq.'VK9' .and. & + ((grid(1:2).eq.'NH' .and. (grid(3:4).eq.'87' .or. grid(3:4).eq.'88')) .or. & + grid(1:4).eq.'QF98' .or. grid(1:4).eq.'OH29' .or. & + (grid(1:2).eq.'RG' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31')) .or. & + (grid(1:2).eq.'QH' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'1' .and. & + grid(4:4).lt.'5')))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'QF' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') then; lgvalid=.false. + else if(grid(1:2).eq.'PF' .and. ((grid(3:3).gt.'/'.and.grid(3:3).lt.'8'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. & + (grid(4:4).eq.'5' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7') .or. grid(3:4).eq.'57')) then; lgvalid=.false. + else if(grid(1:4).eq.'OF74') then; lgvalid=.false. + else if(grid(1:2).eq.'QH' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. grid(3:4).eq.'09')) then; lgvalid=.false. + else if(grid(1:2).eq.'OG' .and. (grid(3:4).eq.'60' .or. grid(3:4).eq.'69')) then; lgvalid=.false. + else if(grid(1:2).eq.'PH' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':' .and. & + grid(4:4).ne.'5' .and. grid(4:4).ne.'6') .or. & + (grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'59' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'89')) then; lgvalid=.false. + endif +endif + +! India 8T..8Y,AT..AW,VT..VW + else if(callsign(2:2).gt.'S' .and. callsign(2:2).lt.'X') then + if((grid(1:2).eq.'MJ' .and. (grid(3:4).eq.'99' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'88' .or. & + grid(3:4).eq.'68')).or. & + (grid(1:2).eq.'MK' .and. ((grid(3:3).gt.'5'.and.grid(3:3).lt.':').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. & + (grid(1:2).eq.'NK' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or.grid(3:4).eq.'39')).or. & + (grid(1:2).eq.'ML' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(1:4).eq.'NM00') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'MK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'5') then; lgvalid=.false. + else if(grid(1:2).eq.'NK' .and. (grid(3:4).eq.'26' .or. grid(3:4).eq.'27')) then; lgvalid=.false. + else if(grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'4'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'5'.or.grid(4:4).eq.'8'.or. & + grid(4:4).eq.'9')) .or. grid(3:4).eq.'58' .or. grid(3:4).eq.'59')) then; lgvalid=.false. + else if(grid(1:2).eq.'NL' .and. ((grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(4:4).eq.'8' .and. grid(3:3).gt.'0' .and. grid(4:4).lt.'5') .or.grid(3:4).eq.'40')) then; lgvalid=.false. + else if(grid(1:2).eq.'MM' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'62')) then; lgvalid=.false. + endif +endif + +! Hong Kong VR + else if(callsign(1:2).eq.'VR'.and. (grid(1:2).eq.'OL' .and. (grid(3:4).eq.'72' .or. grid(3:4).eq.'62'))) then + lgvalid=.true. + +! Antigua & Barbuda V2 + else if(callsign(1:2).eq.'V2') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'86' .or. grid(3:4).eq.'97')) lgvalid=.true. + +! Belize V3 + else if(callsign(1:2).eq.'V3') then + if((grid(1:2).eq.'EK' .and. grid(3:3).eq.'5' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'EK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'9')) lgvalid=.true. + +! St. Kitts & Nevis V4 + else if(callsign(1:2).eq.'V4' .and. grid(1:4).eq.'FK87') then + lgvalid=.true. + +! Namibia V5 + else if(callsign(1:2).eq.'V5') then + if((grid(1:2).eq.'JG' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JH' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'KG' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09')).or. & + (grid(1:2).eq.'KH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) & + lgvalid=.true. + +! Micronesia V6 + else if(callsign(1:2).eq.'V6') then + if((grid(1:2).eq.'PJ' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'QJ' .and. ((grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. grid(3:4).eq.'71' .or. & + grid(3:4).eq.'73')) .or. & + (grid(1:2).eq.'RJ' .and. (grid(3:4).eq.'06' .or. grid(3:4).eq.'15')) .or. grid(1:4).eq.'PK90') lgvalid=.true. + +! Marshall Islands V7 + else if(callsign(1:2).eq.'V7') then + if((grid(1:2).eq.'RJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'RK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. & + grid(4:4).lt.'3') .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'39'))) lgvalid=.true. + +! Brunei Darussalam V8 + else if(callsign(1:2).eq.'V8') then + if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'74' .or. grid(3:4).eq.'75')) lgvalid=.true. + +! Bermuda VP9 + else if(callsign(1:3).eq.'VP9' .and. grid(1:4).eq.'FM72') then + lgvalid=.true. + +! Chagos Islands VQ9 + else if(callsign(1:3).eq.'VQ9') then + if(grid(1:2).eq.'MI' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') & + lgvalid=.true. + +! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU + else if(callsign(1:2).eq.'V9') then + if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. & + (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. & + grid(3:4).ne.'85') .or. & + (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false. +endif + +! Anguilla, Montserrat, British Virgin Islands VP2 + else if(callsign(1:3).eq.'VP2' .and. & + (grid(1:2).eq.'FK' .and. (grid(3:4).eq.'88' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'78'))) then + lgvalid=.true. + +! Turks & Caicos Islands VP5 + else if((callsign(1:3).eq.'VP5' .or. callsign(1:3).eq.'VQ5') .and. & + (grid(1:2).eq.'FL' .and. (grid(3:4).eq.'31' .or. grid(3:4).eq.'41'))) then + lgvalid=.true. + +! Pitcairn Island, Ducie Island VP6 + else if(callsign(1:3).eq.'VP6' .and. (grid(1:2).eq.'CG' .and. (grid(3:4).eq.'55' .or. grid(3:4).eq.'44' .or. & + grid(3:4).eq.'46' .or. grid(3:4).eq.'75'))) then + lgvalid=.true. + +! Falkland Islands, South Georgia Island, South Shetland Islands, South Orkney Islands, South Sandwich Islands VP8 + else if(callsign(1:3).eq.'VP8') then + if((grid(1:2).eq.'FD' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9').or. & + grid(1:4).eq.'GD86' .or. & + (grid(1:2).eq.'HD' .and. ((grid(3:4).eq.'15' .or. grid(3:4).eq.'25' .or.grid(3:4).eq.'05' .or.grid(3:4).eq.'16'.or. & + grid(3:4).eq.'06') .or. (grid(1:3).eq.'HD6' .and.(grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) .or. & + grid(1:4).eq.'HD53')) .or. & + grid(1:4).eq.'GC69' .or. grid(1:4).eq.'GC79') lgvalid=.true. + +! not valid callsigns + else if(callsign(1:2).eq.'V1' .or. callsign(1:2).eq.'V0') then + lwrongcall=.true.; return + + endif ! 'V' + +! USA AA..AL,K,N,W + else if(callsign(1:1).eq.'W') then + if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':' .and. callsign(3:3).gt.'/' .and. callsign(3:3).lt.':') return ! checkcall + if((grid(1:2).eq.'FM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'EL' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'DL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'EM' .or. grid(1:2).eq.'DM' .or. grid(1:2).eq.'EN' .or. & + (grid(1:2).eq.'CM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + (grid(1:2).eq.'DN' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9') .or. & + (grid(1:2).eq.'CO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. & + grid(1:2).eq.'BP' .or. & + (grid(1:2).eq.'BO' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AP' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + grid(1:4).eq.'FK28' .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'BL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'BK' .and. (grid(3:4).eq.'19' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'29')) .or. & + (grid(1:2).eq.'AL' .and. (grid(3:4).eq.'91' .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. & + grid(3:4).eq.'27' .or. grid(3:4).eq.'36' .or. grid(3:4).eq.'45' .or. grid(3:4).eq.'64' .or. & + grid(3:4).eq.'73' .or. grid(3:4).eq.'93')) .or. & + (grid(1:3).eq.'QK2' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'AO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'RO' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'3').or. & + grid(3:4).eq.'63')) .or. & + grid(1:4).eq.'AP30' .or. grid(1:4).eq.'QK36' .or. grid(1:4).eq.'QL20' .or. grid(1:4).eq.'RK39' .or. & + grid(1:4).eq.'AK56' .or. grid(1:4).eq.'AH48' .or. grid(1:4).eq.'JA00' .or. grid(1:4).eq.'RB32' .or. & + grid(1:4).eq.'CP00') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FM' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'24')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9' & + .and. grid(3:4).ne.'28'.and. grid(3:4).ne.'58') .or. grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. & + grid(3:4).eq.'14')) then; lgvalid=.false. + else if(grid(1:2).eq.'DL' .and. (grid(3:4).eq.'78' .or. grid(3:4).eq.'88')) then; lgvalid=.false. + else if(grid(1:2).eq.'DM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) then; lgvalid=.false. + else if(grid(1:2).eq.'EN' .and. ((grid(3:3).eq.'9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':') .or. & + ((grid(3:3).eq.'8' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9' .and. grid(3:3).ne.'2'))) then; lgvalid=.false. + else if(grid(1:2).eq.'CM' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false. + else if(grid(1:2).eq.'FN' .and. ((grid(4:4).eq.'7' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'04' .or. grid(3:4).eq.'05' .or. grid(3:4).eq.'15' .or. grid(3:4).eq.'52')) then; lgvalid=.false. + else if(grid(1:2).eq.'CO' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') .or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'BO' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'9').or. & + (grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'14' .or. grid(3:4).eq.'24' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false. + else if(grid(1:2).eq.'AP' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(4:4).gt.'3' .and. grid(4:4).lt.':'))) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'63' .or. & + grid(3:4).eq.'67' .or. grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'AO' .and. ((grid(3:3).eq.'4' .and. ((grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. & + grid(4:4).eq.'8' .or. grid(4:4).eq.'9')) .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':' .and. grid(4:4).ne.'6') .or. & + ((grid(3:3).eq.'6' .or. grid(3:3).eq.'7') .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'62' .or. grid(3:4).eq.'97' .or. grid(3:4).eq.'86' .or. grid(3:4).eq.'87' .or.grid(3:4).eq.'31')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'BL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'21' .or. & + grid(3:4).eq.'22')) then; lgvalid=.false. + else if(grid(1:2).eq.'RO' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'71')) then; lgvalid=.false. + endif +endif + + else if(callsign(1:1).eq.'X') then + +! Mexico, Revillagigedo 4A..4C, 6D..6J, XA..XI + if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then + if((grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.':').or.grid(3:4).eq.'08'.or.grid(3:4).eq.'09')).or. & + (grid(1:2).eq.'EL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'EK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'34')) .or. & + (grid(1:2).eq.'DM' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'DK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'DK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'38'))) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2') .or. & + grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'33' .or. grid(3:4).eq.'60')) then + lgvalid=.false. + else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'17' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'32' .or. & + grid(3:4).eq.'62')) then; lgvalid=.false. + else if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'05' .or.grid(3:4).eq.'65'.or.grid(3:4).eq.'66'.or.grid(3:4).eq.'67'.or. & + grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'DM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'2') then; lgvalid=.false. + else if(grid(1:2).eq.'DK' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'86')) then; lgvalid=.false. + endif +endif + +! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO + else if(callsign(1:1).eq.'X' .and. callsign(2:2).gt.'I' .and. callsign(2:2).lt.'P') then + if((grid(1:2).eq.'CN' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FN' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'EN' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. grid(1:2).eq.'CO' .or. & + (grid(1:2).eq.'GN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + grid(1:2).eq.'FO' .or. grid(1:2).eq.'EO' .or. grid(1:2).eq.'DO' .or. & + (grid(1:2).eq.'GO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'DN'.and. grid(4:4).gt.'8' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'CP' .or. grid(1:2).eq.'DP' .or. grid(1:2).eq.'EP' .or. & + (grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'96')) .or. & + (grid(1:2).eq.'EQ' .and. (grid(3:4).eq.'15' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'24' .or.grid(3:4).eq.'71'.or. & + grid(3:4).eq.'73' .or. grid(3:4).eq.'79' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'86' .or.grid(3:4).eq.'96')).or. & + (grid(1:2).eq.'FR' .and. (grid(3:4).eq.'71' .or. grid(3:4).eq.'82')) .or. & + (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'50' .or. grid(3:4).eq.'12')) .or. grid(1:4).eq.'GN03' .or. & + grid(1:4).eq.'FN93' .or. grid(1:4).eq.'ER60' .or. grid(1:4).eq.'DQ10' .or. grid(1:4).eq.'CQ71') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'EO' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'7' .and.grid(4:4).lt.':').or. & + (grid(4:4).eq.'7' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'9') .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'CO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. & + grid(4:4).lt.'8').or. grid(3:4).eq.'08' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'30'.or.grid(3:4).eq.'31'.or. & + grid(3:4).eq.'40')) then; lgvalid=.false. + else if(grid(1:2).eq.'EP' .and. ((grid(4:4).eq.'0' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. & + (grid(4:4).eq.'1' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9') .or. & + (grid(4:4).eq.'2' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8'))) then; lgvalid=.false. + else if(grid(1:2).eq.'CN' .and. (grid(3:4).eq.'68' .or. grid(3:4).eq.'98')) then; lgvalid=.false. + else if(grid(1:2).eq.'FP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. & + grid(4:4).lt.'8') .or. grid(3:4).eq.'04')) then; lgvalid=.false. + endif +endif + +! Burkina Faso XT + else if(callsign(1:2).eq.'XT') then + if((grid(1:2).eq.'IK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'IJ' .and. (grid(3:4).eq.'79' .or. grid(3:4).eq.'89'))) & + lgvalid=.true. + +! Cambodia XU + else if(callsign(1:2).eq.'XU') then + if(grid(1:2).eq.'OK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') & + lgvalid=.true. + +! Vietnam 3W,XV + else if(callsign(1:2).eq.'XV') then + if((grid(1:2).eq.'OL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. & + (grid(1:2).eq.'OK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. & + grid(1:4).eq.'OJ19' .or. grid(1:4).eq.'OL41' .or. grid(1:4).eq.'OL23') lgvalid=.true. + +! Laos XW + else if(callsign(1:2).eq.'XW') then + if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'OL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) & + lgvalid=.true. + +! Macao XX9 + else if(callsign(1:3).eq.'XX9' .and. grid(1:4).eq.'OL62') then + lgvalid=.true. + + ! Chile 3G,CA..CE,XQ,XR + else if(callsign(1:2).eq.'XQ' .or. callsign(1:2).eq.'XR') then + if((grid(1:2).eq.'FF' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'FG' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8'))) .or. & + (grid(1:2).eq.'FE' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'52')) .or. & + (grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'53' .or. grid(3:4).eq.'85')) .or. & + grid(1:4).eq.'EF96' .or. grid(1:4).eq.'FF06' .or. grid(1:4).eq.'EG93' .or. grid(1:4).eq.'FG03' .or. & + grid(1:4).eq.'DG52' .or. grid(1:4).eq.'DG73') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FF' .and. grid(3:3).eq.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') then; lgvalid=.false. + else if(grid(1:2).eq.'FE' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'29')) then; lgvalid=.false. + endif +endif + +! Myanmar XY,XZ + else if(callsign(1:2).eq.'XY' .or. callsign(1:2).eq.'XZ') then + if((grid(1:2).eq.'NK' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'NL' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. & + (grid(1:2).eq.'OL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01'))) & + lgvalid=.true. + +! Greenland OX,XP + else if(callsign(1:2).eq.'XP') then + if((grid(1:2).eq.'GP' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'HP' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'HQ90' .or. & + (grid(1:2).eq.'GQ' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'41' .or.grid(3:4).eq.'22'.or. & + grid(3:4).eq.'14' .or. grid(3:4).eq.'12')) .or. & + (grid(1:2).eq.'FQ' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'67' .or. grid(3:4).eq.'57' .or.grid(3:4).eq.'56'.or. & + grid(3:4).eq.'38'))) lgvalid=.true. + +! China, Taiwan B, 3H..3U, XS + else if(callsign(1:2).eq.'XS') then + if(grid(1:2).eq.'OL' .or. & + (grid(1:2).eq.'PL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. grid(1:2).eq.'OM' .or. & + (grid(1:2).eq.'PM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. & + (grid(1:2).eq.'PN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8') .or. & + (grid(1:2).eq.'PO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + (grid(1:2).eq.'OK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or.grid(3:4).eq.'59')).or. & + grid(1:2).eq.'ON' .or. grid(1:4).eq.'OO90' .or. grid(1:4).eq.'OO91' .or. grid(1:2).eq.'NN' .or. grid(1:2).eq.'NM'.or. & + (grid(1:2).eq.'NL' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'MN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':')) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'NL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7'.and. & + grid(3:4).ne.'83' .and. grid(3:4).ne.'84' .and. grid(3:4).ne.'85') .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'87')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'ON' .and.((grid(3:3).gt.'/'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + (grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':') .or. & + grid(3:4).eq.'76' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'PN' .and. ((grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. & + grid(3:4).eq.'40' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'59' .or. & + grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'MM' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).eq.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5'))) then; lgvalid=.false. + else if(grid(1:2).eq.'OL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'0') .or. & + grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) then; lgvalid=.false. + endif +endif + +! not valid callsigns X0...X9 + else if(callsign(2:2).gt.'/' .and. callsign(2:2).lt.':') then + lwrongcall=.true.; return + + endif ! 'X' + + else if(callsign(1:1).eq.'Y') then + +! Romania YO..YR + if(callsign(2:2).gt.'N' .and. callsign(2:2).lt.'S') then + if(grid(1:2).eq.'KN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') & + lgvalid=.true. + +! Serbia YU,YT + else if(callsign(2:2).eq.'U' .or. callsign(2:2).eq.'T') then + if((grid(1:3).eq.'JN9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7') .or. & + (grid(1:3).eq.'KN0' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7') .or. & + (grid(1:3).eq.'KN1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true. + +! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH + else if(callsign(2:2).gt.'A' .and. callsign(2:2).lt.'I') then + if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + grid(1:2).eq.'OI' .or. grid(1:2).eq.'PI' .or. & + (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false. + else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6').or. & + (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1'.or. & + grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + else if(grid(1:2).eq.'OJ'.and.((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false. + else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. & + grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'PI' .and.(grid(3:4).eq.'61'.or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. & + grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'29')) & + then; lgvalid=.false. + endif +endif + +! Venezuela, Aves Island YV..YY 4M + else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'Z') then + if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'60' .or. grid(3:4).eq.'70')) .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + grid(1:4).eq.'FK85') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7' .and. & + grid(3:4).ne.'57') .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) then; lgvalid=.false. + else if(grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'32' .or.grid(3:4).eq.'72'.or.grid(3:4).eq.'82'.or.grid(3:4).eq.'92'.or. & + grid(3:4).eq.'91')) then; lgvalid=.false. + endif +endif + +! Latvia YL + else if(callsign(1:2).eq.'YL') then + if((grid(1:2).eq.'KO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'KO' .and. (grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'28'))) & + lgvalid=.true. + +! Afghanistan T6,YA + else if(callsign(1:2).eq.'YA') then + if((grid(1:2).eq.'MM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. & + (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(3:4).eq.'9')) lgvalid=.true. + +! Iraq HN,YI + else if(callsign(1:2).eq.'YI') then + if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'KM' .and.(grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) .or. & + (grid(1:2).eq.'LL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).eq.'9')) lgvalid=.true. + +! Vanuatu YJ + else if(callsign(1:2).eq.'YJ') then + if((grid(1:2).eq.'RH' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + grid(1:4).eq.'RG49' .or. grid(1:4).eq.'RH50' .or. grid(1:4).eq.'RH36') lgvalid=.true. + +! Syria 6C,YK + else if(callsign(1:2).eq.'YK') then + if((grid(1:2).eq.'KM' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7').or. & + (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8')) & + lgvalid=.true. + +! Turkey TA..TC,YM + else if(callsign(1:2).eq.'YM') then + if((grid(1:2).eq.'KM' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'85')) .or. & + (grid(1:2).eq.'KN' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'20' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'62' .or. grid(3:4).eq.'72')) .or. & + (grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':'.and. & + grid(3:4).ne.'16')) lgvalid=.true. + +! Nicaragua H6,H7,HT,YN + else if(callsign(1:2).eq.'YN') then + if(grid(1:2).eq.'EK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') & + lgvalid=.true. + +! El Salvador YS,HU + else if(callsign(1:2).eq.'YS') then + if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'53' .or. grid(3:4).eq.'54' .or. grid(3:4).eq.'63' .or. grid(3:4).eq.'43')) & + lgvalid=.true. + +! Fed. Rep. of Germany DA..DR, Y2..Y9 + else if(callsign(1:1).eq.'Y' .and. callsign(2:2).gt.'1' .and. callsign(2:2).lt.':') then + if((grid(1:2).eq.'JO' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'45')) .or. & + (grid(1:2).eq.'JN' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':').or. & + grid(1:4).eq.'IB59') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'JO' .and. ((grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. & + grid(3:4).eq.'35')) lgvalid=.false. +endif + +! not valid callsigns Y1,Y0 + else if(callsign(1:2).eq.'Y1' .or. callsign(1:2).eq.'Y0') then + lwrongcall=.true.; return + + endif ! 'Y' + + else if(callsign(1:1).eq.'Z') then + +! North Macedonia Z3 + if(callsign(1:2).eq.'Z3') then + if((grid(1:3).eq.'KN0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + grid(1:4).eq.'KN11' .or. grid(1:4).eq.'KN11') lgvalid=.true. + +! Republic of Kosovo Z6 + else if(callsign(1:2).eq.'Z6' .and. (grid(1:4).eq.'KN02' .or. grid(1:4).eq.'KN03')) then + lgvalid=.true. + +! New Zealand, Chatham Islands, Kermadec Islands, N.Z. Subantarctic Is. ZK ZL ZM + else if(callsign(2:2).gt.'J' .and. callsign(2:2).lt.'N') then + if((grid(1:2).eq.'RF' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'6').or. & + (grid(1:2).eq.'RE' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':') .or. & + grid(1:4).eq.'AE16' .or. grid(1:4).eq.'AE15' .or. grid(1:4).eq.'RE31' .or. grid(1:4).eq.'RE90' .or. & + grid(1:4).eq.'RE92' .or. grid(1:4).eq.'AF10' .or. grid(1:4).eq.'AG09' .or. grid(1:4).eq.'AG08' .or. & + grid(1:4).eq.'RD29' .or. grid(1:4).eq.'RD39' .or. grid(1:4).eq.'RD47') lgvalid=.true. + +! South Africa H5,S4,S8,V9,ZR,ZS,ZT,ZU + else if(callsign(2:2).gt.'Q' .and. callsign(2:2).lt.'V') then + if((grid(1:2).eq.'KG' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8').or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4'))) .or. & + (grid(1:2).eq.'KF' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'JF' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':' .and. & + grid(3:4).ne.'85') .or. & + (grid(1:2).eq.'JG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + grid(1:4).eq.'KE83' .or. grid(1:4).eq.'KE93') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'KF' .and. ((grid(4:4).eq.'5' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6') .or. & + (grid(4:4).eq.'6' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. grid(3:4).eq.'57')) lgvalid=.false. +endif + +! Paraguay ZP + else if(callsign(1:2).eq.'ZP') then + if((grid(1:2).eq.'GG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'FG' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + grid(1:4).eq.'FH90' .or. grid(1:4).eq.'GH00' .or. grid(1:4).eq.'FG95') lgvalid=.true. + +! Albania ZA + else if(callsign(1:2).eq.'ZA') then + if((grid(1:3).eq.'JN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:3).eq.'KN0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + grid(1:4).eq.'JM99' .or. grid(1:4).eq.'KM09') lgvalid=.true. + +! Gibraltar ZB,ZG + else if((callsign(1:2).eq.'ZB' .or. callsign(1:2).eq.'ZG') .and. grid(1:4).eq.'IM76') then + lgvalid=.true. + +! UK Base Areas in Cyprus + else if(callsign(1:3).eq.'ZC4' .and. grid(1:4).eq.'KM64') then + lgvalid=.true. + +! Zimbabwe Z2 + else if(callsign(1:2).eq.'Z2') then + if((grid(1:2).eq.'KH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'KG' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +! Republic of South Sudan Z8 + else if(callsign(1:2).eq.'Z8') then + if((grid(1:2).eq.'KJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3')) & + lgvalid=.true. + +! St. Helena ZD7 + else if(callsign(1:3).eq.'ZD7' .and. (grid(1:4).eq.'IH74' .or. grid(1:4).eq.'IH73')) then + lgvalid=.true. + +! Ascension Island ZD8 + else if(callsign(1:3).eq.'ZD8' .and. grid(1:4).eq.'II22') then + lgvalid=.true. + +! Tristan da Cunha & Gough ZD9 + else if(callsign(1:3).eq.'ZD9' .and. (grid(1:4).eq.'IF32' .or. grid(1:4).eq.'IE49' .or. grid(1:4).eq.'IE59')) then + lgvalid=.true. + +! Cayman Islands ZF + else if(callsign(1:2).eq.'ZF' .and. (grid(1:4).eq.'EK99' .or. grid(1:4).eq.'FK09')) then + lgvalid=.true. + +! Tokelau Islands ZK3 + else if(callsign(1:3).eq.'ZK3' .and. (grid(1:4).eq.'AI31' .or. grid(1:4).eq.'AI40')) then + lgvalid=.true. + +! Brazil PP..PY, ZV..ZZ + else if(callsign(2:2).gt.'U' .and. callsign(2:2).lt.'[') then + if((grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. grid(3:4).eq.'09')) .or. & + (grid(1:2).eq.'HI' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6'.and. & + grid(3:4).ne.'25') .or. grid(3:4).eq.'06' .or. grid(3:4).eq.'07' .or. grid(3:4).eq.'36')) .or. & + (grid(1:2).eq.'HH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. & + (grid(1:2).eq.'GH' .and. grid(3:4).ne.'01') .or. grid(1:2).eq.'GI' .or. & + (grid(1:2).eq.'GF' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'36')) .or. & + (grid(1:2).eq.'GJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. & + grid(3:4).eq.'04' .or. grid(3:4).eq.'44')) .or. & + (grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'95')) .or. & + (grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'93' .or. grid(3:4).eq.'94' .or. grid(3:4).eq.'95')) .or. & + grid(1:4).eq.'HG59' .or. grid(1:4).eq.'HJ50') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'GG' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. & + grid(4:4).lt.'6' .and. grid(3:4).ne.'64' .and. grid(3:4).ne.'65') .or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'7'))) then; lgvalid=.false. + else if(grid(1:2).eq.'HH' .and. (grid(3:3).eq.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) then; lgvalid=.false. + else if(grid(1:2).eq.'GI' .and. ((grid(3:3).gt.'7'.and.grid(3:3).lt.':'.and.grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'GF' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'27')) then; lgvalid=.false. + else if(grid(1:2).eq.'GJ' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'52' .or. & + grid(3:4).eq.'53')) then; lgvalid=.false. + else if(grid(1:2).eq.'FJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') & + then; lgvalid=.false. + else if(grid(1:2).eq.'FI' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') & + then; lgvalid=.false. + else if(grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'5'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'76' .or. grid(3:4).eq.'68')) then; lgvalid=.false. + endif +endif + +! not valid callsigns Z1 Z7 Z9 + else if(callsign(2:2).eq.'1' .or. callsign(2:2).eq.'7' .or. callsign(2:2).eq.'9') then + lwrongcall=.true.; return + + endif ! 'Z' + + endif ! end of block L..Z + +4 if(callsign(1:1).eq.'1') then + +! Sov Mil Order of Malta 1A + if(callsign(1:2).eq.'1A' .and. grid(1:4).eq.'JN61') then + lgvalid=.true. + +! 1B + else if(callsign(1:2).eq.'1B') then + if((grid(1:3).eq.'KM6' .or. grid(1:3).eq.'KM7') .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'6') lgvalid=.true. + +! Spratly Islands 1S,9M0,BM9S,BN9S,BO9S,BP9S,BQ9S,BU9S,BV9S,BW9S,BX9S + else if(callsign(1:2).eq.'1S') then + if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +! not valid callsigns 1C..1R 1T..1Z + else if((callsign(2:2).gt.'B' .and. callsign(2:2).lt.'S') .or. (callsign(2:2).gt.'S' .and. callsign(2:2).lt.'[')) then + lwrongcall=.true.; return + + endif ! '1' + + else if(callsign(1:1).eq.'2') then + +! UK GB / 2E,G,M / 2D,GD,GT,MD,MT / 2I,GI,GN,MI,MN / 2J,GH,GJ,MH,MJ / 2A,2M,GM,GS,MA,MM,MS / 2U,GP,GU,MP,MU / 2W,GC,GW,MC,MW + if(callsign(2:2).eq.'E' .or. callsign(2:2).eq.'A' .or. callsign(2:2).eq.'M' .or. callsign(2:2).eq.'W' .or. & + callsign(2:2).eq.'I' .or. callsign(2:2).eq.'J' .or. callsign(2:2).eq.'U' .or. callsign(2:2).eq.'D') then + if((grid(1:2).eq.'IO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':') .or. & + (grid(1:3).eq.'JO0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + grid(1:4).eq.'IP90' .or. grid(1:4).eq.'IN69' .or. grid(1:4).eq.'IN89' .or. grid(1:4).eq.'IO37') lgvalid=.true. + +if(lgvalid .and. grid(1:2).eq.'IO') then + if((grid(1:3).eq.'IO5' .and. grid(4:4).ne.'4' .and. grid(4:4).ne.'7') .or. & + (grid(1:3).eq.'IO6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + grid(3:4).eq.'96' .or. grid(3:4).eq.'98') lgvalid=.false. +endif + +! not valid callsigns other 2x + else + lwrongcall=.true.; return + + endif ! '2' + + else if(callsign(1:1).eq.'3') then + +! Poland 3Z,HF,SN..SR + if(callsign(1:2).eq.'3Z') then + if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + (grid(1:2).eq.'KO' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'20')) .or. & + grid(1:4).eq.'KN09' .or. grid(1:4).eq.'KN19' .or. grid(1:4).eq.'KO20' .or. grid(1:4).eq.'JN99' .or. & + grid(1:4).eq.'JN89') lgvalid=.true. + +! Monaco 3A + else if(callsign(1:2).eq.'3A' .and. grid(1:4).eq.'JN33') then + lgvalid=.true. + + ! Chile 3G,CA..CE,XQ,XR + else if(callsign(1:2).eq.'3G') then + if((grid(1:2).eq.'FF' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'FG' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'8'))) .or. & + (grid(1:2).eq.'FE' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'FH' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(3:4).eq.'52')) .or. & + (grid(1:2).eq.'FD' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'53' .or. grid(3:4).eq.'85')) .or. & + grid(1:4).eq.'EF96' .or. grid(1:4).eq.'FF06' .or. grid(1:4).eq.'EG93' .or. grid(1:4).eq.'FG03' .or. & + grid(1:4).eq.'DG52' .or. grid(1:4).eq.'DG73') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FF' .and. grid(3:3).eq.'3' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') then; lgvalid=.false. + else if(grid(1:2).eq.'FE' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'29')) then; lgvalid=.false. + endif +endif + +! Agalega & St. Brandon 3B6,3B7 + else if((callsign(1:3).eq.'3B6' .or. callsign(1:3).eq.'3B7') .and. (grid(1:4).eq.'LH89' .or. grid(1:4).eq.'LH93')) then + lgvalid=.true. + +! Mauritius 3B8 + else if(callsign(1:3).eq.'3B8' .and. (grid(1:4).eq.'LG89' .or. grid(1:4).eq.'LH80')) then + lgvalid=.true. + +! Rodriguez Island 3B9 + else if(callsign(1:3).eq.'3B9' .and. grid(1:4).eq.'MH10') then + lgvalid=.true. + +! Equatorial Guinea 3C, Annobon Island 3C0 + else if(callsign(1:2).eq.'3C') then + if((grid(1:3).eq.'JJ4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. grid(1:4).eq.'JJ51' .or. & + grid(1:4).eq.'JJ52' .or. grid(1:4).eq.'JI28') lgvalid=.true. + +! Fiji, Conway Reef, Rotuma Island 3D2 + else if(callsign(1:3).eq.'3D2') then + if((grid(1:2).eq.'RH' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. & + (grid(1:3).eq.'AH0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + grid(1:4).eq.'RG78' .or. grid(1:4).eq.'AG08' .or. grid(1:4).eq.'AG09') lgvalid=.true. + +! Kingdom of eSwatini 3DA + else if(callsign(1:3).eq.'3DA') then + if((grid(1:3).eq.'KG5' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5') .or. grid(1:4).eq.'KG63' .or. & + grid(1:4).eq.'KG64') lgvalid=.true. + +! Tunisia 3V,TS + else if(callsign(1:2).eq.'3V') then + if(grid(1:2).eq.'JM' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') & + lgvalid=.true. + +! Vietnam 3W,XV + else if(callsign(1:2).eq.'3W') then + if((grid(1:2).eq.'OL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. & + (grid(1:2).eq.'OK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. & + grid(1:4).eq.'OJ19' .or. grid(1:4).eq.'OL41' .or. grid(1:4).eq.'OL23') lgvalid=.true. + +! Guinea 3X + else if(callsign(1:2).eq.'3X') then + if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'IK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. & + grid(1:4).eq.'IJ39') lgvalid=.true. + +! Bouvet, Peter 1st Island 3Y + else if(callsign(1:3).eq.'3Y' .and. (grid(1:4).eq.'JD15' .or. grid(1:4).eq.'EC41')) then + lgvalid=.true. + +! Panama 3E,3F,H3,H8,H9,HO,HP + else if(callsign(2:2).eq.'E' .or. callsign(2:2).eq.'F') then + if((grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'09' .or. grid(3:4).eq.'17' .or. & + grid(3:4).eq.'18')) .or. & + (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'88' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'97' .or. & + grid(3:4).eq.'98' .or. grid(3:4).eq.'99'))) lgvalid=.true. + +! China, Taiwan B, 3H..3U, XS + else if(callsign(2:2).gt.'G' .and. callsign(2:2).lt.'V') then + if(len_trim(callsign).gt.5) return ! checkcall + if(grid(1:2).eq.'OL' .or. & + (grid(1:2).eq.'PL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. grid(1:2).eq.'OM' .or. & + (grid(1:2).eq.'PM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. & + (grid(1:2).eq.'PN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8') .or. & + (grid(1:2).eq.'PO' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. & + (grid(1:2).eq.'OK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'58' .or.grid(3:4).eq.'59')).or. & + grid(1:2).eq.'ON' .or. grid(1:4).eq.'OO90' .or. grid(1:4).eq.'OO91' .or. grid(1:2).eq.'NN' .or. grid(1:2).eq.'NM'.or. & + (grid(1:2).eq.'NL' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'MN' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':')) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'NL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7'.and. & + grid(3:4).ne.'83' .and. grid(3:4).ne.'84' .and. grid(3:4).ne.'85') .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'87')) & + then; lgvalid=.false. + else if(grid(1:2).eq.'ON' .and.((grid(3:3).gt.'/'.and.grid(3:3).lt.'5'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + (grid(3:3).gt.'4' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':') .or. & + grid(3:4).eq.'76' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'PN' .and. ((grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. & + (grid(3:3).eq.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5') .or. & + grid(3:4).eq.'40' .or. grid(3:4).eq.'50' .or. grid(3:4).eq.'51' .or. grid(3:4).eq.'59' .or. & + grid(3:4).eq.'69' .or. grid(3:4).eq.'79')) then; lgvalid=.false. + else if(grid(1:2).eq.'MM' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'8') .or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).eq.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5'))) then; lgvalid=.false. + else if(grid(1:2).eq.'OL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'0') .or. & + grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) then; lgvalid=.false. + endif +endif + + endif ! '3' + + else if(callsign(1:1).eq.'4') then + +! Venezuela, Aves Island YV..YY 4M + if(callsign(1:2).eq.'4M') then + if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'60' .or. grid(3:4).eq.'70')) .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + grid(1:4).eq.'FK85') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'2' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'7' .and. & + grid(3:4).ne.'57') .or. grid(3:4).eq.'92' .or. grid(3:4).eq.'93')) then; lgvalid=.false. + else if(grid(1:2).eq.'FJ' .and. (grid(3:4).eq.'32' .or.grid(3:4).eq.'72'.or.grid(3:4).eq.'82'.or.grid(3:4).eq.'92'.or. & + grid(3:4).eq.'91')) then; lgvalid=.false. + endif +endif + +! Israel 4X, 4Z + else if(callsign(1:2).eq.'4X' .or. callsign(1:2).eq.'4Z') then + if((grid(1:3).eq.'KM7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') .or. grid(1:4).eq.'KL79') lgvalid=.true. + +! Montenegro 4O + else if(callsign(1:2).eq.'4O') then + if((grid(1:3).eq.'JN9' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.'4') .or. grid(1:4).eq.'KN02' .or. & + grid(1:4).eq.'KN03') lgvalid=.true. + +! Sri Lanka 4P,4Q,4R,4S + else if(callsign(2:2).gt.'O' .and. callsign(2:2).lt.'T') then + if((grid(1:3).eq.'MJ9' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + (grid(1:3).eq.'NJ0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':')) lgvalid=.true. + +! Philippines 4D,4E,4F,4G,4H,4I,DU,DV,DW,DX,DY,DZ + else if(callsign(2:2).gt.'C' .and. callsign(2:2).lt.'J') then + if((grid(1:2).eq.'PK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4') .or. & + (grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'04')) .or. & + (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'OK' .and. grid(3:3).eq.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7') .or. & + (grid(1:2).eq.'PL' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. & + grid(1:4).eq.'OK70' .or. grid(1:4).eq.'OK71') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PK' .and. ((grid(3:3).eq.'3' .and. grid(4:4).gt.'0' .and. grid(4:4).lt.':') .or. & + (grid(3:3).eq.'2' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':'))) then; lgvalid=.false. + else if(grid(1:2).eq.'PJ' .and. (grid(3:4).eq.'08' .or. grid(3:4).eq.'15')) then; lgvalid=.false. + else if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) then; lgvalid=.false. + endif +endif + +! Azerbaijan 4J, 4K + else if(callsign(1:2).eq.'4J' .or. callsign(1:2).eq.'4J') then + if((grid(1:2).eq.'LN' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + (grid(1:2).eq.'LM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. & + grid(1:4).eq.'LN50') lgvalid=.true. + +! Georgia 4L + else if(callsign(1:2).eq.'4J' .or. callsign(1:2).eq.'4J') then + if(grid(1:2).eq.'LN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4') & + lgvalid=.true. + +! ITU HQ, United Nations HQ, Vienna Intl Ctr + else if(callsign(2:2).eq.'U' .and. & + (callsign(1:6).eq.'4U1ITU' .or. callsign(1:5).eq.'4U1UN' .or. callsign(1:6).eq.'4U1VIC' .or. & + grid(1:4).eq.'JN88')) then + lgvalid=.true. + +! Mexico, Revillagigedo 4A..4C, 6D..6J, XA..XI + else if(callsign(2:2).gt.'@' .and. callsign(2:2).lt.'D') then + if((grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.':').or.grid(3:4).eq.'08'.or.grid(3:4).eq.'09')).or. & + (grid(1:2).eq.'EL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'EK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'34')) .or. & + (grid(1:2).eq.'DM' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'DK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'DK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'38'))) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2') .or. & + grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'33' .or. grid(3:4).eq.'60')) then + lgvalid=.false. + else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'17' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'32' .or. & + grid(3:4).eq.'62')) then; lgvalid=.false. + else if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'05' .or.grid(3:4).eq.'65'.or.grid(3:4).eq.'66'.or.grid(3:4).eq.'67'.or. & + grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'DM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'2') then; lgvalid=.false. + else if(grid(1:2).eq.'DK' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'86')) then; lgvalid=.false. + endif +endif + +! Haiti 4V,HH + else if(callsign(1:2).eq.'4V') then + if((grid(1:2).eq.'FK' .and. (grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'48' .or. & + grid(3:4).eq.'49')) .or. grid(1:4).eq.'FL30') lgvalid=.true. + +! Timor - Leste 4W + else if(callsign(1:2).eq.'4W') then + if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'31')) lgvalid=.true. + +! Peru 4T,OA..OC + else if(callsign(1:2).eq.'4T') then + if((grid(1:2).eq.'FH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'FI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(1:3).eq.'EI9' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'7')) lgvalid=.true. + + endif ! '4' + + else if(callsign(1:1).eq.'5') then + +! Denmark 5P,5Q,OU,OV,OZ + if(callsign(1:2).eq.'5P' .or. callsign(1:2).eq.'5Q') then + if(grid(1:2).eq.'JO' .and. & + ((grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'75' .or. grid(3:4).eq.'76')) lgvalid=.true. + +! Cyprus 5B,C4,H2,P3 + else if(callsign(1:2).eq.'5B') then + if((grid(1:3).eq.'KM6' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5')) .or. & + (grid(1:3).eq.'KM7' .and. (grid(4:4).eq.'4' .or. grid(4:4).eq.'5'))) lgvalid=.true. + +! Morocco 5C..5G,CN + else if(callsign(2:2).gt.'B' .and. callsign(2:2).lt.'H') then + if((grid(1:2).eq.'IM' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. & + (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'6'.and.grid(4:4).gt.'0'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'69' .or. grid(3:4).eq.'79'))) lgvalid=.true. + +! Libya 5A + else if(callsign(1:2).eq.'5A') then + if((grid(1:2).eq.'JM' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'/' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. & + (grid(1:2).eq.'KM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'JL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'KL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3') .or. & + (grid(1:2).eq.'JM' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'53')) .or. & + grid(1:4).eq.'JL91' .or. grid(1:4).eq.'KK19') lgvalid=.true. + +! Tanzania 5H, 5I + else if(callsign(1:2).eq.'5H' .or. callsign(1:2).eq.'5I') then + if((grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'9').or. & + (grid(1:2).eq.'KH' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +! Colombia 5J,5K,HJ,HK + else if(callsign(1:2).eq.'5K' .or. callsign(1:2).eq.'5J') then + if((grid(1:2).eq.'FJ' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7') .or. & + grid(3:4).eq.'01' .or. grid(3:4).eq.'02' .or. grid(3:4).eq.'03')) .or. & + (grid(1:2).eq.'FK' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3' .and. & + grid(3:4).ne.'22') .or. & + (grid(1:2).eq.'FI' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'6' .and.grid(4:4).lt.':').or. & + grid(3:4).eq.'45' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'56') .and.grid(3:4).ne.'27').or. & + (grid(1:2).eq.'EJ' .and. (grid(3:4).eq.'93' .or. grid(3:4).eq.'94')) .or. grid(1:4).eq.'EK92') lgvalid=.true. + +! Liberia 5L,5M,6Z,A8,D5,EL + else if(callsign(1:2).eq.'5L' .or. callsign(1:2).eq.'5M') then + if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and.grid(4:4).lt.'9'.and. & + grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true. + +! Nigeria 5N,5O + else if(callsign(1:2).eq.'5N' .or. callsign(1:2).eq.'5O') then + if((grid(1:2).eq.'JJ' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'JK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'4')) & + lgvalid=.true. + +! Madagascar 5R,5S,6X + else if(callsign(1:2).eq.'5R' .or. callsign(1:2).eq.'5S') then + if((grid(1:2).eq.'LH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. & + (grid(1:2).eq.'LG' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(1:2).eq.'LH' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'47' .or. grid(3:4).eq.'48')) lgvalid=.true. + +! Mauritania 5T + else if(callsign(1:2).eq.'5T') then + if((grid(1:2).eq.'IK' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'8'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'34' .or. grid(3:4).eq.'44')) .or. & + (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. & + grid(3:4).eq.'56' .or. grid(3:4).eq.'66' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'75'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'IK' .and. grid(3:4).eq.'15' .or. grid(3:4).eq.'25') then + lgvalid=.false. + else if(grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'6').or. & + grid(3:4).eq.'34' .or. grid(3:4).eq.'35')) then; lgvalid=.false. + endif +endif + +! Niger 5U + else if(callsign(1:2).eq.'5U') then + if((grid(1:2).eq.'JK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'JL' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'3').or. & + grid(1:4).eq.'JK11' .or. & + grid(1:2).eq.'JL' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'53' .or. grid(3:4).eq.'63')) & + lgvalid=.true. + +! Togo 5V + else if(callsign(1:2).eq.'5V') then + if((grid(1:3).eq.'JJ0' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'JK' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01')) .or. & + (grid(1:2).eq.'IK' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91'))) lgvalid=.true. + +! Samoa 5W + else if(callsign(1:2).eq.'5W') then + if(grid(1:2).eq.'AH' .and. (grid(3:4).eq.'36' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'45')) lgvalid=.true. + +! Uganda 5X + else if(callsign(1:2).eq.'5X') then + if((grid(1:2).eq.'KJ' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4').or. & + (grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).eq.'9') .or. & + (grid(1:2).eq.'KJ' .and. (grid(3:4).eq.'40' .or. grid(3:4).eq.'64' .or. grid(3:4).eq.'74')) .or. & + (grid(1:2).eq.'KI' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'58'))) & + lgvalid=.true. + +! Kenya 5Y,5Z + else if(callsign(1:2).eq.'5Z' .or. callsign(1:2).eq.'5Y') then + if((grid(1:2).eq.'KI' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5').or. & + (grid(1:2).eq.'LI' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'LJ' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + grid(1:4).eq.'KJ60' .or. grid(1:4).eq.'KI69') lgvalid=.true. + + endif ! '5' + + else if(callsign(1:1).eq.'6') then + +! Syria 6C,YK + if(callsign(1:2).eq.'6C') then + if((grid(1:2).eq.'KM' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'7').or. & + (grid(1:2).eq.'LM' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8')) & + lgvalid=.true. + +! Mexico, Revillagigedo 4A..4C, 6D..6J, XA..XI + else if(callsign(2:2).gt.'C' .and. callsign(2:2).lt.'K') then + if((grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.':').or.grid(3:4).eq.'08'.or.grid(3:4).eq.'09')).or. & + (grid(1:2).eq.'EL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8').or. & + (grid(1:2).eq.'EK' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'34')) .or. & + (grid(1:2).eq.'DM' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3').or. & + (grid(1:2).eq.'DK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'5' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'DK' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'28' .or. grid(3:4).eq.'38'))) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'DL' .and. ((grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2') .or. & + grid(3:4).eq.'22' .or. grid(3:4).eq.'23' .or. grid(3:4).eq.'32' .or. grid(3:4).eq.'33' .or. grid(3:4).eq.'60')) then + lgvalid=.false. + else if(grid(1:2).eq.'EL' .and. ((grid(3:3).gt.'1'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'2'.and.grid(4:4).lt.'8').or. & + grid(3:4).eq.'17' .or. grid(3:4).eq.'20' .or. grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'32' .or. & + grid(3:4).eq.'62')) then; lgvalid=.false. + else if(grid(1:2).eq.'EK' .and. (grid(3:4).eq.'05' .or.grid(3:4).eq.'65'.or.grid(3:4).eq.'66'.or.grid(3:4).eq.'67'.or. & + grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'DM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'2') then; lgvalid=.false. + else if(grid(1:2).eq.'DK' .and. (grid(3:4).eq.'76' .or. grid(3:4).eq.'77' .or. grid(3:4).eq.'86')) then; lgvalid=.false. + endif +endif + +! Republic of Korea 6K,6L,6M,6N,D7,D8,D9,DS,DT,HL + else if(callsign(1:1).eq.'6' .and. callsign(2:2).gt.'J' .and. callsign(2:2).lt.'O') then + if((grid(1:3).eq.'PM3' .and. grid(4:4).gt.'2' .and. grid(4:4).lt.'9') .or. & + (grid(1:3).eq.'PM4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'9') .or. & + grid(1:4).eq.'PM24' .or. grid(1:4).eq.'PM57' .or. grid(1:4).eq.'GC07') lgvalid=.true. ! DT8A in GC07OS South Shetland Islands + +! Senegal 6V,6W + else if(callsign(1:2).eq.'6V' .or. callsign(1:2).eq.'6W') then + if(grid(1:2).eq.'IK' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'7').or. & + grid(3:4).eq.'42' .or. grid(3:4).eq.'43')) lgvalid=.true. + +! Madagascar 5R,5S,6X + else if(callsign(1:2).eq.'6X') then + if((grid(1:2).eq.'LH' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. & + (grid(1:2).eq.'LG' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(1:2).eq.'LH' .and. (grid(3:4).eq.'12' .or. grid(3:4).eq.'47' .or. grid(3:4).eq.'48')) lgvalid=.true. + +! Jamaica 6Y + else if(callsign(1:2).eq.'6Y') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'17' .or. grid(3:4).eq.'18' .or. grid(3:4).eq.'08' .or. grid(3:4).eq.'06')) & + lgvalid=.true. + +! Sudan 6T,6U,ST + else if(callsign(2:2).eq.'T' .or. callsign(2:2).eq.'U') then + if((grid(1:2).eq.'KK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'KL' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(1:4).eq.'KJ79') lgvalid=.true. + +! Pakistan 6P..6S, AP..AS + else if(callsign(2:2).gt.'O' .and. callsign(2:2).lt.'T') then + if((grid(1:2).eq.'MM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. & + grid(3:4).eq.'30' .or. grid(3:4).eq.'31' .or. grid(3:4).eq.'84' .or. grid(3:4).eq.'85')) .or. & + (grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'33'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'MM' .and. grid(3:3).eq.'4' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'7') then; lgvalid=.false. + else if(grid(1:2).eq.'ML' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8') .or. & + grid(3:4).eq.'07')) then; lgvalid=.false. + endif +endif + +! Liberia 5L,5M,6Z,A8,D5,EL + else if(callsign(1:2).eq.'6Z') then + if(grid(1:2).eq.'IJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'3' .and.grid(4:4).lt.'9'.and. & + grid(3:4).ne.'67' .and. grid(3:4).ne.'67') lgvalid=.true. + + endif ! '6' + + else if(callsign(1:1).eq.'7') then + +! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH + if(callsign(1:1).eq.'7' .and. callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then + if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'OI' .and. .not.(grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'4') & + .and. .not.(grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'0')) .or. & + (grid(1:2).eq.'PI' .and. .not.(grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0')) .or. & + (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false. + else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6') .or. & + (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. & + grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + else if(grid(1:2).eq.'OJ' .and. ((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5').or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false. + else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. & + grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'61' .or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. & + grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or.grid(3:4).eq.'29')) then + lgvalid=.false. + endif +endif + +! Japan 7J..7N,8J..8N,JA,JE..JS + else if(callsign(1:1).eq.'7' .and. callsign(2:2).gt.'I' .and. callsign(2:2).lt.'O') then + if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:3).eq.'QM0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'QN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. & + (grid(1:3).eq.'PN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'PL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(1:4).eq.'QM19' .or. grid(1:4).eq.'KC90') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and.grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3'.and.grid(3:4).ne.'62').or. & + grid(3:4).eq.'45' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'56' .or.grid(3:4).eq.'88' .or. & + grid(3:4).eq.'89')) then; lgvalid=.false. + else if(grid(1:2).eq.'PL'.and.((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'59')) then; lgvalid=.false. + else if(grid(1:2).eq.'QN'.and.((grid(3:3).eq.'2'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'1'.or.grid(4:4).eq.'5')).or. & + grid(3:4).eq.'10')) then; lgvalid=.false. + endif +endif + +! Yemen 7O + else if(callsign(1:2).eq.'7O') then + if(grid(1:2).eq.'LK' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and.grid(4:4).gt.'2'.and.grid(4:4).lt.'9').or. & + grid(3:4).eq.'05' .or. grid(3:4).eq.'06' .or. grid(3:4).eq.'12' .or. grid(3:4).eq.'22')) lgvalid=.true. + +! Lesotho 7P + else if(callsign(1:2).eq.'7P') then + if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + (grid(1:2).eq.'KF' .and. (grid(3:4).eq.'39' .or. grid(3:4).eq.'49'))) lgvalid=.true. + +! Malawi 7Q + else if(callsign(1:2).eq.'7Q') then + if((grid(1:2).eq.'KH' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(1:4).eq.'KI60' .or. (grid(1:3).eq.'KH7' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5')) lgvalid=.true. + +! Sweden 7S,8S,SA..SM + else if(callsign(1:2).eq.'7S') then + if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JP' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. & + (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'25'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'JO' .and. (grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + else if(grid(1:2).eq.'JP' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. grid(3:4).eq.'89' .or. & + grid(3:4).eq.'99')) then; lgvalid=.false. + else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'14')) then; lgvalid=.false. + endif +endif + +! Algeria 7R, 7T..7Y + else if(callsign(1:2).eq.'7R' .or. callsign(2:2).gt.'S' .and. callsign(2:2).lt.'Z') then + if((grid(1:2).eq.'JM' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'5'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'7').or. & + grid(3:4).eq.'37') .and. grid(3:4).ne.'43') .or. & + (grid(1:2).eq.'IM' .and. ((grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'6').or. & + grid(3:4).eq.'70')) .or. & + (grid(1:2).eq.'JL' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + grid(3:3).eq.'5' .and. grid(3:3).lt.'1' .and. grid(4:4).eq.'5')) .or. & + (grid(1:2).eq.'IL' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2' .and.grid(4:4).lt.':').or. & + grid(3:4).eq.'92')) .or. & + (grid(1:2).eq.'JK' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'4' .and. grid(4:4).eq.'9')) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'IL' .and. ((grid(3:3).eq.'5' .and. grid(3:3).lt.'2' .and. grid(4:4).eq.'6') .or. & + grid(3:4).eq.'63' .or. grid(3:4).eq.'64' .or. grid(3:4).eq.'73')) lgvalid=.false. +endif + +! Saudi Arabia 7Z,8Z,HZ + else if(callsign(1:2).eq.'7Z') then + if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8').or. & + (grid(1:2).eq.'KL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. & + (grid(1:2).eq.'KM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'2') .or. & + grid(1:4).eq.'KM92') lgvalid=.true. + + endif ! '7' + + else if(callsign(1:1).eq.'8') then + +! Indonesia 7A..7I, 8A..8I, PK..PO, YB..YH + if(callsign(1:1).eq.'8' .and. callsign(2:2).gt.'@' .and. callsign(2:2).lt.'J') then + if((grid(1:2).eq.'NJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'NI' .and. grid(3:3).gt.'8' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'OI' .and. .not.(grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'4') & + .and. .not.(grid(3:3).gt.'1' .and. grid(3:3).lt.'8' .and. grid(4:4).eq.'0')) .or. & + (grid(1:2).eq.'PI' .and. .not.(grid(3:3).gt.'3' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0')) .or. & + (grid(1:2).eq.'OJ' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'PJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(1:2).eq.'QI' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'1' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. & + (grid(1:2).eq.'PH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).eq.'9')) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'1' .and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44')) then; lgvalid=.false. + else if(grid(1:2).eq.'NJ' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'/' .and. grid(4:4) .lt.'6') .or. & + (grid(3:3).eq.'7' .and. ((grid(4:4).gt.'5' .and. grid(4:4).lt.':') .or. grid(4:4).eq.'0' .or. grid(4:4).eq.'1' .or. & + grid(4:4).eq.'3')) .or. (grid(3:3).eq.'8' .and. grid(4:4).gt.'5'.and. grid(4:4).lt.':') .or. & + grid(3:4).eq.'43' .or. grid(3:4).eq.'44' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + else if(grid(1:2).eq.'OJ' .and. ((grid(3:3).gt.'4'.and.grid(3:3).lt.'7'.and.grid(4:4).gt.'1'.and.grid(4:4).lt.'5').or. & + (grid(3:3).eq.'1' .and. grid(4:4).gt.'1' .and. grid(4:4).lt.'5').or. & + grid(3:4).eq.'24' .or. grid(3:4).eq.'04')) then; lgvalid=.false. + else if(grid(1:2).eq.'OI' .and. ((grid(4:4).eq.'1' .and. grid(3:3).gt.'1'.and. grid(3:3).lt.'5') .or. & + (grid(4:4).eq.'5' .and. grid(3:3).gt.'2'.and. grid(3:3).lt.'6') .or. & + grid(3:4).eq.'44' .or. grid(3:4).eq.'39')) then; lgvalid=.false. + else if(grid(1:2).eq.'PI' .and. (grid(3:4).eq.'61' .or.grid(3:4).eq.'62'.or.grid(3:4).eq.'71'.or.grid(3:4).eq.'83'.or. & + grid(3:4).eq.'25' .or. grid(3:4).eq.'35' .or. grid(3:4).eq.'34' .or. grid(3:4).eq.'44' .or.grid(3:4).eq.'29')) then + lgvalid=.false. + endif +endif + +! Japan 7J..7N,8J..8N,JA,JE..JS + else if(callsign(1:1).eq.'8' .and. callsign(2:2).gt.'I' .and. callsign(2:2).lt.'O') then + if((grid(1:2).eq.'PM' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:3).eq.'QM0' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':') .or. & + (grid(1:2).eq.'QN' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'6').or. & + (grid(1:3).eq.'PN9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3') .or. & + (grid(1:2).eq.'PL' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + grid(1:4).eq.'QM19' .or. grid(1:4).eq.'KC90') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'PM' .and. ((grid(3:3).gt.'3' .and. grid(3:3).lt.'8' .and.grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + (grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'3'.and.grid(3:4).ne.'62').or. & + grid(3:4).eq.'45' .or. grid(3:4).eq.'46' .or. grid(3:4).eq.'55' .or. grid(3:4).eq.'56' .or.grid(3:4).eq.'88' .or. & + grid(3:4).eq.'89')) then; lgvalid=.false. + else if(grid(1:2).eq.'PL'.and.((grid(3:3).gt.'0'.and.grid(3:3).lt.'3'.and.grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'38' .or. grid(3:4).eq.'39' .or. grid(3:4).eq.'57' .or. grid(3:4).eq.'59')) then; lgvalid=.false. + else if(grid(1:2).eq.'QN'.and.((grid(3:3).eq.'2'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'1'.or.grid(4:4).eq.'5')).or. & + grid(3:4).eq.'10')) then; lgvalid=.false. + endif +endif + +! Botswana 8O,A2 + else if(callsign(1:2).eq.'8O') then + if((grid(1:2).eq.'KG' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'KH' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2') .or. & + (grid(1:2).eq.'KH' .and. (grid(3:4).eq.'22' .or. grid(3:4).eq.'30')) .or. & + (grid(1:2).eq.'KG' .and. (grid(3:4).eq.'48' .or. grid(3:4).eq.'47'))) lgvalid=.true. + +! Barbados 8P + else if(callsign(1:2).eq.'8P' .and. grid(1:4).eq.'GK03') then + lgvalid=.true. + +! Maldives 8Q + else if(callsign(1:2).eq.'8Q') then + if((grid(1:3).eq.'MJ6' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'8') .or. grid(1:4).eq.'MI69') lgvalid=.true. + +! Guyana 8R + else if(callsign(1:2).eq.'8R') then + if((grid(1:2).eq.'GJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'0'.and.grid(4:4).lt.'9').or. & + (grid(1:3).eq.'FJ9' .and. grid(4:4).gt.'3' .and. grid(4:4).lt.'8')) lgvalid=.true. + +! Sweden 7S,8S,SA..SM + else if(callsign(1:2).eq.'8S') then + if((grid(1:2).eq.'JO' .and. grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.':').or. & + (grid(1:2).eq.'JP' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'9').or. & + (grid(1:2).eq.'KP' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'25'))) lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'JO' .and. (grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) then; lgvalid=.false. + else if(grid(1:2).eq.'JP' .and. ((grid(3:3).eq.'6' .and. grid(4:4).gt.'4' .and. grid(4:4).lt.'9') .or. & + (grid(3:3).eq.'7' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.'9') .or. grid(3:4).eq.'89' .or. & + grid(3:4).eq.'99')) then; lgvalid=.false. + else if(grid(1:2).eq.'KP' .and. (grid(3:4).eq.'13' .or. grid(3:4).eq.'14')) then; lgvalid=.false. + endif +endif + +! India 8T..8Y,AT..AW,VT..VW + else if(callsign(2:2).gt.'S' .and. callsign(2:2).lt.'Z') then + if((grid(1:2).eq.'MJ' .and. (grid(3:4).eq.'99' .or. grid(3:4).eq.'89' .or. grid(3:4).eq.'88' .or. & + grid(3:4).eq.'68')).or. & + (grid(1:2).eq.'MK' .and. ((grid(3:3).gt.'5'.and.grid(3:3).lt.':').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. & + (grid(1:2).eq.'NK' .and. ((grid(3:3).eq.'0' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'6') .or. & + (grid(3:3).gt.'/' .and. grid(3:3).lt.'3' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or.grid(3:4).eq.'39')).or. & + (grid(1:2).eq.'ML' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(1:4).eq.'NM00') lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'MK' .and. grid(3:3).eq.'6' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.'5') then; lgvalid=.false. + else if(grid(1:2).eq.'NK' .and. (grid(3:4).eq.'26' .or. grid(3:4).eq.'27')) then; lgvalid=.false. + else if(grid(1:2).eq.'ML' .and. ((grid(3:3).gt.'4'.and.(grid(4:4).eq.'0'.or.grid(4:4).eq.'5'.or.grid(4:4).eq.'8'.or. & + grid(4:4).eq.'9')) .or. grid(3:4).eq.'58' .or. grid(3:4).eq.'59')) then; lgvalid=.false. + else if(grid(1:2).eq.'NL' .and. ((grid(4:4).eq.'9' .and. grid(3:3).gt.'/' .and. grid(4:4).lt.'5') .or. & + (grid(4:4).eq.'8' .and. grid(3:3).gt.'0' .and. grid(4:4).lt.'5') .or.grid(3:4).eq.'40')) then; lgvalid=.false. + else if(grid(1:2).eq.'MM' .and. (grid(3:4).eq.'61' .or. grid(3:4).eq.'62')) then; lgvalid=.false. + endif +endif + +! Saudi Arabia 7Z,8Z,HZ + else if(callsign(1:2).eq.'8Z') then + if((grid(1:2).eq.'LL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8').or. & + (grid(1:2).eq.'KL' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'8' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':') .or. & + (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'01' .or. grid(3:4).eq.'10')) .or. & + (grid(1:2).eq.'KM' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and.grid(4:4).lt.'2') .or. & + grid(1:4).eq.'KM92') lgvalid=.true. + + endif ! '8' + + else if(callsign(1:1).eq.'9') then + +! Croatia 9A + if(callsign(1:2).eq.'9A') then + if(grid(1:2).eq.'JN' .and. ((grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and.grid(4:4).gt.'1'.and.grid(4:4).lt.'6').or. & + grid(3:4).eq.'64' .or. grid(3:4).eq.'65' .or. grid(3:4).eq.'76' .or. grid(3:4).eq.'86') .and. grid(3:4).ne.'93') & + lgvalid=.true. + +! Malta 9H + else if(callsign(1:2).eq.'9H') then + if(grid(1:2).eq.'JM' .and. (grid(3:4).eq.'75' .or. grid(3:4).eq.'76')) lgvalid=.true. + +! West Malaysia, East Malaysia 9M,9W + else if(callsign(1:2).eq.'9M' .or. callsign(1:2).eq.'9W') then + if(grid(1:4).eq.'NJ96' .or. (grid(1:2).eq.'OJ' .and. & + (((grid(3:3).gt.'/' .and. grid(3:3).lt.'2') .or. (grid(3:3).gt.'4' .and.grid(3:3).lt.':')) .and. & + grid(4:4).gt.'0'.and.grid(4:4).lt.'7') .or. & + grid(3:4).eq.'21' .or. grid(3:4).eq.'22' .or. grid(3:4).eq.'41' .or. grid(3:4).eq.'87')) lgvalid=.true. + +! Kuwait 9K + else if(callsign(1:2).eq.'9K') then + if((grid(1:2).eq.'LL' .and. (grid(3:4).eq.'39' .or. grid(3:4).eq.'49' .or. grid(3:4).eq.'38' .or. & + grid(3:4).eq.'48')) .or. & + (grid(1:2).eq.'LM' .and. (grid(3:4).eq.'30' .or. grid(3:4).eq.'40'))) lgvalid=.true. + +! Singapore 9V,S6 + else if(callsign(1:2).eq.'9V') then + if(grid(1:2).eq.'OJ' .and. (grid(3:4).eq.'11' .or. grid(3:4).eq.'21')) lgvalid=.true. + +! Trinidad & Tobago 9Y,9Z + else if(callsign(1:2).eq.'9Y' .or. callsign(1:2).eq.'9Z') then + if(grid(1:2).eq.'FK' .and. (grid(3:4).eq.'90' .or. grid(3:4).eq.'91')) lgvalid=.true. + +! Nepal 9N + else if(callsign(1:2).eq.'9N') then + if((grid(1:2).eq.'NL' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5' .and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'NM' .and. (grid(3:4).eq.'00' .or. grid(3:4).eq.'10'))) lgvalid=.true. + +! Ghana 9G + else if(callsign(1:2).eq.'9G') then + if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + (grid(1:3).eq.'JJ0' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'IK' .and. grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).eq.'0').or. & + (grid(1:4).eq.'JK00' .or. grid(1:4).eq.'JJ84' .or. grid(1:4).eq.'JJ94')) lgvalid=.true. + +! Zambia 9I,9J + else if(callsign(1:2).eq.'9J' .or. callsign(1:2).eq.'9I') then + if((grid(1:2).eq.'KH' .and. grid(3:3).gt.'0' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'7' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'2').or. & + grid(1:4).eq.'KH31') lgvalid=.true. + +! Sierra Leone 9L + else if(callsign(1:2).eq.'9L') then + if((grid(1:2).eq.'IJ' .and. grid(3:3).gt.'2' .and. grid(3:3).lt.'5' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.':').or. & + grid(1:4).eq.'IJ46') lgvalid=.true. + +! Dem. Rep. of the Congo 9O..9T + else if(callsign(2:2).gt.'N' .and. callsign(2:2).lt.'U') then + if((grid(1:2).eq.'JI' .and. ((grid(3:3).gt.'5' .and. grid(3:3).lt.'8'.and.grid(4:4).gt.'3'.and.grid(4:4).lt.'6').or. & + grid(3:3).gt.'7' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'1'.and.grid(4:4).lt.':') .or. grid(3:4).eq.'81').or. & + (grid(1:2).eq.'KI' .and. ((grid(3:3).gt.'/'.and.grid(3:3).lt.'5').or.grid(3:4).eq.'51'.or.grid(3:4).eq.'52')).or. & + (grid(1:2).eq.'KJ' .and. ((grid(3:3).gt.'/' .and. grid(3:3).lt.'6'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'25' .or. grid(3:4).eq.'35')) .or. & + (grid(1:2).eq.'JJ' .and. ((grid(3:3).gt.'8' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + grid(3:4).eq.'80' .or. grid(3:4).eq.'81' .or. grid(3:4).eq.'95')) .or. & + (grid(1:2).eq.'KH' .and. ((grid(3:3).gt.'0' .and. grid(3:3).lt.'5'.and.grid(4:4).gt.'7'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'37' .or. grid(3:4).eq.'47' .or. grid(3:4).eq.'46'))) lgvalid=.true. + +! Burundi 9U + else if(callsign(1:2).eq.'9U') then + if(grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.'8') & + lgvalid=.true. + +! Rwanda 9X + else if(callsign(1:2).eq.'9X') then + if(grid(1:2).eq.'KI' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'6' .and. grid(4:4).gt.'6'.and.grid(4:4).lt.'9') & + lgvalid=.true. + +! Spratly Islands 1S,9M0,BM9S,BN9S,BO9S,BP9S,BQ9S,BU9S,BV9S,BW9S,BX9S + else if(callsign(1:3).eq.'9M0') then + if((grid(1:2).eq.'OK' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'2').or. & + (grid(1:2).eq.'OJ' .and. grid(3:3).gt.'3' .and. grid(3:3).lt.'9' .and. grid(4:4).gt.'6' .and. grid(4:4).lt.':')) & + lgvalid=.true. + +! Iran 9B..9D,EP,EQ + else if(callsign(2:2).gt.'A' .and. callsign(2:2).lt.'E') then + if((grid(1:2).eq.'LM' .and. grid(3:3).gt.'1' .and. grid(3:3).lt.':') .or. & + (grid(1:2).eq.'LL' .and. ((grid(3:3).gt.'4' .and. grid(3:3).lt.':'.and.grid(4:4).gt.'5'.and.grid(4:4).lt.':').or. & + grid(3:4).eq.'49' .or. grid(3:4).eq.'75' .or. grid(3:4).eq.'85' .or. grid(3:4).eq.'95')) .or. & + (grid(1:2).eq.'ML' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'4'.and.grid(4:4).lt.':'.and. & + grid(3:4).ne.'15' .and. grid(3:4).ne.'19') .or. & + (grid(1:2).eq.'MM' .and. grid(3:3).eq.'0' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'7')) & + lgvalid=.true. + +if(lgvalid) then + if(grid(1:2).eq.'LM' .and. ((grid(3:3).eq.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'4') .or. & + (grid(3:3).gt.'4' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'7'.and.grid(4:4).lt.':' .and. & + grid(3:4).ne.'78' .and. grid(3:4).ne.'88'))) lgvalid=.false. +endif + +! Ethiopia 9E,9F,ET + else if(callsign(1:2).eq.'9E' .or. callsign(1:2).eq.'9F') then + if((grid(1:2).eq.'LJ' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'4' .and. grid(4:4).gt.'3'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'LK' .and. grid(3:3).gt.'/' .and. grid(3:3).lt.'2' .and. grid(4:4).gt.'/'.and.grid(4:4).lt.'5').or. & + (grid(1:2).eq.'KJ' .and. grid(3:3).gt.'5' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'2'.and.grid(4:4).lt.':').or. & + (grid(1:2).eq.'KK' .and. grid(3:3).gt.'6' .and. grid(3:3).lt.':' .and. grid(4:4).gt.'/' .and. grid(4:4).lt.'5')) & + lgvalid=.true. + + endif ! '9' + + endif ! end of block 1..9 +endif + + return +end subroutine chkgridvar diff --git a/lib/ft8var/chklong8.f90 b/lib/ft8var/chklong8.f90 index 5f07c627..44d38bbf 100755..100644 --- a/lib/ft8var/chklong8.f90 +++ b/lib/ft8var/chklong8.f90 @@ -1,46 +1,46 @@ -subroutine chklong8(callsign,falsedec)
-
- parameter (NMASK10=9,NMASK11=7)
- character callsign*12,callmask*12
- logical(1) falsedec
- character*12 mask10(NMASK10),mask11(NMASK11)
- data mask10/'0011000000 ','0011100000 ','0011110000 ','1011000000 ','1011100000 ','1011110000 ', &
- '0010000000 ','1010000000 ','0110000000 '/
- data mask11/'00111000000 ','00111100000 ','10111000000 ','10111100000 ','00100000000 ','01100000000 ','10100000000 '/
-
-! <...> I78PY2MTFLF RR73
-! <...> CM5XFIVGPIP RR73
-! WG0XC120LS9 <...> RR73
-! <...> A7MNPJDX/QO RRR TODO list
-! CQ P2PSR6UWBHS
-
-!valid masks for 11-char callsign:
-! DL2019ABCDE TC630ABCDEF 9A200ABCDEF 9A2019ABCDE ZW5STAYHOME Z39STAYHOME 5B4STAYHOME
-! 00111100000 00111000000 10111000000 10111100000 00100000000 01100000000 10100000000
- callmask=''
-! need to exclude 8J/8N/8K Japanese callsigns from checking
- if(index(callsign,'/').lt.1 .and. callsign(1:2).ne.'8J' .and. callsign(1:2).ne.'8N') then
- if(len_trim(callsign).eq.10) then
- do i=1,10
- if(callsign(i:i).gt.'/' .and. callsign(i:i).lt.':') then; callmask(i:i)='1'; else; callmask(i:i)='0'; endif
- enddo
-!print *,callsign,callmask
- falsedec=.true.
- do i=1,NMASK10
- if(callmask.eq.mask10(i)) then; falsedec=.false.; return; endif
- enddo
- endif
- if(len_trim(callsign).eq.11) then
- do i=1,11
- if(callsign(i:i).gt.'/' .and. callsign(i:i).lt.':') then; callmask(i:i)='1'; else; callmask(i:i)='0'; endif
- enddo
-!print *,callsign,callmask
- falsedec=.true.
- do i=1,NMASK11
- if(callmask.eq.mask11(i)) then; falsedec=.false.; return; endif
- enddo
- endif
- endif
-
- return
-end subroutine chklong8
+subroutine chklong8(callsign,falsedec) + + parameter (NMASK10=9,NMASK11=7) + character callsign*12,callmask*12 + logical(1) falsedec + character*12 mask10(NMASK10),mask11(NMASK11) + data mask10/'0011000000 ','0011100000 ','0011110000 ','1011000000 ','1011100000 ','1011110000 ', & + '0010000000 ','1010000000 ','0110000000 '/ + data mask11/'00111000000 ','00111100000 ','10111000000 ','10111100000 ','00100000000 ','01100000000 ','10100000000 '/ + +! <...> I78PY2MTFLF RR73 +! <...> CM5XFIVGPIP RR73 +! WG0XC120LS9 <...> RR73 +! <...> A7MNPJDX/QO RRR TODO list +! CQ P2PSR6UWBHS + +!valid masks for 11-char callsign: +! DL2019ABCDE TC630ABCDEF 9A200ABCDEF 9A2019ABCDE ZW5STAYHOME Z39STAYHOME 5B4STAYHOME +! 00111100000 00111000000 10111000000 10111100000 00100000000 01100000000 10100000000 + callmask='' +! need to exclude 8J/8N/8K Japanese callsigns from checking + if(index(callsign,'/').lt.1 .and. callsign(1:2).ne.'8J' .and. callsign(1:2).ne.'8N') then + if(len_trim(callsign).eq.10) then + do i=1,10 + if(callsign(i:i).gt.'/' .and. callsign(i:i).lt.':') then; callmask(i:i)='1'; else; callmask(i:i)='0'; endif + enddo +!print *,callsign,callmask + falsedec=.true. + do i=1,NMASK10 + if(callmask.eq.mask10(i)) then; falsedec=.false.; return; endif + enddo + endif + if(len_trim(callsign).eq.11) then + do i=1,11 + if(callsign(i:i).gt.'/' .and. callsign(i:i).lt.':') then; callmask(i:i)='1'; else; callmask(i:i)='0'; endif + enddo +!print *,callsign,callmask + falsedec=.true. + do i=1,NMASK11 + if(callmask.eq.mask11(i)) then; falsedec=.false.; return; endif + enddo + endif + endif + + return +end subroutine chklong8 diff --git a/lib/ft8var/chkspecial8var.f90 b/lib/ft8var/chkspecial8var.f90 index 55c58303..37470c6b 100755..100644 --- a/lib/ft8var/chkspecial8var.f90 +++ b/lib/ft8var/chkspecial8var.f90 @@ -1,41 +1,41 @@ -
-subroutine chkspecial8var(msg37,msg37_2,nbadcrc)
-
- use ft8_mod1, only : mycall,hiscall
- character msg37*37,msg37_2*37,call_a*12,call_b*12,call_c*12
- logical(1) falsedec
-
- call_a=' '; call_b=' '; call_c=' '
-
-! V03VTJ RR73; 2D3VDY <...> +08 call_a call_b call_c
-!V03VTJ <...> RR73
-!2D3VDY <...> +08
-! Y84NN RR73; HO5RFG <...> -16
-!Y84NN <...> RR73
-!HO5RFG <...> -16
-! P7IJQ RR73; MP4LEL <...> +02
-!P7IJQ <...> RR73
-!MP4LEL <...> +02
-
- ispc1=index(msg37,' '); ispc2=index(msg37((ispc1+1):),' ')+ispc1; ispc12=index(msg37_2,' ')
- if(ispc1.gt.3 .and. ispc2.gt.7) then
- call_a=msg37(1:ispc1-1); call_b=msg37_2(1:ispc12-1); call_c=msg37(ispc1+1:ispc2-1)
- if(call_a.ne.mycall .and. call_b.ne.mycall .and. call_c.ne.hiscall) then
-! call may not start from 'Q', zero and two digits
- if(call_a(1:1).eq.'Q' .or. call_b(1:1).eq.'Q') then
- nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif
- if(call_a(1:1).eq.'0' .or. call_b(1:1).eq.'0') then
- nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif
- if(call_a(1:1).ge.'0' .and. call_a(1:1).le.'9' .and. call_a(2:2).ge.'0' .and. call_a(2:2).le.'9') then
- nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif
- if(call_b(1:1).ge.'0' .and. call_b(1:1).le.'9' .and. call_b(2:2).ge.'0' .and. call_b(2:2).le.'9') then
- nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif
-
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) then; nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif
- endif
- endif
-
- return
-end subroutine chkspecial8var
+ +subroutine chkspecial8var(msg37,msg37_2,nbadcrc) + + use ft8_mod1, only : mycall,hiscall + character msg37*37,msg37_2*37,call_a*12,call_b*12,call_c*12 + logical(1) falsedec + + call_a=' '; call_b=' '; call_c=' ' + +! V03VTJ RR73; 2D3VDY <...> +08 call_a call_b call_c +!V03VTJ <...> RR73 +!2D3VDY <...> +08 +! Y84NN RR73; HO5RFG <...> -16 +!Y84NN <...> RR73 +!HO5RFG <...> -16 +! P7IJQ RR73; MP4LEL <...> +02 +!P7IJQ <...> RR73 +!MP4LEL <...> +02 + + ispc1=index(msg37,' '); ispc2=index(msg37((ispc1+1):),' ')+ispc1; ispc12=index(msg37_2,' ') + if(ispc1.gt.3 .and. ispc2.gt.7) then + call_a=msg37(1:ispc1-1); call_b=msg37_2(1:ispc12-1); call_c=msg37(ispc1+1:ispc2-1) + if(call_a.ne.mycall .and. call_b.ne.mycall .and. call_c.ne.hiscall) then +! call may not start from 'Q', zero and two digits + if(call_a(1:1).eq.'Q' .or. call_b(1:1).eq.'Q') then + nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif + if(call_a(1:1).eq.'0' .or. call_b(1:1).eq.'0') then + nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif + if(call_a(1:1).ge.'0' .and. call_a(1:1).le.'9' .and. call_a(2:2).ge.'0' .and. call_a(2:2).le.'9') then + nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif + if(call_b(1:1).ge.'0' .and. call_b(1:1).le.'9' .and. call_b(2:2).ge.'0' .and. call_b(2:2).le.'9') then + nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif + + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) then; nbadcrc=1; msg37=' '; msg37_2=msg37; return; endif + endif + endif + + return +end subroutine chkspecial8var diff --git a/lib/ft8var/cwfilter.f90 b/lib/ft8var/cwfilter.f90 index d8a6404d..913c7e3e 100755..100644 --- a/lib/ft8var/cwfilter.f90 +++ b/lib/ft8var/cwfilter.f90 @@ -1,180 +1,180 @@ -subroutine cwfilter(first)
-
- use ft8_mod1, only : cw,windowc1,windowx,pivalue,facx,mcq,m73,mrr73,mrrr,one,twopi,facc1,dt,csync,idtone25,csynccq, &
- NFILT1,NFILT2,endcorr,ctwkw,ctwkn,ctwk256
- use jt65_mod9 ! callsign DB to memory
- use prog_args ! path to files
-
- parameter (NFFT=180000)
- complex csig0(151680)
- real*4 window1(-NFILT1/2:NFILT1/2),window2(-NFILT2/2:NFILT2/2)
- character*37 msgcq25(25),msgsent37
- integer itone(79)
- integer*1 msgbits(77)
- logical, intent(in) :: first
-
-!pushing callsigns from ALLCALL to memory
-!note that with new, larger ALLCALL7.TXT files, dimensions of various ncall arrays may need to be increased in jt65_mod9.f90
-!on 20250709 callj dim was increased from 9000 to 10000 when updated ALLCALL7.TXT file was added
- if(first) then
- open(24,file='ALLCALL7.TXT',status='unknown') ! accepting Australian 7-char callsigns
- do i=1,MAXC
- read(24,1004,end=20) line
-1004 format(a80)
- if(line(1:4).eq.'ZZZZ') exit
- if(line(1:2).eq.'//') cycle
- i1=index(line,',')
- if(i1.lt.4 .or. i1.gt.8) cycle
- callsign=line(1:i1-1)
- if(callsign(1:1).gt.'0' .and. callsign(1:1).lt.'D') then; ncall0c=ncall0c+1; call0c(ncall0c)=callsign(1:7)
- else if(callsign(1:1).gt.'C' .and. callsign(1:1).lt.'E') then; ncalld=ncalld+1; calld(ncalld)=callsign(1:7)
- else if(callsign(1:1).gt.'D' .and. callsign(1:1).lt.'G') then; ncallef=ncallef+1; callef(ncallef)=callsign(1:7)
- else if(callsign(1:1).gt.'F' .and. callsign(1:1).lt.'I') then; ncallgh=ncallgh+1; callgh(ncallgh)=callsign(1:7)
- else if(callsign(1:1).gt.'H' .and. callsign(1:1).lt.'J') then; ncalli=ncalli+1; calli(ncalli)=callsign(1:7)
- else if(callsign(1:1).gt.'I' .and. callsign(1:1).lt.'K') then; ncallj=ncallj+1; callj(ncallj)=callsign(1:7)
- else if(callsign(1:1).gt.'J' .and. callsign(1:1).lt.'L') then; ncallk=ncallk+1; callk(ncallk)=callsign(1:7)
- else if(callsign(1:1).gt.'K' .and. callsign(1:1).lt.'N') then; ncalllm=ncalllm+1; calllm(ncalllm)=callsign(1:7)
- else if(callsign(1:1).gt.'M' .and. callsign(1:1).lt.'O') then; ncalln=ncalln+1; calln(ncalln)=callsign(1:7)
- else if(callsign(1:1).gt.'N' .and. callsign(1:1).lt.'P') then; ncallo=ncallo+1; callo(ncallo)=callsign(1:7)
- else if(callsign(1:1).gt.'O' .and. callsign(1:1).lt.'R') then; ncallpq=ncallpq+1; callpq(ncallpq)=callsign(1:7)
- else if(callsign(1:1).gt.'Q' .and. callsign(1:1).lt.'S') then; ncallr=ncallr+1; callr(ncallr)=callsign(1:7)
- else if(callsign(1:1).gt.'R' .and. callsign(1:1).lt.'U') then; ncallst=ncallst+1; callst(ncallst)=callsign(1:7)
- else if(callsign(1:1).gt.'T' .and. callsign(1:1).lt.'W') then; ncalluv=ncalluv+1; calluv(ncalluv)=callsign(1:7)
- else if(callsign(1:1).gt.'V' .and. callsign(1:1).lt.'X') then; ncallw=ncallw+1; callw(ncallw)=callsign(1:7)
- else if(callsign(1:1).gt.'W' .and. callsign(1:1).le.'Z') then; ncallxz=ncallxz+1; callxz(ncallxz)=callsign(1:7)
- endif
- enddo
-20 close(24)
-!print *,ncall0c,"call0c"; print *,ncalld,"calld"; print *,ncallef,"callef"; print *,ncallgh,"callgh"
-!print *,ncalli,"calli"; print *,ncallj,"callj"; print *,ncallk,"callk"; print *,ncalllm,"calllm"
-!print *,ncalln,"calln"; print *,ncallo,"callo"; print *,ncallpq,"callpq"; print *,ncallr,"callr"
-!print *,ncallst,"callst"; print *,ncalluv,"calluv"; print *,ncallw,"callw"; print *,ncallxz,"callxz"
- if(ncall0c.lt.1 .or. ncalld.lt.1 .or. ncallef.lt.1 .or. ncallgh.lt.1 .or. ncalli.lt.1 .or. ncallj.lt.1 .or. &
- ncallk.lt.1 .or. ncalllm.lt.1 .or. ncalln.lt.1 .or. ncallo.lt.1 .or. ncallpq.lt.1 .or. ncallr.lt.1 .or. &
- ncallst.lt.1 .or. ncalluv.lt.1 .or. ncallw.lt.1 .or. ncallxz.lt.1) then
- ldbvalid=.false.
- write(*,4) 'ALLCALL7.TXT is too short or broken?','d' ! 50th position for "d"
-4 format(a36,13x,a1)
- call flush(6)
- endif
-
- pivalue=4.d0*atan(1.d0)
- twopi=8.d0*atan(1.d0)
- dt=1.d0/12000.d0
-
- do i=0,54; windowc1(i)=(1.0+cos(i*pivalue/55))/2; enddo
- facx=1.0/300.0
- do i=0,200
- windowx(i)=(1.0+cos(i*pivalue/200))/2
- enddo
- windowx=facx*windowx
- facc1=0.01/sqrt(61440.) ! 1.0/sqrt(192000.*3200.) NFFT1*NFFT2
-
- mcq=2*mcq-1
- mrrr=2*mrrr-1
- m73=2*m73-1
- mrr73=2*mrr73-1
-
- one=.false.
- do i=0,511
- do j=0,8
- if(iand(i,2**j).ne.0) one(i,j)=.true.
- enddo
- enddo
-
- msgcq25=''
- msgcq25(2)='CQ 2E0DLA IO92'
- msgcq25(3)='CQ BH3NEB ON81'
- msgcq25(4)='CQ CG3CGT FN04'
- msgcq25(5)='CQ DX CT1JA IM59'
- msgcq25(6)='CQ CU20E'
- msgcq25(7)='CQ NA CX1OB GF14'
- msgcq25(8)='CQ DF2AJ JN49'
- msgcq25(9)='CQ DG4XPZ JN58'
- msgcq25(10)='CQ EA8XR IL19'
- msgcq25(11)='CQ F1YE IN94'
- msgcq25(12)='CQ DX G1KLN IO82'
- msgcq25(13)='CQ HL2KVF PM38'
- msgcq25(14)='CQ IU1ZSV JN45'
- msgcq25(15)='CQ JG1TWO PM96'
- msgcq25(16)='CQ K2ST EM96'
- msgcq25(17)='CQ N9TUX EL98'
- msgcq25(18)='CQ SA NO2FA FM18'
- msgcq25(19)='CQ OH6GKE KP13'
- msgcq25(20)='CQ PD0ORM JO24'
- msgcq25(21)='CQ DX PT7DS HI06'
- msgcq25(22)='CQ RA3XEP KO84'
- msgcq25(23)='CQ SM2GSH KP05'
- msgcq25(24)='CQ UA9OHX NO15'
- msgcq25(25)='CQ JA W0YH EN12'
- do i=2,25
- i3=-1; n3=-1
- call genft8sdvar(msgcq25(i),i3,n3,msgsent37,msgbits,itone)
- if(i.eq.2) then
- call gen_ft8wave(itone,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680)
- m=1
- do j=0,14
- do k=1,32
- if(j.lt.7) then; csync(j,k)=csig0(m); else; csynccq(j-7,k)=csig0(m); endif
- m=m+60
- enddo
- enddo
- endif
- idtone25(i,1:29)=itone(8:36)
- idtone25(i,30:58)=itone(44:72)
- enddo
- dt2=0.005 ! fs2=200 Hz
- k=1
- do ifr=-5,5 !Search over +/- 2.5 Hz
- delf=ifr*0.5
- dphi=twopi*delf*dt2
- phi=0.0
- do i=1,32
- ctwkw(k,i)=cmplx(cos(phi),sin(phi))
- phi=mod(phi+dphi,twopi)
- enddo
- k=k+1
- enddo
- k=1
- do ifr=-5,5 !Search over +/- 1.25 Hz
- delf=ifr*0.25
- dphi=twopi*delf*dt2
- phi=0.0
- do i=1,32
- ctwkn(k,i)=cmplx(cos(phi),sin(phi))
- phi=mod(phi+dphi,twopi)
- enddo
- k=k+1
- enddo
-! lcqsignal
- delf=3.125
- dphi=twopi*delf*dt2
- phi=0.0
- do i=1,256
- ctwk256(i)=cmplx(cos(phi),sin(phi))
- phi=mod(phi+dphi,twopi)
- enddo
- endif
-
-! this filter is being used for signal subtraction
-! Create and normalize the filter
- if(first) then
- fac=1.0/float(nfft)
- sumw=0.0
- do j=-NFILT1/2,NFILT1/2
- window1(j)=cos(pivalue*j/NFILT1)**2
- sumw=sumw+window1(j)
- enddo
- cw=0.
- cw(1:NFILT1+1)=window1/sumw
- cw=cshift(cw,NFILT1/2+1)
- do j=1,NFILT1/2+1
- endcorr(j)=1.0/(1.0-sum(window1(j-1:NFILT1/2))/sumw)
- enddo
- call four2avar(cw,NFFT,1,-1,1)
- cw=cw*fac
- endif
-
- return
-end subroutine cwfilter
+subroutine cwfilter(first) + + use ft8_mod1, only : cw,windowc1,windowx,pivalue,facx,mcq,m73,mrr73,mrrr,one,twopi,facc1,dt,csync,idtone25,csynccq, & + NFILT1,NFILT2,endcorr,ctwkw,ctwkn,ctwk256 + use jt65_mod9 ! callsign DB to memory + use prog_args ! path to files + + parameter (NFFT=180000) + complex csig0(151680) + real*4 window1(-NFILT1/2:NFILT1/2),window2(-NFILT2/2:NFILT2/2) + character*37 msgcq25(25),msgsent37 + integer itone(79) + integer*1 msgbits(77) + logical, intent(in) :: first + +!pushing callsigns from ALLCALL to memory +!note that with new, larger ALLCALL7.TXT files, dimensions of various ncall arrays may need to be increased in jt65_mod9.f90 +!on 20250709 callj dim was increased from 9000 to 10000 when updated ALLCALL7.TXT file was added + if(first) then + open(24,file='ALLCALL7.TXT',status='unknown') ! accepting Australian 7-char callsigns + do i=1,MAXC + read(24,1004,end=20) line +1004 format(a80) + if(line(1:4).eq.'ZZZZ') exit + if(line(1:2).eq.'//') cycle + i1=index(line,',') + if(i1.lt.4 .or. i1.gt.8) cycle + callsign=line(1:i1-1) + if(callsign(1:1).gt.'0' .and. callsign(1:1).lt.'D') then; ncall0c=ncall0c+1; call0c(ncall0c)=callsign(1:7) + else if(callsign(1:1).gt.'C' .and. callsign(1:1).lt.'E') then; ncalld=ncalld+1; calld(ncalld)=callsign(1:7) + else if(callsign(1:1).gt.'D' .and. callsign(1:1).lt.'G') then; ncallef=ncallef+1; callef(ncallef)=callsign(1:7) + else if(callsign(1:1).gt.'F' .and. callsign(1:1).lt.'I') then; ncallgh=ncallgh+1; callgh(ncallgh)=callsign(1:7) + else if(callsign(1:1).gt.'H' .and. callsign(1:1).lt.'J') then; ncalli=ncalli+1; calli(ncalli)=callsign(1:7) + else if(callsign(1:1).gt.'I' .and. callsign(1:1).lt.'K') then; ncallj=ncallj+1; callj(ncallj)=callsign(1:7) + else if(callsign(1:1).gt.'J' .and. callsign(1:1).lt.'L') then; ncallk=ncallk+1; callk(ncallk)=callsign(1:7) + else if(callsign(1:1).gt.'K' .and. callsign(1:1).lt.'N') then; ncalllm=ncalllm+1; calllm(ncalllm)=callsign(1:7) + else if(callsign(1:1).gt.'M' .and. callsign(1:1).lt.'O') then; ncalln=ncalln+1; calln(ncalln)=callsign(1:7) + else if(callsign(1:1).gt.'N' .and. callsign(1:1).lt.'P') then; ncallo=ncallo+1; callo(ncallo)=callsign(1:7) + else if(callsign(1:1).gt.'O' .and. callsign(1:1).lt.'R') then; ncallpq=ncallpq+1; callpq(ncallpq)=callsign(1:7) + else if(callsign(1:1).gt.'Q' .and. callsign(1:1).lt.'S') then; ncallr=ncallr+1; callr(ncallr)=callsign(1:7) + else if(callsign(1:1).gt.'R' .and. callsign(1:1).lt.'U') then; ncallst=ncallst+1; callst(ncallst)=callsign(1:7) + else if(callsign(1:1).gt.'T' .and. callsign(1:1).lt.'W') then; ncalluv=ncalluv+1; calluv(ncalluv)=callsign(1:7) + else if(callsign(1:1).gt.'V' .and. callsign(1:1).lt.'X') then; ncallw=ncallw+1; callw(ncallw)=callsign(1:7) + else if(callsign(1:1).gt.'W' .and. callsign(1:1).le.'Z') then; ncallxz=ncallxz+1; callxz(ncallxz)=callsign(1:7) + endif + enddo +20 close(24) +!print *,ncall0c,"call0c"; print *,ncalld,"calld"; print *,ncallef,"callef"; print *,ncallgh,"callgh" +!print *,ncalli,"calli"; print *,ncallj,"callj"; print *,ncallk,"callk"; print *,ncalllm,"calllm" +!print *,ncalln,"calln"; print *,ncallo,"callo"; print *,ncallpq,"callpq"; print *,ncallr,"callr" +!print *,ncallst,"callst"; print *,ncalluv,"calluv"; print *,ncallw,"callw"; print *,ncallxz,"callxz" + if(ncall0c.lt.1 .or. ncalld.lt.1 .or. ncallef.lt.1 .or. ncallgh.lt.1 .or. ncalli.lt.1 .or. ncallj.lt.1 .or. & + ncallk.lt.1 .or. ncalllm.lt.1 .or. ncalln.lt.1 .or. ncallo.lt.1 .or. ncallpq.lt.1 .or. ncallr.lt.1 .or. & + ncallst.lt.1 .or. ncalluv.lt.1 .or. ncallw.lt.1 .or. ncallxz.lt.1) then + ldbvalid=.false. + write(*,4) 'ALLCALL7.TXT is too short or broken?','d' ! 50th position for "d" +4 format(a36,13x,a1) + call flush(6) + endif + + pivalue=4.d0*atan(1.d0) + twopi=8.d0*atan(1.d0) + dt=1.d0/12000.d0 + + do i=0,54; windowc1(i)=(1.0+cos(i*pivalue/55))/2; enddo + facx=1.0/300.0 + do i=0,200 + windowx(i)=(1.0+cos(i*pivalue/200))/2 + enddo + windowx=facx*windowx + facc1=0.01/sqrt(61440.) ! 1.0/sqrt(192000.*3200.) NFFT1*NFFT2 + + mcq=2*mcq-1 + mrrr=2*mrrr-1 + m73=2*m73-1 + mrr73=2*mrr73-1 + + one=.false. + do i=0,511 + do j=0,8 + if(iand(i,2**j).ne.0) one(i,j)=.true. + enddo + enddo + + msgcq25='' + msgcq25(2)='CQ 2E0DLA IO92' + msgcq25(3)='CQ BH3NEB ON81' + msgcq25(4)='CQ CG3CGT FN04' + msgcq25(5)='CQ DX CT1JA IM59' + msgcq25(6)='CQ CU20E' + msgcq25(7)='CQ NA CX1OB GF14' + msgcq25(8)='CQ DF2AJ JN49' + msgcq25(9)='CQ DG4XPZ JN58' + msgcq25(10)='CQ EA8XR IL19' + msgcq25(11)='CQ F1YE IN94' + msgcq25(12)='CQ DX G1KLN IO82' + msgcq25(13)='CQ HL2KVF PM38' + msgcq25(14)='CQ IU1ZSV JN45' + msgcq25(15)='CQ JG1TWO PM96' + msgcq25(16)='CQ K2ST EM96' + msgcq25(17)='CQ N9TUX EL98' + msgcq25(18)='CQ SA NO2FA FM18' + msgcq25(19)='CQ OH6GKE KP13' + msgcq25(20)='CQ PD0ORM JO24' + msgcq25(21)='CQ DX PT7DS HI06' + msgcq25(22)='CQ RA3XEP KO84' + msgcq25(23)='CQ SM2GSH KP05' + msgcq25(24)='CQ UA9OHX NO15' + msgcq25(25)='CQ JA W0YH EN12' + do i=2,25 + i3=-1; n3=-1 + call genft8sdvar(msgcq25(i),i3,n3,msgsent37,msgbits,itone) + if(i.eq.2) then + call gen_ft8wave(itone,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680) + m=1 + do j=0,14 + do k=1,32 + if(j.lt.7) then; csync(j,k)=csig0(m); else; csynccq(j-7,k)=csig0(m); endif + m=m+60 + enddo + enddo + endif + idtone25(i,1:29)=itone(8:36) + idtone25(i,30:58)=itone(44:72) + enddo + dt2=0.005 ! fs2=200 Hz + k=1 + do ifr=-5,5 !Search over +/- 2.5 Hz + delf=ifr*0.5 + dphi=twopi*delf*dt2 + phi=0.0 + do i=1,32 + ctwkw(k,i)=cmplx(cos(phi),sin(phi)) + phi=mod(phi+dphi,twopi) + enddo + k=k+1 + enddo + k=1 + do ifr=-5,5 !Search over +/- 1.25 Hz + delf=ifr*0.25 + dphi=twopi*delf*dt2 + phi=0.0 + do i=1,32 + ctwkn(k,i)=cmplx(cos(phi),sin(phi)) + phi=mod(phi+dphi,twopi) + enddo + k=k+1 + enddo +! lcqsignal + delf=3.125 + dphi=twopi*delf*dt2 + phi=0.0 + do i=1,256 + ctwk256(i)=cmplx(cos(phi),sin(phi)) + phi=mod(phi+dphi,twopi) + enddo + endif + +! this filter is being used for signal subtraction +! Create and normalize the filter + if(first) then + fac=1.0/float(nfft) + sumw=0.0 + do j=-NFILT1/2,NFILT1/2 + window1(j)=cos(pivalue*j/NFILT1)**2 + sumw=sumw+window1(j) + enddo + cw=0. + cw(1:NFILT1+1)=window1/sumw + cw=cshift(cw,NFILT1/2+1) + do j=1,NFILT1/2+1 + endcorr(j)=1.0/(1.0-sum(window1(j-1:NFILT1/2))/sumw) + enddo + call four2avar(cw,NFFT,1,-1,1) + cw=cw*fac + endif + + return +end subroutine cwfilter
\ No newline at end of file diff --git a/lib/ft8var/datacor.f90 b/lib/ft8var/datacor.f90 index c0fecebc..849b6c20 100755..100644 --- a/lib/ft8var/datacor.f90 +++ b/lib/ft8var/datacor.f90 @@ -1,39 +1,39 @@ -
-subroutine datacor(datapwr,datacorr)
-
- use jt65_mod2var, only : s3,correct
-
- real datapwr,datacorr
-
-! calculate information tones power and datapower/syncpower ratio
- datapwr=0.0
- do i=1,63
- datapwr=datapwr+s3(correct(i)+1,i)
- enddo
-
-! use short correlation function in time and frequency domains
- timeplus=0.; timeminus=0.; freqplus=0.; freqminus=0.
- do i=1,63
- k=i+1
- m=i-1
- if(i.eq.1) m=2
- if(i.eq.63) k=62
- timeplus=timeplus+s3(correct(i)+1,k)
- timeminus=timeminus+s3(correct(i)+1,m)
- if(correct(i).lt.63) then
- j=1
- else
- j=-1
- endif
- if(correct(i).gt.1) then
- n=-1
- else
- n=1
- endif
- freqplus=freqplus+s3(correct(i)+1+j,i)
- freqminus=freqminus+s3(correct(i)+1+n,i)
- enddo
- datacorr=datapwr*4.0/(timeplus+timeminus+freqplus+freqminus)
-
- return
-end subroutine datacor
+ +subroutine datacor(datapwr,datacorr) + + use jt65_mod2var, only : s3,correct + + real datapwr,datacorr + +! calculate information tones power and datapower/syncpower ratio + datapwr=0.0 + do i=1,63 + datapwr=datapwr+s3(correct(i)+1,i) + enddo + +! use short correlation function in time and frequency domains + timeplus=0.; timeminus=0.; freqplus=0.; freqminus=0. + do i=1,63 + k=i+1 + m=i-1 + if(i.eq.1) m=2 + if(i.eq.63) k=62 + timeplus=timeplus+s3(correct(i)+1,k) + timeminus=timeminus+s3(correct(i)+1,m) + if(correct(i).lt.63) then + j=1 + else + j=-1 + endif + if(correct(i).gt.1) then + n=-1 + else + n=1 + endif + freqplus=freqplus+s3(correct(i)+1+j,i) + freqminus=freqminus+s3(correct(i)+1+n,i) + enddo + datacorr=datapwr*4.0/(timeplus+timeminus+freqplus+freqminus) + + return +end subroutine datacor diff --git a/lib/ft8var/encode174_91var.f90 b/lib/ft8var/encode174_91var.f90 index 38c15ee4..962280a2 100755..100644 --- a/lib/ft8var/encode174_91var.f90 +++ b/lib/ft8var/encode174_91var.f90 @@ -1,59 +1,59 @@ -subroutine encode174_91var(message77,codeword)
-!
-! Add a 14-bit CRC to a 77-bit message and return a 174-bit codeword
-!
-use, intrinsic :: iso_c_binding
-use iso_c_binding, only: c_loc,c_size_t
-use crc
-
-integer, parameter:: N=174, K=91, M=N-K
-character*91 tmpchar
-integer*1 codeword(N)
-integer*1 gen(M,K)
-integer*1 message77(77),message(K)
-integer*1 pchecks(M)
-integer*1, target :: i1MsgBytes(12)
-include '/lib/ft8/ldpc_174_91_c_generator.f90'
-logical first
-data first/.true./
-save first,gen
-!$omp threadprivate(first,gen)
-
-if( first ) then ! fill the generator matrix
- first=.false.
- gen=0
- do i=1,M
- do j=1,23
- read(g(i)(j:j),"(Z1)") istr
- ibmax=4
- if(j.eq.23) ibmax=3
- do jj=1, ibmax
- icol=(j-1)*4+jj
- if( btest(istr,4-jj) ) gen(i,icol)=1
- enddo
- enddo
- enddo
-endif
-
-! Add 14-bit CRC to form 91-bit message+CRC14
-write(tmpchar,'(77i1)') message77
-tmpchar(78:80)='000'
-i1MsgBytes=0
-read(tmpchar,'(10b8)') i1MsgBytes(1:10)
-ncrc14 = crc14 (c_loc (i1MsgBytes), 12)
-write(tmpchar(78:91),'(b14)') ncrc14
-read(tmpchar,'(91i1)') message
-
-do i=1,M
- nsum=0
- do j=1,K
- nsum=nsum+message(j)*gen(i,j)
- enddo
- pchecks(i)=mod(nsum,2)
-enddo
-
-codeword(1:K)=message
-codeword(K+1:N)=pchecks
-
-return
-end subroutine encode174_91var
+subroutine encode174_91var(message77,codeword) +! +! Add a 14-bit CRC to a 77-bit message and return a 174-bit codeword +! +use, intrinsic :: iso_c_binding +use iso_c_binding, only: c_loc,c_size_t +use crc + +integer, parameter:: N=174, K=91, M=N-K +character*91 tmpchar +integer*1 codeword(N) +integer*1 gen(M,K) +integer*1 message77(77),message(K) +integer*1 pchecks(M) +integer*1, target :: i1MsgBytes(12) +include '/lib/ft8/ldpc_174_91_c_generator.f90' +logical first +data first/.true./ +save first,gen +!$omp threadprivate(first,gen) + +if( first ) then ! fill the generator matrix + first=.false. + gen=0 + do i=1,M + do j=1,23 + read(g(i)(j:j),"(Z1)") istr + ibmax=4 + if(j.eq.23) ibmax=3 + do jj=1, ibmax + icol=(j-1)*4+jj + if( btest(istr,4-jj) ) gen(i,icol)=1 + enddo + enddo + enddo +endif + +! Add 14-bit CRC to form 91-bit message+CRC14 +write(tmpchar,'(77i1)') message77 +tmpchar(78:80)='000' +i1MsgBytes=0 +read(tmpchar,'(10b8)') i1MsgBytes(1:10) +ncrc14 = crc14 (c_loc (i1MsgBytes), 12) +write(tmpchar(78:91),'(b14)') ncrc14 +read(tmpchar,'(91i1)') message + +do i=1,M + nsum=0 + do j=1,K + nsum=nsum+message(j)*gen(i,j) + enddo + pchecks(i)=mod(nsum,2) +enddo + +codeword(1:K)=message +codeword(K+1:N)=pchecks + +return +end subroutine encode174_91var diff --git a/lib/ft8var/extract_callvar.f90 b/lib/ft8var/extract_callvar.f90 index 4b8e18cf..a5b810bb 100755..100644 --- a/lib/ft8var/extract_callvar.f90 +++ b/lib/ft8var/extract_callvar.f90 @@ -1,28 +1,28 @@ -
-subroutine extract_callvar(msg37,call2)
-
- character, intent(in) :: msg37*37
- character, intent(out) :: call2*12
- character part2*12,part3*12
-
- call2=''; part2=''; part3=''
- ispc1=index(msg37,' '); ispc2=index(msg37((ispc1+1):),' ')+ispc1; ispc3=index(msg37((ispc2+1):),' ')+ispc2
- part2=msg37(ispc1+1:ispc2-1); part3=msg37(ispc2+1:ispc3-1); npart2len=len_trim(part2)
-
- if(msg37(1:3).eq.'CQ ' .or. msg37(1:3).eq.'DE ' .or. msg37(1:4).eq.'QRZ ') then
- if(npart2len.gt.4) then; call2=part2
- elseif(npart2len.eq.4) then
- if(part2(2:2).ge.'0' .and. part2(2:2).lt.':' .or. part2(3:3).ge.'0' .and. part2(3:3).lt.':') then; call2=part2
- else; call2=part3
- endif
- elseif(npart2len.eq.3) then
- if(part2(1:1).ge.'A' .and. part2(1:1).lt.'[' .and. part2(2:2).ge.'0' .and. part2(2:2).lt.':') then; call2=part2
- else; call2=part3
- endif
- elseif(npart2len.eq.2) then; call2=part3
- endif
- elseif(ispc1.gt.3 .and. ispc1.lt.13) then; call2=part2
- endif
-
- return
+ +subroutine extract_callvar(msg37,call2) + + character, intent(in) :: msg37*37 + character, intent(out) :: call2*12 + character part2*12,part3*12 + + call2=''; part2=''; part3='' + ispc1=index(msg37,' '); ispc2=index(msg37((ispc1+1):),' ')+ispc1; ispc3=index(msg37((ispc2+1):),' ')+ispc2 + part2=msg37(ispc1+1:ispc2-1); part3=msg37(ispc2+1:ispc3-1); npart2len=len_trim(part2) + + if(msg37(1:3).eq.'CQ ' .or. msg37(1:3).eq.'DE ' .or. msg37(1:4).eq.'QRZ ') then + if(npart2len.gt.4) then; call2=part2 + elseif(npart2len.eq.4) then + if(part2(2:2).ge.'0' .and. part2(2:2).lt.':' .or. part2(3:3).ge.'0' .and. part2(3:3).lt.':') then; call2=part2 + else; call2=part3 + endif + elseif(npart2len.eq.3) then + if(part2(1:1).ge.'A' .and. part2(1:1).lt.'[' .and. part2(2:2).ge.'0' .and. part2(2:2).lt.':') then; call2=part2 + else; call2=part3 + endif + elseif(npart2len.eq.2) then; call2=part3 + endif + elseif(ispc1.gt.3 .and. ispc1.lt.13) then; call2=part2 + endif + + return end subroutine extract_callvar
\ No newline at end of file diff --git a/lib/ft8var/filbigvar.f90 b/lib/ft8var/filbigvar.f90 index 191d1d2f..cdbb3d85 100755..100644 --- a/lib/ft8var/filbigvar.f90 +++ b/lib/ft8var/filbigvar.f90 @@ -1,198 +1,198 @@ -subroutine filbigvar(f0,newfft,c4a,n4,sq0,c6a,n2)
-
-! Filter and downsample the real data in array dd(npts), sampled at 12000 Hz.
-! Output is complex, sampled at 1378.125 Hz.
-
- use, intrinsic :: iso_c_binding
- use FFTW3
- use timer_module, only: timer
- use jt65_mod5 !ref(3413)
- use jt65_mod6 !NPTS=624000 dd(NPTS)
-
- parameter (NFFT1=672000,NFFT2=77175,NFFT3=9646,NSZ=3413)
- parameter (NZ2=1000)
-
- real*4 rca(NFFT1)
- complex ca(NFFT1/2+1) !FFT of input
- complex c4a(NFFT2),c6a(NFFT3) !Output data
- real*4 s(NZ2)
- integer i,j
- real halfpulse(15),halfpulse2(15) !Impulse response of filter (one sided)
- complex cfilt(NFFT2),cfilt2(NFFT2) !Filter (complex; imag = 0)
- real rfilt(NFFT2),rfilt2(NFFT2) !Filter (real)
- type(C_PTR) :: plan1,plan2,plan3,plan4,plan5 !Pointers to FFTW plans
- logical first
- logical(1) newfft
- equivalence (rfilt,cfilt),(rfilt2,cfilt2),(rca,ca)
- data first/.true./
-
-! Kaiser-Bessel FIR LPF http://www.arc.id.au/FilterDesign.html
-! fsample (Hz) 12000 Input sample rate
-! Ntaps 29 Number of filter taps
-! fc (Hz) 4353 Cutoff frequency
-! dF/2 (Hz) 328 Half transition band
-! Stop Atten (dB) 30 Stopband attenuation
-! fout (Hz) 1378.125 Output sample rate
- data halfpulse/0.725500000, 0.240786311, -0.154852552, 0.053941884, 0.022651887, -0.053126870, &
- 0.041168005, -0.009120071, -0.017722128, 0.025226891, -0.015037961, -0.001056840, 0.011283798, &
- -0.011212205, 0.004348607/
-
-! Kaiser-Bessel FIR LPF http://www.arc.id.au/FilterDesign.html
-! fsample (Hz) 1378.125 Input sample rate
-! Ntaps 29 Number of filter taps
-! fc (Hz) 86 Cutoff frequency
-! dF/2 (Hz) 38 Half transition band
-! Stop Atten (dB) 30 Stopband attenuation
-! fout (Hz) 172.265625 Output sample rate
- data halfpulse2/0.124952381, 0.121297716, 0.110774440, 0.094635363, 0.074749989, 0.053318415, &
- 0.032545585, 0.014332629, 0.000036722, -0.009663997, -0.014785038, -0.015937306, -0.014143718, &
- -0.010611825, -0.006507996/
- common/patience/npatience,nthreads
- save first,plan1,plan2,plan3,plan4,plan5,rfilt,cfilt,rfilt2,cfilt2,ca
-
- if(f0.lt.0.) go to 900 !Clean up at end of program
-
- nthreadsmin=nthreads !single JT65 mode
- if(nnmode.eq.74) then
- nthreadsmin=max(nthreads-1,1)
- if(nthreads.ge.8 .and. nthreads.lt.12) nthreadsmin=nthreads-2
- if(nthreads.ge.12) nthreadsmin=nthreads-3
- endif
-
- if(first) then
- nflags=FFTW_ESTIMATE
- if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT
- if(npatience.eq.2) nflags=FFTW_MEASURE
- if(npatience.eq.3) nflags=FFTW_PATIENT
- if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE
-
-! Plan the FFTs just once
- !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls
- call fftwf_plan_with_nthreads(nthreadsmin)
- plan1=fftwf_plan_dft_r2c_1d(nfft1,rca,ca,nflags)
- plan2=fftwf_plan_dft_1d(nfft2,c4a,c4a,-1,nflags)
- plan3=fftwf_plan_dft_1d(nfft2,cfilt,cfilt,+1,nflags)
- call fftwf_plan_with_nthreads(1)
- plan4=fftwf_plan_dft_1d(nfft3,cfilt2,cfilt2,+1,nflags)
- plan5=fftwf_plan_dft_1d(nfft3,c6a,c6a,-1,nflags)
- !$omp end critical(fftw)
-
-! Convert impulse response to filter function
- cfilt=0.
- cfilt2=0.
- fac=0.00625/nfft1
- fac2=0.03
-
- cfilt(1)=fac*halfpulse(1)
- cfilt2(1)=fac2*halfpulse2(1)
- do i=2,15
- cfilt(i)=fac*halfpulse(i)
- cfilt(nfft2+2-i)=fac*halfpulse(i)
- enddo
- do i=2,15
- cfilt2(i)=fac2*halfpulse2(i)
- cfilt2(nfft3+2-i)=fac2*halfpulse2(i)
- enddo
-
- call fftwf_execute_dft(plan3,cfilt,cfilt)
- call fftwf_execute_dft(plan4,cfilt2,cfilt2)
-
- base=real(cfilt(38588)) ! nfft2/2+1
- base2=real(cfilt2(nfft3/2+1))
- do i=1,nfft2
- rfilt(i)=real(cfilt(i))-base
- enddo
- do i=1,nfft3
- rfilt2(i)=real(cfilt2(i))-base2
- enddo
- first=.false.
- endif
-
-! When new data comes along, we need to compute a new "big FFT"
-! If we just have a new f0, continue with the existing data in ca.
-
- if(newfft) then
-! call timer('FFTbig ',0)
- rca(1:npts)=dd(1:npts)
- rca(npts+1:)=0.
-
- call fftwf_execute_dft_r2c(plan1,rca,ca)
-! call timer('FFTbig ',1)
-
- ib=0
- do j=1,NSZ
- ia=ib+1
- ib=nint(float(j)*(672000./8192)) ! NFFT1/NFFT
- if(ref(j).le.0.0) ref(j)=0.0001
- fac=sqrt(1.0/ref(j))
- ca(ia:ib)=fac*conjg(ca(ia:ib))
- enddo
- endif
-
-! NB: f0 is the frequency at which we want our filter centered.
-! i0 is the bin number in ca closest to f0.
-! call timer('loops ',0)
- i0=nint(f0*56.) + 1 ! f0/df where delta f = 12000/672000 = 1/56
- nh=38587 ! nfft2/2
-
- do i=1,nh !Copy data into c4a and apply
- j=i0+i-1 !the filter function
- if(j.ge.1 .and. j.le.nfft1/2+1) then
- c4a(i)=rfilt(i)*ca(j)
- else
- c4a(i)=0.
- endif
- enddo
- do i=nh+1,nfft2
- j=i0+i-1-nfft2
- if(j.ge.1) then
- c4a(i)=rfilt(i)*ca(j)
- else
- c4a(i)=rfilt(i)*conjg(ca(2-j))
- endif
- enddo
-
- nh=nfft3/2
- do i=1,nh
- c6a(i)=rfilt2(i)*c4a(i)
- enddo
- do i=nh+1,nfft3
- c6a(i)=rfilt2(i)*c4a(nfft2-nfft3+i)
- enddo
-
- nadd=nfft2/(3.0*NZ2) ! 180Hz BW
-
- i=0
- do j=1,NZ2
- s(j)=0.
- do n=1,nadd
- i=i+1
- s(j)=s(j) + real(c4a(i))**2 + aimag(c4a(i))**2
- enddo
- enddo
- call pctile(s,NZ2,10,sq0)
- sq0=sq0*1.732 ! SQRT(3.0)
-! call timer('loops ',1)
-
-! Do the short reverse transform, to go back to time domain.
-! call timer('FFTsmall',0)
- call fftwf_execute_dft(plan2,c4a,c4a)
- call fftwf_execute_dft(plan5,c6a,c6a)
-! call timer('FFTsmall',1)
- n4=min(npts/8,nfft2)
- n2=nfft3
-
- return
-
-900 continue
-
- !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls
- call fftwf_destroy_plan(plan1)
- call fftwf_destroy_plan(plan2)
- call fftwf_destroy_plan(plan3)
- call fftwf_destroy_plan(plan4)
- call fftwf_destroy_plan(plan5)
- !$omp end critical(fftw)
-
- return
-end subroutine filbigvar
+subroutine filbigvar(f0,newfft,c4a,n4,sq0,c6a,n2) + +! Filter and downsample the real data in array dd(npts), sampled at 12000 Hz. +! Output is complex, sampled at 1378.125 Hz. + + use, intrinsic :: iso_c_binding + use FFTW3 + use timer_module, only: timer + use jt65_mod5 !ref(3413) + use jt65_mod6 !NPTS=624000 dd(NPTS) + + parameter (NFFT1=672000,NFFT2=77175,NFFT3=9646,NSZ=3413) + parameter (NZ2=1000) + + real*4 rca(NFFT1) + complex ca(NFFT1/2+1) !FFT of input + complex c4a(NFFT2),c6a(NFFT3) !Output data + real*4 s(NZ2) + integer i,j + real halfpulse(15),halfpulse2(15) !Impulse response of filter (one sided) + complex cfilt(NFFT2),cfilt2(NFFT2) !Filter (complex; imag = 0) + real rfilt(NFFT2),rfilt2(NFFT2) !Filter (real) + type(C_PTR) :: plan1,plan2,plan3,plan4,plan5 !Pointers to FFTW plans + logical first + logical(1) newfft + equivalence (rfilt,cfilt),(rfilt2,cfilt2),(rca,ca) + data first/.true./ + +! Kaiser-Bessel FIR LPF http://www.arc.id.au/FilterDesign.html +! fsample (Hz) 12000 Input sample rate +! Ntaps 29 Number of filter taps +! fc (Hz) 4353 Cutoff frequency +! dF/2 (Hz) 328 Half transition band +! Stop Atten (dB) 30 Stopband attenuation +! fout (Hz) 1378.125 Output sample rate + data halfpulse/0.725500000, 0.240786311, -0.154852552, 0.053941884, 0.022651887, -0.053126870, & + 0.041168005, -0.009120071, -0.017722128, 0.025226891, -0.015037961, -0.001056840, 0.011283798, & + -0.011212205, 0.004348607/ + +! Kaiser-Bessel FIR LPF http://www.arc.id.au/FilterDesign.html +! fsample (Hz) 1378.125 Input sample rate +! Ntaps 29 Number of filter taps +! fc (Hz) 86 Cutoff frequency +! dF/2 (Hz) 38 Half transition band +! Stop Atten (dB) 30 Stopband attenuation +! fout (Hz) 172.265625 Output sample rate + data halfpulse2/0.124952381, 0.121297716, 0.110774440, 0.094635363, 0.074749989, 0.053318415, & + 0.032545585, 0.014332629, 0.000036722, -0.009663997, -0.014785038, -0.015937306, -0.014143718, & + -0.010611825, -0.006507996/ + common/patience/npatience,nthreads + save first,plan1,plan2,plan3,plan4,plan5,rfilt,cfilt,rfilt2,cfilt2,ca + + if(f0.lt.0.) go to 900 !Clean up at end of program + + nthreadsmin=nthreads !single JT65 mode + if(nnmode.eq.74) then + nthreadsmin=max(nthreads-1,1) + if(nthreads.ge.8 .and. nthreads.lt.12) nthreadsmin=nthreads-2 + if(nthreads.ge.12) nthreadsmin=nthreads-3 + endif + + if(first) then + nflags=FFTW_ESTIMATE + if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT + if(npatience.eq.2) nflags=FFTW_MEASURE + if(npatience.eq.3) nflags=FFTW_PATIENT + if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE + +! Plan the FFTs just once + !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls + call fftwf_plan_with_nthreads(nthreadsmin) + plan1=fftwf_plan_dft_r2c_1d(nfft1,rca,ca,nflags) + plan2=fftwf_plan_dft_1d(nfft2,c4a,c4a,-1,nflags) + plan3=fftwf_plan_dft_1d(nfft2,cfilt,cfilt,+1,nflags) + call fftwf_plan_with_nthreads(1) + plan4=fftwf_plan_dft_1d(nfft3,cfilt2,cfilt2,+1,nflags) + plan5=fftwf_plan_dft_1d(nfft3,c6a,c6a,-1,nflags) + !$omp end critical(fftw) + +! Convert impulse response to filter function + cfilt=0. + cfilt2=0. + fac=0.00625/nfft1 + fac2=0.03 + + cfilt(1)=fac*halfpulse(1) + cfilt2(1)=fac2*halfpulse2(1) + do i=2,15 + cfilt(i)=fac*halfpulse(i) + cfilt(nfft2+2-i)=fac*halfpulse(i) + enddo + do i=2,15 + cfilt2(i)=fac2*halfpulse2(i) + cfilt2(nfft3+2-i)=fac2*halfpulse2(i) + enddo + + call fftwf_execute_dft(plan3,cfilt,cfilt) + call fftwf_execute_dft(plan4,cfilt2,cfilt2) + + base=real(cfilt(38588)) ! nfft2/2+1 + base2=real(cfilt2(nfft3/2+1)) + do i=1,nfft2 + rfilt(i)=real(cfilt(i))-base + enddo + do i=1,nfft3 + rfilt2(i)=real(cfilt2(i))-base2 + enddo + first=.false. + endif + +! When new data comes along, we need to compute a new "big FFT" +! If we just have a new f0, continue with the existing data in ca. + + if(newfft) then +! call timer('FFTbig ',0) + rca(1:npts)=dd(1:npts) + rca(npts+1:)=0. + + call fftwf_execute_dft_r2c(plan1,rca,ca) +! call timer('FFTbig ',1) + + ib=0 + do j=1,NSZ + ia=ib+1 + ib=nint(float(j)*(672000./8192)) ! NFFT1/NFFT + if(ref(j).le.0.0) ref(j)=0.0001 + fac=sqrt(1.0/ref(j)) + ca(ia:ib)=fac*conjg(ca(ia:ib)) + enddo + endif + +! NB: f0 is the frequency at which we want our filter centered. +! i0 is the bin number in ca closest to f0. +! call timer('loops ',0) + i0=nint(f0*56.) + 1 ! f0/df where delta f = 12000/672000 = 1/56 + nh=38587 ! nfft2/2 + + do i=1,nh !Copy data into c4a and apply + j=i0+i-1 !the filter function + if(j.ge.1 .and. j.le.nfft1/2+1) then + c4a(i)=rfilt(i)*ca(j) + else + c4a(i)=0. + endif + enddo + do i=nh+1,nfft2 + j=i0+i-1-nfft2 + if(j.ge.1) then + c4a(i)=rfilt(i)*ca(j) + else + c4a(i)=rfilt(i)*conjg(ca(2-j)) + endif + enddo + + nh=nfft3/2 + do i=1,nh + c6a(i)=rfilt2(i)*c4a(i) + enddo + do i=nh+1,nfft3 + c6a(i)=rfilt2(i)*c4a(nfft2-nfft3+i) + enddo + + nadd=nfft2/(3.0*NZ2) ! 180Hz BW + + i=0 + do j=1,NZ2 + s(j)=0. + do n=1,nadd + i=i+1 + s(j)=s(j) + real(c4a(i))**2 + aimag(c4a(i))**2 + enddo + enddo + call pctile(s,NZ2,10,sq0) + sq0=sq0*1.732 ! SQRT(3.0) +! call timer('loops ',1) + +! Do the short reverse transform, to go back to time domain. +! call timer('FFTsmall',0) + call fftwf_execute_dft(plan2,c4a,c4a) + call fftwf_execute_dft(plan5,c6a,c6a) +! call timer('FFTsmall',1) + n4=min(npts/8,nfft2) + n2=nfft3 + + return + +900 continue + + !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls + call fftwf_destroy_plan(plan1) + call fftwf_destroy_plan(plan2) + call fftwf_destroy_plan(plan3) + call fftwf_destroy_plan(plan4) + call fftwf_destroy_plan(plan5) + !$omp end critical(fftw) + + return +end subroutine filbigvar diff --git a/lib/ft8var/fillhashvar.f90 b/lib/ft8var/fillhashvar.f90 index be4453be..edab5e30 100755..100644 --- a/lib/ft8var/fillhashvar.f90 +++ b/lib/ft8var/fillhashvar.f90 @@ -1,68 +1,68 @@ -subroutine fillhashvar(numthreads,lfill)
-
- use packjt77var ! also setting mycall13,dxcall13
- use ft8_mod1, only : mycall,hiscall
- integer, intent(in) :: numthreads
- logical, intent(in) :: lfill
- character*13 cw
-
- if(lfill) then
- do i=1,numthreads
- do m=1,nlast_calls(i)
- nposition=nthrindex(i)+m
- cw=last_calls(nposition)
-!print *,i,m,cw
- n10=ihashcall(cw,10)
- if(n10.ge.0 .and. n10 .le. 1023 .and. cw.ne.mycall13) calls10(n10)=cw
-
- n12=ihashcall(cw,12)
- if(n12.ge.0 .and. n12 .le. 4095 .and. cw.ne.mycall13) calls12(n12)=cw
-
- n22=ihashcall(cw,22)
- if(any(ihash22.eq.n22)) then ! If entry exists, make sure callsign is the most recently received one
- where(ihash22.eq.n22) calls22=cw
- go to 900
- endif
-
-! New entry: move table down, making room for new one at the top
- ihash22(nzhash:2:-1)=ihash22(nzhash-1:1:-1)
-
-! Add the new entry
- calls22(nzhash:2:-1)=calls22(nzhash-1:1:-1)
- ihash22(1)=n22
- calls22(1)=cw
- if(nzhash.lt.MAXHASH) nzhash=nzhash+1
-900 continue
- enddo
- enddo
- else
- nlast_calls=0
- mycall13=mycall//' '; dxcall13=hiscall//' '
- if(mycall13.ne.mycall13_0) then
- if(len(trim(mycall13)).gt.2) then
- mycall13_set=.true.
- mycall13_0=mycall13
- call save_hash_mycallvar(mycall13,hashmy10,hashmy12,hashmy22)
-!print *,mycall13,hashmy10,hashmy12,hashmy22
- else
- mycall13_set=.false.
- endif
- endif
-
- if(dxcall13.ne.dxcall13_0) then
- if(len(trim(dxcall13)).gt.2) then
- dxcall13_set=.true.
- dxcall13_0=dxcall13
- hashdx10=ihashcall(dxcall13,10)
-! make sure new DX Call is stored in hash tables prior to decoding
-! it is needed if manually callsign set in DX Call window was not decoded before
- call save_hash_callvar(dxcall13,1)
-!print *,dxcall13,hashdx10
- else
- dxcall13_set=.false.
- endif
- endif
- endif
-
- return
-end subroutine fillhashvar
+subroutine fillhashvar(numthreads,lfill) + + use packjt77 ! also setting mycall13var,dxcall13var + use ft8_mod1, only : mycall,hiscall + integer, intent(in) :: numthreads + logical, intent(in) :: lfill + character*13 cw + + if(lfill) then + do i=1,numthreads + do m=1,nlast_callsvar(i) + nposition=nthrindexvar(i)+m + cw=last_callsvar(nposition) +!print *,i,m,cw + n10=ihashcallvar(cw,10) + if(n10.ge.0 .and. n10 .le. 1023 .and. cw.ne.mycall13var) calls10var(n10)=cw + + n12=ihashcallvar(cw,12) + if(n12.ge.0 .and. n12 .le. 4095 .and. cw.ne.mycall13var) calls12var(n12)=cw + + n22=ihashcallvar(cw,22) + if(any(ihash22var.eq.n22)) then ! If entry exists, make sure callsign is the most recently received one + where(ihash22var.eq.n22) calls22var=cw + go to 900 + endif + +! New entry: move table down, making room for new one at the top + ihash22var(nzhashvar:2:-1)=ihash22var(nzhashvar-1:1:-1) + +! Add the new entry + calls22var(nzhashvar:2:-1)=calls22var(nzhashvar-1:1:-1) + ihash22var(1)=n22 + calls22var(1)=cw + if(nzhashvar.lt.MAXHASHvar) nzhashvar=nzhashvar+1 +900 continue + enddo + enddo + else + nlast_callsvar=0 + mycall13var=mycall//' '; dxcall13var=hiscall//' ' + if(mycall13var.ne.mycall13_0var) then + if(len(trim(mycall13var)).gt.2) then + mycall13_setvar=.true. + mycall13_0var=mycall13var + call save_hash_mycallvar(mycall13var,hashmy10var,hashmy12var,hashmy22var) +!print *,mycall13var,hashmy10var,hashmy12var,hashmy22var + else + mycall13_setvar=.false. + endif + endif + + if(dxcall13var.ne.dxcall13_0var) then + if(len(trim(dxcall13var)).gt.2) then + dxcall13_setvar=.true. + dxcall13_0var=dxcall13var + hashdx10var=ihashcallvar(dxcall13var,10) +! make sure new DX Call is stored in hash tables prior to decoding +! it is needed if manually callsign set in DX Call window was not decoded before + call save_hash_callvar(dxcall13var,1) +!print *,dxcall13var,hashdx10var + else + dxcall13_setvar=.false. + endif + endif + endif + + return +end subroutine fillhashvar diff --git a/lib/ft8var/filtersfreevar.f90 b/lib/ft8var/filtersfreevar.f90 index ac04b23d..e06bc120 100755..100644 --- a/lib/ft8var/filtersfreevar.f90 +++ b/lib/ft8var/filtersfreevar.f90 @@ -1,126 +1,126 @@ -
-subroutine filtersfreevar(decoded,falsedec)
-
- real datacorr
- character decoded*22,d1*1,d2*2,d3*3,d4*4,d5*5
- logical(1) falsedec
-
- ndot=0
- nsign=0
- nother=0
-
- if(decoded(11:12).eq.'73') go to 4
- if(decoded(12:13).eq.'73') go to 4
- if(decoded(1:1).eq.'/') go to 2
-
- do i=1,13
- d1=decoded(i:i); d2=decoded(i:(i+1)); d3=decoded(i:(i+2)); d4=decoded(i:(i+3)); d5=decoded(i:(i+4))
- if(d2.eq.'73' .or. d2.eq.'TU' .or. d2.eq.'GL') go to 4
-! HA8QJ -07 HA8QJ R-07
- if(i.gt.4) then
- if((d2.eq.' -' .or. d2.eq.' +') .and. decoded(i+2:i+2).ge.'0' .and. decoded(i+2:i+2).lt.'3') go to 4
- if((d3.eq.' R-' .or. d3.eq.' R+') .and. decoded(i+3:i+3).ge.'0' .and. decoded(i+3:i+3).lt.'3') go to 4
- endif
- if(d3.eq.'QSL' .or. d3.eq.'TNX' .or. d2.eq.'RR' .or. &
- d3.eq.'QSO' .or. d3.eq.'CFM' .or. d4.eq.'LOTW' .or. &
- d3.eq.'BND' .or. d3.eq.'QSY' .or. d4.eq.'BAND') go to 4
- if(d3.eq.'MAS' .or. d3.eq.'HNY' .or. d3.eq.'HPY' .or. d3.eq.' DT' .or. &
- d3.eq.'XMS' .or. d5.eq.'EASTE' .or. d5.eq.'PIRAT' .or. d4.eq.'TEST') go to 4
- if(d5.eq.'/HYBR' .or. d5.eq.'/HTML' .or. d5.eq.'/PHOT' .or. d5.eq.'/IMAG' .or. d5.eq.'/JOIN' .or. d5.eq.'QRZ.C' &
- .or. d4.eq.'/GIF' .or. d4.eq.'/JPG' .or. d4.eq.'/AVI' .or. d4.eq.'/MP4' .or. d4.eq.'/CMD') go to 4
- if(d1.eq.'.') ndot=ndot+1
- if(d1.eq.'-' .or. d1.eq.'+' .or. d1.eq.'?') nsign=nsign+1
- if(d1.eq.'/' .or. d1.eq.'?') nother=nother+1
- enddo
-
- if(ndot.ge.2 .or. nsign.ge.2 .or. nother.ge.2) go to 2
- if(decoded(1:2).eq.'-0') go to 2
- if(decoded(1:1).ne.' ' .and. decoded(2:2).eq.' ') go to 2
-
- if(((decoded(13:13).ge.'A' .and. decoded(13:13).le.'Z') .or. &
- (decoded(13:13).ge.'0' .and. decoded(13:13).le.'9')) .and. &
- decoded(12:12).eq.' ') go to 2
-
- if(decoded(1:1).eq.'.' .or. decoded(1:1).eq.'+' .or. decoded(1:1).eq.'?' &
- .or. decoded(1:1).eq.'/' .or. decoded(13:13).eq.'.' .or. decoded(13:13).eq.'+' &
- .or. decoded(13:13).eq.'-' .or. decoded(13:13).eq.'/') go to 2
-
- if(decoded(2:2).eq.'-' .or. decoded(2:2).eq.'+' .or. decoded(12:12).eq.'.' .or. &
- decoded(12:12).eq.'+' .or. decoded(12:12).eq.'-') go to 2
-
- if(decoded(12:12).ge.'0' .and. decoded(12:12).le.'9' .and. &
- decoded(13:13).ge.'0' .and. decoded(13:13).le.'9') then
-
- if(decoded(12:13).ne.'55' .and. decoded(12:13).ne.'73' .and. decoded(12:13).ne.'88') go to 2
-
- endif
-
- if(decoded(1:1).eq.'0' .and. decoded(2:2).ne.'.') go to 2
-
- do i=1,12
- if(i.lt.12 .and. decoded(i:i).eq."?" .and. decoded(i+1:i+1).ne." ") go to 2
- if(i.lt.12 .and. decoded(i:i).ne." " .and. decoded(i+1:i+1).eq."+" &
- .and. (decoded(i+2:i+2).le."0" .or. decoded(i+2:i+2).ge."9")) go to 2
-
- if(decoded(i:i).ge.'A' .and. decoded(i:i).le.'Z' .and. decoded(i+1:i+1).eq.'.' .and. &
- decoded(i+2:i+2).ge.'A' .and. decoded(i+2:i+2).le.'Z') go to 2
-
- if(decoded(i+1:i+2).eq.'/ ' .or. decoded(i+1:i+2).eq.' /') go to 2
-
- if(decoded(i:i).ge.'0' .and. decoded(i:i).le.'9' .and. decoded(i+1:i+1).eq.'/' .and. &
- decoded(i+2:i+2).ge.'0' .and. decoded(i+2:i+2).le.'9') go to 2
-
- if(decoded(i:i).eq.' ' .and. decoded(i+1:i+1).ge.'A' .and. decoded(i+1:i+1).le.'Z' .and. &
- decoded(i+1:i+1).ne.'F' .and. decoded(i+1:i+1).ne.'G' .and. decoded(i+1:i+1).ne.'I' .and. &
- decoded(i+2:i+2).eq.'/') go to 2
-
- if(decoded(i:i).eq.' ' .and. decoded(i+1:i+1).ge.'A' .and. decoded(i+1:i+1).le.'Z' .and. &
- (decoded(i+2:i+2).eq.'.' .or. decoded(i+2:i+2).eq.'+' .or. decoded(i+2:i+2).eq.'-')) go to 2
-
- enddo
-
- if(decoded(1:1).eq.'-' .and. decoded(2:2).le.'1' .and. decoded(2:2).ge.'9') go to 2
-
- if(decoded(1:1).ge.'1' .and. decoded(1:1).le.'9' .and. &
- decoded(2:2).ge.'0' .and. decoded(2:2).le.'9' .and. &
- decoded(3:3).ge.'0' .and. decoded(3:3).le.'9' .and. &
- decoded(4:4).ne.'W') go to 2
-
- if(decoded(1:1).ge.'1' .and. decoded(1:1).le.'9' .and. &
- decoded(2:2).ge.'0' .and. decoded(2:2).le.'9' .and. &
- decoded(3:3).ne.'W') go to 2
-
- if(decoded(1:1).ge.'1' .and. decoded(1:1).le.'9' .and. &
- decoded(2:3).ne.'EL') go to 2
-
- if(decoded(10:10).ne.'/' .and. decoded(11:11).ne.'/' .and. decoded(12:12).ge.'A' .and. &
- decoded(12:12).le.'Z' .and. decoded(13:13).ge.'0' .and. decoded(12:12).le.'9') go to 2
-
- call datacor(datapwr,datacorr)
-
-! ban free message if datacorr is less than 1.55
- if(datacorr.lt.1.55) go to 2
-
- ncount=0
- nchar=0
-
- do i=1,13
- if(decoded(i:i).eq.' ') exit
- if(decoded(i:i).eq.'/' .or. decoded(i:i).eq.'-' .or. decoded(i:i).eq.'.') nchar=nchar+1
- ncount=ncount+1
- enddo
-
- if(ncount.eq.13 .and. nchar.ge.0) go to 2
-
-!print *,"passed"
-!print *,decoded
-
- go to 4
-
-2 falsedec=.true.
-!print *,"stopped"
-!print *,decoded
- return
-
-4 return
-end subroutine filtersfreevar
+ +subroutine filtersfreevar(decoded,falsedec) + + real datacorr + character decoded*22,d1*1,d2*2,d3*3,d4*4,d5*5 + logical(1) falsedec + + ndot=0 + nsign=0 + nother=0 + + if(decoded(11:12).eq.'73') go to 4 + if(decoded(12:13).eq.'73') go to 4 + if(decoded(1:1).eq.'/') go to 2 + + do i=1,13 + d1=decoded(i:i); d2=decoded(i:(i+1)); d3=decoded(i:(i+2)); d4=decoded(i:(i+3)); d5=decoded(i:(i+4)) + if(d2.eq.'73' .or. d2.eq.'TU' .or. d2.eq.'GL') go to 4 +! HA8QJ -07 HA8QJ R-07 + if(i.gt.4) then + if((d2.eq.' -' .or. d2.eq.' +') .and. decoded(i+2:i+2).ge.'0' .and. decoded(i+2:i+2).lt.'3') go to 4 + if((d3.eq.' R-' .or. d3.eq.' R+') .and. decoded(i+3:i+3).ge.'0' .and. decoded(i+3:i+3).lt.'3') go to 4 + endif + if(d3.eq.'QSL' .or. d3.eq.'TNX' .or. d2.eq.'RR' .or. & + d3.eq.'QSO' .or. d3.eq.'CFM' .or. d4.eq.'LOTW' .or. & + d3.eq.'BND' .or. d3.eq.'QSY' .or. d4.eq.'BAND') go to 4 + if(d3.eq.'MAS' .or. d3.eq.'HNY' .or. d3.eq.'HPY' .or. d3.eq.' DT' .or. & + d3.eq.'XMS' .or. d5.eq.'EASTE' .or. d5.eq.'PIRAT' .or. d4.eq.'TEST') go to 4 + if(d5.eq.'/HYBR' .or. d5.eq.'/HTML' .or. d5.eq.'/PHOT' .or. d5.eq.'/IMAG' .or. d5.eq.'/JOIN' .or. d5.eq.'QRZ.C' & + .or. d4.eq.'/GIF' .or. d4.eq.'/JPG' .or. d4.eq.'/AVI' .or. d4.eq.'/MP4' .or. d4.eq.'/CMD') go to 4 + if(d1.eq.'.') ndot=ndot+1 + if(d1.eq.'-' .or. d1.eq.'+' .or. d1.eq.'?') nsign=nsign+1 + if(d1.eq.'/' .or. d1.eq.'?') nother=nother+1 + enddo + + if(ndot.ge.2 .or. nsign.ge.2 .or. nother.ge.2) go to 2 + if(decoded(1:2).eq.'-0') go to 2 + if(decoded(1:1).ne.' ' .and. decoded(2:2).eq.' ') go to 2 + + if(((decoded(13:13).ge.'A' .and. decoded(13:13).le.'Z') .or. & + (decoded(13:13).ge.'0' .and. decoded(13:13).le.'9')) .and. & + decoded(12:12).eq.' ') go to 2 + + if(decoded(1:1).eq.'.' .or. decoded(1:1).eq.'+' .or. decoded(1:1).eq.'?' & + .or. decoded(1:1).eq.'/' .or. decoded(13:13).eq.'.' .or. decoded(13:13).eq.'+' & + .or. decoded(13:13).eq.'-' .or. decoded(13:13).eq.'/') go to 2 + + if(decoded(2:2).eq.'-' .or. decoded(2:2).eq.'+' .or. decoded(12:12).eq.'.' .or. & + decoded(12:12).eq.'+' .or. decoded(12:12).eq.'-') go to 2 + + if(decoded(12:12).ge.'0' .and. decoded(12:12).le.'9' .and. & + decoded(13:13).ge.'0' .and. decoded(13:13).le.'9') then + + if(decoded(12:13).ne.'55' .and. decoded(12:13).ne.'73' .and. decoded(12:13).ne.'88') go to 2 + + endif + + if(decoded(1:1).eq.'0' .and. decoded(2:2).ne.'.') go to 2 + + do i=1,12 + if(i.lt.12 .and. decoded(i:i).eq."?" .and. decoded(i+1:i+1).ne." ") go to 2 + if(i.lt.12 .and. decoded(i:i).ne." " .and. decoded(i+1:i+1).eq."+" & + .and. (decoded(i+2:i+2).le."0" .or. decoded(i+2:i+2).ge."9")) go to 2 + + if(decoded(i:i).ge.'A' .and. decoded(i:i).le.'Z' .and. decoded(i+1:i+1).eq.'.' .and. & + decoded(i+2:i+2).ge.'A' .and. decoded(i+2:i+2).le.'Z') go to 2 + + if(decoded(i+1:i+2).eq.'/ ' .or. decoded(i+1:i+2).eq.' /') go to 2 + + if(decoded(i:i).ge.'0' .and. decoded(i:i).le.'9' .and. decoded(i+1:i+1).eq.'/' .and. & + decoded(i+2:i+2).ge.'0' .and. decoded(i+2:i+2).le.'9') go to 2 + + if(decoded(i:i).eq.' ' .and. decoded(i+1:i+1).ge.'A' .and. decoded(i+1:i+1).le.'Z' .and. & + decoded(i+1:i+1).ne.'F' .and. decoded(i+1:i+1).ne.'G' .and. decoded(i+1:i+1).ne.'I' .and. & + decoded(i+2:i+2).eq.'/') go to 2 + + if(decoded(i:i).eq.' ' .and. decoded(i+1:i+1).ge.'A' .and. decoded(i+1:i+1).le.'Z' .and. & + (decoded(i+2:i+2).eq.'.' .or. decoded(i+2:i+2).eq.'+' .or. decoded(i+2:i+2).eq.'-')) go to 2 + + enddo + + if(decoded(1:1).eq.'-' .and. decoded(2:2).le.'1' .and. decoded(2:2).ge.'9') go to 2 + + if(decoded(1:1).ge.'1' .and. decoded(1:1).le.'9' .and. & + decoded(2:2).ge.'0' .and. decoded(2:2).le.'9' .and. & + decoded(3:3).ge.'0' .and. decoded(3:3).le.'9' .and. & + decoded(4:4).ne.'W') go to 2 + + if(decoded(1:1).ge.'1' .and. decoded(1:1).le.'9' .and. & + decoded(2:2).ge.'0' .and. decoded(2:2).le.'9' .and. & + decoded(3:3).ne.'W') go to 2 + + if(decoded(1:1).ge.'1' .and. decoded(1:1).le.'9' .and. & + decoded(2:3).ne.'EL') go to 2 + + if(decoded(10:10).ne.'/' .and. decoded(11:11).ne.'/' .and. decoded(12:12).ge.'A' .and. & + decoded(12:12).le.'Z' .and. decoded(13:13).ge.'0' .and. decoded(12:12).le.'9') go to 2 + + call datacor(datapwr,datacorr) + +! ban free message if datacorr is less than 1.55 + if(datacorr.lt.1.55) go to 2 + + ncount=0 + nchar=0 + + do i=1,13 + if(decoded(i:i).eq.' ') exit + if(decoded(i:i).eq.'/' .or. decoded(i:i).eq.'-' .or. decoded(i:i).eq.'.') nchar=nchar+1 + ncount=ncount+1 + enddo + + if(ncount.eq.13 .and. nchar.ge.0) go to 2 + +!print *,"passed" +!print *,decoded + + go to 4 + +2 falsedec=.true. +!print *,"stopped" +!print *,decoded + return + +4 return +end subroutine filtersfreevar diff --git a/lib/ft8var/four2avar.f90 b/lib/ft8var/four2avar.f90 index c7df6e99..3ed44f22 100755..100644 --- a/lib/ft8var/four2avar.f90 +++ b/lib/ft8var/four2avar.f90 @@ -1,115 +1,115 @@ -subroutine four2avar(a,nfft,ndim,isign,iform)
-
-! IFORM = 1, 0 or -1, as data is
-! complex, real, or the first half of a complex array. Transform
-! values are returned in array DATA. They are complex, real, or
-! the first half of a complex array, as IFORM = 1, -1 or 0.
-
-! The transform of a real array (IFORM = 0) dimensioned N(1) by N(2)
-! by ... will be returned in the same array, now considered to
-! be complex of dimensions N(1)/2+1 by N(2) by .... Note that if
-! IFORM = 0 or -1, N(1) must be even, and enough room must be
-! reserved. The missing values may be obtained by complex conjugation.
-
-! The reverse transformation of a half complex array dimensioned
-! N(1)/2+1 by N(2) by ..., is accomplished by setting IFORM
-! to -1. In the N array, N(1) must be the true N(1), not N(1)/2+1.
-! The transform will be real and returned to the input array.
-
-! This version of four2avar makes calls to the FFTW library to do the
-! actual computations.
-
- parameter (NPMAX=2100) !Max numberf of stored plans
- parameter (NSMALL=16385) !Max size of "small" FFTs
- complex a(nfft) !Array to be transformed
- complex aa(NSMALL) !Local copy of "small" a()
- integer nn(NPMAX),ns(NPMAX),nf(NPMAX) !Params of stored plans
- integer*8 nl(NPMAX),nloc !More params of plans
- integer*8 plan(NPMAX) !Pointers to stored plans
- logical found_plan
- data nplan/0/ !Number of stored plans
- common/patience/npatience,nthreads !Patience and threads for FFTW plans
- include '/lib/fftw3.f90' !FFTW definitions
- save plan,nplan,nn,ns,nf,nl
-
- if(nfft.lt.0) go to 999
-
- nloc=loc(a)
- found_plan = .false.
-
- do i=1,nplan
- if(nfft.eq.nn(i) .and. isign.eq.ns(i) .and. &
- iform.eq.nf(i) .and. nloc.eq.nl(i)) then
- found_plan = .true.
- exit
- end if
- enddo
-
- if(i.ge.NPMAX) stop 'Too many FFTW plans requested.'
-
- if (.not. found_plan) then
- !$omp critical(four2avar_setup)
- nplan=nplan+1
- i=nplan
-
- nn(i)=nfft
- ns(i)=isign
- nf(i)=iform
- nl(i)=nloc
-
-! Planning: FFTW_ESTIMATE, FFTW_ESTIMATE_PATIENT, FFTW_MEASURE,
-! FFTW_PATIENT, FFTW_EXHAUSTIVE
- nflags=FFTW_ESTIMATE
- if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT
- if(npatience.eq.2) nflags=FFTW_MEASURE
- if(npatience.eq.3) nflags=FFTW_PATIENT
- if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE
-
- if(nfft.le.NSMALL) then
- jz=nfft
- if(iform.le.0) jz=nfft/2+1
- aa(1:jz)=a(1:jz)
- endif
-
- !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls
- if(isign.eq.-1 .and. iform.eq.1) then
- call sfftw_plan_dft_1d(plan(i),nfft,a,a,FFTW_FORWARD,nflags)
- else if(isign.eq.1 .and. iform.eq.1) then
- call sfftw_plan_dft_1d(plan(i),nfft,a,a,FFTW_BACKWARD,nflags)
- else if(isign.eq.-1 .and. iform.eq.0) then
- call sfftw_plan_dft_r2c_1d(plan(i),nfft,a,a,nflags)
- else if(isign.eq.1 .and. iform.eq.-1) then
- call sfftw_plan_dft_c2r_1d(plan(i),nfft,a,a,nflags)
- else
- stop 'Unsupported request in four2avar'
- endif
- !$omp end critical(fftw)
-
- if(nfft.le.NSMALL) then
- jz=nfft
- if(iform.le.0) jz=nfft/2+1
- a(1:jz)=aa(1:jz)
- endif
- !$omp end critical(four2avar_setup)
- end if
-
- call sfftw_execute(plan(i))
- return
-
-999 continue
-
- !$omp critical(four2avar)
- do i=1,nplan
-! The test is only to silence a compiler warning:
- if(ndim.ne.-999) then
- !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls
- call sfftw_destroy_plan(plan(i))
- !$omp end critical(fftw)
- end if
- enddo
-
- nplan=0
- !$omp end critical(four2avar)
-
- return
-end subroutine four2avar
+subroutine four2avar(a,nfft,ndim,isign,iform) + +! IFORM = 1, 0 or -1, as data is +! complex, real, or the first half of a complex array. Transform +! values are returned in array DATA. They are complex, real, or +! the first half of a complex array, as IFORM = 1, -1 or 0. + +! The transform of a real array (IFORM = 0) dimensioned N(1) by N(2) +! by ... will be returned in the same array, now considered to +! be complex of dimensions N(1)/2+1 by N(2) by .... Note that if +! IFORM = 0 or -1, N(1) must be even, and enough room must be +! reserved. The missing values may be obtained by complex conjugation. + +! The reverse transformation of a half complex array dimensioned +! N(1)/2+1 by N(2) by ..., is accomplished by setting IFORM +! to -1. In the N array, N(1) must be the true N(1), not N(1)/2+1. +! The transform will be real and returned to the input array. + +! This version of four2avar makes calls to the FFTW library to do the +! actual computations. + + parameter (NPMAX=2100) !Max numberf of stored plans + parameter (NSMALL=16385) !Max size of "small" FFTs + complex a(nfft) !Array to be transformed + complex aa(NSMALL) !Local copy of "small" a() + integer nn(NPMAX),ns(NPMAX),nf(NPMAX) !Params of stored plans + integer*8 nl(NPMAX),nloc !More params of plans + integer*8 plan(NPMAX) !Pointers to stored plans + logical found_plan + data nplan/0/ !Number of stored plans + common/patience/npatience,nthreads !Patience and threads for FFTW plans + include '/lib/fftw3.f90' !FFTW definitions + save plan,nplan,nn,ns,nf,nl + + if(nfft.lt.0) go to 999 + + nloc=loc(a) + found_plan = .false. + + do i=1,nplan + if(nfft.eq.nn(i) .and. isign.eq.ns(i) .and. & + iform.eq.nf(i) .and. nloc.eq.nl(i)) then + found_plan = .true. + exit + end if + enddo + + if(i.ge.NPMAX) stop 'Too many FFTW plans requested.' + + if (.not. found_plan) then + !$omp critical(four2avar_setup) + nplan=nplan+1 + i=nplan + + nn(i)=nfft + ns(i)=isign + nf(i)=iform + nl(i)=nloc + +! Planning: FFTW_ESTIMATE, FFTW_ESTIMATE_PATIENT, FFTW_MEASURE, +! FFTW_PATIENT, FFTW_EXHAUSTIVE + nflags=FFTW_ESTIMATE + if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT + if(npatience.eq.2) nflags=FFTW_MEASURE + if(npatience.eq.3) nflags=FFTW_PATIENT + if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE + + if(nfft.le.NSMALL) then + jz=nfft + if(iform.le.0) jz=nfft/2+1 + aa(1:jz)=a(1:jz) + endif + + !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls + if(isign.eq.-1 .and. iform.eq.1) then + call sfftw_plan_dft_1d(plan(i),nfft,a,a,FFTW_FORWARD,nflags) + else if(isign.eq.1 .and. iform.eq.1) then + call sfftw_plan_dft_1d(plan(i),nfft,a,a,FFTW_BACKWARD,nflags) + else if(isign.eq.-1 .and. iform.eq.0) then + call sfftw_plan_dft_r2c_1d(plan(i),nfft,a,a,nflags) + else if(isign.eq.1 .and. iform.eq.-1) then + call sfftw_plan_dft_c2r_1d(plan(i),nfft,a,a,nflags) + else + stop 'Unsupported request in four2avar' + endif + !$omp end critical(fftw) + + if(nfft.le.NSMALL) then + jz=nfft + if(iform.le.0) jz=nfft/2+1 + a(1:jz)=aa(1:jz) + endif + !$omp end critical(four2avar_setup) + end if + + call sfftw_execute(plan(i)) + return + +999 continue + + !$omp critical(four2avar) + do i=1,nplan +! The test is only to silence a compiler warning: + if(ndim.ne.-999) then + !$omp critical(fftw) ! serialize non thread-safe FFTW3 calls + call sfftw_destroy_plan(plan(i)) + !$omp end critical(fftw) + end if + enddo + + nplan=0 + !$omp end critical(four2avar) + + return +end subroutine four2avar diff --git a/lib/ft8var/ft4_mod1.f90 b/lib/ft8var/ft4_mod1.f90 index d1e7349b..9bdf2a94 100755..100644 --- a/lib/ft8var/ft4_mod1.f90 +++ b/lib/ft8var/ft4_mod1.f90 @@ -1,7 +1,7 @@ -module ft4_mod1
-
- real*4 dd4(73728)
- logical(1) llagcc,lfilter,lhidetest,lhidetelemetry
- integer nFT4decd,nfafilt,nfbfilt
-
+module ft4_mod1 + + real*4 dd4(73728) + logical(1) llagcc,lfilter,lhidetest,lhidetelemetry + integer nFT4decd,nfafilt,nfbfilt + end module ft4_mod1
\ No newline at end of file diff --git a/lib/ft8var/ft8_decodevar.f90 b/lib/ft8var/ft8_decodevar.f90 index cde39f39..521ab6da 100755..100644 --- a/lib/ft8var/ft8_decodevar.f90 +++ b/lib/ft8var/ft8_decodevar.f90 @@ -1,481 +1,514 @@ -module ft8_decodevar
-
- logical ltry_a8
- type :: ft8_decodervar
- procedure(ft8_decodevar_callback), pointer :: callback
- contains
- procedure :: decodevar
- end type ft8_decodervar
-
- abstract interface
- subroutine ft8_decodevar_callback (this,snr,dt,freq,decodedvar,nap,qual)
- import ft8_decodervar
- implicit none
- class(ft8_decodervar), intent(inout) :: this
- integer, intent(in) :: snr
- integer, intent(in) :: nap
- real, intent(in) :: dt,freq,qual
- character(len=37), intent(in) :: decodedvar !ft8md was 26
- end subroutine ft8_decodevar_callback
- end interface
-
-contains
-
- subroutine decodevar(this,callback,nQSOProgress,nfqso,nft8rxfsens,nftx,nutc, &
- nfa,nfb,ncandthin,ndtcenter,nsec,napwid,lmycallstd,lhiscallstd, &
- stophint,nthr,numthreads,nagainfil,lft8lowth,lft8subpass,lhideft8dupes)
-
- use omp_lib
-
- use ft8_mod1, only : ndecodes,allmessages,allsnrs,allfreq,odd,even,nmsg, &
- lastrxmsg,lasthcall,calldteven,calldtodd,incall,oddcopy,evencopy, &
- avexdt,mycall,hiscall,dd8,nft8cycles,ncandallthr,nincallthr,evencq, &
- oddcq,numcqsig,numdeccq,evenmyc,oddmyc,nummycsig,numdecmyc,lapmyc, &
- evenqso,oddqso,lqsomsgdcd,hisgrid4
-
- include 'ft8_params.f90'
-
- class(ft8_decodervar), intent(inout) :: this
- procedure(ft8_decodevar_callback) :: callback
- real, DIMENSION(:), ALLOCATABLE :: dd8m
- real candidate(4,460),freqsub(200)
- real qual !ft8md
- integer, intent(in) :: nQSOProgress,nfqso,nft8rxfsens,nftx,nfa,nfb, &
- ncandthin,ndtcenter,nsec,napwid,nthr,numthreads
- logical, intent(in) :: nagainfil
- logical(1), intent(in) :: stophint,lft8lowth,lft8subpass,lhideft8dupes, &
- lmycallstd,lhiscallstd
- logical newdat1,lsubtract,ldupe,lFreeText,lspecial
- logical(1) lft8sdec,lft8s,lft8sd,lrepliedother,lhashmsg,lqsothread, &
- lhidemsg,lhighsens,lcqcand,lsubtracted,levenint,loddint,lnohiscall, &
- lnomycall,lnohisgrid
- character msg37*37,msg37_2*37,msg26*37,call2*12 !ft8md msg26 was *26
- character*37 msgsrcvd(130)
-
- type oddtmp_struct
- real freq
- real dt
- logical lstate
- character*37 msg
- end type oddtmp_struct
- type(oddtmp_struct) oddtmp(130)
-
- type eventmp_struct
- real freq
- real dt
- logical lstate
- character*37 msg
- end type eventmp_struct
- type(eventmp_struct) eventmp(130)
-
- type tmpcqdec_struct
- real freq
- real xdt
- end type tmpcqdec_struct
- type(tmpcqdec_struct) tmpcqdec(numdeccq) ! 40 sigs
-
- type tmpcqsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpcqsig_struct
- type(tmpcqsig_struct) tmpcqsig(numcqsig) ! 20 sigs
-
- type tmpmyc_struct
- real freq
- real xdt
- end type tmpmyc_struct
- type(tmpmyc_struct) tmpmyc(numdecmyc) ! 25 sigs
-
- type tmpmycsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpmycsig_struct
- type(tmpmycsig_struct) tmpmycsig(nummycsig) ! 5 sigs
-
- type tmpqsosig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpqsosig_struct
- type(tmpqsosig_struct) tmpqsosig(1)
-
- this%callback => callback
-
- oddtmp%lstate=.false.
- eventmp%lstate=.false.
- nmsgloc=0
- ncandthr=0
- nmsgcq=0
- tmpcqdec(:)%freq=6000.0
- nmsgmyc=0
- tmpmyc(:)%freq=6000.0
- tmpcqsig(:)%freq=6000.0
- tmpmycsig(:)%freq=6000.0
- tmpqsosig(1)%freq=6000.0
- if(hiscall.eq.'') then
- lastrxmsg(1)%lstate=.false.
- else if(lastrxmsg(1)%lstate .and. lasthcall.ne.hiscall .and. &
- index(lastrxmsg(1)%lastmsg,trim(hiscall)).le.0) then
- lastrxmsg(1)%lstate=.false.
- endif
-
- levenint=.false.
- loddint=.false.
- if(nsec.eq.0 .or. nsec.eq.30) then
- levenint=.true.
- elseif(nsec.eq.15 .or. nsec.eq.45) then
- loddint=.true.
- endif
-
- lrepliedother=.false.
- lft8sdec=.false.
- lqsothread=.false.
- lsubtracted=.false.
- ncount=0
- mycalllen1=len_trim(mycall)+1
- nincallthr(nthr)=0
- nallocthr=0
- ncqsignal=0
- nmycsignal=0
-
- lnohiscall=.false.
- if(len_trim(hiscall).lt.3) lnohiscall=.true.
- lnomycall=.false.
- if(len_trim(mycall).lt.3) lnomycall=.true.
- lnohisgrid=.false.
- if(len_trim(hisgrid4).ne.4) lnohisgrid=.true.
- if(nfqso.ge.nfa .and. nfqso.le.nfb) lqsothread=.true.
-
- if(lqsothread .and. .not.lastrxmsg(1)%lstate .and. .not.stophint .and. &
- hiscall.ne.'') then
-! got incoming call
- do i=1,30
- if(incall(i)%msg(1:1).eq." ") exit
- if(index(incall(i)%msg,(trim(mycall)//' '//trim(hiscall))).eq.1) then
- lastrxmsg(1)%lastmsg=incall(i)%msg
- lastrxmsg(1)%xdt=incall(i)%xdt
- lastrxmsg(1)%lstate=.true.
- exit
- endif
- enddo
-
- if(.not.lastrxmsg(1)%lstate) then
-! calling someone, lastrxmsg still not valid
- if(levenint) then
- do i=1,130
- if(.not.evencopy(i)%lstate) cycle
- if(index(evencopy(i)%msg,' '//trim(hiscall)//' ').gt.1) then
- lastrxmsg(1)%lastmsg=evencopy(i)%msg
- lastrxmsg(1)%xdt=evencopy(i)%dt
- lastrxmsg(1)%lstate=.true.
- exit
- endif
- enddo
-
- elseif(loddint) then
- do i=1,130
- if(.not.oddcopy(i)%lstate) cycle
- if(index(oddcopy(i)%msg,' '//trim(hiscall)//' ').gt.1) then
- lastrxmsg(1)%lastmsg=oddcopy(i)%msg
- lastrxmsg(1)%xdt=oddcopy(i)%dt
- lastrxmsg(1)%lstate=.true.
- exit
- endif
- enddo
- endif
- endif
- endif
-
-! sliding search over +/- 2.5s relative to 0.5s TX start time
- jzb=-62 + avexdt*25.
- jzt=62 + avexdt*25.
-
- npass=3 ! fallback
- if(nft8cycles.eq.1) then
- npass=3
- else if(nft8cycles.eq.2) then
- npass=6
- else if(nft8cycles.eq.3) then
- npass=9
- else
- npass=3
- endif
-
- syncmin=1.3
- do ipass=1,npass
- newdat1=.true.
- lsubtract=.true.
- npos=0
- if(ipass.eq.1 .or. ipass.eq.4 .or. ipass.eq.7) then
- if(lft8lowth) syncmin=1.225
- elseif(ipass.eq.2 .or. ipass.eq.5 .or. ipass.eq.8) then
- if(lft8lowth) syncmin=1.3
- elseif(ipass.eq.3 .or. ipass.eq.6 .or. ipass.eq.9) then
- if(lft8lowth) syncmin=1.1
- endif
- if(ipass.gt.5 .or. (ipass.eq.3 .and. npass.eq.3)) lsubtract=.false.
-
- if(ipass.eq.4) then
-!$omp barrier
-!$omp single
- if(npass.eq.9) then ! 3 decoding cycles
- nallocthr=nthr
- allocate(dd8m(180000), STAT = nAllocateStatus1)
- if(nAllocateStatus1.ne.0) STOP "Not enough memory"
- dd8m=dd8
- endif
- do i=1,179999
- dd8(i)=(dd8(i)+dd8(i+1))/2
- enddo
-!$omp end single
-!$omp barrier
- else if(ipass.eq.7) then
-!$omp barrier
- if(nthr.eq.nallocthr) then
- dd8(1)=dd8m(1)
- do i=2,180000
- dd8(i)=(dd8m(i-1)+dd8m(i))/2
- enddo
- deallocate (dd8m, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
- endif
-!$omp barrier
- endif
-
- call sync8var(nfa,nfb,syncmin,nfqso,candidate,ncand,jzb,jzt,ipass, &
- lqsothread,ncandthin,ndtcenter)
- do icand=1,ncand
- sync=candidate(3,icand)
- f1=candidate(1,icand)
- xdt=candidate(2,icand)
- lcqcand=.false.
- if(candidate(4,icand).gt.1.0) lcqcand=.true.
- lhighsens=.false.
- if(sync.lt.1.9 .or. ((ipass.eq.2 .or. ipass.eq.4 .or. ipass.eq.6) &
- .and. sync.lt.3.15)) lhighsens=.true.
- lspecial=.false.
- lFreeText=.false.
- i3bit=0
- lft8s=.false.
- lft8sd=.false.
- lhashmsg=.false.
- iaptype=0
- msg37=''
- i3=16
- n3=16
-
- call ft8bvar(newdat1,nQSOProgress,nfqso,nftx,napwid,lsubtract,npos, &
- freqsub,tmpcqdec,tmpmyc,nagainfil,iaptype,f1,xdt,nbadcrc, &
- lft8sdec,msg37,msg37_2,xsnr,stophint,nthr,lFreeText,ipass, &
- lft8subpass,lspecial,lcqcand,ncqsignal,nmycsignal,npass,i3bit, &
- lft8s,lmycallstd,lhiscallstd,levenint,loddint,lft8sd,i3,n3, &
- nft8rxfsens,ncount,msgsrcvd,lrepliedother,lhashmsg,lqsothread, &
- lft8lowth,lhighsens,lsubtracted,tmpcqsig,tmpmycsig,tmpqsosig, &
- lnohiscall,lnomycall,lnohisgrid,qual,iaptype2)
- nsnr=nint(xsnr)
- xdt=xdt-0.5
- if(nbadcrc.eq.0) then
- lhidemsg=.false.
- if(lspecial) then
- nspecial=2
- else
- nspecial=1
- endif
-
-!$omp critical(find_dupes)
- do k=1,nspecial
- !ft8md if(k.eq.2) msg37=msg37_2 ! this splits DXpedition mode msg into 2 lines
- ldupe=.false.
- if(msg37(1:6).eq." ") ldupe=.true.
- if(.not.ldupe .and. ndecodes.gt.0) then
- do idec=1,ndecodes
- if(lhideft8dupes) then
- if(msg37.eq.allmessages(idec) .and. &
- (nsnr.le.allsnrs(idec) .or. &
- (nsnr.gt.allsnrs(idec) .and. &
- abs(allfreq(idec)-f1).lt.45.0))) then
- ldupe=.true.
- exit
- endif
- else
- if(msg37.eq.allmessages(idec) .and. &
- ((nsnr.le.allsnrs(idec) .and. &
- abs(allfreq(idec)-f1).lt.45.0) .or. &
- (nsnr.gt.allsnrs(idec) .and. &
- abs(allfreq(idec)-f1).lt.45.0 .and. &
- numthreads.ne.1))) then
- ldupe=.true.
- exit
- endif
- endif
- enddo
- endif
-
- if(.not.ldupe) then
- if(.not.lFreeText .and. k.eq.1) call extract_callvar(msg37,call2)
-!!!$omp critical(update_arrays)
- ndecodes=ndecodes+1
- allmessages(ndecodes)=msg37
- allsnrs(ndecodes)=nsnr
- allfreq(ndecodes)=f1
-
- if(.not.lhidemsg) then
- ! simulated wav tests affected, structure contains data for at least previous and current even|odd intervals
- if(levenint) then
- calldteven(150:2:-1)=calldteven(150-1:1:-1)
- calldteven(1)%call2=call2
- calldteven(1)%dt=xdt
- else if(loddint) then
- calldtodd(150:2:-1)=calldtodd(150-1:1:-1)
- calldtodd(1)%call2=call2
- calldtodd(1)%dt=xdt
- endif
- endif
-!!!$omp end critical(update_arrays)
-
- if(.not.lhidemsg) then
- msg26=msg37(1:37) !ft8md was 1:26
- if(associated(this%callback)) then
- call this%callback(nsnr,xdt,f1,msg26,iaptype2,qual)
- endif
- endif
-
- if(msg37(1:3).eq.'CQ ' .and. nmsgcq.lt.numdeccq) then
- nmsgcq=nmsgcq+1
- xdtr=xdt+0.5
- tmpcqdec(nmsgcq)%freq=f1
- tmpcqdec(nmsgcq)%xdt=xdtr
- endif
-
- if(lapmyc .and. lmycallstd) then
- ispc1=index(msg37,' ')
- if(msg37(1:ispc1-1).eq.trim(mycall) .and. &
- nmsgmyc.lt.numdecmyc) then
- nmsgmyc=nmsgmyc+1
- xdtr=xdt+0.5
- tmpmyc(nmsgmyc)%freq=f1
- tmpmyc(nmsgmyc)%xdt=xdtr
- endif
- endif
-
- if(i3.eq.4 .and. msg37(1:3).eq.'CQ ' .and. &
- mod(nsec,15).eq.0 .and. nmsgloc.lt.130) then
- nmsgloc=nmsgloc+1
-
- if(levenint) then
- eventmp(nmsgloc)%msg=msg37
- eventmp(nmsgloc)%freq=f1
- eventmp(nmsgloc)%dt=xdt
- eventmp(nmsgloc)%lstate=.true.
- endif
-
- if(loddint) then
- oddtmp(nmsgloc)%msg=msg37
- oddtmp(nmsgloc)%freq=f1
- oddtmp(nmsgloc)%dt=xdt
- oddtmp(nmsgloc)%lstate=.true.
- endif
- go to 4 ! tmp filled in
- endif
-
- if(.not.lFreeText) then
-! protection against any possible free txtmsg bit corruption
- ispc1=index(msg37,' ')
- if(.not.lhashmsg .and. mod(nsec,15).eq.0 .and. &
- ((i3.eq.1 .and. .not.lft8sd) .or. lft8sd) .and. &
- msg37(1:ispc1-1).ne.trim(mycall) .and. &
- nmsgloc.lt.130 .and. index(msg37,'<').le.0) then
-
-
- ! compound callsigns not supported
- if(index(msg37,'/').gt.0 .and. msg37(1:3).ne.'CQ ') go to 4
-
- nmsgloc=nmsgloc+1
- if(levenint) then
- eventmp(nmsgloc)%msg=msg37
- eventmp(nmsgloc)%freq=f1
- eventmp(nmsgloc)%dt=xdt
- eventmp(nmsgloc)%lstate=.true.
- endif
- if(loddint) then
- oddtmp(nmsgloc)%msg=msg37
- oddtmp(nmsgloc)%freq=f1
- oddtmp(nmsgloc)%dt=xdt
- oddtmp(nmsgloc)%lstate=.true.
- endif
- endif
- endif
- endif
-4 continue
- enddo !do k
-!$omp end critical(find_dupes)
-
- endif
- enddo !icand
- ncandthr=ncandthr+ncand
- enddo !ipass
-
- if(levenint) then
- evencq(1:ncqsignal,nthr)%freq=tmpcqsig(1:ncqsignal)%freq
- evencq(1:ncqsignal,nthr)%xdt=tmpcqsig(1:ncqsignal)%xdt
- do ik=1,ncqsignal
- evencq(ik,nthr)%cs=tmpcqsig(ik)%cs
- enddo
- if(lapmyc) then
- evenmyc(1:nmycsignal,nthr)%freq=tmpmycsig(1:nmycsignal)%freq
- evenmyc(1:nmycsignal,nthr)%xdt=tmpmycsig(1:nmycsignal)%xdt
- do ik=1,nmycsignal
- evenmyc(ik,nthr)%cs=tmpmycsig(ik)%cs
- enddo
- if(.not.lqsomsgdcd .and. tmpqsosig(1)%freq.lt.5001.) then
- evenqso(1,nthr)%freq=tmpqsosig(1)%freq
- evenqso(1,nthr)%xdt=tmpqsosig(1)%xdt
- evenqso(1,nthr)%cs=tmpqsosig(1)%cs
- endif
- endif
- else if(loddint) then
- oddcq(1:ncqsignal,nthr)%freq=tmpcqsig(1:ncqsignal)%freq
- oddcq(1:ncqsignal,nthr)%xdt=tmpcqsig(1:ncqsignal)%xdt
- do ik=1,ncqsignal
- oddcq(ik,nthr)%cs=tmpcqsig(ik)%cs
- enddo
- if(lapmyc) then
- oddmyc(1:nmycsignal,nthr)%freq=tmpmycsig(1:nmycsignal)%freq
- oddmyc(1:nmycsignal,nthr)%xdt=tmpmycsig(1:nmycsignal)%xdt
- do ik=1,nmycsignal
- oddmyc(ik,nthr)%cs=tmpmycsig(ik)%cs
- enddo
- if(.not.lqsomsgdcd .and. tmpqsosig(1)%freq.lt.5001.) then
- oddqso(1,nthr)%freq=tmpqsosig(1)%freq
- oddqso(1,nthr)%xdt=tmpqsosig(1)%xdt
- oddqso(1,nthr)%cs=tmpqsosig(1)%cs
- endif
- endif
- endif
-
- ncandthr=nint(float(ncandthr)/npass)
- ncandallthr(nthr)=ncandallthr(nthr)+ncandthr
-
- if(nmsgloc.gt.0) then
-!$omp critical(update_structures)
- if(levenint) then
- even(nmsg+1:nmsg+nmsgloc)%msg=eventmp(1:nmsgloc)%msg
- even(nmsg+1:nmsg+nmsgloc)%freq=eventmp(1:nmsgloc)%freq
- even(nmsg+1:nmsg+nmsgloc)%dt=eventmp(1:nmsgloc)%dt
- even(nmsg+1:nmsg+nmsgloc)%lstate=eventmp(1:nmsgloc)%lstate
- nmsg=nmsg+nmsgloc
- else if(loddint) then
- odd(nmsg+1:nmsg+nmsgloc)%msg=oddtmp(1:nmsgloc)%msg
- odd(nmsg+1:nmsg+nmsgloc)%freq=oddtmp(1:nmsgloc)%freq
- odd(nmsg+1:nmsg+nmsgloc)%dt=oddtmp(1:nmsgloc)%dt
- odd(nmsg+1:nmsg+nmsgloc)%lstate=oddtmp(1:nmsgloc)%lstate
- nmsg=nmsg+nmsgloc
- endif
-!$omp end critical(update_structures)
- endif
-
- return
- end subroutine decodevar
-end module ft8_decodevar
+module ft8_decodevar + + logical ltry_a8 + type :: ft8_decodervar + procedure(ft8_decodevar_callback), pointer :: callback + contains + procedure :: decodevar + end type ft8_decodervar + + abstract interface + subroutine ft8_decodevar_callback (this,snr,dt,freq,decodedvar,nap,qual) + import ft8_decodervar + implicit none + class(ft8_decodervar), intent(inout) :: this + integer, intent(in) :: snr + integer, intent(in) :: nap + real, intent(in) :: dt,freq,qual + character(len=37), intent(in) :: decodedvar !ft8md was 26 + end subroutine ft8_decodevar_callback + end interface + +contains + + subroutine decodevar(this,callback,nQSOProgress,nfqso,nft8rxfsens,nftx,nutc, & + nfa,nfb,ncandthin,ndtcenter,nsec,napwid,lmycallstd,lhiscallstd, & + stophint,nthr,numthreads,nagainfil,lft8lowth,lft8subpass,lhideft8dupes, & + lft8apon,ncontest) + + use timer_module, only: timer + use omp_lib + use ft8_a7 + + use ft8_mod1, only : ndecodes,allmessages,allsnrs,allfreq,odd,even,nmsg, & + lastrxmsg,lasthcall,calldteven,calldtodd,incall,oddcopy,evencopy, & + avexdt,mycall,hiscall,dd8,nft8cycles,ncandallthr,nincallthr,evencq, & + oddcq,numcqsig,numdeccq,evenmyc,oddmyc,nummycsig,numdecmyc,lapmyc, & + evenqso,oddqso,lqsomsgdcd,hisgrid4 + + include 'ft8_params.f90' + + class(ft8_decodervar), intent(inout) :: this + procedure(ft8_decodevar_callback) :: callback + real, DIMENSION(:), ALLOCATABLE :: dd8m + real candidate(4,460),freqsub(200) + real qual !ft8md + integer, intent(in) :: nQSOProgress,nfqso,nft8rxfsens,nftx,nfa,nfb, & + ncandthin,ndtcenter,nsec,napwid,nthr,numthreads + logical, intent(in) :: nagainfil + logical(1), intent(in) :: stophint,lft8lowth,lft8subpass,lhideft8dupes, & + lmycallstd,lhiscallstd,lft8apon + logical newdat1,lsubtract,ldupe,lFreeText,lspecial + logical(1) lft8sdec,lft8s,lft8sd,lrepliedother,lhashmsg,lqsothread, & + lhidemsg,lhighsens,lcqcand,lsubtracted,levenint,loddint,lnohiscall, & + lnomycall,lnohisgrid + character msg37*37,msg37_2*37,msg26*37,call2*12 !ft8md msg26 was *26 + character*37 msgsrcvd(130) + logical la8 + integer nsnr + character*6 dxgrid + + type oddtmp_struct + real freq + real dt + logical lstate + character*37 msg + end type oddtmp_struct + type(oddtmp_struct) oddtmp(130) + + type eventmp_struct + real freq + real dt + logical lstate + character*37 msg + end type eventmp_struct + type(eventmp_struct) eventmp(130) + + type tmpcqdec_struct + real freq + real xdt + end type tmpcqdec_struct + type(tmpcqdec_struct) tmpcqdec(numdeccq) ! 40 sigs + + type tmpcqsig_struct + real freq + real xdt + complex cs(0:7,79) + end type tmpcqsig_struct + type(tmpcqsig_struct) tmpcqsig(numcqsig) ! 20 sigs + + type tmpmyc_struct + real freq + real xdt + end type tmpmyc_struct + type(tmpmyc_struct) tmpmyc(numdecmyc) ! 25 sigs + + type tmpmycsig_struct + real freq + real xdt + complex cs(0:7,79) + end type tmpmycsig_struct + type(tmpmycsig_struct) tmpmycsig(nummycsig) ! 5 sigs + + type tmpqsosig_struct + real freq + real xdt + complex cs(0:7,79) + end type tmpqsosig_struct + type(tmpqsosig_struct) tmpqsosig(1) + + this%callback => callback + la8=.true. + + oddtmp%lstate=.false. + eventmp%lstate=.false. + nmsgloc=0 + ncandthr=0 + nmsgcq=0 + tmpcqdec(:)%freq=6000.0 + nmsgmyc=0 + tmpmyc(:)%freq=6000.0 + tmpcqsig(:)%freq=6000.0 + tmpmycsig(:)%freq=6000.0 + tmpqsosig(1)%freq=6000.0 + if(hiscall.eq.'') then + lastrxmsg(1)%lstate=.false. + else if(lastrxmsg(1)%lstate .and. lasthcall.ne.hiscall .and. & + index(lastrxmsg(1)%lastmsg,trim(hiscall)).le.0) then + lastrxmsg(1)%lstate=.false. + endif + + levenint=.false. + loddint=.false. + if(nsec.eq.0 .or. nsec.eq.30) then + levenint=.true. + elseif(nsec.eq.15 .or. nsec.eq.45) then + loddint=.true. + endif + + lrepliedother=.false. + lft8sdec=.false. + lqsothread=.false. + lsubtracted=.false. + ncount=0 + mycalllen1=len_trim(mycall)+1 + nincallthr(nthr)=0 + nallocthr=0 + ncqsignal=0 + nmycsignal=0 + + lnohiscall=.false. + if(len_trim(hiscall).lt.3) lnohiscall=.true. + lnomycall=.false. + if(len_trim(mycall).lt.3) lnomycall=.true. + lnohisgrid=.false. + if(len_trim(hisgrid4).ne.4) lnohisgrid=.true. + if(nfqso.ge.nfa .and. nfqso.le.nfb) lqsothread=.true. + + if(lqsothread .and. .not.lastrxmsg(1)%lstate .and. .not.stophint .and. & + hiscall.ne.'') then +! got incoming call + do i=1,30 + if(incall(i)%msg(1:1).eq." ") exit + if(index(incall(i)%msg,(trim(mycall)//' '//trim(hiscall))).eq.1) then + lastrxmsg(1)%lastmsg=incall(i)%msg + lastrxmsg(1)%xdt=incall(i)%xdt + lastrxmsg(1)%lstate=.true. + exit + endif + enddo + + if(.not.lastrxmsg(1)%lstate) then +! calling someone, lastrxmsg still not valid + if(levenint) then + do i=1,130 + if(.not.evencopy(i)%lstate) cycle + if(index(evencopy(i)%msg,' '//trim(hiscall)//' ').gt.1) then + lastrxmsg(1)%lastmsg=evencopy(i)%msg + lastrxmsg(1)%xdt=evencopy(i)%dt + lastrxmsg(1)%lstate=.true. + exit + endif + enddo + + elseif(loddint) then + do i=1,130 + if(.not.oddcopy(i)%lstate) cycle + if(index(oddcopy(i)%msg,' '//trim(hiscall)//' ').gt.1) then + lastrxmsg(1)%lastmsg=oddcopy(i)%msg + lastrxmsg(1)%xdt=oddcopy(i)%dt + lastrxmsg(1)%lstate=.true. + exit + endif + enddo + endif + endif + endif + +! sliding search over +/- 2.5s relative to 0.5s TX start time + jzb=-62 + avexdt*25. + jzt=62 + avexdt*25. + + npass=3 ! fallback + if(nft8cycles.eq.1) then + npass=3 + else if(nft8cycles.eq.2) then + npass=6 + else if(nft8cycles.eq.3) then + npass=9 + else + npass=3 + endif + + syncmin=1.3 + do ipass=1,npass + newdat1=.true. + lsubtract=.true. + npos=0 + if(ipass.eq.1 .or. ipass.eq.4 .or. ipass.eq.7) then + if(lft8lowth) syncmin=1.225 + elseif(ipass.eq.2 .or. ipass.eq.5 .or. ipass.eq.8) then + if(lft8lowth) syncmin=1.3 + elseif(ipass.eq.3 .or. ipass.eq.6 .or. ipass.eq.9) then + if(lft8lowth) syncmin=1.1 + endif + if(ipass.gt.5 .or. (ipass.eq.3 .and. npass.eq.3)) lsubtract=.false. + + if(ipass.eq.4) then +!$omp barrier +!$omp single + if(npass.eq.9) then ! 3 decoding cycles + nallocthr=nthr + allocate(dd8m(180000), STAT = nAllocateStatus1) + if(nAllocateStatus1.ne.0) STOP "Not enough memory" + dd8m=dd8 + endif + do i=1,179999 + dd8(i)=(dd8(i)+dd8(i+1))/2 + enddo +!$omp end single +!$omp barrier + else if(ipass.eq.7) then +!$omp barrier + if(nthr.eq.nallocthr) then + dd8(1)=dd8m(1) + do i=2,180000 + dd8(i)=(dd8m(i-1)+dd8m(i))/2 + enddo + deallocate (dd8m, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + endif +!$omp barrier + endif + + call sync8var(nfa,nfb,syncmin,nfqso,candidate,ncand,jzb,jzt,ipass, & + lqsothread,ncandthin,ndtcenter) + do icand=1,ncand + sync=candidate(3,icand) + f1=candidate(1,icand) + xdt=candidate(2,icand) + lcqcand=.false. + if(candidate(4,icand).gt.1.0) lcqcand=.true. + lhighsens=.false. + if(sync.lt.1.9 .or. ((ipass.eq.2 .or. ipass.eq.4 .or. ipass.eq.6) & + .and. sync.lt.3.15)) lhighsens=.true. + lspecial=.false. + lFreeText=.false. + i3bit=0 + lft8s=.false. + lft8sd=.false. + lhashmsg=.false. + iaptype=0 + msg37='' + i3=16 + n3=16 + + call ft8bvar(newdat1,nQSOProgress,nfqso,nftx,napwid,lsubtract,npos, & + freqsub,tmpcqdec,tmpmyc,nagainfil,iaptype,f1,xdt,nbadcrc, & + lft8sdec,msg37,msg37_2,xsnr,stophint,nthr,lFreeText,ipass, & + lft8subpass,lspecial,lcqcand,ncqsignal,nmycsignal,npass,i3bit, & + lft8s,lmycallstd,lhiscallstd,levenint,loddint,lft8sd,i3,n3, & + nft8rxfsens,ncount,msgsrcvd,lrepliedother,lhashmsg,lqsothread, & + lft8lowth,lhighsens,lsubtracted,tmpcqsig,tmpmycsig,tmpqsosig, & + lnohiscall,lnomycall,lnohisgrid,qual,iaptype2) + nsnr=nint(xsnr) + xdt=xdt-0.5 + if(nbadcrc.eq.0) then + lhidemsg=.false. + if(lspecial) then + nspecial=2 + else + nspecial=1 + endif + +!$omp critical(find_dupes) + do k=1,nspecial + !ft8md if(k.eq.2) msg37=msg37_2 ! this splits DXpedition mode msg into 2 lines + ldupe=.false. + if(msg37(1:6).eq." ") ldupe=.true. + if(.not.ldupe .and. ndecodes.gt.0) then + do idec=1,ndecodes + if(lhideft8dupes) then + if(msg37.eq.allmessages(idec) .and. & + (nsnr.le.allsnrs(idec) .or. & + (nsnr.gt.allsnrs(idec) .and. & + abs(allfreq(idec)-f1).lt.45.0))) then + ldupe=.true. + exit + endif + else + if(msg37.eq.allmessages(idec) .and. & + ((nsnr.le.allsnrs(idec) .and. & + abs(allfreq(idec)-f1).lt.45.0) .or. & + (nsnr.gt.allsnrs(idec) .and. & + abs(allfreq(idec)-f1).lt.45.0 .and. & + numthreads.ne.1))) then + ldupe=.true. + exit + endif + endif + enddo + endif + + if(.not.ldupe) then + if(.not.lFreeText .and. k.eq.1) call extract_callvar(msg37,call2) +!!!$omp critical(update_arrays) + ndecodes=ndecodes+1 + allmessages(ndecodes)=msg37 + allsnrs(ndecodes)=nsnr + allfreq(ndecodes)=f1 + + if(.not.lhidemsg) then + ! simulated wav tests affected, structure contains data for at least previous and current even|odd intervals + if(levenint) then + calldteven(150:2:-1)=calldteven(150-1:1:-1) + calldteven(1)%call2=call2 + calldteven(1)%dt=xdt + else if(loddint) then + calldtodd(150:2:-1)=calldtodd(150-1:1:-1) + calldtodd(1)%call2=call2 + calldtodd(1)%dt=xdt + endif + endif +!!!$omp end critical(update_arrays) + + if(.not.lhidemsg) then + msg26=msg37(1:37) !ft8md was 1:26 + if(associated(this%callback)) then + call this%callback(nsnr,xdt,f1,msg26,iaptype2,qual) + endif + endif + + if(msg37(1:3).eq.'CQ ' .and. nmsgcq.lt.numdeccq) then + nmsgcq=nmsgcq+1 + xdtr=xdt+0.5 + tmpcqdec(nmsgcq)%freq=f1 + tmpcqdec(nmsgcq)%xdt=xdtr + endif + + if(lapmyc .and. lmycallstd) then + ispc1=index(msg37,' ') + if(msg37(1:ispc1-1).eq.trim(mycall) .and. & + nmsgmyc.lt.numdecmyc) then + nmsgmyc=nmsgmyc+1 + xdtr=xdt+0.5 + tmpmyc(nmsgmyc)%freq=f1 + tmpmyc(nmsgmyc)%xdt=xdtr + endif + endif + + if(i3.eq.4 .and. msg37(1:3).eq.'CQ ' .and. & + mod(nsec,15).eq.0 .and. nmsgloc.lt.130) then + nmsgloc=nmsgloc+1 + + if(levenint) then + eventmp(nmsgloc)%msg=msg37 + eventmp(nmsgloc)%freq=f1 + eventmp(nmsgloc)%dt=xdt + eventmp(nmsgloc)%lstate=.true. + endif + + if(loddint) then + oddtmp(nmsgloc)%msg=msg37 + oddtmp(nmsgloc)%freq=f1 + oddtmp(nmsgloc)%dt=xdt + oddtmp(nmsgloc)%lstate=.true. + endif + go to 4 ! tmp filled in + endif + + if(.not.lFreeText) then +! protection against any possible free txtmsg bit corruption + ispc1=index(msg37,' ') + if(.not.lhashmsg .and. mod(nsec,15).eq.0 .and. & + ((i3.eq.1 .and. .not.lft8sd) .or. lft8sd) .and. & + msg37(1:ispc1-1).ne.trim(mycall) .and. & + nmsgloc.lt.130 .and. index(msg37,'<').le.0) then + + + ! compound callsigns not supported + if(index(msg37,'/').gt.0 .and. msg37(1:3).ne.'CQ ') go to 4 + + nmsgloc=nmsgloc+1 + if(levenint) then + eventmp(nmsgloc)%msg=msg37 + eventmp(nmsgloc)%freq=f1 + eventmp(nmsgloc)%dt=xdt + eventmp(nmsgloc)%lstate=.true. + endif + if(loddint) then + oddtmp(nmsgloc)%msg=msg37 + oddtmp(nmsgloc)%freq=f1 + oddtmp(nmsgloc)%dt=xdt + oddtmp(nmsgloc)%lstate=.true. + endif + endif + endif + endif +4 continue + enddo !do k +!$omp end critical(find_dupes) + endif + enddo !icand + ncandthr=ncandthr+ncand + enddo !ipass + +!a8 test code was here + + if(levenint) then + evencq(1:ncqsignal,nthr)%freq=tmpcqsig(1:ncqsignal)%freq + evencq(1:ncqsignal,nthr)%xdt=tmpcqsig(1:ncqsignal)%xdt + do ik=1,ncqsignal + evencq(ik,nthr)%cs=tmpcqsig(ik)%cs + enddo + if(lapmyc) then + evenmyc(1:nmycsignal,nthr)%freq=tmpmycsig(1:nmycsignal)%freq + evenmyc(1:nmycsignal,nthr)%xdt=tmpmycsig(1:nmycsignal)%xdt + do ik=1,nmycsignal + evenmyc(ik,nthr)%cs=tmpmycsig(ik)%cs + enddo + if(.not.lqsomsgdcd .and. tmpqsosig(1)%freq.lt.5001.) then + evenqso(1,nthr)%freq=tmpqsosig(1)%freq + evenqso(1,nthr)%xdt=tmpqsosig(1)%xdt + evenqso(1,nthr)%cs=tmpqsosig(1)%cs + endif + endif + else if(loddint) then + oddcq(1:ncqsignal,nthr)%freq=tmpcqsig(1:ncqsignal)%freq + oddcq(1:ncqsignal,nthr)%xdt=tmpcqsig(1:ncqsignal)%xdt + do ik=1,ncqsignal + oddcq(ik,nthr)%cs=tmpcqsig(ik)%cs + enddo + if(lapmyc) then + oddmyc(1:nmycsignal,nthr)%freq=tmpmycsig(1:nmycsignal)%freq + oddmyc(1:nmycsignal,nthr)%xdt=tmpmycsig(1:nmycsignal)%xdt + do ik=1,nmycsignal + oddmyc(ik,nthr)%cs=tmpmycsig(ik)%cs + enddo + if(.not.lqsomsgdcd .and. tmpqsosig(1)%freq.lt.5001.) then + oddqso(1,nthr)%freq=tmpqsosig(1)%freq + oddqso(1,nthr)%xdt=tmpqsosig(1)%xdt + oddqso(1,nthr)%cs=tmpqsosig(1)%cs + endif + endif + endif + + ncandthr=nint(float(ncandthr)/npass) + ncandallthr(nthr)=ncandallthr(nthr)+ncandthr + + if(nmsgloc.gt.0) then +!$omp critical(update_structures) + if(levenint) then + even(nmsg+1:nmsg+nmsgloc)%msg=eventmp(1:nmsgloc)%msg + even(nmsg+1:nmsg+nmsgloc)%freq=eventmp(1:nmsgloc)%freq + even(nmsg+1:nmsg+nmsgloc)%dt=eventmp(1:nmsgloc)%dt + even(nmsg+1:nmsg+nmsgloc)%lstate=eventmp(1:nmsgloc)%lstate + nmsg=nmsg+nmsgloc + else if(loddint) then + odd(nmsg+1:nmsg+nmsgloc)%msg=oddtmp(1:nmsgloc)%msg + odd(nmsg+1:nmsg+nmsgloc)%freq=oddtmp(1:nmsgloc)%freq + odd(nmsg+1:nmsg+nmsgloc)%dt=oddtmp(1:nmsgloc)%dt + odd(nmsg+1:nmsg+nmsgloc)%lstate=oddtmp(1:nmsgloc)%lstate + nmsg=nmsg+nmsgloc + endif +!$omp end critical(update_structures) + endif + +!$omp single +! test code for a8 start + if(lft8apon .and. ncontest.ne.6 .and. ncontest.ne.7 .and. la8 .and. & + len(trim(hiscall)).ge.3 .and. & + len(trim(hisgrid4)).ge.4 .and. ltry_a8) then +! Try for an a8 decode at nfqso + f1=nfqso + dxgrid=hisgrid4 + call timer('ft8_a8d ',0) + call ft8_a8d(dd8,mycall,hiscall,dxgrid,f1,xdt,fbest,xsnr,plog,msg37) !w3sz was dd + call timer('ft8_a8d ',1) + if(msg37(1:1).ne.' ') then + if(associated(this%callback)) then + sync=10.0 !### ??? !URUR was 10, tried 15 + nsnr=nint(xsnr) + iaptype=8 + qual=1.0 + if(plog.lt.-147.0) qual=0.16 + call this%callback(nsnr,xdt,fbest,msg37,iaptype,qual) + endif + endif + endif +! test code for a8 stop +!$omp end single nowait + + return + end subroutine decodevar +end module ft8_decodevar diff --git a/lib/ft8var/ft8_downsamplevar.f90 b/lib/ft8var/ft8_downsamplevar.f90 index 7ef178b6..7253075e 100755..100644 --- a/lib/ft8var/ft8_downsamplevar.f90 +++ b/lib/ft8var/ft8_downsamplevar.f90 @@ -1,63 +1,63 @@ -subroutine ft8_downsamplevar(newdat1,f0,nqso,c0,c2,c3,lhighsens,lsubtracted,npos,freqsub)
-
-! Downconvert to complex data sampled at 200 Hz ==> 32 samples/symbol
- use ft8_mod1, only : dd8,windowc1,facc1
- parameter (NFFT1=192000,NFFT2=3200) !192000/60 = 3200
-
- logical newdat1
- complex, intent(out) :: c0(-800:4000),c2(-800:4000),c3(-800:4000)
- complex cx(0:96000),cxx(0:96000),c1(0:3199) ! 0:NFFT1/2
- real x(NFFT1)
- real, intent(in) :: f0
- integer, intent(in) :: nqso
- real freqsub(200)
- logical(1), intent(in) :: lhighsens
- logical(1) lsubtracted,ldofft
- equivalence (x,cx)
- save cxx
-
- ldofft=.false.
- if(lsubtracted) then
- do i=1,npos
- if(abs(f0-freqsub(i)).lt.50.) then; ldofft=.true.; lsubtracted=.false.; exit; endif
- enddo
- endif
-
- if(newdat1 .or. ldofft) then
-! Data in dd have changed, recompute the long FFT
- x(1:180000)=dd8
- x(180001:NFFT1)=0. !Zero-pad the x array
- call four2avar(cx,NFFT1,1,-1,0) !r2c FFT to freq domain
- newdat1=.false.; ldofft=.false.; npos=0
- cxx=cx
- endif
-
- df=0.0625 ! 12000.0/NFFT1
-! tonewidth=6.25 Hz ! 12000.0/1920.
- i0=nint(f0/df)
- ft=f0+55.75; it=min(nint(ft/df),96000)
- fb=f0-5.75; ib=max(1,nint(fb/df))
- c1=cmplx(0.0,0.0)
- k=it-ib
- c1(0:k)=cxx(ib:it)
- c1(0:54)=c1(0:54)*windowc1(54:0:-1)
- c1(k-54:k)=c1(k-54:k)*windowc1
- c1=cshift(c1,i0-ib)
- if(lhighsens) then; c1(0)=c1(0)*1.93; c1(799)=c1(799)*1.7; c1(800)=c1(800)*1.7; c1(3199)=c1(3199)*1.93
- else; c1(45)=c1(45)*1.49; c1(54)=c1(54)*1.49; c1(3145)=c1(3145)*1.49; c1(3154)=c1(3154)*1.49
- endif ! 10346..10347
- call four2avar(c1,NFFT2,1,1,1) !c2c FFT back to time domain
- c0(-800:-1)=0.; c0(0:3199)=facc1*c1(0:3199); c0(3200:4000)=0.
- if(nqso.gt.1) then
- c2(-800:-1)=0.; c2(3200:4000)=0.
- do i=0,3198; c2(i)=c0(i)+c0(i+1); enddo
- c2(3199)=c0(3199); c2=c2/2
- endif
- if(nqso.eq.3) then
- c3(-800:-1)=0.; c3(3200:4000)=0.
- do i=1,3199; c3(i)=c0(i-1)+c0(i); enddo
- c3(0)=c0(0); c3=c3/2
- endif
-
- return
-end subroutine ft8_downsamplevar
+subroutine ft8_downsamplevar(newdat1,f0,nqso,c0,c2,c3,lhighsens,lsubtracted,npos,freqsub) + +! Downconvert to complex data sampled at 200 Hz ==> 32 samples/symbol + use ft8_mod1, only : dd8,windowc1,facc1 + parameter (NFFT1=192000,NFFT2=3200) !192000/60 = 3200 + + logical newdat1 + complex, intent(out) :: c0(-800:4000),c2(-800:4000),c3(-800:4000) + complex cx(0:96000),cxx(0:96000),c1(0:3199) ! 0:NFFT1/2 + real x(NFFT1) + real, intent(in) :: f0 + integer, intent(in) :: nqso + real freqsub(200) + logical(1), intent(in) :: lhighsens + logical(1) lsubtracted,ldofft + equivalence (x,cx) + save cxx + + ldofft=.false. + if(lsubtracted) then + do i=1,npos + if(abs(f0-freqsub(i)).lt.50.) then; ldofft=.true.; lsubtracted=.false.; exit; endif + enddo + endif + + if(newdat1 .or. ldofft) then +! Data in dd have changed, recompute the long FFT + x(1:180000)=dd8 + x(180001:NFFT1)=0. !Zero-pad the x array + call four2avar(cx,NFFT1,1,-1,0) !r2c FFT to freq domain + newdat1=.false.; ldofft=.false.; npos=0 + cxx=cx + endif + + df=0.0625 ! 12000.0/NFFT1 +! tonewidth=6.25 Hz ! 12000.0/1920. + i0=nint(f0/df) + ft=f0+55.75; it=min(nint(ft/df),96000) + fb=f0-5.75; ib=max(1,nint(fb/df)) + c1=cmplx(0.0,0.0) + k=it-ib + c1(0:k)=cxx(ib:it) + c1(0:54)=c1(0:54)*windowc1(54:0:-1) + c1(k-54:k)=c1(k-54:k)*windowc1 + c1=cshift(c1,i0-ib) + if(lhighsens) then; c1(0)=c1(0)*1.93; c1(799)=c1(799)*1.7; c1(800)=c1(800)*1.7; c1(3199)=c1(3199)*1.93 + else; c1(45)=c1(45)*1.49; c1(54)=c1(54)*1.49; c1(3145)=c1(3145)*1.49; c1(3154)=c1(3154)*1.49 + endif ! 10346..10347 + call four2avar(c1,NFFT2,1,1,1) !c2c FFT back to time domain + c0(-800:-1)=0.; c0(0:3199)=facc1*c1(0:3199); c0(3200:4000)=0. + if(nqso.gt.1) then + c2(-800:-1)=0.; c2(3200:4000)=0. + do i=0,3198; c2(i)=c0(i)+c0(i+1); enddo + c2(3199)=c0(3199); c2=c2/2 + endif + if(nqso.eq.3) then + c3(-800:-1)=0.; c3(3200:4000)=0. + do i=1,3199; c3(i)=c0(i-1)+c0(i); enddo + c3(0)=c0(0); c3=c3/2 + endif + + return +end subroutine ft8_downsamplevar diff --git a/lib/ft8var/ft8_mod1.f90 b/lib/ft8var/ft8_mod1.f90 index aba90550..8bfe3027 100755..100644 --- a/lib/ft8var/ft8_mod1.f90 +++ b/lib/ft8var/ft8_mod1.f90 @@ -1,203 +1,203 @@ -module ft8_mod1
-
- parameter (NPS=180000,NFR=151680,NFILT1=4000,NFILT2=3400,numcqsig=20, &
- numdeccq=40,nummycsig=5,numdecmyc=25,nmaxthreads=24)
- real*4 dd8(nps)
- real endcorr(NFILT1/2+1)
- complex cw(nps),csync(0:6,32),csynce(0:18,32),csyncsd(0:18,32), &
- csyncsdcq(0:57,32),csynccq(0:7,32),ctwkw(11,32),ctwkn(11,32), &
- ctwk256(256)
- character*37 allmessages(200),msgsd76(76),msg(56),msgroot,msgincall(174)
- character lasthcall*12,mycall12_0*12,mycall12_00*12,hiscall12_0*12, &
- hisgrid4*4,hisgrid*6 !ft8md w3sz added hisgrid
- character(len=12) :: mycall,hiscall,mybcall,hisbcall
- real allfreq(200),windowc1(0:54),windowx(0:200),pivalue,facx,twopi, &
- facc1,dt,sumxdtt(24),avexdt,xdtincall(174)
- integer itone76(76,79),idtone76(76,58),itone56(56,79),idtone56(56,58), &
- idtone25(25,58),allsnrs(200),apsym(58),idtonemyc(58),mcq(29), &
- mrrr(19),m73(19),mrr73(19),naptypes(0:5,27),icos7(0:6), &
- graymap(0:7),nappasses(0:5),nmsg,ndecodes,nlasttx,mycalllen1, &
- msgrootlen,nfawide,nfbwide,nhaptypes(0:5,27),apsymsp(66), &
- apsymdxns1(58),apsymdxnsrrr(77),ndxnsaptypes(0:5,27),apcqsym(77), &
- apsymdxnsrr73(77),apsymdxns73(77),nft8cycles,ncandallthr(24), &
- maskincallthr(25),nincallthr(24),idtonecqdxcns(58),apsymmyns1(29), &
- apsymmyns2(58),apsymmynsrr73(77),apsymmyns73(77), &
- nmycnsaptypes(0:5,27),apsymdxstd(58),apsymdxnsr73(77), &
- apsymdxns732(77),apsymmynsrrr(77),idtonedxcns73(58), &
- idtonefox73(58),idtonespec(58),nintcount
- integer*1 gen(91,174)
- logical one(0:511,0:8),lqsomsgdcd,first_osd
- logical(1) lapmyc,lagcc,lagccbail,lhound,lenabledxcsearch, &
- lwidedxcsearch,lmultinst,lskiptx1,ltxing
- data maskincallthr/0,30,45,55,65,75,85,90,95,100,105,110,115,120,125, &
- 130,135,140,145,150,155,160,165,170,175/
- data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/
- data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/
- data m73/0,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,1/
- data mrr73/0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1/
- data icos7/3,1,4,0,6,5,2/
- data graymap/0,1,3,2,5,6,4,7/
- data mycall12_0/'dummy'/
- data mycall12_00/'dummy'/
- data hiscall12_0/'dummy'/
-
-! Hound OFF, MyCall is standard, DXCall is standard or empty
- data naptypes(0,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36, &
- 36,36,35,35,35/ ! Tx6 CQ
- data naptypes(1,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36, &
- 36,36,35,35,35/ ! Tx1 Grid
- data naptypes(2,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36, &
- 36,36,35,35,35/ ! Tx2 Report
- data naptypes(3,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,0,0,0,0,0,0,31,31,31,36, &
- 36,36,35,35,35/ ! Tx3 RRreport
- data naptypes(4,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,2,2,2,0,0,0,31,31,31,36, &
- 36,36,35,35,35/ ! Tx4 RRR,RR73
- data naptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36, &
- 36,36,35,35,35/ ! Tx5 73
-
-! Hound OFF, MyCall is non-standard, DXCall is standard or empty
- data nmycnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31, &
- 31,31,36,36,36,35,35,35/ ! Tx6 CQ
- data nmycnsaptypes(1,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31, &
- 31,31,36,36,36,35,35,35/ ! Tx1 DXcall MyCall
- data nmycnsaptypes(2,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31, &
- 31,31,36,36,36,35,35,35/ ! Tx2 Report
- data nmycnsaptypes(3,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,0,0,0,0, &
- 0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport
- data nmycnsaptypes(4,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,40,40,40,&
- 0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73
- data nmycnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,31,&
- 31,36,36,36,35,35,35/ ! Tx5 73
-
-! Hound mode
- data nhaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0, &
- 111,111,111/ ! Tx6 CQ, possible in idle mode if DXCall is empty
- data nhaptypes(1,1:27)/21,21,21,22,22,22,0,0,0,0,0,0,0,0,0,31,31,31,0,0,&
- 0,36,36,36,0,0,0/ ! Tx1 Grid idle mode or transmitting
- data nhaptypes(2,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, &
- 0,0,0/ ! Tx2 none
- data nhaptypes(3,1:27)/21,21,21,22,22,22,23,23,23,24,24,24,0,0,0,0,0,0, &
- 0,0,0,0,0,0,0,0,0/ ! Tx3 RRreport QSO in progress or QSO is finished
- data nhaptypes(4,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, &
- 0,0,0/ ! Tx4 none
- data nhaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, &
- 0,0,0/ ! Tx5 none
-
-!Non-standard DXCall
- data ndxnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31, &
- 36,36,36,35,35,35/ ! Tx6 CQ
- data ndxnsaptypes(1,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31, &
- 31,36,36,36,35,35,35/ ! Tx1 Grid
- data ndxnsaptypes(2,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31, &
- 31,36,36,36,35,35,35/ ! Tx2 Report
- data ndxnsaptypes(3,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,0,0,0,0, &
- 0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport
- data ndxnsaptypes(4,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,2,2,2,0, &
- 0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73
- data ndxnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31, &
- 36,36,36,35,35,35/ ! Tx5 73
- data nintcount/0/
- data avexdt/0.0/
- data first_osd/.true./
-
- type odd_struct
- real freq
- real dt
- logical lstate
- character*37 msg
- end type odd_struct
- type(odd_struct) odd(130)
-
- type even_struct
- real freq
- real dt
- logical lstate
- character*37 msg
- end type even_struct
- type(even_struct) even(130)
-
- type oddcopy_struct
- real freq
- real dt
- logical lstate
- character*37 msg
- end type oddcopy_struct
- type(oddcopy_struct) oddcopy(130)
-
- type evencopy_struct
- real freq
- real dt
- logical lstate
- character*37 msg
- end type evencopy_struct
- type(evencopy_struct) evencopy(130)
-
- type lastrxmsg_struct
- real xdt
- logical lstate
- character*37 lastmsg
- end type lastrxmsg_struct
- type (lastrxmsg_struct) lastrxmsg(1)
- data lastrxmsg%lstate/.false./
-
- type callsigndtodd_struct
- real dt
- character*12 call2
- end type callsigndtodd_struct
- type (callsigndtodd_struct) calldtodd(150)
-
- type callsigndteven_struct
- real dt
- character*12 call2
- end type callsigndteven_struct
- type (callsigndteven_struct) calldteven(150)
-
- type incall_struct
- real xdt
- character*37 msg
- end type incall_struct
- type (incall_struct) incall(30)
-
- type evencq_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type evencq_struct
- type(evencq_struct) evencq(numcqsig,nmaxthreads) ! 24 threads
-
- type oddcq_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type oddcq_struct
- type(oddcq_struct) oddcq(numcqsig,nmaxthreads)
-
- type evenmyc_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type evenmyc_struct
- type(evenmyc_struct) evenmyc(nummycsig,nmaxthreads)
-
- type oddmyc_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type oddmyc_struct
- type(oddmyc_struct) oddmyc(nummycsig,nmaxthreads)
-
- type evenqso_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type evenqso_struct
- type(evenqso_struct) evenqso(1,nmaxthreads)
-
- type oddqso_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type oddqso_struct
- type(oddqso_struct) oddqso(1,nmaxthreads)
-
-end module ft8_mod1
+module ft8_mod1 + + parameter (NPS=180000,NFR=151680,NFILT1=4000,NFILT2=3400,numcqsig=20, & + numdeccq=40,nummycsig=5,numdecmyc=25,nmaxthreads=24) + real*4 dd8(nps) + real endcorr(NFILT1/2+1) + complex cw(nps),csync(0:6,32),csynce(0:18,32),csyncsd(0:18,32), & + csyncsdcq(0:57,32),csynccq(0:7,32),ctwkw(11,32),ctwkn(11,32), & + ctwk256(256) + character*37 allmessages(200),msgsd76(76),msg(56),msgroot,msgincall(174) + character lasthcall*12,mycall12_0*12,mycall12_00*12,hiscall12_0*12, & + hisgrid4*4,hisgrid*6 !ft8md w3sz added hisgrid + character(len=12) :: mycall,hiscall,mybcall,hisbcall + real allfreq(200),windowc1(0:54),windowx(0:200),pivalue,facx,twopi, & + facc1,dt,sumxdtt(24),avexdt,xdtincall(174) + integer itone76(76,79),idtone76(76,58),itone56(56,79),idtone56(56,58), & + idtone25(25,58),allsnrs(200),apsym(58),idtonemyc(58),mcq(29), & + mrrr(19),m73(19),mrr73(19),naptypes(0:5,27),icos7(0:6), & + graymap(0:7),nappasses(0:5),nmsg,ndecodes,nlasttx,mycalllen1, & + msgrootlen,nfawide,nfbwide,nhaptypes(0:5,27),apsymsp(66), & + apsymdxns1(58),apsymdxnsrrr(77),ndxnsaptypes(0:5,27),apcqsym(77), & + apsymdxnsrr73(77),apsymdxns73(77),nft8cycles,ncandallthr(24), & + maskincallthr(25),nincallthr(24),idtonecqdxcns(58),apsymmyns1(29), & + apsymmyns2(58),apsymmynsrr73(77),apsymmyns73(77), & + nmycnsaptypes(0:5,27),apsymdxstd(58),apsymdxnsr73(77), & + apsymdxns732(77),apsymmynsrrr(77),idtonedxcns73(58), & + idtonefox73(58),idtonespec(58),nintcount + integer*1 gen(91,174) + logical one(0:511,0:8),lqsomsgdcd,first_osd + logical(1) lapmyc,lagcc,lagccbail,lhound,lenabledxcsearch, & + lwidedxcsearch,lmultinst,lskiptx1,ltxing + data maskincallthr/0,30,45,55,65,75,85,90,95,100,105,110,115,120,125, & + 130,135,140,145,150,155,160,165,170,175/ + data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/ + data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/ + data m73/0,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,1/ + data mrr73/0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1/ + data icos7/3,1,4,0,6,5,2/ + data graymap/0,1,3,2,5,6,4,7/ + data mycall12_0/'dummy'/ + data mycall12_00/'dummy'/ + data hiscall12_0/'dummy'/ + +! Hound OFF, MyCall is standard, DXCall is standard or empty + data naptypes(0,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36, & + 36,36,35,35,35/ ! Tx6 CQ + data naptypes(1,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36, & + 36,36,35,35,35/ ! Tx1 Grid + data naptypes(2,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36, & + 36,36,35,35,35/ ! Tx2 Report + data naptypes(3,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,0,0,0,0,0,0,31,31,31,36, & + 36,36,35,35,35/ ! Tx3 RRreport + data naptypes(4,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,2,2,2,0,0,0,31,31,31,36, & + 36,36,35,35,35/ ! Tx4 RRR,RR73 + data naptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36, & + 36,36,35,35,35/ ! Tx5 73 + +! Hound OFF, MyCall is non-standard, DXCall is standard or empty + data nmycnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31, & + 31,31,36,36,36,35,35,35/ ! Tx6 CQ + data nmycnsaptypes(1,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31, & + 31,31,36,36,36,35,35,35/ ! Tx1 DXcall MyCall + data nmycnsaptypes(2,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31, & + 31,31,36,36,36,35,35,35/ ! Tx2 Report + data nmycnsaptypes(3,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,0,0,0,0, & + 0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport + data nmycnsaptypes(4,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,40,40,40,& + 0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73 + data nmycnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,31,& + 31,36,36,36,35,35,35/ ! Tx5 73 + +! Hound mode + data nhaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0, & + 111,111,111/ ! Tx6 CQ, possible in idle mode if DXCall is empty + data nhaptypes(1,1:27)/21,21,21,22,22,22,0,0,0,0,0,0,0,0,0,31,31,31,0,0,& + 0,36,36,36,0,0,0/ ! Tx1 Grid idle mode or transmitting + data nhaptypes(2,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, & + 0,0,0/ ! Tx2 none + data nhaptypes(3,1:27)/21,21,21,22,22,22,23,23,23,24,24,24,0,0,0,0,0,0, & + 0,0,0,0,0,0,0,0,0/ ! Tx3 RRreport QSO in progress or QSO is finished + data nhaptypes(4,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, & + 0,0,0/ ! Tx4 none + data nhaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, & + 0,0,0/ ! Tx5 none + +!Non-standard DXCall + data ndxnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31, & + 36,36,36,35,35,35/ ! Tx6 CQ + data ndxnsaptypes(1,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31, & + 31,36,36,36,35,35,35/ ! Tx1 Grid + data ndxnsaptypes(2,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31, & + 31,36,36,36,35,35,35/ ! Tx2 Report + data ndxnsaptypes(3,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,0,0,0,0, & + 0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport + data ndxnsaptypes(4,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,2,2,2,0, & + 0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73 + data ndxnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31, & + 36,36,36,35,35,35/ ! Tx5 73 + data nintcount/0/ + data avexdt/0.0/ + data first_osd/.true./ + + type odd_struct + real freq + real dt + logical lstate + character*37 msg + end type odd_struct + type(odd_struct) odd(130) + + type even_struct + real freq + real dt + logical lstate + character*37 msg + end type even_struct + type(even_struct) even(130) + + type oddcopy_struct + real freq + real dt + logical lstate + character*37 msg + end type oddcopy_struct + type(oddcopy_struct) oddcopy(130) + + type evencopy_struct + real freq + real dt + logical lstate + character*37 msg + end type evencopy_struct + type(evencopy_struct) evencopy(130) + + type lastrxmsg_struct + real xdt + logical lstate + character*37 lastmsg + end type lastrxmsg_struct + type (lastrxmsg_struct) lastrxmsg(1) + data lastrxmsg%lstate/.false./ + + type callsigndtodd_struct + real dt + character*12 call2 + end type callsigndtodd_struct + type (callsigndtodd_struct) calldtodd(150) + + type callsigndteven_struct + real dt + character*12 call2 + end type callsigndteven_struct + type (callsigndteven_struct) calldteven(150) + + type incall_struct + real xdt + character*37 msg + end type incall_struct + type (incall_struct) incall(30) + + type evencq_struct + real freq + real xdt + complex cs(0:7,79) + end type evencq_struct + type(evencq_struct) evencq(numcqsig,nmaxthreads) ! 24 threads + + type oddcq_struct + real freq + real xdt + complex cs(0:7,79) + end type oddcq_struct + type(oddcq_struct) oddcq(numcqsig,nmaxthreads) + + type evenmyc_struct + real freq + real xdt + complex cs(0:7,79) + end type evenmyc_struct + type(evenmyc_struct) evenmyc(nummycsig,nmaxthreads) + + type oddmyc_struct + real freq + real xdt + complex cs(0:7,79) + end type oddmyc_struct + type(oddmyc_struct) oddmyc(nummycsig,nmaxthreads) + + type evenqso_struct + real freq + real xdt + complex cs(0:7,79) + end type evenqso_struct + type(evenqso_struct) evenqso(1,nmaxthreads) + + type oddqso_struct + real freq + real xdt + complex cs(0:7,79) + end type oddqso_struct + type(oddqso_struct) oddqso(1,nmaxthreads) + +end module ft8_mod1 diff --git a/lib/ft8var/ft8_params.f90 b/lib/ft8var/ft8_params.f90 index d8e57840..4a4159db 100755..100644 --- a/lib/ft8var/ft8_params.f90 +++ b/lib/ft8var/ft8_params.f90 @@ -1,12 +1,12 @@ -! LDPC (174,91) code
-parameter (KK=91) !Information bits (77 + CRC14)
-parameter (ND=58) !Data symbols
-parameter (NS=21) !Sync symbols (3 @ Costas 7x7)
-parameter (NN=79) !Total channel symbols NS+ND (79)
-parameter (NSPS=1920) !Samples per symbol at 12000 S/s
-parameter (NZ=151680) !Samples in full 15 s waveform NSPS*NN (151,680)
-parameter (NMAX=180000) !Samples in iwave 15s*12000 (180,000)
-parameter (NFFT1=3840, NH1=1920) !Length of FFTs for symbol spectra NFFT1=2*NSPS, NH1=NFFT1/2
-parameter (NSTEP=480) !Rough time-sync step size NSTEP=NSPS/4
-parameter (NHSYM=372) !Number of symbol spectra (1/4-sym steps) NHSYM=NMAX/NSTEP-3
-parameter (NDOWN=60) !Downsample factor
+! LDPC (174,91) code +parameter (KK=91) !Information bits (77 + CRC14) +parameter (ND=58) !Data symbols +parameter (NS=21) !Sync symbols (3 @ Costas 7x7) +parameter (NN=79) !Total channel symbols NS+ND (79) +parameter (NSPS=1920) !Samples per symbol at 12000 S/s +parameter (NZ=151680) !Samples in full 15 s waveform NSPS*NN (151,680) +parameter (NMAX=180000) !Samples in iwave 15s*12000 (180,000) +parameter (NFFT1=3840, NH1=1920) !Length of FFTs for symbol spectra NFFT1=2*NSPS, NH1=NFFT1/2 +parameter (NSTEP=480) !Rough time-sync step size NSTEP=NSPS/4 +parameter (NHSYM=372) !Number of symbol spectra (1/4-sym steps) NHSYM=NMAX/NSTEP-3 +parameter (NDOWN=60) !Downsample factor diff --git a/lib/ft8var/ft8apsetvar.f90 b/lib/ft8var/ft8apsetvar.f90 index 3999691b..6a247a38 100755..100644 --- a/lib/ft8var/ft8apsetvar.f90 +++ b/lib/ft8var/ft8apsetvar.f90 @@ -1,216 +1,216 @@ -subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
-
- use packjt77var
- use ft8_mod1, only : apsym,mycall,hiscall,apsymsp,lhound,apsymdxns1,apsymdxnsrrr,mybcall,hisbcall,apcqsym,hisgrid4, &
- apsymdxnsrr73,apsymdxns73,apsymmyns1,apsymmyns2,apsymmynsrr73,apsymmyns73,apsymdxstd,apsymdxnsr73, &
- apsymdxns732,apsymmynsrrr
- character*77 c77
- character*37 msg,msgchk
- character*12 hiscallt,mycallprev,hiscallprev
- logical lnohiscall,unpk77_success,first
- logical(1) lhoundprev
- logical(1), intent(in) :: lmycallstd,lhiscallstd
- data mycallprev/'QQ2QQ'/
- data hiscallprev/'QQ1QQ'/
- data lhoundprev/.false./
- data first/.true./
- save hiscallprev,mycallprev,lhoundprev,first
-
- if(hiscall.ne.hiscallprev .or. mycall.ne.mycallprev .or. (lhound.neqv.lhoundprev) .or. first) then ! first for lhound triggered
-
- first=.false.; mycallprev=mycall; lhoundprev=lhound
-
-! shall hash both callsigns for making AP masks with nonstandard callsign message
- if(.not.lhound) call fillhashvar(numthreads,.true.)
-
- lnohiscall=.false.
- hiscallt=hiscall
- if(len_trim(hiscallt).lt.3) then
- hiscallt=mycall ! use mycall for dummy hiscall - mycall won't be hashed
- lnohiscall=.true.
- endif
-
- if(hiscall.ne.hiscallprev) then
- hiscallprev=hiscall
-! Encode a dummy standard message: i3=1, 28 1 28 1 1 15
- if(len_trim(hiscall).gt.2) then
- if(lhiscallstd .and. len_trim(hisgrid4).eq.4) then; msg='CQ '//trim(hiscall)//' '//trim(hisgrid4)
- else; msg='CQ '//trim(hiscall)
- endif
-
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(lhiscallstd .and. i3.ne.1 .or. .not.lhiscallstd .and. i3.ne.4 .or. (msg.ne.msgchk) .or. .not.unpk77_success) go to 1
- read(c77,'(77i1)',err=1) apcqsym(1:77)
- apcqsym=2*apcqsym-1
- endif
-
- if(lhiscallstd .and. .not.lmycallstd) then
- msg=trim(hiscall)//' '//trim(hiscall)//' RRR'
- i3=0; n3=0
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_success) go to 2
- read(c77,'(58i1)',err=2) apsymdxstd(1:58)
- apsymdxstd=2*apsymdxstd-1
- endif
-
- if(.not.lhound .and. .not.lhiscallstd .and. len_trim(hiscall).gt.2) then
-! nonstandard DXCall searching
- msg='<W9XYZ> '//trim(hiscall)//' RR73'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.4 .or. .not.unpk77_success) go to 3
- read(c77,'(77i1)',err=3) apsymdxnsrr73(1:77)
- apsymdxnsrr73=2*apsymdxnsrr73-1
-
- msg='<W9XYZ> '//trim(hiscall)//' 73'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.4 .or. .not.unpk77_success) go to 4
- read(c77,'(77i1)',err=4) apsymdxns73(1:77)
- apsymdxns73=2*apsymdxns73-1
- endif
- endif
-
- if(.not.lhound .and. .not.lmycallstd .and. len_trim(mycall).gt.2) then
- if(lhiscallstd) then
- msg='<'//trim(mycall)//'> '//trim(hiscall)//' -15'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
- if(i3.ne.1 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 5
- read(c77,'(58i1)',err=5) apsymmyns2(1:58)
- apsymmyns2=2*apsymmyns2-1
-
- nlenmyc=len_trim(mycall)
- msg=trim(mycall)//' <'//trim(hiscall)//'> RR73'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
- if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 6
- read(c77,'(77i1)',err=6) apsymmynsrr73(1:77)
- apsymmynsrr73=2*apsymmynsrr73-1
- msg=trim(mycall)//' <'//trim(hiscall)//'> 73'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
- if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 7
- read(c77,'(77i1)',err=7) apsymmyns73(1:77)
- apsymmyns73=2*apsymmyns73-1
- msg=trim(mycall)//' <'//trim(hiscall)//'> RRR'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
- if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 15
- read(c77,'(77i1)',err=15) apsymmynsrrr(1:77)
- apsymmynsrrr=2*apsymmynsrrr-1
-
- else if(lnohiscall) then
-
- msg='<'//trim(mycall)//'> ZZ1ZZZ -15'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
- if(i3.ne.1 .or. msgchk.ne.msg .or. .not.unpk77_success) go to 8
- read(c77,'(29i1)',err=8) apsymmyns1(1:29)
- apsymmyns1=2*apsymmyns1-1
- endif
- endif
-
- if(len_trim(mycall).lt.3) return
-
- if(.not.lhound .and. lmycallstd .and. (lhiscallstd .or. lnohiscall)) then
- msg=trim(mycall)//' '//trim(hiscallt)//' RRR'
- i3=0; n3=0
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_success) go to 9
- read(c77,'(58i1)',err=9) apsym(1:58)
- apsym=2*apsym-1; if(lnohiscall) apsym(30)=99
- endif
-
- if(lhound) then
-! standard messages from Fox, always base callsigns
- if(len_trim(hisbcall).gt.2 .and. len_trim(mybcall).gt.2) then
- msg=trim(mybcall)//' '//trim(hisbcall)//' -15'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_success) go to 9
- read(c77,'(58i1)',err=9) apsym(1:58)
- apsym=2*apsym-1
- else
- apsym(30)=99
- endif
-
-! special messages
- msg=trim(mycall)//' RR73; '//trim(mycall)//' <'//trim(hiscallt)//'> -16'
- i3=0; n3=1
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- i1=0; i1=index(msgchk,'<'); if(i1.lt.15) return
- if(i3.ne.0 .or. msg(1:i1).ne.msgchk(1:i1) .or. .not.unpk77_success) go to 10
- read(c77,'(66i1)',err=10) apsymsp(1:66)
- apsymsp=2*apsymsp-1!; if(lnohiscall) apsymsp(30)=99
- endif
-
- if(.not.lhound .and. lmycallstd .and. .not.lhiscallstd .and. len_trim(hiscall).gt.2) then
- msg=trim(mycall)//' <'//trim(hiscall)//'> -16' ! report, rreport
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.1 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 11
- read(c77,'(58i1)',err=11) apsymdxns1(1:58)
- apsymdxns1=2*apsymdxns1-1
-
- msg='<'//trim(mycall)//'> '//trim(hiscall)//' RRR'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 12
- read(c77,'(77i1)',err=12) apsymdxnsrrr(1:77)
- apsymdxnsrrr=2*apsymdxnsrrr-1
-
- msg='<'//trim(mycall)//'> '//trim(hiscall)//' RR73'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 13
- read(c77,'(77i1)',err=13) apsymdxnsr73(1:77)
- apsymdxnsr73=2*apsymdxnsr73-1
-
- msg='<'//trim(mycall)//'> '//trim(hiscall)//' 73'
- call pack77var(msg,i3,n3,c77,0)
- call unpack77var(c77,1,msgchk,unpk77_success,25)
-!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
- if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_success) go to 14
- read(c77,'(77i1)',err=14) apsymdxns732(1:77)
- apsymdxns732=2*apsymdxns732-1
- endif
-
- endif
-
- go to 32
-
-1 apcqsym=0; apcqsym(1)=99; apcqsym(30)=99; go to 32
-2 apsymdxstd=0; apsymdxstd(1)=99; apsymdxstd(30)=99; go to 32
-3 apsymdxnsrr73=0; apsymdxnsrr73(1)=99; apsymdxnsrr73(30)=99; go to 32
-4 apsymdxns73=0; apsymdxns73(1)=99; apsymdxns73(30)=99; go to 32
-5 apsymmyns2=0; apsymmyns2(1)=99; apsymmyns2(30)=99; go to 32
-6 apsymmynsrr73=0; apsymmynsrr73(1)=99; apsymmynsrr73(30)=99; go to 32
-7 apsymmyns73=0; apsymmyns73(1)=99; apsymmyns73(30)=99; go to 32
-8 apsymmyns1=0; apsymmyns1(1)=99; go to 32
-9 apsym=0; apsym(1)=99; apsym(30)=99; go to 32
-10 apsymsp=0; apsymsp(1)=99; apsymsp(30)=99; go to 32
-11 apsymdxns1=0; apsymdxns1(1)=99; apsymdxns1(30)=99; go to 32
-12 apsymdxnsrrr=0; apsymdxnsrrr(1)=99; apsymdxnsrrr(30)=99; go to 32
-13 apsymdxnsr73=0; apsymdxnsr73(1)=99; apsymdxnsr73(30)=99; go to 32
-14 apsymdxns732=0; apsymdxns732(1)=99; apsymdxns732(30)=99; go to 32
-15 apsymmynsrrr=0; apsymmynsrrr(1)=99; apsymmynsrrr(30)=99; go to 32
-
-32 continue
-
- return
-end subroutine ft8apsetvar
+subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads) + + use packjt77 + use ft8_mod1, only : apsym,mycall,hiscall,apsymsp,lhound,apsymdxns1,apsymdxnsrrr,mybcall,hisbcall,apcqsym,hisgrid4, & + apsymdxnsrr73,apsymdxns73,apsymmyns1,apsymmyns2,apsymmynsrr73,apsymmyns73,apsymdxstd,apsymdxnsr73, & + apsymdxns732,apsymmynsrrr + character*77 c77 + character*37 msg,msgchk + character*12 hiscallt,mycallprev,hiscallprev + logical lnohiscall,unpk77_successvar,first + logical(1) lhoundprev + logical(1), intent(in) :: lmycallstd,lhiscallstd + data mycallprev/'QQ2QQ'/ + data hiscallprev/'QQ1QQ'/ + data lhoundprev/.false./ + data first/.true./ + save hiscallprev,mycallprev,lhoundprev,first + + if(hiscall.ne.hiscallprev .or. mycall.ne.mycallprev .or. (lhound.neqv.lhoundprev) .or. first) then ! first for lhound triggered + + first=.false.; mycallprev=mycall; lhoundprev=lhound + +! shall hash both callsigns for making AP masks with nonstandard callsign message + if(.not.lhound) call fillhashvar(numthreads,.true.) + + lnohiscall=.false. + hiscallt=hiscall + if(len_trim(hiscallt).lt.3) then + hiscallt=mycall ! use mycall for dummy hiscall - mycall won't be hashed + lnohiscall=.true. + endif + + if(hiscall.ne.hiscallprev) then + hiscallprev=hiscall +! Encode a dummy standard message: i3=1, 28 1 28 1 1 15 + if(len_trim(hiscall).gt.2) then + if(lhiscallstd .and. len_trim(hisgrid4).eq.4) then; msg='CQ '//trim(hiscall)//' '//trim(hisgrid4) + else; msg='CQ '//trim(hiscall) + endif + + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(lhiscallstd .and. i3.ne.1 .or. .not.lhiscallstd .and. i3.ne.4 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 1 + read(c77,'(77i1)',err=1) apcqsym(1:77) + apcqsym=2*apcqsym-1 + endif + + if(lhiscallstd .and. .not.lmycallstd) then + msg=trim(hiscall)//' '//trim(hiscall)//' RRR' + i3=0; n3=0 + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 2 + read(c77,'(58i1)',err=2) apsymdxstd(1:58) + apsymdxstd=2*apsymdxstd-1 + endif + + if(.not.lhound .and. .not.lhiscallstd .and. len_trim(hiscall).gt.2) then +! nonstandard DXCall searching + msg='<W9XYZ> '//trim(hiscall)//' RR73' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.4 .or. .not.unpk77_successvar) go to 3 + read(c77,'(77i1)',err=3) apsymdxnsrr73(1:77) + apsymdxnsrr73=2*apsymdxnsrr73-1 + + msg='<W9XYZ> '//trim(hiscall)//' 73' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.4 .or. .not.unpk77_successvar) go to 4 + read(c77,'(77i1)',err=4) apsymdxns73(1:77) + apsymdxns73=2*apsymdxns73-1 + endif + endif + + if(.not.lhound .and. .not.lmycallstd .and. len_trim(mycall).gt.2) then + if(lhiscallstd) then + msg='<'//trim(mycall)//'> '//trim(hiscall)//' -15' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) + if(i3.ne.1 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 5 + read(c77,'(58i1)',err=5) apsymmyns2(1:58) + apsymmyns2=2*apsymmyns2-1 + + nlenmyc=len_trim(mycall) + msg=trim(mycall)//' <'//trim(hiscall)//'> RR73' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) + if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 6 + read(c77,'(77i1)',err=6) apsymmynsrr73(1:77) + apsymmynsrr73=2*apsymmynsrr73-1 + msg=trim(mycall)//' <'//trim(hiscall)//'> 73' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) + if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 7 + read(c77,'(77i1)',err=7) apsymmyns73(1:77) + apsymmyns73=2*apsymmyns73-1 + msg=trim(mycall)//' <'//trim(hiscall)//'> RRR' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) + if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 15 + read(c77,'(77i1)',err=15) apsymmynsrrr(1:77) + apsymmynsrrr=2*apsymmynsrrr-1 + + else if(lnohiscall) then + + msg='<'//trim(mycall)//'> ZZ1ZZZ -15' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) + if(i3.ne.1 .or. msgchk.ne.msg .or. .not.unpk77_successvar) go to 8 + read(c77,'(29i1)',err=8) apsymmyns1(1:29) + apsymmyns1=2*apsymmyns1-1 + endif + endif + + if(len_trim(mycall).lt.3) return + + if(.not.lhound .and. lmycallstd .and. (lhiscallstd .or. lnohiscall)) then + msg=trim(mycall)//' '//trim(hiscallt)//' RRR' + i3=0; n3=0 + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 9 + read(c77,'(58i1)',err=9) apsym(1:58) + apsym=2*apsym-1; if(lnohiscall) apsym(30)=99 + endif + + if(lhound) then +! standard messages from Fox, always base callsigns + if(len_trim(hisbcall).gt.2 .and. len_trim(mybcall).gt.2) then + msg=trim(mybcall)//' '//trim(hisbcall)//' -15' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 9 + read(c77,'(58i1)',err=9) apsym(1:58) + apsym=2*apsym-1 + else + apsym(30)=99 + endif + +! special messages + msg=trim(mycall)//' RR73; '//trim(mycall)//' <'//trim(hiscallt)//'> -16' + i3=0; n3=1 + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + i1=0; i1=index(msgchk,'<'); if(i1.lt.15) return + if(i3.ne.0 .or. msg(1:i1).ne.msgchk(1:i1) .or. .not.unpk77_successvar) go to 10 + read(c77,'(66i1)',err=10) apsymsp(1:66) + apsymsp=2*apsymsp-1!; if(lnohiscall) apsymsp(30)=99 + endif + + if(.not.lhound .and. lmycallstd .and. .not.lhiscallstd .and. len_trim(hiscall).gt.2) then + msg=trim(mycall)//' <'//trim(hiscall)//'> -16' ! report, rreport + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.1 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 11 + read(c77,'(58i1)',err=11) apsymdxns1(1:58) + apsymdxns1=2*apsymdxns1-1 + + msg='<'//trim(mycall)//'> '//trim(hiscall)//' RRR' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 12 + read(c77,'(77i1)',err=12) apsymdxnsrrr(1:77) + apsymdxnsrrr=2*apsymdxnsrrr-1 + + msg='<'//trim(mycall)//'> '//trim(hiscall)//' RR73' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 13 + read(c77,'(77i1)',err=13) apsymdxnsr73(1:77) + apsymdxnsr73=2*apsymdxnsr73-1 + + msg='<'//trim(mycall)//'> '//trim(hiscall)//' 73' + call pack77var(msg,i3,n3,c77,0) + call unpack77var(c77,1,msgchk,unpk77_successvar,25) +!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk + if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 14 + read(c77,'(77i1)',err=14) apsymdxns732(1:77) + apsymdxns732=2*apsymdxns732-1 + endif + + endif + + go to 32 + +1 apcqsym=0; apcqsym(1)=99; apcqsym(30)=99; go to 32 +2 apsymdxstd=0; apsymdxstd(1)=99; apsymdxstd(30)=99; go to 32 +3 apsymdxnsrr73=0; apsymdxnsrr73(1)=99; apsymdxnsrr73(30)=99; go to 32 +4 apsymdxns73=0; apsymdxns73(1)=99; apsymdxns73(30)=99; go to 32 +5 apsymmyns2=0; apsymmyns2(1)=99; apsymmyns2(30)=99; go to 32 +6 apsymmynsrr73=0; apsymmynsrr73(1)=99; apsymmynsrr73(30)=99; go to 32 +7 apsymmyns73=0; apsymmyns73(1)=99; apsymmyns73(30)=99; go to 32 +8 apsymmyns1=0; apsymmyns1(1)=99; go to 32 +9 apsym=0; apsym(1)=99; apsym(30)=99; go to 32 +10 apsymsp=0; apsymsp(1)=99; apsymsp(30)=99; go to 32 +11 apsymdxns1=0; apsymdxns1(1)=99; apsymdxns1(30)=99; go to 32 +12 apsymdxnsrrr=0; apsymdxnsrrr(1)=99; apsymdxnsrrr(30)=99; go to 32 +13 apsymdxnsr73=0; apsymdxnsr73(1)=99; apsymdxnsr73(30)=99; go to 32 +14 apsymdxns732=0; apsymdxns732(1)=99; apsymdxns732(30)=99; go to 32 +15 apsymmynsrrr=0; apsymmynsrrr(1)=99; apsymmynsrrr(30)=99; go to 32 + +32 continue + + return +end subroutine ft8apsetvar diff --git a/lib/ft8var/ft8bvar.f90 b/lib/ft8var/ft8bvar.f90 index 54004883..6a12b933 100755..100644 --- a/lib/ft8var/ft8bvar.f90 +++ b/lib/ft8var/ft8bvar.f90 @@ -1,2952 +1,2956 @@ -subroutine ft8bvar(newdat1,nQSOProgress,nfqso,nftx,napwid,lsubtract,npos,freqsub, &
- tmpcqdec,tmpmyc,nagainfil,iaptype,f1,xdt,nbadcrc,lft8sdec,msg37,msg37_2, &
- xsnr,stophint,nthr,lFreeText,ipass,lft8subpass,lspecial,lcqcand,ncqsignal, &
- nmycsignal,npass,i3bit,lft8s,lmycallstd,lhiscallstd,levenint,loddint,lft8sd, &
- i3,n3,nft8rxfsens,ncount,msgsrcvd,lrepliedother,lhashmsg,lqsothread, &
- lft8lowth,lhighsens,lsubtracted,tmpcqsig,tmpmycsig,tmpqsosig,lnohiscall, &
- lnomycall,lnohisgrid,qual,iaptype2)
-
- use packjt77var, only : unpack77var
- use ft8_mod1, only : allmessages,ndecodes,apsym,mcq,m73,mrr73,mrrr,icos7, &
- naptypes,nhaptypes,one,graymap,oddcopy,evencopy,lastrxmsg,lasthcall, &
- nlasttx,calldteven,calldtodd,lqsomsgdcd,mycalllen1,msgroot,msgrootlen, &
- allfreq,idtone25,lapmyc,idtonemyc,mycall,hiscall,lhound,apsymsp, &
- ndxnsaptypes,apsymdxns1,apsymdxnsrrr,lenabledxcsearch,lwidedxcsearch, &
- apcqsym,apsymdxnsrr73,apsymdxns73,mybcall,hisbcall,lskiptx1,nft8cycles, &
- ctwkw,ctwkn,nincallthr,msgincall,xdtincall,maskincallthr,ctwk256,numcqsig, &
- numdeccq,evencq,oddcq,nummycsig,numdecmyc,evenmyc,oddmyc,idtone56, &
- idtonecqdxcns,evenqso,oddqso,nmycnsaptypes,apsymmyns1,apsymmyns2, &
- apsymmynsrr73,apsymmyns73,apsymdxstd,apsymdxnsr73,apsymdxns732,ltxing, &
- apsymmynsrrr,idtonedxcns73,idtonefox73,idtonespec !ft8md added
-
- include 'ft8_params.f90'
- character c77*77,msg37*37,msg37_2*37,msgd*37,msgbase37*37,call_a*12,call_b*12
- character callsign*12,grid*12
- character*37 msgsrcvd(130)
- complex cd0(-800:4000),cd1(-800:4000),cd2(-800:4000),cd3(-800:4000),ctwk(32), &
- csymb(32),cs(0:7,79),csymbr(32),csr(0:7,79),csig(32),csig0(151680),z1, &
- csymb256(256),cstmp2(0:7,79),csold(0:7,79),cscs(0:7,79)
- real a(5),s8(0:7,79),s82(0:7,79),s2(0:511),sp(0:7),s81(0:7),snrsync(21), &
- syncw(7),sumkw(7),scoreratiow(7),freqsub(200),s256(0:8),s2563(0:26), &
- syncavpart(3)
- real bmeta(174),bmetb(174),bmetc(174),bmetd(174)
- real llra(174),llrb(174),llrc(174),llrd(174),llrz(174)
- real qual !ft8md
- integer*1 message77(77),apmask(174),cw(174),nsmax(8)
- integer itone(79),ip(1),ka(1),nqsoend(3)
- integer, intent(in) :: nQSOProgress,nfqso,nftx,napwid,nthr,ipass,nft8rxfsens
- logical newdat1,lsubtract,lFreeText,nagainfil,lspecial,unpk77_success
- logical(1), intent(in) :: stophint,lft8subpass,lmycallstd,lhiscallstd, &
- lqsothread,lft8lowth,lhighsens,lcqcand,levenint,loddint,lnohiscall, &
- lnomycall,lnohisgrid
- logical(1) falsedec,lastsync,ldupemsg,lft8s,lft8sdec,lft8sd,lsdone,ldupeft8sd, &
- lrepliedother,lhashmsg,lvirtual2,lvirtual3,lsd,lcq,ldeepsync,lcallsstd, &
- lfound,lsubptxfreq,lreverse,lchkcall,lgvalid,lwrongcall,lsubtracted, &
- lcqsignal,loutapwid,lfoundcq,lmycsignal,lfoundmyc,lqsosig,ldxcsig, &
- lcqdxcsig,lcqdxcnssig,lqsocandave,lcall1hash,lqsosigtype3,lqso73,lqsorr73, &
- lqsorrr,lfoxspecrpt,lfoxstdr73,lapcqonly,lcall2hash,lskipnotap
- integer iaptype2
-
- type tmpcqdec_struct
- real freq
- real xdt
- end type tmpcqdec_struct
- type(tmpcqdec_struct) tmpcqdec(numdeccq)
-
- type tmpcqsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpcqsig_struct
- type(tmpcqsig_struct) tmpcqsig(numcqsig) ! 20 sigs 24 threads
-
- type tmpmyc_struct
- real freq
- real xdt
- end type tmpmyc_struct
- type(tmpmyc_struct) tmpmyc(numdecmyc)
-
- type tmpmycsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpmycsig_struct
- type(tmpmycsig_struct) tmpmycsig(nummycsig) ! 5 sigs
-
- type tmpqsosig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpqsosig_struct
- type(tmpqsosig_struct) tmpqsosig(1)
-
- iaptype2 = 99 !ft8md
-
- max_iterations=30
- nharderrors=-1
- nbadcrc=1
- delfbest=0.
- ibest=0
- dfqso=500.
- rrxdt=0.5
- fs2=200.
- dt2=0.005 ! fs2=12000.0/NDOWN; dt2=1.0/fs2
- lcall1hash=.false.
- lcall2hash=.false.
- lskipnotap=.false.
- ldeepsync=.false.
- if(lft8lowth .or. lft8subpass) ldeepsync=.true.
- lcallsstd=.true.
- if(.not.lmycallstd .or. .not.lhiscallstd) lcallsstd=.false.
-
- xdt0=xdt
- f10=f1
-! apply last freq f1 and last DT criteria here
- nqso=1
- if(lqsothread .and. .not. lft8sdec .and. .not.lqsomsgdcd .and. .not.stophint &
- .and. nlasttx.ge.1 .and. nlasttx.le.4 .and. abs(f10-nfqso).lt.2.51) then
- if(lastrxmsg(1)%lstate .and. abs(lastrxmsg(1)%xdt-xdt).lt.0.18) then
- nqso=2
- elseif(.not.lastrxmsg(1)%lstate) then
- nqso=2
- endif
- endif
-
- lvirtual2=.false.
- lvirtual3=.false.
- maxlasttx=4
- if(lqsothread .and. .not. lft8sdec .and. .not.lqsomsgdcd) then
- if(len_trim(hiscall).gt.2) then
- if(xdt.gt.4.9 .or. xdt.lt.-4.9) then
- if(lastrxmsg(1)%lstate .and. trim(lastrxmsg(1)%lastmsg).eq.trim(msgroot)//&
- ' RRR') maxlasttx=5
- endif
- if(xdt.gt.4.9) then
- if(.not.stophint .and. nlasttx.ge.1 .and. nlasttx.le.maxlasttx .and. &
- abs(f10-nfqso).lt.0.1) then
- if(lastrxmsg(1)%lstate) then
- xdt0=lastrxmsg(1)%xdt
- nqso=2
- lvirtual2=.true.
- endif
- if(.not.lastrxmsg(1)%lstate) then
- if(levenint) then
- do i=1,150
- if(trim(calldteven(i)%call2).eq.trim(hiscall)) then
- xdt0=calldteven(i)%dt
- nqso=3
- lvirtual2=.true.
- exit
- endif
- enddo
- else if(loddint) then
- do i=1,150
- if(trim(calldtodd(i)%call2).eq.trim(hiscall)) then
- xdt0=calldtodd(i)%dt
- nqso=3
- lvirtual2=.true.
- exit
- endif
- enddo
- endif
- endif
- endif
- elseif (xdt.lt.-4.9) then
- if(.not.stophint .and. nlasttx.ge.1 .and. nlasttx.le.maxlasttx .and. &
- abs(f10-nfqso).lt.0.1) then
- if(lastrxmsg(1)%lstate) then
- xdt0=lastrxmsg(1)%xdt
- nqso=3
- lvirtual3=.true.
- endif
- if(.not.lastrxmsg(1)%lstate) then
- if(levenint) then
- do i=1,150
- if(trim(calldteven(i)%call2).eq.trim(hiscall)) then
- xdt0=calldteven(i)%dt
- nqso=3
- lvirtual3=.true.
- exit
- endif
- enddo
- else if(loddint) then
- do i=1,150
- if(trim(calldtodd(i)%call2).eq.trim(hiscall)) then
- xdt0=calldtodd(i)%dt
- nqso=3
- lvirtual3=.true.
- exit
- endif
- enddo
- endif
- endif
- endif
- endif
- endif
- endif
-
- call ft8_downsamplevar(newdat1,f1,nqso,cd0,cd2,cd3,lhighsens,lsubtracted,npos, &
- freqsub) !Mix f1 to baseband and downsample
-
- lsd=.false.
- isd=1
- lcq=.false.
- if(levenint) then
- do i=1,130
- if(.not.evencopy(i)%lstate) cycle
- if(abs(evencopy(i)%freq-f1).lt.3.0 .and. abs(evencopy(i)%dt-xdt).lt.0.19) then
- msgd=evencopy(i)%msg
- lsd=.true.
- isd=i
- if(msgd(1:3).eq.'CQ ' .or. msgd(1:3).eq.'DE ' .or. &
- msgd(1:4).eq.'QRZ ') lcq=.true.
- endif
- enddo
- elseif(loddint) then
- do i=1,130
- if(.not.oddcopy(i)%lstate) cycle
- if(abs(oddcopy(i)%freq-f1).lt.3.0 .and. abs(oddcopy(i)%dt-xdt).lt.0.19) then
- msgd=oddcopy(i)%msg
- lsd=.true.
- isd=i
- if(msgd(1:3).eq.'CQ ' .or. msgd(1:3).eq.'DE ' .or. &
- msgd(1:4).eq.'QRZ ') lcq=.true.
- endif
- enddo
- endif
-
- if(lsd .and. nqso.eq.1) nqso=4
-
-!nlasttx last TX message
-! 0 Tx was halted
-! 1 AA1AA BB1BB PL35
-! 2 AA1AA BB1BB -15
-! 3 AA1AA BB1BB R-15
-! 4 AA1AA BB1BB RRR/RR73
-! 5 AA1AA BB1BB 73
-! 6 CQ BB1BB PL35
-
- if(nqso.eq.4) cd1=cd0
- do iqso=1,nqso
- lapcqonly=.false.
- if(iqso.gt.1 .and. iqso.lt.4 .and. nqso.eq.4) cycle
- if(xdt0.lt.-4.9 .or. xdt0.gt.4.9) cycle
- if(lvirtual2 .and. iqso.ne.2) cycle
- if(lvirtual3 .and. iqso.lt.2) cycle
- if((lvirtual2 .or. lvirtual3) .and. nft8rxfsens.lt.3 .and. iqso.eq.3) cycle
- lastsync=.false.
- lsdone=.false.
- if(.not.lvirtual2 .and. .not.lvirtual3 .and. iqso.eq.2) then
- cd0=cd2
- elseif(lvirtual2 .and. iqso.eq.2) then
- cd0=cd2
- elseif(lvirtual3 .and. iqso.eq.2) then
- cd0=cd3
- endif
- if(iqso.eq.4) then
- call tonesdvar(msgd,lcq)
- if(.not.ldeepsync) go to 32
- cd0=cd1
- endif
- if(iqso.eq.3) go to 16
- i0=nint((xdt0+0.5)*fs2) !Initial guess for start of signal
- smax=0.0
- ctwk=cmplx(1.0,0.0)
- do idt=i0-8,i0+8 !Search over +/- one quarter symbol
- call sync8dvar(cd0,idt,ctwk,0,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand)
- if(sync.gt.smax) then
- smax=sync
- ibest=idt
- endif
- enddo
- xdt2=ibest*dt2 !Improved estimate for DT
-
- ! Now peak up in frequency
- i0=nint(xdt2*fs2)
- smax=0.0
- kstep=1
- do ifr=-5,5
- if(iqso.eq.1 .or. iqso.eq.4) then
- ctwk=ctwkw(kstep,:)
- delf=ifr*0.5 ! Search over +/- 2.5 Hz
- else
- ctwk=ctwkn(kstep,:)
- delf=ifr*0.25 ! Search over +/- 1.25 Hz
- endif
- call sync8dvar(cd0,i0,ctwk,1,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand)
- if(sync.gt.smax) then
- smax=sync
- delfbest=delf
- endif
- kstep=kstep+1
- enddo
- a=0.0
- a(1)=-delfbest
- call twkfreq1var(cd0,-800,3199,4000,fs2,a,cd0)
- xdt=xdt2
- f1=f10+delfbest !Improved estimate of DF
- dfqso=abs(nfqso-f1)
- lastsync=.true.
- call sync8dvar(cd0,i0,ctwk,2,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand)
-
-16 if(iqso.eq.3) ibest=ibest+1
-
- syncav=3.
- syncavpart=3.
- snrsync=0.
- do k=1,79
- i1=ibest+(k-1)*32
- csymb=cd0(i1:i1+31)
- if((k.ge.1 .and. k.le.7) .or. (k.ge.37 .and. k.le.43) .or. &
- (k.ge.73 .and. k.le.79)) then
- call four2avar(csymb,32,1,-1,1)
- s81(0:7)=abs(csymb(1:8))
- if(k.ge.1 .and. k.le.7) then
- synclev=s81(icos7(k-1))
- snoiselev=(sum(s81)-synclev)/7.0
- if(snoiselev.gt.1.E-16) snrsync(k)=synclev/snoiselev
- else if(k.ge.37 .and. k.le.43) then
- synclev=s81(icos7(k-37))
- snoiselev=(sum(s81)-synclev)/7.0
- if(snoiselev.gt.1.E-16) snrsync(k-29)=synclev/snoiselev
- else if(k.ge.73 .and. k.le.79) then
- synclev=s81(icos7(k-73))
- snoiselev=(sum(s81)-synclev)/7.0
- if(snoiselev.gt.1.E-16) snrsync(k-58)=synclev/snoiselev
- endif
- else
- cycle
- endif
- enddo
-
- syncav=sum(snrsync)/21.
- syncavpart(1)=sum(snrsync(1:7))/7.
- syncavpart(2)=sum(snrsync(8:14))/7.
- syncavpart(3)=sum(snrsync(15:21))/7.
- syncavemax=maxval(syncavpart,1)
-
-! plev=0.0
-! do k=1000,1009; abscd=abs(cd0(k)); if(abscd.gt.plev) plev=abscd; enddo
-! plev=plev/61.0
-! do k=0,3199; xx=plev*gran(); yy=plev*gran(); cd0(k)=cd0(k) + complex(xx,yy); enddo
-
- lreverse=.false.
- if(nft8cycles.lt.2) then
- if(ipass.eq.2) lreverse=.true.
- else
- if(ipass.eq.5 .or. ipass.eq.7) lreverse=.true.
- endif
-
- do k=1,79
- i1=ibest+(k-1)*32
- csymb=cd0(i1:i1+31)
- if(syncav.lt.2.5) then
- csymb(1)=csymb(1)*1.9
- csymb(32)=csymb(32)*1.9
- scr=SQRT(abs(csymb(1)))/SQRT(abs(csymb(32)))
- if(scr.gt.1.0) then
- csymb(32)=csymb(32)*scr
- else
- if(scr.gt.1.E-16) csymb(1)=csymb(1)/scr
- endif
- endif
- do i=1,32
- csymbr(i)=cmplx(real(csymb(33-i)),-aimag(csymb(33-i)))
- enddo
- if(lreverse) then
- call four2avar(csymb,32,1,-1,1)
- cscs(0:7,k)=csymb(1:8)/1e3
- csymb=csymbr
- endif
- call four2avar(csymb,32,1,-1,1)
- cs(0:7,k)=csymb(1:8)/1e3
- if(lreverse) then
- csr=cs
- else
- call four2avar(csymbr,32,1,-1,1)
- csr(0:7,k)=csymbr(1:8)/1e3
- endif
- s8(0:7,k)=abs(csymb(1:8))
- enddo
-
- sp=0.
- do k=0,7
- sp(k)=sum(s8(k,1:7))+sum(s8(k,18:79))
- enddo
- ka=minloc(sp)-1
- k=ka(1)
- if(k.lt.0) go to 128
- do kb=0,7
- if(kb.eq.k) cycle
- spr=sp(kb)/sp(k)
- if(spr.gt.1.5) then
- s8(kb,:)=s8(kb,:)/spr
- sprsqr=SQRT(spr)
- cs(kb,:)=cs(kb,:)/sprsqr
- csr(kb,:)=csr(kb,:)/sprsqr
- cscs(kb,:)=cscs(kb,:)/sprsqr
- endif
- enddo
-128 continue
-
- if(iqso.gt.1 .and. iqso.lt.4) then
- s82=SQRT(s8)
- go to 8
- endif
- if(iqso.eq.4) go to 32
-
- nsyncscorew=0
- scoreratiowa=0.
- rrxdt=xdt-0.5
- if(rrxdt.ge.-0.5 .and. rrxdt.le.2.13) then
- do k=1,7
- syncw(icos7(k-1)+1)=s8(icos7(k-1),k)+s8(icos7(k-1),k+36) + &
- s8(icos7(k-1),k+72)
- enddo
- do k=1,7
- sumkw(k)=(sum(s8(k-1,:))-syncw(k))/25.333
- enddo ! (79-3)/3
- else if(rrxdt.lt.-0.5) then
- do k=1,7
- syncw(icos7(k-1)+1)=s8(icos7(k-1),k+36)+s8(icos7(k-1),k+72)
- enddo
- do k=1,7
- sumkw(k)=(sum(s8(k-1,26:79))-syncw(k))/26.
- enddo ! (54-2)/2
- else if(rrxdt.gt.2.13) then
- do k=1,7
- syncw(icos7(k-1)+1)=s8(icos7(k-1),k)+s8(icos7(k-1),k+36)
- enddo
- do k=1,7
- sumkw(k)=(sum(s8(k-1,1:54))-syncw(k))/26.
- enddo ! (54-2)/2
- endif
- do k=1,7
- if(syncw(k).gt.sumkw(k)) nsyncscorew=nsyncscorew+1
- scoreratiow(k)=syncw(k)/sumkw(k)
- enddo
- scoreratiowa=sum(scoreratiow)/7.
-
-! sync quality check
- is1=0
- is2=0
- is3=0
- nsyncscore=0
- nsyncscore1=0
- nsyncscore2=0
- nsyncscore3=0
- scoreratio=0.
- scoreratio1=0.
- scoreratio2=0.
- scoreratio3=0.
- nsync2=0
- do k=1,7
- s81(:)=s8(:,k)
- ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- is1=is1+1
- else
- s81(ip(1)-1)=0.
- ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) nsync2=nsync2+1
- endif
- s81=s8(:,k+36)
- ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- is2=is2+1
- else
- s81(ip(1)-1)=0.
- ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) nsync2=nsync2+1
- endif
- s81=s8(:,k+72)
- ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- is3=is3+1
- else
- s81(ip(1)-1)=0.
- ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) nsync2=nsync2+1
- endif
- if(rrxdt.ge.-0.5) then
- synck=s8(icos7(k-1),k)
- sumk=(sum(s8(:,k))-synck)/7.0
- if(synck.gt.sumk) then
- nsyncscore1=nsyncscore1+1
- scoreratio1=scoreratio1+synck/sumk
- endif
- endif
- synck=s8(icos7(k-1),k+36)
- sumk=(sum(s8(:,k+36))-synck)/7.0
- if(synck.gt.sumk) then
- nsyncscore2=nsyncscore2+1
- scoreratio2=scoreratio2+synck/sumk
- endif
- if(rrxdt.le.2.13) then
- synck=s8(icos7(k-1),k+72)
- sumk=(sum(s8(:,k+72))-synck)/7.0
- if(synck.gt.sumk) then
- nsyncscore3=nsyncscore3+1
- scoreratio3=scoreratio3+synck/sumk
- endif
- endif
- enddo
- nsyncscore=nsyncscore1+nsyncscore2+nsyncscore3
- scoreratio=scoreratio1+scoreratio2+scoreratio3
-! hard sync sum - max is 21
- nsync=is1+is2+is3
-! bail out
- rscq=0.
- if(lcqcand) then
- do k11=8,16
- ip=maxloc(s8(:,k11))
- if(k11.lt.16) then
- if(ip(1).eq.1) rscq=rscq+1.
- else
- if(ip(1).eq.2) rscq=rscq+1.
- endif
- enddo
- ip=maxloc(s8(:,17))
- if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5
- ip=maxloc(s8(:,27))
- if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5
- ip=maxloc(s8(:,33))
- if(ip(1).eq.3 .or. ip(1).eq.4) rscq=rscq+0.5
- endif
- if(lcqcand .and. nsync.eq.4) then
- if(nsync+nsync2.lt.12) then
- if(rscq.lt.6.6) then
- nbadcrc=1
- return
- endif
- endif
- lapcqonly=.true.
- else if(lcqcand .and. nsync.eq.5) then
- if(nsync+nsync2.lt.12) then
- if(rscq.lt.6.1) then
- nbadcrc=1
- return
- endif
- endif
- lapcqonly=.true.
- else if(lcqcand .and. nsync.eq.6) then
- if(nsync+nsync2.lt.11) then
- if(rscq.lt.5.6) then
- nbadcrc=1
- return
- endif
- endif
- lapcqonly=.true.
- else
- if(nsync.lt.7) then
- nbadcrc=1
- return
- endif
- endif
-
- lskipnotap=.false.
- if(.not.lapcqonly .and. nsync.lt.11) then
- nsmax=0
- do k=1,7
- s81=s8(:,k)
- include 'syncdist.f90'
- s81=s8(:,k+36)
- include 'syncdist.f90'
- s81=s8(:,k+72)
- include 'syncdist.f90'
- enddo
- if(sum(nsmax(7:8)).gt.sum(nsmax(2:3)) .or. &
- sum(nsmax(5:6)).gt.sum(nsmax(2:3))) lskipnotap=.true.
- endif
-
-! if(lcqcand .and. nsync.lt.7 .and. nsync.gt.1) then
-! if(nsync+nsync2.lt.9) then
-! rscq=0.
-! do k11=8,16
-! ip=maxloc(s8(:,k11))
-! if(k11.lt.16) then; if(ip(1).eq.1) rscq=rscq+1.; else; if(ip(1).eq.2) rscq=rscq+1.; endif
-! enddo
-! ip=maxloc(s8(:,17)); if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5
-! ip=maxloc(s8(:,27)); if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5
-! ip=maxloc(s8(:,33)); if(ip(1).eq.3 .or. ip(1).eq.4) rscq=rscq+0.5
-! if(rscq.lt.4.9) then; nbadcrc=1; return; endif
-! endif
-! else
-! if(nsync.lt.7) then; nbadcrc=1; return; endif
-! endif
-
- if(nsyncscore.gt.0) then
- scoreratio=scoreratio/nsyncscore
- else
- scoreratio=0.
- endif
- if(nsyncscore1.gt.0) then
- scoreratio1=scoreratio1/nsyncscore1
- else
- scoreratio1=0.
- endif
- if(nsyncscore3.gt.0) then
- scoreratio3=scoreratio3/nsyncscore3
- else
- scoreratio3=0.
- endif
-
- if(dfqso.ge.2.0 .or. (dfqso.lt.2.0 .and. stophint)) then
- if(rrxdt.ge.-0.5 .and. rrxdt.le.2.13) then
- if(nsyncscore.lt.8 .or. (nsyncscore.lt.10 .and. scoreratio.lt.5.5) .or. &
- (nsyncscore.lt.11 .and. scoreratio.lt.3.63)) then
- nbadcrc=1
- return ! 377 out of 20709
- else if(nsyncscore.eq.11 .and. scoreratio.lt.5.37) then
- if(nsyncscore1.lt.5 .and. nsyncscore3.lt.5 .and. scoreratio1.lt.4.2 &
- .and. scoreratio3.lt.4.2) then
- nbadcrc=1
- return ! 261
- endif
- else if(nsyncscore.eq.12 .and. scoreratio.lt.4.6) then
- if(nsyncscore1.lt.5 .and. nsyncscore3.lt.5 .and. scoreratio1.lt.4.0 &
- .and. scoreratio3.lt.4.0) then
- nbadcrc=1
- return ! 222
- endif
- else if(nsyncscore.eq.13 .and. scoreratio.lt.4.4) then
- if(nsyncscore1.lt.5 .and. nsyncscore2.lt.6 .and. nsyncscore3.lt.5 &
- .and. scoreratio1.lt.4.4 .and. scoreratio3.lt.4.4) then
- nbadcrc=1
- return ! 98
- endif
- else if(nsyncscorew.lt.3) then
- if((nsyncscore1.gt.5 .and. scoreratio1.gt.13.8) .or. &
- (nsyncscore2.gt.5 .and. scoreratio2.gt.13.8) .or. &
- (nsyncscore3.gt.5 .and. scoreratio3.gt.13.8)) go to 32
- nbadcrc=1
- return ! 75
- else if(nsyncscorew.eq.3) then
- if(scoreratio1.gt.15. .or. scoreratio2.gt.15. .or. scoreratio3.gt.15.) &
- go to 32
- nbadcrc=1
- return ! 125
- else if(nsyncscorew.eq.4) then
- if(nsyncscore1.eq.7 .or. nsyncscore2.eq.7 .or. nsyncscore3.eq.7 .or. &
- scoreratio1.gt.10. .or. scoreratio2.gt.10. .or. &
- scoreratio3.gt.10.) go to 32
- nbadcrc=1
- return ! 94
- else if(nsyncscorew.eq.5) then
- if(nsyncscore.gt.17 .or. nsyncscore1.eq.7 .or. nsyncscore2.eq.7 .or. &
- nsyncscore3.eq.7 .or. scoreratio1.gt.10. .or. &
- scoreratio2.gt.10. .or. scoreratio3.gt.10.) go to 32
- nbadcrc=1
- return ! 131
- endif
- else if(rrxdt.lt.-0.5) then
- if(nsyncscore.lt.6 .or. (nsyncscore.gt.5 .and. nsyncscore.lt.8 .and. &
- nsyncscorew.lt.6 .and. scoreratio2.lt.5.5 .and. &
- scoreratio3.lt.5.5)) then
- nbadcrc=1
- return ! 46
- else if(nsyncscore.eq.8) then
- if(nsyncscore2.lt.6 .and. nsyncscore3.lt.6 .and. scoreratio2.lt.6.6 &
- .and. scoreratio3.lt.6.6) then
- nbadcrc=1
- return ! 20
- endif
- else if(nsyncscore.eq.9 .and. scoreratio.lt.6.0) then
- if(nsyncscore2.lt.6 .and. nsyncscore3.lt.6 .and. scoreratio2.lt.6.6 &
- .and. scoreratio3.lt.6.5) then
- nbadcrc=1
- return ! 5
- endif
- else if(nsyncscorew.lt.3) then
- if((nsyncscore2.gt.5 .and. scoreratio2.gt.13.8) .or. &
- (nsyncscore3.gt.5 .and. scoreratio3.gt.13.8)) go to 32
- nbadcrc=1
- return ! 22
- else if(nsyncscorew.eq.3) then
- if(scoreratio2.gt.15. .or. nsyncscore3.gt.15) go to 32
- nbadcrc=1
- return ! 31
- else if(nsyncscorew.eq.4) then
- if(nsyncscore2.eq.7 .or. nsyncscore3.eq.7 .or. scoreratio2.gt.10. &
- .or. nsyncscore3.gt.10) go to 32
- nbadcrc=1
- return ! 34
- else if(nsyncscorew.eq.5) then
- if(nsyncscore.gt.11 .or. nsyncscore2.eq.7 .or. nsyncscore3.eq.7 &
- .or. scoreratio2.gt.10. .or. scoreratio3.gt.10.) go to 32
- nbadcrc=1
- return ! 35
- endif
- else if(rrxdt.gt.2.13) then
- if(nsyncscore.lt.6 .or. (nsyncscore.gt.5 .and. nsyncscore.lt.8 .and. &
- nsyncscorew.lt.6 .and. scoreratio1.lt.5.5 .and. &
- scoreratio2.lt.5.5)) then
- nbadcrc=1
- return ! 4
- else if(nsyncscore.eq.8) then
- if(nsyncscore1.lt.6 .and. nsyncscore2.lt.6 .and. scoreratio1.lt.6.6 &
- .and. scoreratio2.lt.6.6) then
- nbadcrc=1
- return ! 8
- endif
- else if(nsyncscore.eq.9 .and. scoreratio.lt.6.0) then
- if(nsyncscore1.lt.6 .and. nsyncscore2.lt.6 .and. scoreratio2.lt.6.6 &
- .and. scoreratio1.lt.6.5) then
- nbadcrc=1
- return ! 2
- endif
- else if(nsyncscorew.lt.3) then
- if((nsyncscore1.gt.5 .and. scoreratio1.gt.13.8) .or. &
- (nsyncscore2.gt.5 .and. scoreratio2.gt.13.8)) go to 32
- nbadcrc=1
- return ! 12
- else if(nsyncscorew.eq.3) then
- if(scoreratio1.gt.15. .or. scoreratio2.gt.15.) go to 32
- nbadcrc=1
- return ! 32
- else if(nsyncscorew.eq.4) then
- if(nsyncscore1.eq.7 .or. nsyncscore2.eq.7 .or. scoreratio1.gt.10. &
- .or. nsyncscore2.gt.10) go to 32
- nbadcrc=1
- return ! 103
- else if(nsyncscorew.eq.5) then
- if(nsyncscore.gt.11 .or. nsyncscore1.eq.7 .or. nsyncscore2.eq.7 &
- .or. scoreratio1.gt.10. .or. scoreratio2.gt.10.) go to 32
- nbadcrc=1
- return ! 0
- endif
- endif
- endif
-
-32 if(lsd) then
- if(iqso.eq.4 .and. .not.ldeepsync) go to 64
- call ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq)
- if(lft8sd) then
- if(levenint) then
- evencopy(isd)%lstate=.false.
- elseif(loddint) then
- oddcopy(isd)%lstate=.false.
- endif
- i3=1
- n3=1
- iaptype2=iaptype
- iaptype=0
- nbadcrc=0
- lsd=.false.
- go to 2
- endif
-
-64 if(iqso.eq.4) then
- if(.not.lcq) then
- call ft8mf1var(s8,itone,msgd,msg37,lft8sd)
- if(lft8sd) then
- if(levenint) then
- evencopy(isd)%lstate=.false.
- elseif(loddint) then
- oddcopy(isd)%lstate=.false.
- endif
- i3=1
- n3=1
- iaptype2=iaptype
- iaptype=0
- nbadcrc=0
- lsd=.false.
- go to 2
- endif
- else
- call ft8mfcqvar(s8,itone,msgd,msg37,lft8sd)
- if(lft8sd) then
- if(levenint) then
- evencopy(isd)%lstate=.false.
- elseif(loddint) then
- oddcopy(isd)%lstate=.false.
- endif
- i3=1
- n3=1
- iaptype2=iaptype
- iaptype=0
- nbadcrc=0
- lsd=.false.
- go to 2
- endif
- endif
- endif
- endif
-
- if(iqso.eq.4) then
- nbadcrc=1
- go to 2
- endif
-
- synclev=0.0
- snoiselev=1.0
- do k=1,7
- synclev=synclev+s8(icos7(k-1),k+36)
- enddo
- snoiselev=(sum(s8(0:7,37:43))- synclev)/7.0
- if(snoiselev.lt.0.1) snoiselev=1.0 ! safe division
- srr=synclev/snoiselev
-
-! SNR srr range average srr
-! -18 1.8...4.0 2.9
-! -19 1.7...3.6 2.65
-! -20 1.6...3.3 2.43
-! -21 1.6...3.0 2.22
-! -22 1.55...2.8 2.19
-! -23 1.4...2.6 2.03
-! -24 1.94
-
-8 if(iqso.gt.1 .and. iqso.lt.4) then
- if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. .not.lhiscallstd)) then
- if(.not.lft8sdec .and. dfqso.lt.2.0) then
- if(lvirtual2 .or. lvirtual3) srr=0.0
- call ft8svar(s82,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
- if(lft8s) then
- if(index(msg37,'<').gt.0) then
- lhashmsg=.true.
- endif
- nbadcrc=0
- lft8sdec=.true.
- lsdone=.true.
- go to 2 ! i3=16 n3=16, any affect?
- endif
- endif
- endif
- lsdone=.true.
- nbadcrc=1
- cycle
- endif
-
- i1=ibest+224 ! 7*32
- csymb256=cd0(i1:i1+255)*ctwk256
- call four2avar(csymb256,256,1,-1,1)
- s256(0:8)=abs(csymb256(1:9))
- rscq=0.
- nmic=0
- do k11=8,16
- ip=maxloc(s8(:,k11))
- if(ip(1).eq.idtonemyc(k11-7)+1) nmic=nmic+1
- if(k11.lt.16) then
- if(ip(1).eq.1) rscq=rscq+1.
- else
- if(ip(1).eq.2) rscq=rscq+1.
- endif
- enddo
- ip=maxloc(s8(:,17))
- if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5
- ip=maxloc(s8(:,27))
- if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5
- ip=maxloc(s8(:,33))
- if(ip(1).eq.3 .or. ip(1).eq.4) rscq=rscq+0.5
-
- lqsosig=.false.
- lqsosigtype3=.false.
- lqso73=.false.
- lqsorr73=.false.
- lqsorrr=.false. ! 73/rr73/rrr for std/nonstd callsigns
- if(.not.lqsomsgdcd .and. (dfqso.lt.napwid .or. abs(nftx-f1).lt.napwid) .and. &
- lapmyc .and. len_trim(hiscall).gt.2) then
- nqsot=0
- do i=1,19
- ip=maxloc(s8(:,i+7))
- if(ip(1).eq.idtone56(1,i)+1) nqsot=nqsot+1
- enddo
- if(nqsot.gt.6) lqsosig=.true. ! decoding depth only
- do i=20,22
- ip=maxloc(s8(:,i+7))
- if(ip(1).eq.idtone56(1,i)+1) nqsot=nqsot+1
- enddo
- if(nqsot.gt.3) lqsosigtype3=.true.
- nqsoend=0 ! array 73,rr73,rrr
- if(dfqso.lt.napwid .and. (nQSOProgress.eq.3 .or. nQSOProgress.eq.4)) then
- ! QSO RX freq only
- do i=24,58
- if(i.lt.30) then
- ip=maxloc(s8(:,i+7))
- else
- ip=maxloc(s8(:,i+14))
- endif
- if(ip(1).eq.idtone56(56,i)+1) nqsoend(1)=nqsoend(1)+1
- if(ip(1).eq.idtone56(55,i)+1) nqsoend(2)=nqsoend(2)+1
- if(ip(1).eq.idtone56(54,i)+1) nqsoend(3)=nqsoend(3)+1
- enddo
- ip=maxloc(nqsoend)
- if(nqsoend(ip(1)).gt.6) then
- if(ip(1).eq.1) then
- lqso73=.true.
- else if(ip(1).eq.2) then
- lqsorr73=.true.
- else if(ip(1).eq.3) then
- lqsorrr=.true.
- endif
- endif
- endif
- endif
-
- lcqsignal=.false.
- ip(1)=maxloc(s256,1)
- if(ip(1).eq.5 .or. rscq.gt.3.1) lcqsignal=.true.
- if(.not.lcqsignal .and. ip(1).eq.4 .or. ip(1).eq.6) then
- s2563(0:8)=s256(0:8)
- s2563(9:26)=abs(csymb256(9:26))
- ip(1)=maxloc(s2563,1)
- if(ip(1).eq.4 .or. ip(1).eq.6) lcqsignal=.true.
- endif
- lmycsignal=.false.
- if(lapmyc .and. nmic.gt.2) lmycsignal=.true.
-
- ldxcsig=.false.
- lcqdxcsig=.false.
- lcqdxcnssig=.false.
- ndxt=0
- if(lhiscallstd) then
- do k11=17,26
- ip=maxloc(s8(:,k11))
- if(ip(1).eq.idtone56(1,k11-7)+1) ndxt=ndxt+1
- enddo
- if(ndxt.gt.3) ldxcsig=.true.
- if(lcqsignal .and. ldxcsig) lcqdxcsig=.true.
- endif
-! nonstd DXCall search in idle mode
- if(.not.lhiscallstd .and. len_trim(hiscall).gt.2) then ! nonstandard DXCall
- ncqdxcnst=0
- do i=1,4
- ip=maxloc(s8(:,i+7))
- if(ip(1).eq.idtonecqdxcns(i)+1) ncqdxcnst=ncqdxcnst+1
- enddo
- ndxt=0
- do i=5,23
- ip=maxloc(s8(:,i+7))
- if(ip(1).eq.idtonedxcns73(i)+1) ndxt=ndxt+1
- if(ip(1).eq.idtonecqdxcns(i)+1) ncqdxcnst=ncqdxcnst+1
- enddo
- ldxcsig=.false.
- if(dfqso.lt.napwid) then
- if(ndxt.gt.4) ldxcsig=.true. ! relaxed threshold for RXF napwid
- if(ncqdxcnst.gt.5) lcqdxcnssig=.true.
- else
- if(ndxt.gt.5) ldxcsig=.true.
- if(ncqdxcnst.gt.6) lcqdxcnssig=.true.
- endif
- endif
-
- lfoxstdr73=.false.
- lfoxspecrpt=.false.
- nfoxspecrpt=0 ! checking fo special message with report to mybcall
- if(lhound) then
- nfoxstdbase=0 ! checking for report signal and base of RR73 signal
- nfoxspecr73=0 ! checking fo special message with RR73 to mybcall
- nfoxr73=0 ! checking for RR73 signal with standard message
- fdelta=abs(f1-nfqso)
- fdeltam=modulo(fdelta,60.)
- if(fdelta.lt.245.0 .and. fdeltam.lt.3.0 .and. (nQSOProgress.eq.1 .or. &
- nQSOProgress.eq.3)) then ! calculate on possible Fox frequencies only
- do i=1,18
- ip=maxloc(s8(:,i+7))
- if(ip(1).eq.idtonefox73(i)+1) nfoxstdbase=nfoxstdbase+1
- if(i.gt.10 .and. ip(1).eq.idtonespec(i)+1) nfoxspecrpt=nfoxspecrpt+1
- enddo
- do i=20,22 ! hash10
- ip=maxloc(s8(:,i+7))
- if(ip(1).eq.idtonespec(i)+1) then
- nfoxspecrpt=nfoxspecrpt+1
- nfoxspecr73=nfoxspecr73+1
- endif
- enddo
- ip=maxloc(s8(:,25+7)) ! i3,n3
- if(ip(1).eq.idtonespec(25)+1) then
- nfoxspecrpt=nfoxspecrpt+1
- nfoxspecr73=nfoxspecr73+1
- endif
- if(nfoxstdbase.eq.0) then
- rspecstdrpt=(nfoxspecrpt*18.)/(1.2)
- else
- rspecstdrpt=(nfoxspecrpt*18.)/(12.*nfoxstdbase)
- endif
- if(rspecstdrpt.gt.1.) lfoxspecrpt=.true.
- if(nQSOProgress.eq.3) then
- do i=24,58
- if(i.lt.30) then
- ip=maxloc(s8(:,i+7))
- else
- ip=maxloc(s8(:,i+14))
- endif
- if(ip(1).eq.idtonefox73(i)+1) nfoxr73=nfoxr73+1
- enddo
- if(nfoxspecr73.eq.0) then
- rstdr73=(nfoxr73*4.)/(3.5)
- else
- rstdr73=(nfoxr73*4.)/(35.*nfoxspecr73)
- endif
- if(rstdr73.gt.1.) lfoxstdr73=.true.
- endif
- endif
- endif
-
- lsubptxfreq=.false.
- if(lapmyc .and. abs(f1-nftx).lt.2.0 .and. .not.lhound .and. .not.lft8sdec &
- .and. .not.lqsomsgdcd .and. ((.not.lskiptx1 .and. nlasttx.eq.1) .or. &
- (lskiptx1 .and. nlasttx.eq.2))) lsubptxfreq=.true.
-
- nweak=1
- if(lft8subpass .or. dfqso.lt.2.0 .or. lsubptxfreq) nweak=2
- nsubpasses=nweak
- if(lcqsignal) then
- nsubpasses=3
- if(levenint) then
- do ik=1,numcqsig
- if(evencq(ik,nthr)%freq.gt.5001.) exit
- if(abs(evencq(ik,nthr)%freq-f1).lt.2.0 .and. &
- abs(evencq(ik,nthr)%xdt-xdt).lt.0.05) then
- nsubpasses=5
- csold=evencq(ik,nthr)%cs
- endif
- enddo
- else if (loddint) then
- do ik=1,numcqsig
- if(oddcq(ik,nthr)%freq.gt.5001.) exit
- if(abs(oddcq(ik,nthr)%freq-f1).lt.2.0 .and. &
- abs(oddcq(ik,nthr)%xdt-xdt).lt.0.05) then
- nsubpasses=5
- csold=oddcq(ik,nthr)%cs
- endif
- enddo
- endif
- endif
- if(lmycsignal .and. lmycallstd) then
- nsubpasses=6
- if(levenint) then
- do ik=1,nummycsig
- if(evenmyc(ik,nthr)%freq.gt.5001.) exit
- if(abs(evenmyc(ik,nthr)%freq-f1).lt.2.0 .and. &
- abs(evenmyc(ik,nthr)%xdt-xdt).lt.0.05) then
- nsubpasses=8
- csold=evenmyc(ik,nthr)%cs
- endif
- enddo
- else if (loddint) then
- do ik=1,nummycsig
- if(oddmyc(ik,nthr)%freq.gt.5001.) exit
- if(abs(oddmyc(ik,nthr)%freq-f1).lt.2.0 .and. &
- abs(oddmyc(ik,nthr)%xdt-xdt).lt.0.05) then
- nsubpasses=8
- csold=oddmyc(ik,nthr)%cs
- endif
- enddo
- endif
- endif
- lqsocandave=.false.
- if(lapmyc .and. ndxt.gt.2 .and. nmic.gt.2 .and. .not.lqsomsgdcd .and. &
- lmycallstd .and. lhiscallstd .and. dfqso.lt.napwid/2.0) then
- lqsocandave=.true.
- nsubpasses=9
- if(levenint) then
- if(abs(evenqso(1,nthr)%freq-f1).lt.2.0 .and. &
- abs(evenqso(1,nthr)%xdt-xdt).lt.0.05) then
- nsubpasses=11
- csold=evenqso(1,nthr)%cs
- endif
- else if (loddint) then
- if(abs(oddqso(1,nthr)%freq-f1).lt.2.0 .and. &
- abs(oddqso(1,nthr)%xdt-xdt).lt.0.05) then
- nsubpasses=11
- csold=oddqso(1,nthr)%cs
- endif
- endif
- endif
-
- do isubp1=1,nsubpasses
- if(nweak.eq.1 .and. isubp1.eq.2) cycle
-
- ! skip if it is lmycsignal, can be both lcq and lmy
- if(isubp1.gt.2 .and. isubp1.lt.6 .and. lmycsignal) cycle
-
- syncavemax=3.
- if(isubp1.eq.2) cs=csr
- if(ipass.eq.npass-1 .and. (lcqsignal .or. lmycsignal) .and. &
- ((nweak.eq.1 .and. isubp1.eq.1) .or. (nweak.eq.2 .and. &
- isubp1.eq.2))) cstmp2=cs
- if(ipass.eq.npass .and. lapmyc .and. ndxt.gt.2 .and. nmic.gt.2 .and. &
- ((nweak.eq.1 .and. isubp1.eq.1) .or. &
- (nweak.eq.2 .and. isubp1.eq.2))) cstmp2=cs
- do nsym=1,3
- nt=2**(3*nsym)-1
- do ihalf=1,2
- do k=1,29,nsym
- if(ihalf.eq.1) then
- ks=k+7
- else
- ks=k+43
- endif
- ks1=ks+1
- ks2=ks+2
- do i=0,nt
- i1=i/64
- i2=iand(i,63)/8
- i33=iand(i,7)
- if(isubp1.lt.3) then
- if(nsym.eq.1) then
- s2(i)=abs(cs(graymap(i33),ks))
- elseif(nsym.eq.2) then
- s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i33),ks1))
- else
- s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks1) + &
- cs(graymap(i33),ks2))
- endif
- else if(isubp1.eq.3 .or. isubp1.eq.6 .or. isubp1.eq.9) then
- if(nsym.eq.1) then
- s2(i)=abs(cscs(graymap(i33),ks))**2 + &
- abs(csr(graymap(i33),ks))**2
- elseif(nsym.eq.2) then
- s2(i)=abs(cscs(graymap(i2),ks) + &
- cscs(graymap(i33),ks1))**2 + &
- abs(csr(graymap(i2),ks)+csr(graymap(i33),ks1))**2
- else
- s2(i)=abs(cscs(graymap(i1),ks) + &
- cscs(graymap(i2),ks1)+cscs(graymap(i33),ks2))**2 + &
- abs(csr(graymap(i1),ks)+csr(graymap(i2),ks1) + &
- csr(graymap(i33),ks2))**2
- endif
- else if(isubp1.eq.4 .or. isubp1.eq.7 .or. isubp1.eq.10) then
- if(nsym.eq.1) then
- s2(i)=abs(cs(graymap(i33),ks))**2 + &
- abs(csold(graymap(i33),ks))**2
- elseif(nsym.eq.2) then
- s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i33),ks1))**2 + &
- abs(csold(graymap(i2),ks)+csold(graymap(i33),ks1))**2
- else
- s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks1) + &
- cs(graymap(i33),ks2))**2 + &
- abs(csold(graymap(i1),ks)+csold(graymap(i2),ks1) + &
- csold(graymap(i33),ks2))**2
- endif
- else if(isubp1.eq.5 .or. isubp1.eq.8 .or. isubp1.eq.11) then
- if(nsym.eq.1) then
- s2(i)=abs(cs(graymap(i33),ks))+abs(csold(graymap(i33),ks))
- elseif(nsym.eq.2) then
- s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i33),ks1)) + &
- abs(csold(graymap(i2),ks)+csold(graymap(i33),ks1))
- else
- s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks1) + &
- cs(graymap(i33),ks2)) + &
- abs(csold(graymap(i1),ks)+csold(graymap(i2),ks1) + &
- csold(graymap(i33),ks2))
- endif
- endif
- if(isubp1.eq.1 .and. srr.lt.2.5) then
- ! srr.lt.2.5 -19dB SNR threshold
- if(srr.gt.2.3) then
- s2(i)=s2(i)**2
- else
- ss1=s2(i)
- if(ss1.lt.5.77) then
- s2(i)=1+8.*ss1**2-0.12*ss1**4
- else
- s2(i)=(ss1+5.82)**2
- endif
- endif
- endif
- if(isubp1.gt.1 .and. srr.lt.2.5) then
- s2(i)=(0.5*s2(i))**3 ! -19dB SNR threshold
- endif
- enddo
- i32=1+(k-1)*3+(ihalf-1)*87
- if(nsym.eq.1) ibmax=2
- if(nsym.eq.2) ibmax=5
- if(nsym.eq.3) ibmax=8
- do ib=0,ibmax
- bm=maxval(s2(0:nt),one(0:nt,ibmax-ib)) - &
- maxval(s2(0:nt),.not.one(0:nt,ibmax-ib))
- if(i32+ib .gt.174) cycle
- if(nsym.eq.1) then
- bmeta(i32+ib)=bm
- den=max(maxval(s2(0:nt),one(0:nt,ibmax-ib)), &
- maxval(s2(0:nt),.not.one(0:nt,ibmax-ib)))
- if(den.gt.0.0) then
- cm=bm/den
- else
- cm=0.0
- endif
- bmetd(i32+ib)=cm
- elseif(nsym.eq.2) then
- bmetb(i32+ib)=bm
- elseif(nsym.eq.3) then
- bmetc(i32+ib)=bm
- endif
- enddo
- enddo ! k
- enddo ! ihalf
- enddo ! nsym
-
-!tests
-!call indexx(bmetc(1:174),174,indx)
-!src=abs(bmetc(indx(1))/bmetc(indx(174)))
-!print *,src
-
- call normalizebmetvar(bmeta,174)
- call normalizebmetvar(bmetb,174)
- call normalizebmetvar(bmetc,174)
- call normalizebmetvar(bmetd,174)
- scalefac=2.83
- llra=scalefac*bmeta
- llrb=scalefac*bmetb
- llrc=scalefac*bmetc
- llrd=scalefac*bmetd
- apmag=maxval(abs(llra))*1.01
-
-! isubp2 #
-!------------------------------
-! 1 regular decoding, nsym=1
-! 2 regular decoding, nsym=2
-! 3 regular decoding, nsym=3
-! 4 regular decoding, llrd
-! 5..18 ap passes
-
-! iaptype Hound OFF, MyCall is standard, DXCall is standard or empty
-!------------------------
-! 0 cycle
-! 1 CQ ??? ??? (29+3=32 ap bits)
-! 2 MyCall ??? ??? (29+3=32 ap bits)
-! 3 MyCall DxCall ??? (58+3=61 ap bits)
-! 4 MyCall DxCall RRR (77 ap bits)
-! 5 MyCall DxCall 73 (77 ap bits)
-! 6 MyCall DxCall RR73 (77 ap bits)
-
-! naptypes(nQSOProgress, extra decoding pass)
-! 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
-! 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-! data naptypes(0,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx6 CQ
-! data naptypes(1,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx1 Grid
-! data naptypes(2,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx2 Report
-! data naptypes(3,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,0,0,0,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport
-! data naptypes(4,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,2,2,2,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73
-! data naptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx5 73
-
-! iaptype standard DxCall tracking, also valid in Hound mode
-!------------------------
-! 31 CQ DxCall Grid(???) (77 ap bits)
-! 35 ??? DxCall 73 (29+19 ap bits)
-! 36 ??? DxCall RR73 (29+19 ap bits)
-
-! iaptype Hound off, MyCall is nonstandard, DXCall is standard or empty
-!------------------------
-! 0 cycle
-! 1 CQ ??? ??? (29+3=32 ap bits)
-! 40 <MyCall> ??? ??? (29+3=32 ap bits) incoming call
-! 41 <MyCall> DxCall ??? (58 ap bits) REPORT/RREPORT
-! 42 MyCall <DxCall> RRR (77 ap bits)
-! 43 MyCall <DxCall> 73 (77 ap bits)
-! 44 MyCall <DxCall> RR73 (77 ap bits)
-! 31 CQ DxCall Grid(???) (77 ap bits) standard DxCall tracking
-! 35 ??? DxCall 73 (29+19 ap bits) standard DxCall tracking
-! 36 ??? DxCall RR73 (29+19 ap bits) standard DxCall tracking
-
-! nmycnsaptypes(nQSOProgress, extra decoding pass)
-! data nmycnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx6 CQ
-! data nmycnsaptypes(1,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx1 DXcall MyCall
-! data nmycnsaptypes(2,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx2 Report
-! data nmycnsaptypes(3,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,0,0,0,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport
-! data nmycnsaptypes(4,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,40,40,40,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73
-! data nmycnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx5 73
-
-! iaptype Hound off, MyCall is standard, DXCall is not empty and is nonstandard
-!------------------------
-! 0 cycle
-! 1 CQ ??? ??? (29+3=32 ap bits)
-! 2 MyCall ??? ??? (29+3=32 ap bits)
-! 11 MyCall <DxCall> ??? (58 ap bits) REPORT/RREPORT
-! 12 <MyCall> DxCall RRR (77 ap bits)
-! 13 <MyCall> DxCall 73 (77 ap bits)
-! 14 <MyCall> DxCall RR73 (77 ap bits)
-! 31 CQ DxCall (77 ap bits) ! full compound or just nonstandard callsign
-! 35 ??? DxCall 73 (64 ap bits) ! full compound or just nonstandard callsign
-! 36 ??? DxCall RR73 (64 ap bits) ! full compound or just nonstandard callsign
-
-! ndxnsaptypes(nQSOProgress, extra decoding pass)
-! data ndxnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx6 CQ
-! data ndxnsaptypes(1,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx1 Grid
-! data ndxnsaptypes(2,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx2 Report
-! data ndxnsaptypes(3,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,0,0,0,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport
-! data ndxnsaptypes(4,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,2,2,2,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73
-! data ndxnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx5 73
-
-! iaptype Hound mode
-!------------------------
-! 0 cycle
-! 1 CQ ??? ??? (29+3=32 ap bits) standard callsign
-! 21 MyBaseCall DxBaseCall ??? (58+3=61 ap bits) Report
-! 22 ??? RR73; MyCall <???> ??? (28+6=34 ap bits)
-! 23 MyBaseCall DxBaseCall RR73 (77 ap bits)
-! 24 MyCall RR73; ??? <???> ??? (28+6=34 ap bits)
-! 31 CQ DxCall (DXGrid) (77 ap bits) ! standard/full compound or just nonstandard callsign
-! 36 ??? DxCall RR73 (29+19/64 ap bits) ! standard/ full compound or just nonstandard callsign
-! 111 CQ ??? (3 last i3 bits) type 4 message with nonstandard callsign
-
-! nhaptypes(nQSOProgress, extra decoding pass)
-! data nhaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,111,111,111/ ! Tx6 CQ, possible in idle mode if DXCall is empty
-! data nhaptypes(1,1:27)/21,21,21,22,22,22,0,0,0,0,0,0,0,0,0,31,31,31,0,0,0,36,36,36,0,0,0/ ! Tx1 Grid idle mode or transmitting
-! data nhaptypes(2,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx2 none
-! data nhaptypes(3,1:27)/21,21,21,22,22,22,23,23,23,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx3 RRreport QSO in progress or QSO is finished
-! data nhaptypes(4,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx4 none
-! data nhaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx5 none
-
- loutapwid=.false.
- loutapwid=abs(f1-nfqso).gt.napwid .and. abs(f1-nftx).gt.napwid
- scqnr=2.
- smycnr=2.
-
- ! print*,'stophint is ',stophint,' lft8sdec is ',lft8sdec
- ! print*,'lnohiscall is ',lnohiscall,' loutapwid is ',loutapwid
- ! print*,'lenabledxcsearch ',lenabledxcsearch, ' lwidedxcsearch is ',lwidedxcsearch
- ! print*,'lcqdxcsig is', lcqdxcsig
- ! print*,'lcqsignal is',lcqsignal
- ! print*,'ldxcsig',ldxcsig
- ! print*,'lhiscallstd',lhiscallstd
- ! print*,'mycall ',mycall,mybcall
- ! print*,'hiscall ',hiscall,hisbcall
- ! print*,'hisgrid is ',hisgrid
-
- do isubp2=1,31
- if(isubp2.lt.5) then
- if(lapcqonly .or. lskipnotap) cycle
- if(ltxing) then
- ! enabled Tx and transmitted message including CQ at last interval
- if(abs(f1-nfqso).lt.3.0) then ! +- 3Hz sync8var QSOfreq candidate list
- if(syncavemax.lt.1.8) cycle
- else
- if(syncavemax.lt.1.9) cycle
- endif
- else
- if(syncavemax.lt.1.8) cycle
- endif
- endif
- if(isubp2.eq.4) cycle
- if(isubp1.gt.2 .and. isubp2.lt.5) cycle ! skip regular decoding for extra subpasses
- if(lqsocandave) then
- if(isubp1.gt.2 .and. isubp1.lt.9) cycle ! skip other extra subpasses if QSO signal, highest priority
- if(lqsomsgdcd) cycle
- else if(lmycsignal .and. lmycallstd) then
- if(isubp1.gt.2 .and. isubp1.lt.6) cycle ! skip CQ signal extra subpasses if MyCall signal
- endif
-
- if(isubp2.lt.5) then
- apmask=0
- iaptype2=iaptype
- iaptype=0
- if(isubp2.eq.1) then
- if(ipass.eq.1) then
- llrz=llrd
- else
- llrz=llra
- endif
- if(isubp1.gt.1 .and. ipass.gt.1) llrz=llrd
- else if(isubp2.eq.2) then
- llrz=llrb
- if(isubp1.gt.1) llrz=llra
- else if(isubp2.eq.3) then
- llrz=llrc
- else if(isubp2.eq.4) then
- llrz=llrd
- endif
- else
- if(.not.lhound) then
- if(lmycallstd .and. (lhiscallstd .or. lnohiscall)) then
- iaptype=naptypes(nQSOProgress,isubp2-4)
- iaptype2=iaptype
- ! print*,'line 1357 iaptype,isubp1,isubp2 = ',iaptype,isubp1,isubp2
- if(iaptype.eq.0) cycle
- if(lqsomsgdcd .and. iaptype.gt.2 .and. iaptype.lt.31) cycle ! QSO message already decoded
- if(iaptype.eq.2) then
- if(.not.lapmyc .or. lapcqonly) cycle ! skip AP for 'mycall ???? ????' in 2..3 minutes after last TX
- if(nQSOProgress.ne.0 .and. nmic.lt.2) cycle ! reduce CPU load at QSO
- endif
- ! if(.not.stophint .and. iaptype.gt.30) cycle ! no DXCall searching at QSO, reduce Lag
- ! if(stophint .and. iaptype.gt.2 .and. iaptype.lt.31) cycle
- if(lft8sdec .and. iaptype.gt.2) cycle ! QSO message already decoded
- if(iaptype.gt.2 .and. lnohiscall) cycle ! no DXCall
- if(iaptype.gt.2 .and. iaptype.lt.31 .and. loutapwid) cycle
- ! if(iaptype.eq.3 .and. .not.lqsosigtype3) cycle ! not QSO signal
- ! if(iaptype.eq.4 .and. .not.lqsorrr) cycle ! not RRR signal
- ! if(iaptype.eq.5 .and. .not.lqso73) cycle ! not 73 signal
- ! if(iaptype.eq.6 .and. .not.lqsorr73) cycle ! not RR73 signal
- if(iaptype.gt.30 .and. .not.lenabledxcsearch) cycle ! in QSO or TXing CQ or last logged is DX Call: searching disabled
- if(iaptype.gt.30 .and. .not.lwidedxcsearch .and. loutapwid) cycle ! only RX freq DX Call searching
- if(iaptype.eq.31 .and. .not.lcqdxcsig) cycle ! not CQ signal from std DXCall
- if(iaptype.eq.31 .and. .not.lhiscallstd .and. lapcqonly) cycle ! skip weak CQ signals with std call
- if(iaptype.gt.31 .and. lapcqonly) cycle ! skip weak CQ signals
- if(iaptype.eq.35 .and. .not.lqso73) cycle ! DXCall searching, not 73 signal
- if(iaptype.eq.36 .and. .not.lqsorr73) cycle ! DXCall searching, not RR73 signal
- if(lqsocandave .and. isubp1.gt.8 .and. (iaptype.lt.3 .or. iaptype.gt.6)) cycle ! QSO signal
- ! if(.not.lqsocandave .and. lmycsignal .and. isubp1.gt.5 .and. isubp1.lt.9 .and. iaptype.ne.2) cycle ! skip other AP if lmycsignal extra subpasses)
-
- if(iaptype.eq.1) then
- if(isubp2.eq.20) then
- scqlev=0.
- do i4=1,9
- scqlev=scqlev+s8(idtone25(2,i4),i4+7)
- enddo
- snoiselev=(sum(s8(0:7,8:16))-scqlev)/7.0
- scqnr=scqlev/snoiselev
- if(scqnr.lt.1.0 .and. .not.lcqsignal) cycle
- endif
- if(isubp2.eq.21) then
- if(lft8lowth .or. lft8subpass) then
- if(scqnr.lt.1.2 .and. .not.lcqsignal) cycle
- endif
- if(.not. lft8subpass .and. .not.lft8lowth) then
- if(scqnr.lt.1.3 .and. .not.lcqsignal) cycle
- endif
- endif
- endif
-
- if(iaptype.eq.2) then
- if(isubp2.eq.17) then
- smyclev=0.
- do i4=1,9
- smyclev=smyclev+s8(idtonemyc(i4),i4+7)
- enddo
- snoiselev=(sum(s8(0:7,8:16))-smyclev)/7.0
- smycnr=smyclev/snoiselev
- if(smycnr.lt.1.0 .and. .not.lmycsignal) cycle
- endif
- if(isubp2.eq.18) then
- if(lft8lowth .or. lft8subpass) then
- if(smycnr.lt.1.2 .and. .not.lmycsignal) cycle
- endif
- endif
- endif
-
- if(iaptype.eq.3) then
- if(isubp2.eq.5) then
- smyclev=0.
- do i4=1,9
- smyclev=smyclev+s8(idtonemyc(i4),i4+7)
- enddo
- snoiselev=(sum(s8(0:7,8:16))-smyclev)/7.0
- smycnr=smyclev/snoiselev
- if(smycnr.lt.1.0) cycle
- else if(isubp2.eq.6) then
- if(smycnr.lt.1.2) cycle
- endif
- endif
-
- apmask=0
- if(iaptype.eq.1) then ! CQ
- if(isubp2.eq.20) then
- llrz=llrc
- else if(isubp2.eq.21) then
- llrz=llrb
- else if(isubp2.eq.22) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*mcq(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.2) then ! MyCall ??? ???
- if(isubp2.eq.17) then
- llrz=llrc
- else if(isubp2.eq.18) then
- llrz=llrb
- else if(isubp2.eq.19) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*apsym(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.3) then ! MyCall DxCall ???
- if(isubp2.eq.5) then
- llrz=llrc
- else if(isubp2.eq.6) then
- llrz=llrb
- else if(isubp2.eq.7) then
- llrz=llra
- endif
- apmask(1:58)=1
- llrz(1:58)=apmag*apsym
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.gt.3 .and. iaptype.lt.7) then
- if(isubp2.eq.8 .or. isubp2.eq.11 .or. isubp2.eq.14) then
- llrz=llrc
- else if(isubp2.eq.9 .or. isubp2.eq.12 .or. isubp2.eq.15) then
- llrz=llrb
- else if(isubp2.eq.10 .or. isubp2.eq.13 .or. isubp2.eq.16) then
- llrz=llrb
- endif
- apmask(1:77)=1
- llrz(1:58)=apmag*apsym ! mycall hiscall 73|RR73
- if(iaptype.eq.5) then
- llrz(59:77)=apmag*m73
- else if(iaptype.eq.6) then
- llrz(59:77)=apmag*mrr73
- else if(iaptype.eq.4) then
- llrz(59:77)=apmag*mrrr
- endif
- else if(iaptype.eq.31) then ! CQ DxCall Grid(???)
- if(isubp2.eq.23) then
- llrz=llrc
- else if(isubp2.eq.24) then
- llrz=llrb
- else if(isubp2.eq.25) then
- llrz=llra
- endif
- if(lnohisgrid) then
- apmask(1:58)=1
- llrz(1:58)=apmag*apcqsym(1:58)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else
- apmask(1:77)=1
- llrz(1:77)=apmag*apcqsym
- endif
- else if(iaptype.eq.35) then ! ??? DxCall 73, type 1 std DXCall
- if(isubp2.eq.29) then
- llrz=llrc
- else if(isubp2.eq.30) then
- llrz=llrb
- else if(isubp2.eq.31) then
- llrz=llra
- endif
- apmask(30:77)=1
- llrz(30:58)=apmag*apsym(30:58)
- llrz(59:77)=apmag*m73
- else if(iaptype.eq.36) then ! ??? DxCall RR73 type 1 std DXCall
- if(isubp2.eq.26) then
- llrz=llrc
- else if(isubp2.eq.27) then
- llrz=llrb
- else if(isubp2.eq.28) then
- llrz=llra
- endif
- apmask(30:77)=1
- llrz(30:58)=apmag*apsym(30:58)
- llrz(59:77)=apmag*mrr73
- endif
-
- !! print*,'line 1533 iaptype,isubp1,isubp2 = ',iaptype,isubp1,isubp2
-
- else if(lmycallstd .and. .not.lhiscallstd .and. &
- len_trim(hiscall).gt.2) then
- iaptype=ndxnsaptypes(nQSOProgress,isubp2-4)
- iaptype2=iaptype
- if(iaptype.eq.0) cycle
- if(iaptype.eq.2 .and. lapcqonly) cycle ! skip weak CQ signals
- if(.not.stophint .and. iaptype.gt.30) cycle ! no DXCall searching at QSO, reduce Lag
- if((lqsomsgdcd .or. .not.lapmyc) .and. iaptype.gt.1 .and. iaptype.lt.15) cycle ! skip AP for mycall in 2..3 minutes after last TX
- if(iaptype.eq.12 .and. .not.lqsorrr) cycle ! not RRR signal
- if(iaptype.eq.13 .and. .not.lqso73) cycle ! not 73 signal
- if(iaptype.eq.14 .and. .not.lqsorr73) cycle ! not RR73 signal
- if(iaptype.gt.30 .and. .not.lenabledxcsearch) cycle ! in QSO or TXing CQ or last logged is DX Call: searching disabled
- if(iaptype.gt.30 .and. .not.lwidedxcsearch .and. loutapwid) cycle ! only RX freq DX Call searching
- if(iaptype.gt.30 .and. lapcqonly) cycle ! skip weak CQ signals
- if(iaptype.eq.31 .and. .not.lcqdxcnssig) cycle ! it is not CQ signal of non-standard DXCall
- if(iaptype.eq.35 .and. .not.lqso73) cycle ! DXCall searching, not 73 signal
- if(iaptype.eq.36 .and. .not.lqsorr73) cycle ! DXCall searching, not RR73 signal
- if(lqsocandave .and. isubp1.gt.8 .and. (iaptype.lt.11 .or. iaptype.gt.14)) cycle ! QSO signal
- if(iaptype.gt.2 .and. iaptype.lt.15 .and. loutapwid) cycle
-
- if(iaptype.eq.1) then
- if(isubp2.eq.20) then
- scqlev=0.
- do i4=1,9
- scqlev=scqlev+s8(idtone25(2,i4),i4+7)
- enddo
- snoiselev=(sum(s8(0:7,8:16))-scqlev)/7.0
- scqnr=scqlev/snoiselev
- if(scqnr.lt.1.0 .and. .not.lcqsignal) cycle
- endif
- if(isubp2.eq.21) then
- if(lft8lowth .or. lft8subpass) then
- if(scqnr.lt.1.2 .and. .not.lcqsignal) cycle
- endif
- if(.not. lft8subpass .and. .not.lft8lowth) then
- if(scqnr.lt.1.3 .and. .not.lcqsignal) cycle
- endif
- endif
- endif
-
- if(iaptype.eq.2) then
- if(isubp2.eq.17) then
- smyclev=0.
- do i4=1,9
- smyclev=smyclev+s8(idtonemyc(i4),i4+7)
- enddo
- snoiselev=(sum(s8(0:7,8:16))-smyclev)/7.0
- smycnr=smyclev/snoiselev
- if(smycnr.lt.1.0 .and. .not.lmycsignal) cycle
- endif
- if(isubp2.eq.18) then
- if(lft8lowth .or. lft8subpass) then
- if(smycnr.lt.1.2 .and. .not.lmycsignal) cycle
- endif
- endif
- endif
-
- apmask=0
- if(iaptype.eq.1) then ! CQ ??? ???
- if(isubp2.eq.20) then
- llrz=llrc
- else if(isubp2.eq.21) then
- llrz=llrb
- else if(isubp2.eq.22) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*mcq(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.2) then ! MyCall ??? ???
- if(isubp2.eq.17) then
- llrz=llrc
- else if(isubp2.eq.18) then
- llrz=llrb
- else if(isubp2.eq.19) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*apsym(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.11) then ! MyCall <DxCall> ??? ! report rreport type 1 msg
- if(isubp2.eq.5) then
- llrz=llrc
- else if(isubp2.eq.6) then
- llrz=llrb
- else if(isubp2.eq.7) then
- llrz=llra
- endif
- apmask(1:58)=1
- llrz(1:58)=apmag*apsymdxns1
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.12) then ! type 4 <MyCall> DxCall RRR
- if(isubp2.eq.14) then
- llrz=llrc
- else if(isubp2.eq.15) then
- llrz=llrb
- else if(isubp2.eq.16) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apsymdxnsrrr
- else if(iaptype.eq.13) then ! type 4 <MyCall> DxCall 73
- if(isubp2.eq.11) then
- llrz=llrc
- else if(isubp2.eq.12) then
- llrz=llrb
- else if(isubp2.eq.13) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apsymdxns732
- else if(iaptype.eq.14) then ! type 4 <MyCall> DxCall RR73
- if(isubp2.eq.8) then
- llrz=llrc
- else if(isubp2.eq.9) then
- llrz=llrb
- else if(isubp2.eq.10) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apsymdxnsr73
- else if(iaptype.eq.31) then ! CQ DxCall ! full compound or nonstandard
- if(isubp2.eq.23) then
- llrz=llrc
- else if(isubp2.eq.24) then
- llrz=llrb
- else if(isubp2.eq.25) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apcqsym
- else if(iaptype.eq.35) then ! ??? DxCall 73 ! full compound or nonstandard
- if(isubp2.eq.29) then
- llrz=llrc
- else if(isubp2.eq.30) then
- llrz=llrb
- else if(isubp2.eq.31) then
- llrz=llra
- endif
- apmask(14:77)=1
- llrz(14:77)=apmag*apsymdxns73(14:77)
- else if(iaptype.eq.36) then ! ??? DxCall RR73 ! full compound or nonstandard
- if(isubp2.eq.26) then
- llrz=llrc
- else if(isubp2.eq.27) then
- llrz=llrb
- else if(isubp2.eq.28) then
- llrz=llra
- endif
- apmask(14:77)=1
- llrz(14:77)=apmag*apsymdxnsrr73(14:77)
- endif
-
- else if(.not.lmycallstd .and. .not.lhiscallstd .and. &
- len_trim(hiscall).gt.2) then ! empty mycall or compound/nonstandard both calls
- iaptype=ndxnsaptypes(nQSOProgress,isubp2-4)
- iaptype2=iaptype
- if(iaptype.eq.0) cycle
- if(iaptype.gt.1 .and. iaptype.lt.31) cycle
- if(.not.stophint .and. iaptype.gt.1) cycle ! on air, QSO is not possible
- if(iaptype.gt.30 .and. lapcqonly) cycle ! skip weak CQ signals with std call
- if(iaptype.eq.31 .and. .not.lcqdxcnssig) cycle ! it is not CQ signal of non-standard DXCall
- if(iaptype.gt.34 .and. .not.ldxcsig) cycle ! not DXCall signal
-
- if(iaptype.eq.1) then
- if(isubp2.eq.20) then
- scqlev=0.
- do i4=1,9
- scqlev=scqlev+s8(idtone25(2,i4),i4+7)
- enddo
- snoiselev=(sum(s8(0:7,8:16))-scqlev)/7.0
- scqnr=scqlev/snoiselev
- if(scqnr.lt.1.0 .and. .not.lcqsignal) cycle
- endif
- if(isubp2.eq.21) then
- if(lft8lowth .or. lft8subpass)then
- if(scqnr.lt.1.2 .and. .not.lcqsignal) cycle
- endif
- if(.not. lft8subpass .and. .not.lft8lowth) then
- if(scqnr.lt.1.3 .and. .not.lcqsignal) cycle
- endif
- endif
- endif
-
- apmask=0
- if(iaptype.eq.1) then ! CQ ??? ???
- if(isubp2.eq.20) then
- llrz=llrc
- else if(isubp2.eq.21) then
- llrz=llrb
- else if(isubp2.eq.22) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*mcq(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
-
-! Nonstandard DXCall search masks below are for monitoring purpose in idle mode,
-! QSO is not possible
-! wideband searching being used by default
-
- else if(iaptype.eq.31) then ! CQ DxCall ! full compound or nonstandard
- if(isubp2.eq.23) then
- llrz=llrc
- else if(isubp2.eq.24) then
- llrz=llrb
- else if(isubp2.eq.25) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apcqsym
- else if(iaptype.eq.35) then ! ??? DxCall 73 ! full compound or nonstandard
- if(isubp2.eq.29) then
- llrz=llrc
- else if(isubp2.eq.30) then
- llrz=llrb
- else if(isubp2.eq.31) then
- llrz=llra
- endif
- apmask(14:77)=1
- llrz(14:77)=apmag*apsymdxns73(14:77)
- else if(iaptype.eq.36) then ! ??? DxCall RR73 ! full compound or nonstandard
- if(isubp2.eq.26) then
- llrz=llrc
- else if(isubp2.eq.27) then
- llrz=llrb
- else if(isubp2.eq.28) then
- llrz=llra
- endif
- apmask(14:77)=1
- llrz(14:77)=apmag*apsymdxnsrr73(14:77)
- endif
-
- else if(.not.lmycallstd .and. (lhiscallstd .or. lnohiscall)) then
- iaptype=nmycnsaptypes(nQSOProgress,isubp2-4)
- iaptype2=iaptype
- if(iaptype.eq.0) cycle
- if(isubp1.eq.2 .and. nweak.eq.1) cycle
- if(isubp1.gt.5) cycle ! so far CQ averaging only
- if(iaptype.eq.40 .and. lapcqonly) cycle ! skip weak CQ signals
- if(iaptype.gt.40 .and. iaptype.lt.45 .and. lqsomsgdcd) cycle ! already decoded
- if(iaptype.eq.42 .and. .not.lqsorrr) cycle ! not RRR signal
- if(iaptype.eq.43 .and. .not.lqso73) cycle ! not 73 signal
- if(iaptype.eq.44 .and. .not.lqsorr73) cycle ! not RR73 signal
- if(iaptype.gt.39 .and. .not.lapmyc) cycle
- if(lnomycall .and. iaptype.gt.39 .and. iaptype.lt.45) cycle ! skip QSO signals if mycall is empty
- if(lnohiscall .and. iaptype.ne.1 .and. iaptype.ne.40) cycle ! skip DXCall masks if empty
- if(iaptype.gt.30 .and. iaptype.lt.40 .and. .not.stophint) cycle ! in QSO, reduce number of CPU cycles
- if(iaptype.eq.31 .and. .not.lcqdxcsig) cycle ! not CQ signal from std DXCall
- if(iaptype.gt.34 .and. iaptype.lt.37 .and. (.not.ldxcsig .or. lapcqonly)) cycle ! not DXCall signal, skip weak CQ signals
- if(iaptype.gt.30 .and. iaptype.lt.40 .and. .not.lwidedxcsearch .and. loutapwid) cycle ! if wideband DX search disabled
-
- apmask=0
- if(lcqsignal .and. iaptype.eq.1) then ! CQ ??? ???
- if(isubp2.eq.20) then
- llrz=llrc
- else if(isubp2.eq.21) then
- llrz=llrb
- else if(isubp2.eq.22) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*mcq(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.31) then ! CQ DxCall Grid(???) //std DX call type1 with or without grid
- if(isubp2.eq.23) then
- llrz=llrc
- else if(isubp2.eq.24) then
- llrz=llrb
- else if(isubp2.eq.25) then
- llrz=llra
- endif
- if(lnohisgrid) then
- apmask(1:58)=1
- llrz(1:58)=apmag*apcqsym(1:58)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else
- apmask(1:77)=1
- llrz(1:77)=apmag*apcqsym
- endif
- else if(iaptype.eq.35) then ! ??? DxCall 73 //std DX call
- if(isubp2.eq.29) then
- llrz=llrc
- else if(isubp2.eq.30) then
- llrz=llrb
- else if(isubp2.eq.31) then
- llrz=llra
- endif
- apmask(30:77)=1
- llrz(30:58)=apmag*apsymdxstd(30:58)
- llrz(59:77)=apmag*m73
- else if(iaptype.eq.36) then ! ??? DxCall RR73 //std DX call
- if(isubp2.eq.26) then
- llrz=llrc
- else if(isubp2.eq.27) then
- llrz=llrb
- else if(isubp2.eq.28) then
- llrz=llra
- endif
- apmask(30:77)=1
- llrz(30:58)=apmag*apsymdxstd(30:58)
- llrz(59:77)=apmag*mrr73
- else if(iaptype.eq.40) then ! <MyCall>,???,??? type 1
- if(isubp2.eq.17) then
- llrz=llrc
- else if(isubp2.eq.18) then
- llrz=llrb
- else if(isubp2.eq.19) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*apsymmyns1(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.41) then ! <MyCall>,DXCall,??? type 1
- if(isubp2.eq.5) then
- llrz=llrc
- else if(isubp2.eq.6) then
- llrz=llrb
- else if(isubp2.eq.7) then
- llrz=llra
- endif
- apmask(1:58)=1
- llrz(1:58)=apmag*apsymmyns2
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.42) then ! MyCall,<DXCall>,RRR type 4
- if(isubp2.eq.14) then
- llrz=llrc
- else if(isubp2.eq.15) then
- llrz=llrb
- else if(isubp2.eq.16) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apsymmynsrrr
- else if(iaptype.eq.43) then ! MyCall,<DXCall>,73 type 4
- if(isubp2.eq.11) then
- llrz=llrc
- else if(isubp2.eq.12) then
- llrz=llrb
- else if(isubp2.eq.13) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apsymmyns73
- else if(iaptype.eq.44) then ! MyCall,<DXCall>,RR73 type 4
- if(isubp2.eq.8) then
- llrz=llrc
- else if(isubp2.eq.9) then
- llrz=llrb
- else if(isubp2.eq.10) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:77)=apmag*apsymmynsrr73
- endif
- else
- cycle ! fallback
- endif
-
- else if(lhound) then
- iaptype=nhaptypes(nQSOProgress,isubp2-4)
- iaptype2=iaptype
- if(iaptype.eq.0) cycle
- if(lnomycall .and. iaptype.gt.1 .and. iaptype.lt.31) cycle ! skip AP if mycall is missed in config
- if(lhiscallstd .and. iaptype.eq.31 .and. .not.lcqsignal) cycle ! not CQ signal, skip CQ DXCall DXgrid mask
- if(lqsomsgdcd .and. iaptype.gt.0 .and. iaptype.lt.25) cycle ! QSO message already decoded
- if(.not.stophint .and. (iaptype.eq.31 .or. iaptype.eq.36)) cycle ! CQ and RR73 decoding not needed if TX is on
- if(nQSOProgress.eq.1) then
- if(lfoxspecrpt) then
- if(iaptype.eq.21) cycle ! it is not standard message report signal
- if((iaptype.eq.31 .or. iaptype.eq.36) .and. nfoxspecrpt.gt.3) cycle ! probably special message signal
- else
- if(iaptype.eq.22) cycle ! it is not special message report signal
- if((iaptype.eq.31 .or. iaptype.eq.36) .and. nmic.gt.3) cycle ! probably standard message signal with mybcall
- endif
- endif
- if(nQSOProgress.eq.3) then
- if(lfoxspecrpt) then
- if(iaptype.eq.21) cycle ! it is not standard message report signal
- else
- if(iaptype.eq.22) cycle ! it is not special message report signal
- endif
- if(lfoxstdr73) then
- if(iaptype.eq.24) cycle ! it is not special message RR73 signal
- else
- if(iaptype.eq.23) cycle ! it is not standard message RR73 signal
- endif
- endif
-! can be staying in queue, need to process possible incoming report iaptype 21/22 even if TX is switched off
- if(.not.lapmyc .and. (iaptype.eq.23 .or. iaptype.eq.24)) cycle ! skip AP for mycall RR73 in 2..3 minutes after last TX
- fdelta=abs(f1-nfqso)
- fdeltam=modulo(fdelta,60.) ! dupe string to prevent compiler warning
- if(nQSOProgress.gt.0 .and. iaptype.lt.31 .and. (fdelta.gt.245.0 .or. &
- fdeltam.gt.3.0)) cycle ! AP shall be applied to Fox frequencies only
- if((iaptype.eq.31 .or. iaptype.eq.36) .and. .not.lwidedxcsearch .and. &
- (fdelta.gt.245.0 .or. fdeltam.gt.3.0)) cycle ! only Fox frequencies DX Call searching
- if(iaptype.eq.31 .and. .not.lhiscallstd .and. lapcqonly) cycle ! skip weak CQ signals with std call
- if(iaptype.eq.36 .and. lwidedxcsearch .and. lapcqonly) cycle ! skip weak CQ signals
- if(iaptype.eq.111 .and. lapcqonly) cycle ! skip weak CQ signals with std call
-
- apmask=0
- if(iaptype.eq.1) then ! CQ ??? ??? type 1 msg
- if(isubp2.eq.20) then
- llrz=llrc
- else if(isubp2.eq.21) then
- llrz=llrb
- else if(isubp2.eq.22) then
- llrz=llra
- endif
- apmask(1:29)=1
- llrz(1:29)=apmag*mcq(1:29)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.21) then ! MyBaseCall DxBaseCall ??? ! report
- if(isubp2.eq.5) then
- llrz=llrc
- else if(isubp2.eq.6) then
- llrz=llrb
- else if(isubp2.eq.7) then
- llrz=llra
- endif
- apmask(1:58)=1
- llrz(1:58)=apmag*apsym
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else if(iaptype.eq.22) then ! ??? RR73; MyCall <???> ??? ! report
- if(isubp2.eq.8) then
- llrz=llrc
- else if(isubp2.eq.9) then
- llrz=llrb
- else if(isubp2.eq.10) then
- llrz=llra
- endif
- apmask(29:66)=1
- llrz(29:66)=apmag*apsymsp(29:66)
- apmask(72:77)=1
- llrz(72:73)=apmag*(-1)
- llrz(74)=apmag*(+1)
- llrz(75:77)=apmag*(-1)
- else if(iaptype.eq.23) then ! MyBaseCall DxBaseCall RR73
- if(isubp2.eq.11) then
- llrz=llrc
- else if(isubp2.eq.12) then
- llrz=llrb
- else if(isubp2.eq.13) then
- llrz=llra
- endif
- apmask(1:77)=1
- llrz(1:58)=apmag*apsym
- llrz(59:77)=apmag*mrr73
- else if(iaptype.eq.24) then ! MyCall RR73; ??? <???> ???
- if(isubp2.eq.14) then
- llrz=llrc
- else if(isubp2.eq.15) then
- llrz=llrb
- else if(isubp2.eq.16) then
- llrz=llra
- endif
- apmask(1:28)=1
- apmask(57:66)=1
- llrz(1:28)=apmag*apsymsp(1:28)
- llrz(57:66)=apmag*apsymsp(57:66)
- apmask(72:77)=1
- llrz(72:73)=apmag*(-1)
- llrz(74)=apmag*(+1)
- llrz(75:77)=apmag*(-1)
- else if(iaptype.eq.31) then ! CQ DxCall Grid(???)
- if(isubp2.eq.23) then
- llrz=llrc
- else if(isubp2.eq.24) then
- llrz=llrb
- else if(isubp2.eq.25) then
- llrz=llra
- endif
- if(lhiscallstd) then
- if(lnohisgrid) then
- apmask(1:58)=1
- llrz(1:58)=apmag*apcqsym(1:58)
- apmask(75:77)=1
- llrz(75:76)=apmag*(-1)
- llrz(77)=apmag*(+1)
- else
- apmask(1:77)=1
- llrz(1:77)=apmag*apcqsym
- endif
- else
- apmask(1:77)=1
- llrz(1:77)=apmag*apcqsym
- endif
- else if(iaptype.eq.36) then
- if(isubp2.eq.26) then
- llrz=llrc
- else if(isubp2.eq.27) then
- llrz=llrb
- else if(isubp2.eq.28) then
- llrz=llra
- endif
- if(lhiscallstd .or. (.not.lhiscallstd .and. &
- len_trim(hiscall).gt.2 &
- .and. index(hiscall,"/").gt.0)) then
- apmask(30:77)=1
- llrz(30:58)=apmag*apsym(30:58)
- llrz(59:77)=apmag*mrr73 ! ??? DxBaseCall RR73
- else
- cycle ! (noncompound .and. nonstandard) Fox callsign being not supported by Fox WSJT-X
- endif
- else if(iaptype.eq.111) then ! CQ ??? type 4 msg (iflip,nrpt,icq,i3 001100)
- if(isubp2.eq.29) then
- llrz=llrc
- else if(isubp2.eq.30) then
- llrz=llrb
- else if(isubp2.eq.31) then
- llrz=llra
- endif
- apmask(72:77)=1
- llrz(72:73)=apmag*(-1)
- llrz(74:75)=apmag*(1)
- llrz(76:77)=apmag*(-1)
- endif
- else
- cycle ! fallback
- endif
- endif
- cw=0
- call bpdecode174_91var(llrz,apmask,max_iterations,message77,cw, &
- nharderrors,niterations)
- dmin=0.0
- if(nharderrors.lt.0) then
- ndeep=3
- if(lqsosig .or. lmycsignal) then
- if((dfqso.lt.napwid .or. (abs(nftx-f1).lt.napwid .and. lapmyc)) &
- .and. .not.nagainfil) ndeep=4
- if(lapmyc .and. lqsomsgdcd .or. iaptype.eq.0) ndeep=3 ! deep is not needed, reduce number of CPU cycles
- if(.not.stophint .and. len_trim(hiscall).gt.2) ndeep=3 ! unload CPU, let ft8svar pick up QSO message
- endif
- if(ldxcsig .and. stophint .and. dfqso.lt.napwid) ndeep=4 ! DXCall search inside RX napwid
- if(lhound) ndeep=3 ! we have no enough CPU resources to decode all Fox slots with ndeep=4
-! if(nagainfil .or. swl) ndeep=5 ! 30 against 26 -23dB, more than 15sec to decode and many false decodes
-! if(swl) ndeep=4 ! 29 decodes -23dB, 7..12sec to decode
- if(nagainfil) ndeep=5
-!print *,omp_get_nested(),OMP_get_num_threads()
-
- call osd174_91var(llrz,apmask,ndeep,message77,cw,nharderrors,dmin,nthr)
- endif
-
- nbadcrc=1
- msg37=''
- if(count(cw.eq.0).eq.174) cycle !Reject the all-zero codeword
- if(nharderrors.lt.0 .or. nharderrors+dmin.ge.60.0 .or. (isubp2.gt.2 &
- .and. nharderrors.gt.39)) then ! chk isubp2 value
- if(nweak.eq.2 .and. isubp1.eq.2) then
- if(ipass.eq.npass-1) then
- if(lcqsignal) then
- if(isubp2.eq.22) then ! last pass, std and nonstd mycall
- lfoundcq=.false.
- do ik=1,numdeccq
- if(tmpcqdec(ik)%freq.gt.5001.0) exit
- if(abs(tmpcqdec(ik)%freq-f1).lt.5.0 .and. abs(tmpcqdec(ik)%xdt-xdt).lt.0.05) then ! max signal delay
- lfoundcq=.true.
- exit
- endif
- enddo
- if(.not.lfoundcq .and. ncqsignal.lt.numcqsig) then
- ncqsignal=ncqsignal+1
- tmpcqsig(ncqsignal)%freq=f1
- tmpcqsig(ncqsignal)%xdt=xdt
- tmpcqsig(ncqsignal)%cs=cstmp2
- endif
- endif
- endif
- if(lmycsignal .and. isubp2.eq.19) then ! last pass
- lfoundmyc=.false.
- do ik=1,numdecmyc
- if(tmpmyc(ik)%freq.gt.5001.0) exit
- if(abs(tmpmyc(ik)%freq-f1).lt.5.0 .and. &
- abs(tmpmyc(ik)%xdt-xdt).lt.0.05) then ! max signal delay
- lfoundmyc=.true.
- exit
- endif
- enddo
- if(.not.lfoundmyc .and. nmycsignal.lt.nummycsig) then
- nmycsignal=nmycsignal+1
- tmpmycsig(nmycsignal)%freq=f1
- tmpmycsig(nmycsignal)%xdt=xdt
- tmpmycsig(nmycsignal)%cs=cstmp2
- endif
- endif
- endif
- if(ipass.eq.npass) then
- if(lqsocandave .and. (iaptype.eq.3 .or. iaptype.eq.6)) then
- tmpqsosig(1)%freq=f1
- tmpqsosig(1)%xdt=xdt
- tmpqsosig(1)%cs=cstmp2
- endif
- endif
- endif
- !print*,'line 2149 iaptype,isubp1,isubp2,ndeep = ',iaptype,isubp1,isubp2,ndeep
-
- if(isubp1.gt.1) cycle
- ! print*,'line 2150 did not cycle'
- if(lqsothread .and. (.not.lhound .and. iaptype.ge.3 .or. lhound &
- .and. (iaptype.eq.21 .or. iaptype.eq.23)) .and. .not.lsdone) then
- if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. &
- .not.lhiscallstd)) then
- if(.not.lft8sdec .and. .not.stophint .and. dfqso.lt.2.0) then
- call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
- if(lft8s) then
- if(index(msg37,'<').gt.0) then
- lhashmsg=.true.
- endif
- nbadcrc=0
- lft8sdec=.true.
- endif
- endif
- endif
- lsdone=.true.
- endif
- if(nbadcrc.eq.0) then
- i3=1
- n3=1
- exit
- endif
-
- if(lsd .and. isubp2.eq.3 .and. nbadcrc.eq.1 .and. srr.lt.7.0) then ! low DR setups shall not try FT8SDvar for strong signals
- call ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq)
- if(lft8sd) then
- if(levenint) then
- evencopy(isd)%lstate=.false.
- elseif(loddint) then
- oddcopy(isd)%lstate=.false.
- endif
- i3=1
- n3=1
- iaptype2=iaptype
- iaptype=0
- nbadcrc=0
- lsd=.false.
- exit
- endif
- endif
-
- if(nweak.eq.1 .and. isubp1.eq.1) then
- if(ipass.eq.npass-1) then
- if(lcqsignal) then
- if(isubp2.eq.22) then ! last pass, std and nonstd mycall
- lfoundcq=.false.
- do ik=1,numdeccq
- if(tmpcqdec(ik)%freq.gt.5001.0) exit
- if(abs(tmpcqdec(ik)%freq-f1).lt.5.0 .and. &
- abs(tmpcqdec(ik)%xdt-xdt).lt.0.05) then ! max signal delay
- lfoundcq=.true.
- exit
- endif
- enddo
- if(.not.lfoundcq .and. ncqsignal.lt.numcqsig) then
- ncqsignal=ncqsignal+1
- tmpcqsig(ncqsignal)%freq=f1
- tmpcqsig(ncqsignal)%xdt=xdt
- tmpcqsig(ncqsignal)%cs=cstmp2
- endif
- endif
- endif
- if(lmycsignal .and. isubp2.eq.19) then ! last pass
- lfoundmyc=.false.
- do ik=1,numdecmyc
- if(tmpmyc(ik)%freq.gt.5001.0) exit
- if(abs(tmpmyc(ik)%freq-f1).lt.5.0 .and. &
- abs(tmpmyc(ik)%xdt-xdt).lt.0.05) then ! max signal delay
- lfoundmyc=.true.
- exit
- endif
- enddo
- if(.not.lfoundmyc .and. nmycsignal.lt.nummycsig) then
- nmycsignal=nmycsignal+1
- tmpmycsig(nmycsignal)%freq=f1
- tmpmycsig(nmycsignal)%xdt=xdt
- tmpmycsig(nmycsignal)%cs=cstmp2
- endif
- endif
- endif
- if(ipass.eq.npass) then
- if(lqsocandave .and. (iaptype.eq.3 .or. iaptype.eq.6)) then
- tmpqsosig(1)%freq=f1
- tmpqsosig(1)%xdt=xdt
- tmpqsosig(1)%cs=cstmp2
- endif
- endif
- endif
- ! print*,'line 2242 nbadcrc=',nbadcrc
-
- if(nbadcrc.eq.1) cycle
- endif
-
- write(c77,'(77i1)') message77
- read(c77(72:74),'(b3)') n3
- read(c77(75:77),'(b3)') i3
- !print*,'line 2247 iaptype=',iaptype,' i3=',i3,' n3=',n3
- if((i3.gt.4 .or. (i3.eq.0 .and. n3.gt.5)) .and. (.not.(i3.eq.5 .and. &
- (n3.eq.1 .or. n3.eq.7 .or.n3.eq.6 .or.n3.eq.4 .or.n3.eq.3 .or.n3.eq.0 .or.n3.eq.5)))) cycle ! ft8md added n3.eq.6 and n3.eq.4 and n3.eq.3 and n3.eq.0 and n3.eq.5 for USA calls with EU VHF
- !print*,'did not cycle at line 2248'
- call unpack77var(c77,1,msg37,unpk77_success,nthr)
- if(.not.unpk77_success) then
- if(lqsothread .and. (.not.lhound .and. iaptype.ge.3 .or. lhound .and. &
- (iaptype.eq.21 .or. iaptype.eq.23)) .and. .not.lsdone) then
- if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. &
- .not.lhiscallstd)) then
- if(.not.lft8sdec .and. .not.stophint .and. dfqso.lt.2.0) then
- call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
- if(lft8s) then
- if(index(msg37,'<').gt.0) then
- lhashmsg=.true.
- endif
- nbadcrc=0
- lft8sdec=.true.
- endif
- endif
- endif
- lsdone=.true.
- if(nbadcrc.eq.0) then
- i3=1
- n3=1
- exit
- endif
- endif
- cycle
- endif
-
- if(iaptype.eq.1 .and. msg37(1:10).eq.'CQ DE AA00') then
- nbadcrc=1
- cycle
- endif
- lcall1hash=.false.
- if(msg37(1:1).eq.'<') lcall1hash=.true.
- nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message.
- call get_tones_from_77bits(message77,itone)
-! 0.1 K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 71 DXpedition Mode
- i3bit=0
- if(i3.eq.0 .and. n3.eq.1) i3bit=1
-! iFreeText=message77(57)
-! 0.0 Free text
- if(i3.eq.0 .and. n3.eq.0) then
- lFreeText=.true.
- else
- lFreeText=.false.
- endif
-! delete braces
- lcall2hash=.false.
- if(.not.lFreeText .and. i3bit.ne.1 .and. index(msg37,'<').gt.0) then
- if(index(msg37,'<').gt.4) lcall2hash=.true.
- if(index(msg37,'<').gt.0) then
- lhashmsg=.true.
- endif
- endif
- if(nbadcrc.eq.0) exit
- enddo ! ap passes
- if(nbadcrc.eq.0) exit
- enddo ! weak sigs
- if(nbadcrc.eq.0) exit
- enddo !nqso sync
-
-2 if(nbadcrc.eq.0) then
-! check for the false FT8Svar decode
- if(lft8s .and. lrepliedother) then
- msg37=''
- nbadcrc=1
- return
- endif
- msg37_2=''
- if(i3bit.eq.1 .and. .not.lft8s .and. .not.lft8sd) then
- call msgparservar(msg37,msg37_2)
- lspecial=.true. !only in ft8var
-
-!protection against a false FT8Svar decode in Hound mode
- if(lhound .and. dfqso.lt.2.0) lqsomsgdcd=.true. !$OMP FLUSH (lqsomsgdcd)
- endif
- qual=1.0-(nharderrors+dmin)/60.0
- xsnr=0.001
- xnoi=1.E-8
- xsnrtmp=0.001
- do i=1,79
- xsig=s8(itone(i),i)**2
- xnoi=(sum(s8(0:7,i)**2) - xsig)/7.0
- if(xnoi.lt.0.01) xnoi=0.01 ! safe division and better accuracy
- if(xnoi.lt.xsig) then
- xsnr=xsig/xnoi
- else
- xsnr=1.01
- endif
- xsnrtmp=xsnrtmp+xsnr
- enddo
-
- xsnr=xsnrtmp/79.0-1.0
- xsnr=10.0*log10(xsnr)-26.5
- if(xsnr.gt.7.0) xsnr=xsnr+(xsnr-7.0)/2.0
- if(xsnr.gt.30.0) then
- xsnr=xsnr-1.0
- if(xsnr.gt.40.0) xsnr=xsnr-1.0
- if(xsnr.gt.49.0) xsnr=49.0
- endif
- xsnrs=xsnr
- if(xsnr .lt. -17.0) then
- if(xsnr.lt.-22.5 .and. xsnr.gt.-23.5) xsnr=-22.5 ! safe division and better accuracy
- xsnr=xsnr-(1.0+1.4/(23.0+xsnr))**2+1.2
- endif
- if(iaptype.eq.0) then
- if(xsnr.lt.-23.0) xsnr=-23.0
- else
- if(xsnr.lt.-24.0) xsnr=-24.0
- endif
- if(lft8s .or. lft8sd) then
- if(xsnr.lt.-22.0) xsnr=xsnrs-1.0 ! correction offset
- if(xsnr.lt.-26.0) xsnr=-26.0
-
-! -26 0.1 1477 ~ AC1MX AC1MX R-17 ^
- if(len_trim(mycall).gt.3 .and. index(msg37,' '//trim(mycall)//' ').gt.1) then
- msg37=''
- return
- endif
- go to 4 ! bypass checking to false decode
- endif
- !if(len_trim(msg37)>0) print*,'line 2371 ',msg37
-
- rxdt=xdt-0.5
- if(iaptype.gt.34 .and. iaptype.lt.40) then ! DX Call searching false iaptype 35,36: 'CS7CYU/R FO5QB 73', 'T57KWP/R FO5QB RR73'
- ispc1=index(msg37,' ')
- if(ispc1.gt.5) then
- if(msg37((ispc1-2):(ispc1-1)).eq.'/R') then ! have to cascade it to prevent getting out of index range
- call_a=''
- call_a=msg37(1:(ispc1-3))
- lfound=.false.
- call searchcallsvar(call_a," ",lfound)
- if(.not.lfound) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- else if(qual.lt.0.39 .or. xsnr.lt.-20.5 .or. rxdt.lt.-0.5 .or. rxdt.gt.1.9 &
- .or. (iaptype.gt.0 .and. iaptype.lt.4) .or. iaptype.eq.11 .or. &
- iaptype.eq.21 .or. iaptype.eq.40 .or. iaptype.eq.41) then
- if(iaptype.gt.3 .and. iaptype.lt.7) go to 4 ! skip, nothing to check
- if(iaptype.ne.2 .and. iaptype.ne.3 .and. iaptype.ne.11 .and. iaptype.ne.21 &
- .and. iaptype.ne.40 .and. iaptype.ne.41) then
- if((mybcall.ne." " .and. index(msg37,mybcall).gt.0) .or. &
- (hisbcall.ne." " .and. index(msg37,hisbcall).gt.0)) go to 256
- endif
-
- if(i3bit.eq.1) then
- ! print*,'nbadcrc line 2400',nbadcrc
- call chkspecial8var(msg37,msg37_2,nbadcrc)
- ! print*,'nbadcrc line 2402',nbadcrc
- else
- ! print*,'nbadcrc line 2404 nbadcrc,i3,n3',nbadcrc,i3,n3
- call chkfalse8var(msg37,i3,n3,nbadcrc,iaptype,lcall1hash)
- ! print*,'nbadcrc line 2406',nbadcrc
- endif
- if(nbadcrc.eq.1) then
- msg37=''
- return
- endif
- endif
- if(iaptype.eq.2 .or. iaptype.eq.3 .or. iaptype.eq.11 .or. iaptype.eq.21 .or. &
- iaptype.eq.40 .or. iaptype.eq.41) go to 4 ! already checked
-
-! decoded without AP masks:
-! CQ PLIB U40OKH FE61
-! CQ 000 RO8JSV GJ38
-256 if(iaptype.eq.0 .and. i3.eq.1 .and. msg37(1:3).eq.'CQ ') then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if((ispc2-ispc1).eq.4 .or. (ispc2-ispc1).eq.5) then
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- ispc4=index(msg37((ispc3+1):),' ')+ispc3
- if((ispc3-ispc2).gt.3 .and. (ispc4-ispc3).eq.5) then
- grid=''
- if(msg37(ispc3+1:ispc3+1).gt.'@' .and. msg37(ispc3+1:ispc3+1).lt.'S' &
- .and. msg37(ispc3+2:ispc3+2).gt.'@' .and. &
- msg37(ispc3+2:ispc3+2).lt.'S' .and. &
- msg37(ispc3+3:ispc3+3).lt.':' .and. &
- msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1)
- if(grid.ne.'') then
- callsign=''
- callsign=msg37(ispc2+1:ispc3-1)
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- endif
- endif
-
-! i3=1,2 false decodes with ' R '
-! 3B4NDC/R C40AUZ/R R IR83 i3=1
-! MS8QQS UX3QBS/P R NG63 i3=2
-! <...> P32WRF R LR56
-! P32WRF <...> R LR56
-
- if((i3.eq.1 .or. i3.eq.2) .and. index(msg37,' R ').gt.0) then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- if(ispc3-ispc2.eq.2) then
- if(msg37(ispc2:ispc3).eq.' R ') then
- call_b=''
- if((i3.eq.1 .and. msg37(ispc2-2:ispc2-1).eq.'/R') .or. &
- (i3.eq.2 .and. msg37(ispc2-2:ispc2-1).eq.'/P')) then
- call_b=msg37(ispc1+1:ispc2-3)
- else
- call_b=msg37(ispc1+1:ispc2-1)
- endif
- if(lcall2hash) then ! valid call_b can be found in hash table, check call_a then
- call_a=''
- if((i3.eq.1 .and. msg37(ispc1-2:ispc1-1).eq.'/R') .or. &
- (i3.eq.2 .and. msg37(ispc1-2:ispc1-1).eq.'/R')) then
- call_a=msg37(1:ispc1-3)
- else
- call_a=msg37(1:ispc1-1)
- endif
- falsedec=.false.
- call chkflscallvar('CQ ',call_a,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
- else if(len_trim(call_b).gt.2) then
- ispc4=index(msg37((ispc3+1):),' ')+ispc3
- grid=''
- if(ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc3+1).gt.'@' .and. &
- msg37(ispc3+1:ispc3+1).lt.'S' .and. &
- msg37(ispc3+2:ispc3+2).gt.'@' .and. &
- msg37(ispc3+2:ispc3+2).lt.'S' .and. &
- msg37(ispc3+3:ispc3+3).lt.':' .and. &
- msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1)
- if(grid.ne.'') then
- call chkgridvar(call_b,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- endif
- endif
- endif
-
-! 0.3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day
-! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day
-! -23 3.1 197 ~ Z67BGE H67HJI 22G EMA i3=0 n3=4
-! -3 2.2 FY4IML UV7BEA R 24F NNJ i3=0 n3=4
-
- if(i3.eq.0 .and. n3.gt.2 .and. n3.lt.5) then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if(ispc1.gt.3 .and. ispc2.gt.7) then
- call_a=''
- call_b=''
- if(msg37(1:ispc1-1).eq.'/R' .or. msg37(1:ispc1-1).eq.'/P') then
- call_a=msg37(1:ispc1-3)
- else
- call_a=msg37(1:ispc1-1)
- endif
- if(msg37(ispc1+1:ispc2-1).eq.'/R' .or. msg37(ispc1+1:ispc2-1).eq.'/P') then
- call_b=msg37(ispc1+1:ispc2-3)
- else
- call_b=msg37(ispc1+1:ispc2-1)
- endif
-
-! operators outside USA and Canada shall transmit ' DX '
- if(call_b(1:1).ne.'A' .and. call_b(1:1).ne.'K' .and. call_b(1:1).ne.'N' &
- .and. call_b(1:1).ne.'W' .and. call_b(1:1).ne.'V' .and. &
- call_b(1:1).ne.'C' .and. call_b(1:1).ne.'X') then
- if(index(msg37,' DX ').lt.1) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
-
-! USA AA..AL
- if(call_b(1:1).eq.'A' .and. (call_b(2:2).lt.'A' .or. call_b(2:2).gt.'L')) then
- if(index(msg37,' DX ').lt.1) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
-
-! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO
- if(call_b(1:1).eq.'C' .and. (call_b(2:2).lt.'F' .or. call_b(2:2).gt.'K')) then
- if(call_b(2:2).ne.'Y' .and. call_b(2:2).ne.'Z') then
- if(index(msg37,' DX ').lt.1) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
-
- if(call_b(1:1).eq.'V' .and. (call_b(2:2).lt.'A' .or. call_b(2:2).gt.'G')) then
- if(call_b(2:2).ne.'O' .and. call_b(2:2).ne.'X' .and. call_b(2:2).ne.'Y') then
- if(index(msg37,' DX ').lt.1) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- if(call_b(1:1).eq.'X' .and. (call_b(2:2).lt.'J' .or. call_b(2:2).gt.'O')) then
- if(index(msg37,' DX ').lt.1) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- if(xsnr.lt.-19.0 .or. rxdt.lt.-0.5 .or. rxdt.gt.1.0) then
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- endif
-
-! EU VHF contest exchange i3=5
-! <PA3XYZ> <G4ABC/P> R 590003 IO91NP h12 h22 r1 s3 S11 g25
-! packing is not implemented in WSJT-X 2.5.4?
-! old implementation with i3=0 n3=2
-! JL6GSC/P R 571553 CJ76MV i3=5
-! G59XTB R 521562 RA82SJ
-
- if(i3.eq.5 .and. n3.eq.1 .and. (xsnr.lt.-19.0 .or. rxdt.lt.-0.5 .or. &
- rxdt.gt.1.0)) then ! was if i3-0 and n3=2
- ispc1=index(msg37,' ')
- if(ispc1.gt.3) then
- call_b=''
- if(msg37(ispc1-2:ispc1-1).eq.'/P') then
- call_b=msg37(1:ispc1-3)
- else
- call_b=msg37(1:ispc1-1)
- endif
- falsedec=.false.
- call chkflscallvar('CQ ',call_b,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
-
-! FT8OPG/R Z27HRN/R OH12 check all standard messages with contest callsigns
-! /P has i3.eq.2 .and. n3.eq.0
- if(iaptype.eq.0 .and. i3.eq.1 .and. n3.eq.0 .and. index(msg37,'/R ').gt.3) then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if(ispc1.gt.3 .and. ispc2.gt.6) then
- call_a=''
- call_b=''
- if(msg37(ispc1-2:ispc1-1).eq.'/R') then
- call_a=msg37(1:ispc1-3)
- else
- call_a=msg37(1:ispc1-1)
- endif
- if(msg37(ispc2-2:ispc2-1).eq.'/R') then
- call_b=msg37(ispc1+1:ispc2-3)
- else
- call_b=msg37(ispc1+1:ispc2-1)
- endif
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
-
-! -23 -0.5 2533 ~ <...> W LKNQZG2K4 RR73 invalid message, iaptype=0 this type of message is not allowed for transmission with RR73
-! -23 -1.2 1335 ~ <...> Z7VENB8R G9 RRR non AP decode, iaptype=0 invalid message, this type of message is not allowed
-! for transmission with RRR
-
- if(msg37(1:2).eq.'<.') then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- ispc4=index(msg37((ispc3+1):),' ')+ispc3
- if((ispc4-ispc3.eq.4 .and. msg37(ispc3+1:ispc4-1).eq.'RRR') .or. &
- (ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc4-1).eq.'RR73') .or. &
- (ispc4-ispc3.eq.3 .and. msg37(ispc3+1:ispc4-1).eq.'73')) then
- nbadcrc=1
- msg37=''
- return
- endif
-
-! -19 0.0 2256 ~ <...> 9T4DQZ RP53 non AP decode, iaptype=0 i3=1 n3=1 SAME AS CQ MSG
-! <...> 9T4DQZ -15(R-15) message has i3=1 n3=4
- if(i3.eq.1 .and. n3.eq.1 .and. (xsnr.lt.-18.0 .or. rxdt.lt.-0.5 .or. &
- rxdt.gt.1.0)) then
- callsign=' '
- callsign=msg37(ispc1+1:ispc2-1)
- grid=msg37(ispc2+1:ispc3-1)
- include 'callsign_q.f90'
- call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall) then
- nbadcrc=1
- msg37=''
- return
- endif
- if(lchkcall .or. .not.lgvalid) then
- falsedec=.false.
- call chkflscallvar('CQ ',callsign,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- endif
-
-! -22 0.3 1000 ~ 9Y4DWY <...> BF70 iaptype=0 i3=1 n3=2 invalid message in FT8
-! protocol, can be transmitted manually
-
- if(i3.eq.1) then
- ispc1=index(msg37,' ')
- if(msg37(ispc1+1:ispc1+2).eq.'<.') then
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. &
- msg37(ispc2+1:ispc2+1).lt.'S' .and. &
- msg37(ispc2+2:ispc2+2).gt.'@' .and. &
- msg37(ispc2+2:ispc2+2).lt.'S' .and. &
- msg37(ispc2+3:ispc2+3).lt.':' .and. &
- msg37(ispc2+4:ispc2+4).lt.':') then ! there is a valid grid in message
- call_b=''
- call_b=msg37(1:ispc1-1)
- falsedec=.false.
- call chkflscallvar('CQ ',call_b,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- endif
-
-! i3=3 parse ARRL RTTY contest message
-! i3 n3 Bits Total Message type
-! 3 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest
-! 3 TU; W9XYZ G8ABC R 559 0013 1 28 28 1 3 13 74 ARRL RTTY (DX)
-! TU; D47IAQ <...> 559 032' does protocol support the message?
-
- if(i3.eq.3 .and. msg37(1:3).eq.'TU;') then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- call_a=''
- call_b=''
- call_a=msg37(ispc1+1:ispc2-1)
- call_b=msg37(ispc2+1:ispc3-1)
-! check for false, too tough, need to rework if contest is supported
- falsedec=.false.
- call chkflscallvar(call_a,call_b,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
-! parse
- lspecial=.true.
- msg37_2=msg37(5:37)//' '
- msg37=''
- msg37='DE '//trim(call_b)//' TU'
- endif
-
-! DX Call searching false decodes, search for 1st callsign in ALLCALL7
-! 6W6VIV EY8MM 73
-! 6Y9KOZ EY8MM RR73
- if(iaptype.gt.34 .and. iaptype.lt.40 .and. (xsnr.lt.-21.0 .or. rxdt.lt.-0.5 &
- .or. rxdt.gt.1.0)) then
- ispc1=index(msg37,' ')
- if(ispc1.gt.1) then
- call_b=''
- call_b=msg37(1:ispc1-1)
- falsedec=.false.
- call chkflscallvar('CQ ',call_b,falsedec)
- if(falsedec) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
-
-4 continue
-!### Possibly call ft8_a8d() here ??? ###
-
- ldupemsg=.false.
- if(ndecodes.gt.0) then
- do i=1,ndecodes
- if(allmessages(i).eq.msg37 .and. abs(allfreq(i)-f1).lt.45.0) then
- ldupemsg=.true.
- endif
- enddo
- endif
-
- if(.not.ldupemsg .and. dfqso.lt.2.0 .and. ((i3.eq.1 .and. .not.lft8s) .or. &
- lft8s)) then
- if(msg37(1:msgrootlen+1).eq.trim(msgroot)//' ') then
- lasthcall=hiscall
- lastrxmsg(1)%lastmsg=msg37
- lastrxmsg(1)%xdt=xdt-0.5
- lastrxmsg(1)%lstate=.true.
- lqsomsgdcd=.true.
-!$OMP FLUSH (lqsomsgdcd)
- else if(.not.lft8s .and. mycalllen1.gt.2) then
- if(msg37(1:mycalllen1).ne.trim(mycall)//' ' .and. &
- index(msg37,' '//trim(hiscall)//' ').gt.0) then
- lrepliedother=.true.
- endif
- endif
- endif
-
- if(len_trim(hiscall).gt.3 .and. .not.lqsomsgdcd) then
- if(msg37(1:msgrootlen+1).eq.trim(msgroot)//' ') then
- lqsomsgdcd=.true.
-!$OMP FLUSH (lqsomsgdcd)
- endif
- endif
-
- if(.not.stophint .and. .not.ldupemsg .and. dfqso.lt.2.0 .and. nlasttx.gt.0 &
- .and. nlasttx.lt.6 .and. msg37(1:3).eq.'CQ ') then
- nlength=len_trim(hiscall)
- if(nlength.gt.2) then
- if(msg37(4:4+nlength).eq.trim(hiscall)//' ' .or. &
- msg37(7:7+nlength).eq.trim(hiscall)//' ') lrepliedother=.true.
- endif
- endif
-
- if(mycalllen1.gt.2) then
- if(.not.ldupemsg .and. msg37(1:mycalllen1).eq.trim(mycall)//' ') then
- nincallthr(nthr)=nincallthr(nthr)+1
- nindex=maskincallthr(nthr)+nincallthr(nthr)
- if(nindex.lt.maskincallthr(nthr+1)) then
- msgincall(nindex)=msg37
- xdtincall(nindex)=xdt-0.5
- else
- nincallthr(nthr)=nincallthr(nthr)-1
- endif
- endif
- endif
-
- ldupeft8sd=.false.
- if(ncount.gt.0 .and. lft8sd) then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- msgbase37=''
- msgbase37=msg37(1:ispc2-1)
- do i=1,ncount
- if(trim(msgbase37).eq.trim(msgsrcvd(i))) then
- ldupeft8sd=.true.
- exit
- endif
- enddo
- endif
-
- if(ldupeft8sd) then
- msg37=''
- nbadcrc=1
- return
- endif
-
- if(.not.ldupemsg .and. i3.eq.1 .and. .not.lft8sd .and. .not.lft8s .and. &
- msg37(1:3).ne.'CQ ') then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ncount=ncount+1
- msgsrcvd(ncount)=msg37(1:ispc2-1)
- endif
-
-! -23 0.0 1606 ~ <...> 3U1TBM/R CC65 i3=4 n3=0
-! -18 0.3 1609 ~ CQ 6U6MBL/R IJ90 i3=1 in some noisy setups false decode with any SNR value is possible
-
- if((i3.eq.4 .and. n3.eq.0) .or. (i3.eq.1 .and. msg37(1:3).eq."CQ ")) then
- if(index(msg37,'/R ').gt.9) then
- ispc1=index(msg37,' ')
- ispc2=index(msg37((ispc1+1):),' ')+ispc1
- if(ispc2.gt.11) then
- ispc3=index(msg37((ispc2+1):),' ')+ispc2
- if(msg37((ispc2-2):(ispc2-1)).eq.'/R') then
- if((ispc3-ispc2).eq.5) then
- grid=msg37(ispc2+1:ispc3-1)
-! grid can not be txed, invalid message:
- if(i3.eq.4 .and. len_trim(grid).eq.4) then
- nbadcrc=1
- msg37=''
- return
- endif
- call_b=''
- call_b=msg37((ispc1+1):(ispc2-3))
- call chkgridvar(call_b,grid,lchkcall,lgvalid,lwrongcall)
- if(lwrongcall .or. .not.lgvalid) then
- nbadcrc=1
- msg37=''
- return
- endif
- endif
- endif
- endif
- endif
- endif
-
-! protocol violations
-! 713STG 869TK NO05 i3=2 n3=5, false decode, as per protocol type2 shall be /P message
- if(i3.eq.2 .and. index(msg37,'/P ').lt.1) then
- msg37=''
- nbadcrc=1
- return
- endif
-
-! -18 0.5 584 ~ UA3ALE <...> PR07 * AP decode with grid
- if(iaptype.eq.2) then
- nhash=index(msg37,"<...>")
- if(nhash.gt.4 .and. nhash.lt.13 .and. msg37(nhash+6:nhash+6).gt.'@' .and. &
- msg37(nhash+7:nhash+7).gt.'@') then
- msg37=''
- nbadcrc=1
- return
- endif
- endif
-
- if(lsubtract) then
- noff=10
- sync0=0.
- syncp=0.
- syncm=0.
- k=1
- call gen_ft8wavevar(itone,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680)
- do i=0,78
- do j=1,32
- csig(j)=csig0(k)
- k=k+60
- enddo
- i21=i0+i*32
- z1=0.
- z1=sum(cd0(i21:i21+31)*conjg(csig))
- sync0 = sync0 + real(z1)**2 + aimag(z1)**2
- i21=i0+i*32+noff
- z1=0.
- z1=sum(cd0(i21:i21+31)*conjg(csig))
- syncp = syncp + real(z1)**2 + aimag(z1)**2
- i21=i21-noff*2
- z1=0.
- z1=sum(cd0(i21:i21+31)*conjg(csig))
- syncm = syncm + real(z1)**2 + aimag(z1)**2
- enddo
- call peakup(syncm,sync0,syncp,dx)
- if(abs(dx).gt.1.0) then
- scorr=0.
- else
- scorr=real(noff)*(dx) ! was * dx ft8md
- endif
- xdt3=xdt+scorr*dt2
- call subtractft8var(itone,f1,xdt3)
- lsubtracted=.true. ! inside current thread
- if(npos.lt.200) then
- npos=npos+1
- freqsub(npos)=f1
- endif
- endif
- endif
-
- return
-end subroutine ft8bvar
-
-subroutine normalizebmetvar(bmet,n)
- real bmet(n)
-
-! bmetav=sum(bmet)/real(n)
- bmet2av=sum(bmet*bmet)/real(n)
-! var=bmet2av-bmetav*bmetav
-! if( var .gt. 0.0 ) then
-! bmetsig=sqrt(var)
-! else
- bmetsig=sqrt(bmet2av)
-! endif
- bmet=bmet/bmetsig
-
- return
-end subroutine normalizebmetvar
+subroutine ft8bvar(newdat1,nQSOProgress,nfqso,nftx,napwid,lsubtract,npos,freqsub, & + tmpcqdec,tmpmyc,nagainfil,iaptype,f1,xdt,nbadcrc,lft8sdec,msg37,msg37_2, & + xsnr,stophint,nthr,lFreeText,ipass,lft8subpass,lspecial,lcqcand,ncqsignal, & + nmycsignal,npass,i3bit,lft8s,lmycallstd,lhiscallstd,levenint,loddint,lft8sd, & + i3,n3,nft8rxfsens,ncount,msgsrcvd,lrepliedother,lhashmsg,lqsothread, & + lft8lowth,lhighsens,lsubtracted,tmpcqsig,tmpmycsig,tmpqsosig,lnohiscall, & + lnomycall,lnohisgrid,qual,iaptype2) + + use packjt77, only : unpack77var + use ft8_mod1, only : allmessages,ndecodes,apsym,mcq,m73,mrr73,mrrr,icos7, & + naptypes,nhaptypes,one,graymap,oddcopy,evencopy,lastrxmsg,lasthcall, & + nlasttx,calldteven,calldtodd,lqsomsgdcd,mycalllen1,msgroot,msgrootlen, & + allfreq,idtone25,lapmyc,idtonemyc,mycall,hiscall,lhound,apsymsp, & + ndxnsaptypes,apsymdxns1,apsymdxnsrrr,lenabledxcsearch,lwidedxcsearch, & + apcqsym,apsymdxnsrr73,apsymdxns73,mybcall,hisbcall,lskiptx1,nft8cycles, & + ctwkw,ctwkn,nincallthr,msgincall,xdtincall,maskincallthr,ctwk256,numcqsig, & + numdeccq,evencq,oddcq,nummycsig,numdecmyc,evenmyc,oddmyc,idtone56, & + idtonecqdxcns,evenqso,oddqso,nmycnsaptypes,apsymmyns1,apsymmyns2, & + apsymmynsrr73,apsymmyns73,apsymdxstd,apsymdxnsr73,apsymdxns732,ltxing, & + apsymmynsrrr,idtonedxcns73,idtonefox73,idtonespec !ft8md added + + include 'ft8_params.f90' + character c77*77,msg37*37,msg37_2*37,msgd*37,msgbase37*37,call_a*12,call_b*12 + character callsign*12,grid*12 + character*37 msgsrcvd(130) + complex cd0(-800:4000),cd1(-800:4000),cd2(-800:4000),cd3(-800:4000),ctwk(32), & + csymb(32),cs(0:7,79),csymbr(32),csr(0:7,79),csig(32),csig0(151680),z1, & + csymb256(256),cstmp2(0:7,79),csold(0:7,79),cscs(0:7,79) + real a(5),s8(0:7,79),s82(0:7,79),s2(0:511),sp(0:7),s81(0:7),snrsync(21), & + syncw(7),sumkw(7),scoreratiow(7),freqsub(200),s256(0:8),s2563(0:26), & + syncavpart(3) + real bmeta(174),bmetb(174),bmetc(174),bmetd(174) + real llra(174),llrb(174),llrc(174),llrd(174),llrz(174) + real qual !ft8md + integer*1 message77(77),apmask(174),cw(174),nsmax(8) + integer itone(79),ip(1),ka(1),nqsoend(3) + integer, intent(in) :: nQSOProgress,nfqso,nftx,napwid,nthr,ipass,nft8rxfsens + logical newdat1,lsubtract,lFreeText,nagainfil,lspecial,unpk77_successvar + logical(1), intent(in) :: stophint,lft8subpass,lmycallstd,lhiscallstd, & + lqsothread,lft8lowth,lhighsens,lcqcand,levenint,loddint,lnohiscall, & + lnomycall,lnohisgrid + logical(1) falsedec,lastsync,ldupemsg,lft8s,lft8sdec,lft8sd,lsdone,ldupeft8sd, & + lrepliedother,lhashmsg,lvirtual2,lvirtual3,lsd,lcq,ldeepsync,lcallsstd, & + lfound,lsubptxfreq,lreverse,lchkcall,lgvalid,lwrongcall,lsubtracted, & + lcqsignal,loutapwid,lfoundcq,lmycsignal,lfoundmyc,lqsosig,ldxcsig, & + lcqdxcsig,lcqdxcnssig,lqsocandave,lcall1hash,lqsosigtype3,lqso73,lqsorr73, & + lqsorrr,lfoxspecrpt,lfoxstdr73,lapcqonly,lcall2hash,lskipnotap + integer iaptype2 + + type tmpcqdec_struct + real freq + real xdt + end type tmpcqdec_struct + type(tmpcqdec_struct) tmpcqdec(numdeccq) + + type tmpcqsig_struct + real freq + real xdt + complex cs(0:7,79) + end type tmpcqsig_struct + type(tmpcqsig_struct) tmpcqsig(numcqsig) ! 20 sigs 24 threads + + type tmpmyc_struct + real freq + real xdt + end type tmpmyc_struct + type(tmpmyc_struct) tmpmyc(numdecmyc) + + type tmpmycsig_struct + real freq + real xdt + complex cs(0:7,79) + end type tmpmycsig_struct + type(tmpmycsig_struct) tmpmycsig(nummycsig) ! 5 sigs + + type tmpqsosig_struct + real freq + real xdt + complex cs(0:7,79) + end type tmpqsosig_struct + type(tmpqsosig_struct) tmpqsosig(1) + + iaptype2 = 99 !ft8md + + max_iterations=30 + nharderrors=-1 + nbadcrc=1 + delfbest=0. + ibest=0 + dfqso=500. + rrxdt=0.5 + fs2=200. + dt2=0.005 ! fs2=12000.0/NDOWN; dt2=1.0/fs2 + lcall1hash=.false. + lcall2hash=.false. + lskipnotap=.false. + ldeepsync=.false. + if(lft8lowth .or. lft8subpass) ldeepsync=.true. + lcallsstd=.true. + if(.not.lmycallstd .or. .not.lhiscallstd) lcallsstd=.false. + + xdt0=xdt + f10=f1 +! apply last freq f1 and last DT criteria here + nqso=1 + if(lqsothread .and. .not. lft8sdec .and. .not.lqsomsgdcd .and. .not.stophint & + .and. nlasttx.ge.1 .and. nlasttx.le.4 .and. abs(f10-nfqso).lt.2.51) then + if(lastrxmsg(1)%lstate .and. abs(lastrxmsg(1)%xdt-xdt).lt.0.18) then + nqso=2 + elseif(.not.lastrxmsg(1)%lstate) then + nqso=2 + endif + endif + + lvirtual2=.false. + lvirtual3=.false. + maxlasttx=4 + if(lqsothread .and. .not. lft8sdec .and. .not.lqsomsgdcd) then + if(len_trim(hiscall).gt.2) then + if(xdt.gt.4.9 .or. xdt.lt.-4.9) then + if(lastrxmsg(1)%lstate .and. trim(lastrxmsg(1)%lastmsg).eq.trim(msgroot)//& + ' RRR') maxlasttx=5 + endif + if(xdt.gt.4.9) then + if(.not.stophint .and. nlasttx.ge.1 .and. nlasttx.le.maxlasttx .and. & + abs(f10-nfqso).lt.0.1) then + if(lastrxmsg(1)%lstate) then + xdt0=lastrxmsg(1)%xdt + nqso=2 + lvirtual2=.true. + endif + if(.not.lastrxmsg(1)%lstate) then + if(levenint) then + do i=1,150 + if(trim(calldteven(i)%call2).eq.trim(hiscall)) then + xdt0=calldteven(i)%dt + nqso=3 + lvirtual2=.true. + exit + endif + enddo + else if(loddint) then + do i=1,150 + if(trim(calldtodd(i)%call2).eq.trim(hiscall)) then + xdt0=calldtodd(i)%dt + nqso=3 + lvirtual2=.true. + exit + endif + enddo + endif + endif + endif + elseif (xdt.lt.-4.9) then + if(.not.stophint .and. nlasttx.ge.1 .and. nlasttx.le.maxlasttx .and. & + abs(f10-nfqso).lt.0.1) then + if(lastrxmsg(1)%lstate) then + xdt0=lastrxmsg(1)%xdt + nqso=3 + lvirtual3=.true. + endif + if(.not.lastrxmsg(1)%lstate) then + if(levenint) then + do i=1,150 + if(trim(calldteven(i)%call2).eq.trim(hiscall)) then + xdt0=calldteven(i)%dt + nqso=3 + lvirtual3=.true. + exit + endif + enddo + else if(loddint) then + do i=1,150 + if(trim(calldtodd(i)%call2).eq.trim(hiscall)) then + xdt0=calldtodd(i)%dt + nqso=3 + lvirtual3=.true. + exit + endif + enddo + endif + endif + endif + endif + endif + endif + + call ft8_downsamplevar(newdat1,f1,nqso,cd0,cd2,cd3,lhighsens,lsubtracted,npos, & + freqsub) !Mix f1 to baseband and downsample + + lsd=.false. + isd=1 + lcq=.false. + if(levenint) then + do i=1,130 + if(.not.evencopy(i)%lstate) cycle + if(abs(evencopy(i)%freq-f1).lt.3.0 .and. abs(evencopy(i)%dt-xdt).lt.0.19) then + msgd=evencopy(i)%msg + lsd=.true. + isd=i + if(msgd(1:3).eq.'CQ ' .or. msgd(1:3).eq.'DE ' .or. & + msgd(1:4).eq.'QRZ ') lcq=.true. + endif + enddo + elseif(loddint) then + do i=1,130 + if(.not.oddcopy(i)%lstate) cycle + if(abs(oddcopy(i)%freq-f1).lt.3.0 .and. abs(oddcopy(i)%dt-xdt).lt.0.19) then + msgd=oddcopy(i)%msg + lsd=.true. + isd=i + if(msgd(1:3).eq.'CQ ' .or. msgd(1:3).eq.'DE ' .or. & + msgd(1:4).eq.'QRZ ') lcq=.true. + endif + enddo + endif + + if(lsd .and. nqso.eq.1) nqso=4 + +!nlasttx last TX message +! 0 Tx was halted +! 1 AA1AA BB1BB PL35 +! 2 AA1AA BB1BB -15 +! 3 AA1AA BB1BB R-15 +! 4 AA1AA BB1BB RRR/RR73 +! 5 AA1AA BB1BB 73 +! 6 CQ BB1BB PL35 + + if(nqso.eq.4) cd1=cd0 + do iqso=1,nqso + lapcqonly=.false. + if(iqso.gt.1 .and. iqso.lt.4 .and. nqso.eq.4) cycle + if(xdt0.lt.-4.9 .or. xdt0.gt.4.9) cycle + if(lvirtual2 .and. iqso.ne.2) cycle + if(lvirtual3 .and. iqso.lt.2) cycle + if((lvirtual2 .or. lvirtual3) .and. nft8rxfsens.lt.3 .and. iqso.eq.3) cycle + lastsync=.false. + lsdone=.false. + if(.not.lvirtual2 .and. .not.lvirtual3 .and. iqso.eq.2) then + cd0=cd2 + elseif(lvirtual2 .and. iqso.eq.2) then + cd0=cd2 + elseif(lvirtual3 .and. iqso.eq.2) then + cd0=cd3 + endif + if(iqso.eq.4) then + call tonesdvar(msgd,lcq) + if(.not.ldeepsync) go to 32 + cd0=cd1 + endif + if(iqso.eq.3) go to 16 + i0=nint((xdt0+0.5)*fs2) !Initial guess for start of signal + smax=0.0 + ctwk=cmplx(1.0,0.0) + do idt=i0-8,i0+8 !Search over +/- one quarter symbol + call sync8dvar(cd0,idt,ctwk,0,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand) + if(sync.gt.smax) then + smax=sync + ibest=idt + endif + enddo + xdt2=ibest*dt2 !Improved estimate for DT + + ! Now peak up in frequency + i0=nint(xdt2*fs2) + smax=0.0 + kstep=1 + do ifr=-5,5 + if(iqso.eq.1 .or. iqso.eq.4) then + ctwk=ctwkw(kstep,:) + delf=ifr*0.5 ! Search over +/- 2.5 Hz + else + ctwk=ctwkn(kstep,:) + delf=ifr*0.25 ! Search over +/- 1.25 Hz + endif + call sync8dvar(cd0,i0,ctwk,1,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand) + if(sync.gt.smax) then + smax=sync + delfbest=delf + endif + kstep=kstep+1 + enddo + a=0.0 + a(1)=-delfbest + call twkfreq1var(cd0,-800,3199,4000,fs2,a,cd0) + xdt=xdt2 + f1=f10+delfbest !Improved estimate of DF + dfqso=abs(nfqso-f1) + lastsync=.true. + call sync8dvar(cd0,i0,ctwk,2,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand) + +16 if(iqso.eq.3) ibest=ibest+1 + + syncav=3. + syncavpart=3. + snrsync=0. + do k=1,79 + i1=ibest+(k-1)*32 + csymb=cd0(i1:i1+31) + if((k.ge.1 .and. k.le.7) .or. (k.ge.37 .and. k.le.43) .or. & + (k.ge.73 .and. k.le.79)) then + call four2avar(csymb,32,1,-1,1) + s81(0:7)=abs(csymb(1:8)) + if(k.ge.1 .and. k.le.7) then + synclev=s81(icos7(k-1)) + snoiselev=(sum(s81)-synclev)/7.0 + if(snoiselev.gt.1.E-16) snrsync(k)=synclev/snoiselev + else if(k.ge.37 .and. k.le.43) then + synclev=s81(icos7(k-37)) + snoiselev=(sum(s81)-synclev)/7.0 + if(snoiselev.gt.1.E-16) snrsync(k-29)=synclev/snoiselev + else if(k.ge.73 .and. k.le.79) then + synclev=s81(icos7(k-73)) + snoiselev=(sum(s81)-synclev)/7.0 + if(snoiselev.gt.1.E-16) snrsync(k-58)=synclev/snoiselev + endif + else + cycle + endif + enddo + + syncav=sum(snrsync)/21. + syncavpart(1)=sum(snrsync(1:7))/7. + syncavpart(2)=sum(snrsync(8:14))/7. + syncavpart(3)=sum(snrsync(15:21))/7. + syncavemax=maxval(syncavpart,1) + +! plev=0.0 +! do k=1000,1009; abscd=abs(cd0(k)); if(abscd.gt.plev) plev=abscd; enddo +! plev=plev/61.0 +! do k=0,3199; xx=plev*gran(); yy=plev*gran(); cd0(k)=cd0(k) + complex(xx,yy); enddo + + lreverse=.false. + if(nft8cycles.lt.2) then + if(ipass.eq.2) lreverse=.true. + else + if(ipass.eq.5 .or. ipass.eq.7) lreverse=.true. + endif + + do k=1,79 + i1=ibest+(k-1)*32 + csymb=cd0(i1:i1+31) + if(syncav.lt.2.5) then + csymb(1)=csymb(1)*1.9 + csymb(32)=csymb(32)*1.9 + scr=SQRT(abs(csymb(1)))/SQRT(abs(csymb(32))) + if(scr.gt.1.0) then + csymb(32)=csymb(32)*scr + else + if(scr.gt.1.E-16) csymb(1)=csymb(1)/scr + endif + endif + do i=1,32 + csymbr(i)=cmplx(real(csymb(33-i)),-aimag(csymb(33-i))) + enddo + if(lreverse) then + call four2avar(csymb,32,1,-1,1) + cscs(0:7,k)=csymb(1:8)/1e3 + csymb=csymbr + endif + call four2avar(csymb,32,1,-1,1) + cs(0:7,k)=csymb(1:8)/1e3 + if(lreverse) then + csr=cs + else + call four2avar(csymbr,32,1,-1,1) + csr(0:7,k)=csymbr(1:8)/1e3 + endif + s8(0:7,k)=abs(csymb(1:8)) + enddo + + sp=0. + do k=0,7 + sp(k)=sum(s8(k,1:7))+sum(s8(k,18:79)) + enddo + ka=minloc(sp)-1 + k=ka(1) + if(k.lt.0) go to 128 + do kb=0,7 + if(kb.eq.k) cycle + spr=sp(kb)/sp(k) + if(spr.gt.1.5) then + s8(kb,:)=s8(kb,:)/spr + sprsqr=SQRT(spr) + cs(kb,:)=cs(kb,:)/sprsqr + csr(kb,:)=csr(kb,:)/sprsqr + cscs(kb,:)=cscs(kb,:)/sprsqr + endif + enddo +128 continue + + if(iqso.gt.1 .and. iqso.lt.4) then + s82=SQRT(s8) + go to 8 + endif + if(iqso.eq.4) go to 32 + + nsyncscorew=0 + scoreratiowa=0. + rrxdt=xdt-0.5 + if(rrxdt.ge.-0.5 .and. rrxdt.le.2.13) then + do k=1,7 + syncw(icos7(k-1)+1)=s8(icos7(k-1),k)+s8(icos7(k-1),k+36) + & + s8(icos7(k-1),k+72) + enddo + do k=1,7 + sumkw(k)=(sum(s8(k-1,:))-syncw(k))/25.333 + enddo ! (79-3)/3 + else if(rrxdt.lt.-0.5) then + do k=1,7 + syncw(icos7(k-1)+1)=s8(icos7(k-1),k+36)+s8(icos7(k-1),k+72) + enddo + do k=1,7 + sumkw(k)=(sum(s8(k-1,26:79))-syncw(k))/26. + enddo ! (54-2)/2 + else if(rrxdt.gt.2.13) then + do k=1,7 + syncw(icos7(k-1)+1)=s8(icos7(k-1),k)+s8(icos7(k-1),k+36) + enddo + do k=1,7 + sumkw(k)=(sum(s8(k-1,1:54))-syncw(k))/26. + enddo ! (54-2)/2 + endif + do k=1,7 + if(syncw(k).gt.sumkw(k)) nsyncscorew=nsyncscorew+1 + scoreratiow(k)=syncw(k)/sumkw(k) + enddo + scoreratiowa=sum(scoreratiow)/7. + +! sync quality check + is1=0 + is2=0 + is3=0 + nsyncscore=0 + nsyncscore1=0 + nsyncscore2=0 + nsyncscore3=0 + scoreratio=0. + scoreratio1=0. + scoreratio2=0. + scoreratio3=0. + nsync2=0 + do k=1,7 + s81(:)=s8(:,k) + ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + is1=is1+1 + else + s81(ip(1)-1)=0. + ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) nsync2=nsync2+1 + endif + s81=s8(:,k+36) + ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + is2=is2+1 + else + s81(ip(1)-1)=0. + ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) nsync2=nsync2+1 + endif + s81=s8(:,k+72) + ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + is3=is3+1 + else + s81(ip(1)-1)=0. + ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) nsync2=nsync2+1 + endif + if(rrxdt.ge.-0.5) then + synck=s8(icos7(k-1),k) + sumk=(sum(s8(:,k))-synck)/7.0 + if(synck.gt.sumk) then + nsyncscore1=nsyncscore1+1 + scoreratio1=scoreratio1+synck/sumk + endif + endif + synck=s8(icos7(k-1),k+36) + sumk=(sum(s8(:,k+36))-synck)/7.0 + if(synck.gt.sumk) then + nsyncscore2=nsyncscore2+1 + scoreratio2=scoreratio2+synck/sumk + endif + if(rrxdt.le.2.13) then + synck=s8(icos7(k-1),k+72) + sumk=(sum(s8(:,k+72))-synck)/7.0 + if(synck.gt.sumk) then + nsyncscore3=nsyncscore3+1 + scoreratio3=scoreratio3+synck/sumk + endif + endif + enddo + nsyncscore=nsyncscore1+nsyncscore2+nsyncscore3 + scoreratio=scoreratio1+scoreratio2+scoreratio3 +! hard sync sum - max is 21 + nsync=is1+is2+is3 +! bail out + rscq=0. + if(lcqcand) then + do k11=8,16 + ip=maxloc(s8(:,k11)) + if(k11.lt.16) then + if(ip(1).eq.1) rscq=rscq+1. + else + if(ip(1).eq.2) rscq=rscq+1. + endif + enddo + ip=maxloc(s8(:,17)) + if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5 + ip=maxloc(s8(:,27)) + if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5 + ip=maxloc(s8(:,33)) + if(ip(1).eq.3 .or. ip(1).eq.4) rscq=rscq+0.5 + endif + if(lcqcand .and. nsync.eq.4) then + if(nsync+nsync2.lt.12) then + if(rscq.lt.6.6) then + nbadcrc=1 + return + endif + endif + lapcqonly=.true. + else if(lcqcand .and. nsync.eq.5) then + if(nsync+nsync2.lt.12) then + if(rscq.lt.6.1) then + nbadcrc=1 + return + endif + endif + lapcqonly=.true. + else if(lcqcand .and. nsync.eq.6) then + if(nsync+nsync2.lt.11) then + if(rscq.lt.5.6) then + nbadcrc=1 + return + endif + endif + lapcqonly=.true. + else + if(nsync.lt.7) then + nbadcrc=1 + return + endif + endif + + lskipnotap=.false. + if(.not.lapcqonly .and. nsync.lt.11) then + nsmax=0 + do k=1,7 + s81=s8(:,k) + include 'syncdist.f90' + s81=s8(:,k+36) + include 'syncdist.f90' + s81=s8(:,k+72) + include 'syncdist.f90' + enddo + if(sum(nsmax(7:8)).gt.sum(nsmax(2:3)) .or. & + sum(nsmax(5:6)).gt.sum(nsmax(2:3))) lskipnotap=.true. + endif + +! if(lcqcand .and. nsync.lt.7 .and. nsync.gt.1) then +! if(nsync+nsync2.lt.9) then +! rscq=0. +! do k11=8,16 +! ip=maxloc(s8(:,k11)) +! if(k11.lt.16) then; if(ip(1).eq.1) rscq=rscq+1.; else; if(ip(1).eq.2) rscq=rscq+1.; endif +! enddo +! ip=maxloc(s8(:,17)); if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5 +! ip=maxloc(s8(:,27)); if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5 +! ip=maxloc(s8(:,33)); if(ip(1).eq.3 .or. ip(1).eq.4) rscq=rscq+0.5 +! if(rscq.lt.4.9) then; nbadcrc=1; return; endif +! endif +! else +! if(nsync.lt.7) then; nbadcrc=1; return; endif +! endif + + if(nsyncscore.gt.0) then + scoreratio=scoreratio/nsyncscore + else + scoreratio=0. + endif + if(nsyncscore1.gt.0) then + scoreratio1=scoreratio1/nsyncscore1 + else + scoreratio1=0. + endif + if(nsyncscore3.gt.0) then + scoreratio3=scoreratio3/nsyncscore3 + else + scoreratio3=0. + endif + + if(dfqso.ge.2.0 .or. (dfqso.lt.2.0 .and. stophint)) then + if(rrxdt.ge.-0.5 .and. rrxdt.le.2.13) then + if(nsyncscore.lt.8 .or. (nsyncscore.lt.10 .and. scoreratio.lt.5.5) .or. & + (nsyncscore.lt.11 .and. scoreratio.lt.3.63)) then + nbadcrc=1 + return ! 377 out of 20709 + else if(nsyncscore.eq.11 .and. scoreratio.lt.5.37) then + if(nsyncscore1.lt.5 .and. nsyncscore3.lt.5 .and. scoreratio1.lt.4.2 & + .and. scoreratio3.lt.4.2) then + nbadcrc=1 + return ! 261 + endif + else if(nsyncscore.eq.12 .and. scoreratio.lt.4.6) then + if(nsyncscore1.lt.5 .and. nsyncscore3.lt.5 .and. scoreratio1.lt.4.0 & + .and. scoreratio3.lt.4.0) then + nbadcrc=1 + return ! 222 + endif + else if(nsyncscore.eq.13 .and. scoreratio.lt.4.4) then + if(nsyncscore1.lt.5 .and. nsyncscore2.lt.6 .and. nsyncscore3.lt.5 & + .and. scoreratio1.lt.4.4 .and. scoreratio3.lt.4.4) then + nbadcrc=1 + return ! 98 + endif + else if(nsyncscorew.lt.3) then + if((nsyncscore1.gt.5 .and. scoreratio1.gt.13.8) .or. & + (nsyncscore2.gt.5 .and. scoreratio2.gt.13.8) .or. & + (nsyncscore3.gt.5 .and. scoreratio3.gt.13.8)) go to 32 + nbadcrc=1 + return ! 75 + else if(nsyncscorew.eq.3) then + if(scoreratio1.gt.15. .or. scoreratio2.gt.15. .or. scoreratio3.gt.15.) & + go to 32 + nbadcrc=1 + return ! 125 + else if(nsyncscorew.eq.4) then + if(nsyncscore1.eq.7 .or. nsyncscore2.eq.7 .or. nsyncscore3.eq.7 .or. & + scoreratio1.gt.10. .or. scoreratio2.gt.10. .or. & + scoreratio3.gt.10.) go to 32 + nbadcrc=1 + return ! 94 + else if(nsyncscorew.eq.5) then + if(nsyncscore.gt.17 .or. nsyncscore1.eq.7 .or. nsyncscore2.eq.7 .or. & + nsyncscore3.eq.7 .or. scoreratio1.gt.10. .or. & + scoreratio2.gt.10. .or. scoreratio3.gt.10.) go to 32 + nbadcrc=1 + return ! 131 + endif + else if(rrxdt.lt.-0.5) then + if(nsyncscore.lt.6 .or. (nsyncscore.gt.5 .and. nsyncscore.lt.8 .and. & + nsyncscorew.lt.6 .and. scoreratio2.lt.5.5 .and. & + scoreratio3.lt.5.5)) then + nbadcrc=1 + return ! 46 + else if(nsyncscore.eq.8) then + if(nsyncscore2.lt.6 .and. nsyncscore3.lt.6 .and. scoreratio2.lt.6.6 & + .and. scoreratio3.lt.6.6) then + nbadcrc=1 + return ! 20 + endif + else if(nsyncscore.eq.9 .and. scoreratio.lt.6.0) then + if(nsyncscore2.lt.6 .and. nsyncscore3.lt.6 .and. scoreratio2.lt.6.6 & + .and. scoreratio3.lt.6.5) then + nbadcrc=1 + return ! 5 + endif + else if(nsyncscorew.lt.3) then + if((nsyncscore2.gt.5 .and. scoreratio2.gt.13.8) .or. & + (nsyncscore3.gt.5 .and. scoreratio3.gt.13.8)) go to 32 + nbadcrc=1 + return ! 22 + else if(nsyncscorew.eq.3) then + if(scoreratio2.gt.15. .or. nsyncscore3.gt.15) go to 32 + nbadcrc=1 + return ! 31 + else if(nsyncscorew.eq.4) then + if(nsyncscore2.eq.7 .or. nsyncscore3.eq.7 .or. scoreratio2.gt.10. & + .or. nsyncscore3.gt.10) go to 32 + nbadcrc=1 + return ! 34 + else if(nsyncscorew.eq.5) then + if(nsyncscore.gt.11 .or. nsyncscore2.eq.7 .or. nsyncscore3.eq.7 & + .or. scoreratio2.gt.10. .or. scoreratio3.gt.10.) go to 32 + nbadcrc=1 + return ! 35 + endif + else if(rrxdt.gt.2.13) then + if(nsyncscore.lt.6 .or. (nsyncscore.gt.5 .and. nsyncscore.lt.8 .and. & + nsyncscorew.lt.6 .and. scoreratio1.lt.5.5 .and. & + scoreratio2.lt.5.5)) then + nbadcrc=1 + return ! 4 + else if(nsyncscore.eq.8) then + if(nsyncscore1.lt.6 .and. nsyncscore2.lt.6 .and. scoreratio1.lt.6.6 & + .and. scoreratio2.lt.6.6) then + nbadcrc=1 + return ! 8 + endif + else if(nsyncscore.eq.9 .and. scoreratio.lt.6.0) then + if(nsyncscore1.lt.6 .and. nsyncscore2.lt.6 .and. scoreratio2.lt.6.6 & + .and. scoreratio1.lt.6.5) then + nbadcrc=1 + return ! 2 + endif + else if(nsyncscorew.lt.3) then + if((nsyncscore1.gt.5 .and. scoreratio1.gt.13.8) .or. & + (nsyncscore2.gt.5 .and. scoreratio2.gt.13.8)) go to 32 + nbadcrc=1 + return ! 12 + else if(nsyncscorew.eq.3) then + if(scoreratio1.gt.15. .or. scoreratio2.gt.15.) go to 32 + nbadcrc=1 + return ! 32 + else if(nsyncscorew.eq.4) then + if(nsyncscore1.eq.7 .or. nsyncscore2.eq.7 .or. scoreratio1.gt.10. & + .or. nsyncscore2.gt.10) go to 32 + nbadcrc=1 + return ! 103 + else if(nsyncscorew.eq.5) then + if(nsyncscore.gt.11 .or. nsyncscore1.eq.7 .or. nsyncscore2.eq.7 & + .or. scoreratio1.gt.10. .or. scoreratio2.gt.10.) go to 32 + nbadcrc=1 + return ! 0 + endif + endif + endif + +32 if(lsd) then + if(iqso.eq.4 .and. .not.ldeepsync) go to 64 + call ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq) + if(lft8sd) then + if(levenint) then + evencopy(isd)%lstate=.false. + elseif(loddint) then + oddcopy(isd)%lstate=.false. + endif + i3=1 + n3=1 + iaptype2=iaptype + iaptype=0 + nbadcrc=0 + lsd=.false. + go to 2 + endif + +64 if(iqso.eq.4) then + if(.not.lcq) then + call ft8mf1var(s8,itone,msgd,msg37,lft8sd) + if(lft8sd) then + if(levenint) then + evencopy(isd)%lstate=.false. + elseif(loddint) then + oddcopy(isd)%lstate=.false. + endif + i3=1 + n3=1 + iaptype2=iaptype + iaptype=0 + nbadcrc=0 + lsd=.false. + go to 2 + endif + else + call ft8mfcqvar(s8,itone,msgd,msg37,lft8sd) + if(lft8sd) then + if(levenint) then + evencopy(isd)%lstate=.false. + elseif(loddint) then + oddcopy(isd)%lstate=.false. + endif + i3=1 + n3=1 + iaptype2=iaptype + iaptype=0 + nbadcrc=0 + lsd=.false. + go to 2 + endif + endif + endif + endif + + if(iqso.eq.4) then + nbadcrc=1 + go to 2 + endif + + synclev=0.0 + snoiselev=1.0 + do k=1,7 + synclev=synclev+s8(icos7(k-1),k+36) + enddo + snoiselev=(sum(s8(0:7,37:43))- synclev)/7.0 + if(snoiselev.lt.0.1) snoiselev=1.0 ! safe division + srr=synclev/snoiselev + +! SNR srr range average srr +! -18 1.8...4.0 2.9 +! -19 1.7...3.6 2.65 +! -20 1.6...3.3 2.43 +! -21 1.6...3.0 2.22 +! -22 1.55...2.8 2.19 +! -23 1.4...2.6 2.03 +! -24 1.94 + +8 if(iqso.gt.1 .and. iqso.lt.4) then + if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. .not.lhiscallstd)) then + if(.not.lft8sdec .and. dfqso.lt.2.0) then + if(lvirtual2 .or. lvirtual3) srr=0.0 + call ft8svar(s82,srr,itone,msg37,lft8s,nft8rxfsens,stophint) + if(lft8s) then + if(index(msg37,'<').gt.0) then + lhashmsg=.true. + endif + nbadcrc=0 + lft8sdec=.true. + lsdone=.true. + go to 2 ! i3=16 n3=16, any affect? + endif + endif + endif + lsdone=.true. + nbadcrc=1 + cycle + endif + + i1=ibest+224 ! 7*32 + csymb256=cd0(i1:i1+255)*ctwk256 + call four2avar(csymb256,256,1,-1,1) + s256(0:8)=abs(csymb256(1:9)) + rscq=0. + nmic=0 + do k11=8,16 + ip=maxloc(s8(:,k11)) + if(ip(1).eq.idtonemyc(k11-7)+1) nmic=nmic+1 + if(k11.lt.16) then + if(ip(1).eq.1) rscq=rscq+1. + else + if(ip(1).eq.2) rscq=rscq+1. + endif + enddo + ip=maxloc(s8(:,17)) + if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5 + ip=maxloc(s8(:,27)) + if(ip(1).eq.1 .or. ip(1).eq.2) rscq=rscq+0.5 + ip=maxloc(s8(:,33)) + if(ip(1).eq.3 .or. ip(1).eq.4) rscq=rscq+0.5 + + lqsosig=.false. + lqsosigtype3=.false. + lqso73=.false. + lqsorr73=.false. + lqsorrr=.false. ! 73/rr73/rrr for std/nonstd callsigns + if(.not.lqsomsgdcd .and. (dfqso.lt.napwid .or. abs(nftx-f1).lt.napwid) .and. & + lapmyc .and. len_trim(hiscall).gt.2) then + nqsot=0 + do i=1,19 + ip=maxloc(s8(:,i+7)) + if(ip(1).eq.idtone56(1,i)+1) nqsot=nqsot+1 + enddo + if(nqsot.gt.6) lqsosig=.true. ! decoding depth only + do i=20,22 + ip=maxloc(s8(:,i+7)) + if(ip(1).eq.idtone56(1,i)+1) nqsot=nqsot+1 + enddo + if(nqsot.gt.3) lqsosigtype3=.true. + nqsoend=0 ! array 73,rr73,rrr + if(dfqso.lt.napwid .and. (nQSOProgress.eq.3 .or. nQSOProgress.eq.4)) then + ! QSO RX freq only + do i=24,58 + if(i.lt.30) then + ip=maxloc(s8(:,i+7)) + else + ip=maxloc(s8(:,i+14)) + endif + if(ip(1).eq.idtone56(56,i)+1) nqsoend(1)=nqsoend(1)+1 + if(ip(1).eq.idtone56(55,i)+1) nqsoend(2)=nqsoend(2)+1 + if(ip(1).eq.idtone56(54,i)+1) nqsoend(3)=nqsoend(3)+1 + enddo + ip=maxloc(nqsoend) + if(nqsoend(ip(1)).gt.6) then + if(ip(1).eq.1) then + lqso73=.true. + else if(ip(1).eq.2) then + lqsorr73=.true. + else if(ip(1).eq.3) then + lqsorrr=.true. + endif + endif + endif + endif + + lcqsignal=.false. + ip(1)=maxloc(s256,1) + if(ip(1).eq.5 .or. rscq.gt.3.1) lcqsignal=.true. + if(.not.lcqsignal .and. ip(1).eq.4 .or. ip(1).eq.6) then + s2563(0:8)=s256(0:8) + s2563(9:26)=abs(csymb256(9:26)) + ip(1)=maxloc(s2563,1) + if(ip(1).eq.4 .or. ip(1).eq.6) lcqsignal=.true. + endif + lmycsignal=.false. + if(lapmyc .and. nmic.gt.2) lmycsignal=.true. + + ldxcsig=.false. + lcqdxcsig=.false. + lcqdxcnssig=.false. + ndxt=0 + if(lhiscallstd) then + do k11=17,26 + ip=maxloc(s8(:,k11)) + if(ip(1).eq.idtone56(1,k11-7)+1) ndxt=ndxt+1 + enddo + if(ndxt.gt.3) ldxcsig=.true. + if(lcqsignal .and. ldxcsig) lcqdxcsig=.true. + endif +! nonstd DXCall search in idle mode + if(.not.lhiscallstd .and. len_trim(hiscall).gt.2) then ! nonstandard DXCall + ncqdxcnst=0 + do i=1,4 + ip=maxloc(s8(:,i+7)) + if(ip(1).eq.idtonecqdxcns(i)+1) ncqdxcnst=ncqdxcnst+1 + enddo + ndxt=0 + do i=5,23 + ip=maxloc(s8(:,i+7)) + if(ip(1).eq.idtonedxcns73(i)+1) ndxt=ndxt+1 + if(ip(1).eq.idtonecqdxcns(i)+1) ncqdxcnst=ncqdxcnst+1 + enddo + ldxcsig=.false. + if(dfqso.lt.napwid) then + if(ndxt.gt.4) ldxcsig=.true. ! relaxed threshold for RXF napwid + if(ncqdxcnst.gt.5) lcqdxcnssig=.true. + else + if(ndxt.gt.5) ldxcsig=.true. + if(ncqdxcnst.gt.6) lcqdxcnssig=.true. + endif + endif + + lfoxstdr73=.false. + lfoxspecrpt=.false. + nfoxspecrpt=0 ! checking fo special message with report to mybcall + if(lhound) then + nfoxstdbase=0 ! checking for report signal and base of RR73 signal + nfoxspecr73=0 ! checking fo special message with RR73 to mybcall + nfoxr73=0 ! checking for RR73 signal with standard message + fdelta=abs(f1-nfqso) + fdeltam=modulo(fdelta,60.) + if(fdelta.lt.245.0 .and. fdeltam.lt.3.0 .and. (nQSOProgress.eq.1 .or. & + nQSOProgress.eq.3)) then ! calculate on possible Fox frequencies only + do i=1,18 + ip=maxloc(s8(:,i+7)) + if(ip(1).eq.idtonefox73(i)+1) nfoxstdbase=nfoxstdbase+1 + if(i.gt.10 .and. ip(1).eq.idtonespec(i)+1) nfoxspecrpt=nfoxspecrpt+1 + enddo + do i=20,22 ! hash10 + ip=maxloc(s8(:,i+7)) + if(ip(1).eq.idtonespec(i)+1) then + nfoxspecrpt=nfoxspecrpt+1 + nfoxspecr73=nfoxspecr73+1 + endif + enddo + ip=maxloc(s8(:,25+7)) ! i3,n3 + if(ip(1).eq.idtonespec(25)+1) then + nfoxspecrpt=nfoxspecrpt+1 + nfoxspecr73=nfoxspecr73+1 + endif + if(nfoxstdbase.eq.0) then + rspecstdrpt=(nfoxspecrpt*18.)/(1.2) + else + rspecstdrpt=(nfoxspecrpt*18.)/(12.*nfoxstdbase) + endif + if(rspecstdrpt.gt.1.) lfoxspecrpt=.true. + if(nQSOProgress.eq.3) then + do i=24,58 + if(i.lt.30) then + ip=maxloc(s8(:,i+7)) + else + ip=maxloc(s8(:,i+14)) + endif + if(ip(1).eq.idtonefox73(i)+1) nfoxr73=nfoxr73+1 + enddo + if(nfoxspecr73.eq.0) then + rstdr73=(nfoxr73*4.)/(3.5) + else + rstdr73=(nfoxr73*4.)/(35.*nfoxspecr73) + endif + if(rstdr73.gt.1.) lfoxstdr73=.true. + endif + endif + endif + + lsubptxfreq=.false. + if(lapmyc .and. abs(f1-nftx).lt.2.0 .and. .not.lhound .and. .not.lft8sdec & + .and. .not.lqsomsgdcd .and. ((.not.lskiptx1 .and. nlasttx.eq.1) .or. & + (lskiptx1 .and. nlasttx.eq.2))) lsubptxfreq=.true. + + nweak=1 + if(lft8subpass .or. dfqso.lt.2.0 .or. lsubptxfreq) nweak=2 + nsubpasses=nweak + if(lcqsignal) then + nsubpasses=3 + if(levenint) then + do ik=1,numcqsig + if(evencq(ik,nthr)%freq.gt.5001.) exit + if(abs(evencq(ik,nthr)%freq-f1).lt.2.0 .and. & + abs(evencq(ik,nthr)%xdt-xdt).lt.0.05) then + nsubpasses=5 + csold=evencq(ik,nthr)%cs + endif + enddo + else if (loddint) then + do ik=1,numcqsig + if(oddcq(ik,nthr)%freq.gt.5001.) exit + if(abs(oddcq(ik,nthr)%freq-f1).lt.2.0 .and. & + abs(oddcq(ik,nthr)%xdt-xdt).lt.0.05) then + nsubpasses=5 + csold=oddcq(ik,nthr)%cs + endif + enddo + endif + endif + if(lmycsignal .and. lmycallstd) then + nsubpasses=6 + if(levenint) then + do ik=1,nummycsig + if(evenmyc(ik,nthr)%freq.gt.5001.) exit + if(abs(evenmyc(ik,nthr)%freq-f1).lt.2.0 .and. & + abs(evenmyc(ik,nthr)%xdt-xdt).lt.0.05) then + nsubpasses=8 + csold=evenmyc(ik,nthr)%cs + endif + enddo + else if (loddint) then + do ik=1,nummycsig + if(oddmyc(ik,nthr)%freq.gt.5001.) exit + if(abs(oddmyc(ik,nthr)%freq-f1).lt.2.0 .and. & + abs(oddmyc(ik,nthr)%xdt-xdt).lt.0.05) then + nsubpasses=8 + csold=oddmyc(ik,nthr)%cs + endif + enddo + endif + endif + lqsocandave=.false. + if(lapmyc .and. ndxt.gt.2 .and. nmic.gt.2 .and. .not.lqsomsgdcd .and. & + lmycallstd .and. lhiscallstd .and. dfqso.lt.napwid/2.0) then + lqsocandave=.true. + nsubpasses=9 + if(levenint) then + if(abs(evenqso(1,nthr)%freq-f1).lt.2.0 .and. & + abs(evenqso(1,nthr)%xdt-xdt).lt.0.05) then + nsubpasses=11 + csold=evenqso(1,nthr)%cs + endif + else if (loddint) then + if(abs(oddqso(1,nthr)%freq-f1).lt.2.0 .and. & + abs(oddqso(1,nthr)%xdt-xdt).lt.0.05) then + nsubpasses=11 + csold=oddqso(1,nthr)%cs + endif + endif + endif + + do isubp1=1,nsubpasses + if(nweak.eq.1 .and. isubp1.eq.2) cycle + + ! skip if it is lmycsignal, can be both lcq and lmy + if(isubp1.gt.2 .and. isubp1.lt.6 .and. lmycsignal) cycle + + syncavemax=3. + if(isubp1.eq.2) cs=csr + if(ipass.eq.npass-1 .and. (lcqsignal .or. lmycsignal) .and. & + ((nweak.eq.1 .and. isubp1.eq.1) .or. (nweak.eq.2 .and. & + isubp1.eq.2))) cstmp2=cs + if(ipass.eq.npass .and. lapmyc .and. ndxt.gt.2 .and. nmic.gt.2 .and. & + ((nweak.eq.1 .and. isubp1.eq.1) .or. & + (nweak.eq.2 .and. isubp1.eq.2))) cstmp2=cs + do nsym=1,3 + nt=2**(3*nsym)-1 + do ihalf=1,2 + do k=1,29,nsym + if(ihalf.eq.1) then + ks=k+7 + else + ks=k+43 + endif + ks1=ks+1 + ks2=ks+2 + do i=0,nt + i1=i/64 + i2=iand(i,63)/8 + i33=iand(i,7) + if(isubp1.lt.3) then + if(nsym.eq.1) then + s2(i)=abs(cs(graymap(i33),ks)) + elseif(nsym.eq.2) then + s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i33),ks1)) + else + s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks1) + & + cs(graymap(i33),ks2)) + endif + else if(isubp1.eq.3 .or. isubp1.eq.6 .or. isubp1.eq.9) then + if(nsym.eq.1) then + s2(i)=abs(cscs(graymap(i33),ks))**2 + & + abs(csr(graymap(i33),ks))**2 + elseif(nsym.eq.2) then + s2(i)=abs(cscs(graymap(i2),ks) + & + cscs(graymap(i33),ks1))**2 + & + abs(csr(graymap(i2),ks)+csr(graymap(i33),ks1))**2 + else + s2(i)=abs(cscs(graymap(i1),ks) + & + cscs(graymap(i2),ks1)+cscs(graymap(i33),ks2))**2 + & + abs(csr(graymap(i1),ks)+csr(graymap(i2),ks1) + & + csr(graymap(i33),ks2))**2 + endif + else if(isubp1.eq.4 .or. isubp1.eq.7 .or. isubp1.eq.10) then + if(nsym.eq.1) then + s2(i)=abs(cs(graymap(i33),ks))**2 + & + abs(csold(graymap(i33),ks))**2 + elseif(nsym.eq.2) then + s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i33),ks1))**2 + & + abs(csold(graymap(i2),ks)+csold(graymap(i33),ks1))**2 + else + s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks1) + & + cs(graymap(i33),ks2))**2 + & + abs(csold(graymap(i1),ks)+csold(graymap(i2),ks1) + & + csold(graymap(i33),ks2))**2 + endif + else if(isubp1.eq.5 .or. isubp1.eq.8 .or. isubp1.eq.11) then + if(nsym.eq.1) then + s2(i)=abs(cs(graymap(i33),ks))+abs(csold(graymap(i33),ks)) + elseif(nsym.eq.2) then + s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i33),ks1)) + & + abs(csold(graymap(i2),ks)+csold(graymap(i33),ks1)) + else + s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks1) + & + cs(graymap(i33),ks2)) + & + abs(csold(graymap(i1),ks)+csold(graymap(i2),ks1) + & + csold(graymap(i33),ks2)) + endif + endif + if(isubp1.eq.1 .and. srr.lt.2.5) then + ! srr.lt.2.5 -19dB SNR threshold + if(srr.gt.2.3) then + s2(i)=s2(i)**2 + else + ss1=s2(i) + if(ss1.lt.5.77) then + s2(i)=1+8.*ss1**2-0.12*ss1**4 + else + s2(i)=(ss1+5.82)**2 + endif + endif + endif + if(isubp1.gt.1 .and. srr.lt.2.5) then + s2(i)=(0.5*s2(i))**3 ! -19dB SNR threshold + endif + enddo + i32=1+(k-1)*3+(ihalf-1)*87 + if(nsym.eq.1) ibmax=2 + if(nsym.eq.2) ibmax=5 + if(nsym.eq.3) ibmax=8 + do ib=0,ibmax + bm=maxval(s2(0:nt),one(0:nt,ibmax-ib)) - & + maxval(s2(0:nt),.not.one(0:nt,ibmax-ib)) + if(i32+ib .gt.174) cycle + if(nsym.eq.1) then + bmeta(i32+ib)=bm + den=max(maxval(s2(0:nt),one(0:nt,ibmax-ib)), & + maxval(s2(0:nt),.not.one(0:nt,ibmax-ib))) + if(den.gt.0.0) then + cm=bm/den + else + cm=0.0 + endif + bmetd(i32+ib)=cm + elseif(nsym.eq.2) then + bmetb(i32+ib)=bm + elseif(nsym.eq.3) then + bmetc(i32+ib)=bm + endif + enddo + enddo ! k + enddo ! ihalf + enddo ! nsym + +!tests +!call indexx(bmetc(1:174),174,indx) +!src=abs(bmetc(indx(1))/bmetc(indx(174))) +!print *,src + + call normalizebmetvar(bmeta,174) + call normalizebmetvar(bmetb,174) + call normalizebmetvar(bmetc,174) + call normalizebmetvar(bmetd,174) + scalefac=2.83 + llra=scalefac*bmeta + llrb=scalefac*bmetb + llrc=scalefac*bmetc + llrd=scalefac*bmetd + apmag=maxval(abs(llra))*1.01 + +! isubp2 # +!------------------------------ +! 1 regular decoding, nsym=1 +! 2 regular decoding, nsym=2 +! 3 regular decoding, nsym=3 +! 4 regular decoding, llrd +! 5..18 ap passes + +! iaptype Hound OFF, MyCall is standard, DXCall is standard or empty +!------------------------ +! 0 cycle +! 1 CQ ??? ??? (29+3=32 ap bits) +! 2 MyCall ??? ??? (29+3=32 ap bits) +! 3 MyCall DxCall ??? (58+3=61 ap bits) +! 4 MyCall DxCall RRR (77 ap bits) +! 5 MyCall DxCall 73 (77 ap bits) +! 6 MyCall DxCall RR73 (77 ap bits) + +! naptypes(nQSOProgress, extra decoding pass) +! 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 +! 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +! data naptypes(0,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx6 CQ +! data naptypes(1,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx1 Grid +! data naptypes(2,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx2 Report +! data naptypes(3,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,0,0,0,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport +! data naptypes(4,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,2,2,2,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73 +! data naptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx5 73 + +! iaptype standard DxCall tracking, also valid in Hound mode +!------------------------ +! 31 CQ DxCall Grid(???) (77 ap bits) +! 35 ??? DxCall 73 (29+19 ap bits) +! 36 ??? DxCall RR73 (29+19 ap bits) + +! iaptype Hound off, MyCall is nonstandard, DXCall is standard or empty +!------------------------ +! 0 cycle +! 1 CQ ??? ??? (29+3=32 ap bits) +! 40 <MyCall> ??? ??? (29+3=32 ap bits) incoming call +! 41 <MyCall> DxCall ??? (58 ap bits) REPORT/RREPORT +! 42 MyCall <DxCall> RRR (77 ap bits) +! 43 MyCall <DxCall> 73 (77 ap bits) +! 44 MyCall <DxCall> RR73 (77 ap bits) +! 31 CQ DxCall Grid(???) (77 ap bits) standard DxCall tracking +! 35 ??? DxCall 73 (29+19 ap bits) standard DxCall tracking +! 36 ??? DxCall RR73 (29+19 ap bits) standard DxCall tracking + +! nmycnsaptypes(nQSOProgress, extra decoding pass) +! data nmycnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx6 CQ +! data nmycnsaptypes(1,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx1 DXcall MyCall +! data nmycnsaptypes(2,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx2 Report +! data nmycnsaptypes(3,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,0,0,0,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport +! data nmycnsaptypes(4,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,40,40,40,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73 +! data nmycnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx5 73 + +! iaptype Hound off, MyCall is standard, DXCall is not empty and is nonstandard +!------------------------ +! 0 cycle +! 1 CQ ??? ??? (29+3=32 ap bits) +! 2 MyCall ??? ??? (29+3=32 ap bits) +! 11 MyCall <DxCall> ??? (58 ap bits) REPORT/RREPORT +! 12 <MyCall> DxCall RRR (77 ap bits) +! 13 <MyCall> DxCall 73 (77 ap bits) +! 14 <MyCall> DxCall RR73 (77 ap bits) +! 31 CQ DxCall (77 ap bits) ! full compound or just nonstandard callsign +! 35 ??? DxCall 73 (64 ap bits) ! full compound or just nonstandard callsign +! 36 ??? DxCall RR73 (64 ap bits) ! full compound or just nonstandard callsign + +! ndxnsaptypes(nQSOProgress, extra decoding pass) +! data ndxnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx6 CQ +! data ndxnsaptypes(1,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx1 Grid +! data ndxnsaptypes(2,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx2 Report +! data ndxnsaptypes(3,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,0,0,0,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport +! data ndxnsaptypes(4,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,2,2,2,0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73 +! data ndxnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,36,36,35,35,35/ ! Tx5 73 + +! iaptype Hound mode +!------------------------ +! 0 cycle +! 1 CQ ??? ??? (29+3=32 ap bits) standard callsign +! 21 MyBaseCall DxBaseCall ??? (58+3=61 ap bits) Report +! 22 ??? RR73; MyCall <???> ??? (28+6=34 ap bits) +! 23 MyBaseCall DxBaseCall RR73 (77 ap bits) +! 24 MyCall RR73; ??? <???> ??? (28+6=34 ap bits) +! 31 CQ DxCall (DXGrid) (77 ap bits) ! standard/full compound or just nonstandard callsign +! 36 ??? DxCall RR73 (29+19/64 ap bits) ! standard/ full compound or just nonstandard callsign +! 111 CQ ??? (3 last i3 bits) type 4 message with nonstandard callsign + +! nhaptypes(nQSOProgress, extra decoding pass) +! data nhaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,111,111,111/ ! Tx6 CQ, possible in idle mode if DXCall is empty +! data nhaptypes(1,1:27)/21,21,21,22,22,22,0,0,0,0,0,0,0,0,0,31,31,31,0,0,0,36,36,36,0,0,0/ ! Tx1 Grid idle mode or transmitting +! data nhaptypes(2,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx2 none +! data nhaptypes(3,1:27)/21,21,21,22,22,22,23,23,23,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx3 RRreport QSO in progress or QSO is finished +! data nhaptypes(4,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx4 none +! data nhaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ ! Tx5 none + + loutapwid=.false. + loutapwid=abs(f1-nfqso).gt.napwid .and. abs(f1-nftx).gt.napwid + scqnr=2. + smycnr=2. + + ! print*,'stophint is ',stophint,' lft8sdec is ',lft8sdec + ! print*,'lnohiscall is ',lnohiscall,' loutapwid is ',loutapwid + ! print*,'lenabledxcsearch ',lenabledxcsearch, ' lwidedxcsearch is ',lwidedxcsearch + ! print*,'lcqdxcsig is', lcqdxcsig + ! print*,'lcqsignal is',lcqsignal + ! print*,'ldxcsig',ldxcsig + ! print*,'lhiscallstd',lhiscallstd + ! print*,'mycall ',mycall,mybcall + ! print*,'hiscall ',hiscall,hisbcall + ! print*,'hisgrid is ',hisgrid + + do isubp2=1,31 + if(isubp2.lt.5) then + if(lapcqonly .or. lskipnotap) cycle + if(ltxing) then + ! enabled Tx and transmitted message including CQ at last interval + if(abs(f1-nfqso).lt.3.0) then ! +- 3Hz sync8var QSOfreq candidate list + if(syncavemax.lt.1.8) cycle + else + if(syncavemax.lt.1.9) cycle + endif + else + if(syncavemax.lt.1.8) cycle + endif + endif + if(isubp2.eq.4) cycle + if(isubp1.gt.2 .and. isubp2.lt.5) cycle ! skip regular decoding for extra subpasses + if(lqsocandave) then + if(isubp1.gt.2 .and. isubp1.lt.9) cycle ! skip other extra subpasses if QSO signal, highest priority + if(lqsomsgdcd) cycle + else if(lmycsignal .and. lmycallstd) then + if(isubp1.gt.2 .and. isubp1.lt.6) cycle ! skip CQ signal extra subpasses if MyCall signal + endif + + if(isubp2.lt.5) then + apmask=0 + iaptype2=iaptype + iaptype=0 + if(isubp2.eq.1) then + if(ipass.eq.1) then + llrz=llrd + else + llrz=llra + endif + if(isubp1.gt.1 .and. ipass.gt.1) llrz=llrd + else if(isubp2.eq.2) then + llrz=llrb + if(isubp1.gt.1) llrz=llra + else if(isubp2.eq.3) then + llrz=llrc + else if(isubp2.eq.4) then + llrz=llrd + endif + else + if(.not.lhound) then + if(lmycallstd .and. (lhiscallstd .or. lnohiscall)) then + iaptype=naptypes(nQSOProgress,isubp2-4) + iaptype2=iaptype + ! print*,'line 1357 iaptype,isubp1,isubp2 = ',iaptype,isubp1,isubp2 + if(iaptype.eq.0) cycle + if(lqsomsgdcd .and. iaptype.gt.2 .and. iaptype.lt.31) cycle ! QSO message already decoded + if(iaptype.eq.2) then + if(.not.lapmyc .or. lapcqonly) cycle ! skip AP for 'mycall ???? ????' in 2..3 minutes after last TX + if(nQSOProgress.ne.0 .and. nmic.lt.2) cycle ! reduce CPU load at QSO + endif + ! if(.not.stophint .and. iaptype.gt.30) cycle ! no DXCall searching at QSO, reduce Lag + ! if(stophint .and. iaptype.gt.2 .and. iaptype.lt.31) cycle + if(lft8sdec .and. iaptype.gt.2) cycle ! QSO message already decoded + if(iaptype.gt.2 .and. lnohiscall) cycle ! no DXCall + if(iaptype.gt.2 .and. iaptype.lt.31 .and. loutapwid) cycle + ! if(iaptype.eq.3 .and. .not.lqsosigtype3) cycle ! not QSO signal + ! if(iaptype.eq.4 .and. .not.lqsorrr) cycle ! not RRR signal + ! if(iaptype.eq.5 .and. .not.lqso73) cycle ! not 73 signal + ! if(iaptype.eq.6 .and. .not.lqsorr73) cycle ! not RR73 signal + if(iaptype.gt.30 .and. .not.lenabledxcsearch) cycle ! in QSO or TXing CQ or last logged is DX Call: searching disabled + if(iaptype.gt.30 .and. .not.lwidedxcsearch .and. loutapwid) cycle ! only RX freq DX Call searching + if(iaptype.eq.31 .and. .not.lcqdxcsig) cycle ! not CQ signal from std DXCall + if(iaptype.eq.31 .and. .not.lhiscallstd .and. lapcqonly) cycle ! skip weak CQ signals with std call + if(iaptype.gt.31 .and. lapcqonly) cycle ! skip weak CQ signals + if(iaptype.eq.35 .and. .not.lqso73) cycle ! DXCall searching, not 73 signal + if(iaptype.eq.36 .and. .not.lqsorr73) cycle ! DXCall searching, not RR73 signal + if(lqsocandave .and. isubp1.gt.8 .and. (iaptype.lt.3 .or. iaptype.gt.6)) cycle ! QSO signal + ! if(.not.lqsocandave .and. lmycsignal .and. isubp1.gt.5 .and. isubp1.lt.9 .and. iaptype.ne.2) cycle ! skip other AP if lmycsignal extra subpasses) + + if(iaptype.eq.1) then + if(isubp2.eq.20) then + scqlev=0. + do i4=1,9 + scqlev=scqlev+s8(idtone25(2,i4),i4+7) + enddo + snoiselev=(sum(s8(0:7,8:16))-scqlev)/7.0 + scqnr=scqlev/snoiselev + if(scqnr.lt.1.0 .and. .not.lcqsignal) cycle + endif + if(isubp2.eq.21) then + if(lft8lowth .or. lft8subpass) then + if(scqnr.lt.1.2 .and. .not.lcqsignal) cycle + endif + if(.not. lft8subpass .and. .not.lft8lowth) then + if(scqnr.lt.1.3 .and. .not.lcqsignal) cycle + endif + endif + endif + + if(iaptype.eq.2) then + if(isubp2.eq.17) then + smyclev=0. + do i4=1,9 + smyclev=smyclev+s8(idtonemyc(i4),i4+7) + enddo + snoiselev=(sum(s8(0:7,8:16))-smyclev)/7.0 + smycnr=smyclev/snoiselev + if(smycnr.lt.1.0 .and. .not.lmycsignal) cycle + endif + if(isubp2.eq.18) then + if(lft8lowth .or. lft8subpass) then + if(smycnr.lt.1.2 .and. .not.lmycsignal) cycle + endif + endif + endif + + if(iaptype.eq.3) then + if(isubp2.eq.5) then + smyclev=0. + do i4=1,9 + smyclev=smyclev+s8(idtonemyc(i4),i4+7) + enddo + snoiselev=(sum(s8(0:7,8:16))-smyclev)/7.0 + smycnr=smyclev/snoiselev + if(smycnr.lt.1.0) cycle + else if(isubp2.eq.6) then + if(smycnr.lt.1.2) cycle + endif + endif + + apmask=0 + if(iaptype.eq.1) then ! CQ + if(isubp2.eq.20) then + llrz=llrc + else if(isubp2.eq.21) then + llrz=llrb + else if(isubp2.eq.22) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*mcq(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.2) then ! MyCall ??? ??? + if(isubp2.eq.17) then + llrz=llrc + else if(isubp2.eq.18) then + llrz=llrb + else if(isubp2.eq.19) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*apsym(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.3) then ! MyCall DxCall ??? + if(isubp2.eq.5) then + llrz=llrc + else if(isubp2.eq.6) then + llrz=llrb + else if(isubp2.eq.7) then + llrz=llra + endif + apmask(1:58)=1 + llrz(1:58)=apmag*apsym + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.gt.3 .and. iaptype.lt.7) then + if(isubp2.eq.8 .or. isubp2.eq.11 .or. isubp2.eq.14) then + llrz=llrc + else if(isubp2.eq.9 .or. isubp2.eq.12 .or. isubp2.eq.15) then + llrz=llrb + else if(isubp2.eq.10 .or. isubp2.eq.13 .or. isubp2.eq.16) then + llrz=llrb + endif + apmask(1:77)=1 + llrz(1:58)=apmag*apsym ! mycall hiscall 73|RR73 + if(iaptype.eq.5) then + llrz(59:77)=apmag*m73 + else if(iaptype.eq.6) then + llrz(59:77)=apmag*mrr73 + else if(iaptype.eq.4) then + llrz(59:77)=apmag*mrrr + endif + else if(iaptype.eq.31) then ! CQ DxCall Grid(???) + if(isubp2.eq.23) then + llrz=llrc + else if(isubp2.eq.24) then + llrz=llrb + else if(isubp2.eq.25) then + llrz=llra + endif + if(lnohisgrid) then + apmask(1:58)=1 + llrz(1:58)=apmag*apcqsym(1:58) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else + apmask(1:77)=1 + llrz(1:77)=apmag*apcqsym + endif + else if(iaptype.eq.35) then ! ??? DxCall 73, type 1 std DXCall + if(isubp2.eq.29) then + llrz=llrc + else if(isubp2.eq.30) then + llrz=llrb + else if(isubp2.eq.31) then + llrz=llra + endif + apmask(30:77)=1 + llrz(30:58)=apmag*apsym(30:58) + llrz(59:77)=apmag*m73 + else if(iaptype.eq.36) then ! ??? DxCall RR73 type 1 std DXCall + if(isubp2.eq.26) then + llrz=llrc + else if(isubp2.eq.27) then + llrz=llrb + else if(isubp2.eq.28) then + llrz=llra + endif + apmask(30:77)=1 + llrz(30:58)=apmag*apsym(30:58) + llrz(59:77)=apmag*mrr73 + endif + + !! print*,'line 1533 iaptype,isubp1,isubp2 = ',iaptype,isubp1,isubp2 + + else if(lmycallstd .and. .not.lhiscallstd .and. & + len_trim(hiscall).gt.2) then + iaptype=ndxnsaptypes(nQSOProgress,isubp2-4) + iaptype2=iaptype + if(iaptype.eq.0) cycle + if(iaptype.eq.2 .and. lapcqonly) cycle ! skip weak CQ signals + if(.not.stophint .and. iaptype.gt.30) cycle ! no DXCall searching at QSO, reduce Lag + if((lqsomsgdcd .or. .not.lapmyc) .and. iaptype.gt.1 .and. iaptype.lt.15) cycle ! skip AP for mycall in 2..3 minutes after last TX + if(iaptype.eq.12 .and. .not.lqsorrr) cycle ! not RRR signal + if(iaptype.eq.13 .and. .not.lqso73) cycle ! not 73 signal + if(iaptype.eq.14 .and. .not.lqsorr73) cycle ! not RR73 signal + if(iaptype.gt.30 .and. .not.lenabledxcsearch) cycle ! in QSO or TXing CQ or last logged is DX Call: searching disabled + if(iaptype.gt.30 .and. .not.lwidedxcsearch .and. loutapwid) cycle ! only RX freq DX Call searching + if(iaptype.gt.30 .and. lapcqonly) cycle ! skip weak CQ signals + if(iaptype.eq.31 .and. .not.lcqdxcnssig) cycle ! it is not CQ signal of non-standard DXCall + if(iaptype.eq.35 .and. .not.lqso73) cycle ! DXCall searching, not 73 signal + if(iaptype.eq.36 .and. .not.lqsorr73) cycle ! DXCall searching, not RR73 signal + if(lqsocandave .and. isubp1.gt.8 .and. (iaptype.lt.11 .or. iaptype.gt.14)) cycle ! QSO signal + if(iaptype.gt.2 .and. iaptype.lt.15 .and. loutapwid) cycle + + if(iaptype.eq.1) then + if(isubp2.eq.20) then + scqlev=0. + do i4=1,9 + scqlev=scqlev+s8(idtone25(2,i4),i4+7) + enddo + snoiselev=(sum(s8(0:7,8:16))-scqlev)/7.0 + scqnr=scqlev/snoiselev + if(scqnr.lt.1.0 .and. .not.lcqsignal) cycle + endif + if(isubp2.eq.21) then + if(lft8lowth .or. lft8subpass) then + if(scqnr.lt.1.2 .and. .not.lcqsignal) cycle + endif + if(.not. lft8subpass .and. .not.lft8lowth) then + if(scqnr.lt.1.3 .and. .not.lcqsignal) cycle + endif + endif + endif + + if(iaptype.eq.2) then + if(isubp2.eq.17) then + smyclev=0. + do i4=1,9 + smyclev=smyclev+s8(idtonemyc(i4),i4+7) + enddo + snoiselev=(sum(s8(0:7,8:16))-smyclev)/7.0 + smycnr=smyclev/snoiselev + if(smycnr.lt.1.0 .and. .not.lmycsignal) cycle + endif + if(isubp2.eq.18) then + if(lft8lowth .or. lft8subpass) then + if(smycnr.lt.1.2 .and. .not.lmycsignal) cycle + endif + endif + endif + + apmask=0 + if(iaptype.eq.1) then ! CQ ??? ??? + if(isubp2.eq.20) then + llrz=llrc + else if(isubp2.eq.21) then + llrz=llrb + else if(isubp2.eq.22) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*mcq(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.2) then ! MyCall ??? ??? + if(isubp2.eq.17) then + llrz=llrc + else if(isubp2.eq.18) then + llrz=llrb + else if(isubp2.eq.19) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*apsym(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.11) then ! MyCall <DxCall> ??? ! report rreport type 1 msg + if(isubp2.eq.5) then + llrz=llrc + else if(isubp2.eq.6) then + llrz=llrb + else if(isubp2.eq.7) then + llrz=llra + endif + apmask(1:58)=1 + llrz(1:58)=apmag*apsymdxns1 + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.12) then ! type 4 <MyCall> DxCall RRR + if(isubp2.eq.14) then + llrz=llrc + else if(isubp2.eq.15) then + llrz=llrb + else if(isubp2.eq.16) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apsymdxnsrrr + else if(iaptype.eq.13) then ! type 4 <MyCall> DxCall 73 + if(isubp2.eq.11) then + llrz=llrc + else if(isubp2.eq.12) then + llrz=llrb + else if(isubp2.eq.13) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apsymdxns732 + else if(iaptype.eq.14) then ! type 4 <MyCall> DxCall RR73 + if(isubp2.eq.8) then + llrz=llrc + else if(isubp2.eq.9) then + llrz=llrb + else if(isubp2.eq.10) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apsymdxnsr73 + else if(iaptype.eq.31) then ! CQ DxCall ! full compound or nonstandard + if(isubp2.eq.23) then + llrz=llrc + else if(isubp2.eq.24) then + llrz=llrb + else if(isubp2.eq.25) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apcqsym + else if(iaptype.eq.35) then ! ??? DxCall 73 ! full compound or nonstandard + if(isubp2.eq.29) then + llrz=llrc + else if(isubp2.eq.30) then + llrz=llrb + else if(isubp2.eq.31) then + llrz=llra + endif + apmask(14:77)=1 + llrz(14:77)=apmag*apsymdxns73(14:77) + else if(iaptype.eq.36) then ! ??? DxCall RR73 ! full compound or nonstandard + if(isubp2.eq.26) then + llrz=llrc + else if(isubp2.eq.27) then + llrz=llrb + else if(isubp2.eq.28) then + llrz=llra + endif + apmask(14:77)=1 + llrz(14:77)=apmag*apsymdxnsrr73(14:77) + endif + + else if(.not.lmycallstd .and. .not.lhiscallstd .and. & + len_trim(hiscall).gt.2) then ! empty mycall or compound/nonstandard both calls + iaptype=ndxnsaptypes(nQSOProgress,isubp2-4) + iaptype2=iaptype + if(iaptype.eq.0) cycle + if(iaptype.gt.1 .and. iaptype.lt.31) cycle + if(.not.stophint .and. iaptype.gt.1) cycle ! on air, QSO is not possible + if(iaptype.gt.30 .and. lapcqonly) cycle ! skip weak CQ signals with std call + if(iaptype.eq.31 .and. .not.lcqdxcnssig) cycle ! it is not CQ signal of non-standard DXCall + if(iaptype.gt.34 .and. .not.ldxcsig) cycle ! not DXCall signal + + if(iaptype.eq.1) then + if(isubp2.eq.20) then + scqlev=0. + do i4=1,9 + scqlev=scqlev+s8(idtone25(2,i4),i4+7) + enddo + snoiselev=(sum(s8(0:7,8:16))-scqlev)/7.0 + scqnr=scqlev/snoiselev + if(scqnr.lt.1.0 .and. .not.lcqsignal) cycle + endif + if(isubp2.eq.21) then + if(lft8lowth .or. lft8subpass)then + if(scqnr.lt.1.2 .and. .not.lcqsignal) cycle + endif + if(.not. lft8subpass .and. .not.lft8lowth) then + if(scqnr.lt.1.3 .and. .not.lcqsignal) cycle + endif + endif + endif + + apmask=0 + if(iaptype.eq.1) then ! CQ ??? ??? + if(isubp2.eq.20) then + llrz=llrc + else if(isubp2.eq.21) then + llrz=llrb + else if(isubp2.eq.22) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*mcq(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + +! Nonstandard DXCall search masks below are for monitoring purpose in idle mode, +! QSO is not possible +! wideband searching being used by default + + else if(iaptype.eq.31) then ! CQ DxCall ! full compound or nonstandard + if(isubp2.eq.23) then + llrz=llrc + else if(isubp2.eq.24) then + llrz=llrb + else if(isubp2.eq.25) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apcqsym + else if(iaptype.eq.35) then ! ??? DxCall 73 ! full compound or nonstandard + if(isubp2.eq.29) then + llrz=llrc + else if(isubp2.eq.30) then + llrz=llrb + else if(isubp2.eq.31) then + llrz=llra + endif + apmask(14:77)=1 + llrz(14:77)=apmag*apsymdxns73(14:77) + else if(iaptype.eq.36) then ! ??? DxCall RR73 ! full compound or nonstandard + if(isubp2.eq.26) then + llrz=llrc + else if(isubp2.eq.27) then + llrz=llrb + else if(isubp2.eq.28) then + llrz=llra + endif + apmask(14:77)=1 + llrz(14:77)=apmag*apsymdxnsrr73(14:77) + endif + + else if(.not.lmycallstd .and. (lhiscallstd .or. lnohiscall)) then + iaptype=nmycnsaptypes(nQSOProgress,isubp2-4) + iaptype2=iaptype + if(iaptype.eq.0) cycle + if(isubp1.eq.2 .and. nweak.eq.1) cycle + if(isubp1.gt.5) cycle ! so far CQ averaging only + if(iaptype.eq.40 .and. lapcqonly) cycle ! skip weak CQ signals + if(iaptype.gt.40 .and. iaptype.lt.45 .and. lqsomsgdcd) cycle ! already decoded + if(iaptype.eq.42 .and. .not.lqsorrr) cycle ! not RRR signal + if(iaptype.eq.43 .and. .not.lqso73) cycle ! not 73 signal + if(iaptype.eq.44 .and. .not.lqsorr73) cycle ! not RR73 signal + if(iaptype.gt.39 .and. .not.lapmyc) cycle + if(lnomycall .and. iaptype.gt.39 .and. iaptype.lt.45) cycle ! skip QSO signals if mycall is empty + if(lnohiscall .and. iaptype.ne.1 .and. iaptype.ne.40) cycle ! skip DXCall masks if empty + if(iaptype.gt.30 .and. iaptype.lt.40 .and. .not.stophint) cycle ! in QSO, reduce number of CPU cycles + if(iaptype.eq.31 .and. .not.lcqdxcsig) cycle ! not CQ signal from std DXCall + if(iaptype.gt.34 .and. iaptype.lt.37 .and. (.not.ldxcsig .or. lapcqonly)) cycle ! not DXCall signal, skip weak CQ signals + if(iaptype.gt.30 .and. iaptype.lt.40 .and. .not.lwidedxcsearch .and. loutapwid) cycle ! if wideband DX search disabled + + apmask=0 + if(lcqsignal .and. iaptype.eq.1) then ! CQ ??? ??? + if(isubp2.eq.20) then + llrz=llrc + else if(isubp2.eq.21) then + llrz=llrb + else if(isubp2.eq.22) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*mcq(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.31) then ! CQ DxCall Grid(???) //std DX call type1 with or without grid + if(isubp2.eq.23) then + llrz=llrc + else if(isubp2.eq.24) then + llrz=llrb + else if(isubp2.eq.25) then + llrz=llra + endif + if(lnohisgrid) then + apmask(1:58)=1 + llrz(1:58)=apmag*apcqsym(1:58) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else + apmask(1:77)=1 + llrz(1:77)=apmag*apcqsym + endif + else if(iaptype.eq.35) then ! ??? DxCall 73 //std DX call + if(isubp2.eq.29) then + llrz=llrc + else if(isubp2.eq.30) then + llrz=llrb + else if(isubp2.eq.31) then + llrz=llra + endif + apmask(30:77)=1 + llrz(30:58)=apmag*apsymdxstd(30:58) + llrz(59:77)=apmag*m73 + else if(iaptype.eq.36) then ! ??? DxCall RR73 //std DX call + if(isubp2.eq.26) then + llrz=llrc + else if(isubp2.eq.27) then + llrz=llrb + else if(isubp2.eq.28) then + llrz=llra + endif + apmask(30:77)=1 + llrz(30:58)=apmag*apsymdxstd(30:58) + llrz(59:77)=apmag*mrr73 + else if(iaptype.eq.40) then ! <MyCall>,???,??? type 1 + if(isubp2.eq.17) then + llrz=llrc + else if(isubp2.eq.18) then + llrz=llrb + else if(isubp2.eq.19) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*apsymmyns1(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.41) then ! <MyCall>,DXCall,??? type 1 + if(isubp2.eq.5) then + llrz=llrc + else if(isubp2.eq.6) then + llrz=llrb + else if(isubp2.eq.7) then + llrz=llra + endif + apmask(1:58)=1 + llrz(1:58)=apmag*apsymmyns2 + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.42) then ! MyCall,<DXCall>,RRR type 4 + if(isubp2.eq.14) then + llrz=llrc + else if(isubp2.eq.15) then + llrz=llrb + else if(isubp2.eq.16) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apsymmynsrrr + else if(iaptype.eq.43) then ! MyCall,<DXCall>,73 type 4 + if(isubp2.eq.11) then + llrz=llrc + else if(isubp2.eq.12) then + llrz=llrb + else if(isubp2.eq.13) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apsymmyns73 + else if(iaptype.eq.44) then ! MyCall,<DXCall>,RR73 type 4 + if(isubp2.eq.8) then + llrz=llrc + else if(isubp2.eq.9) then + llrz=llrb + else if(isubp2.eq.10) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:77)=apmag*apsymmynsrr73 + endif + else + cycle ! fallback + endif + + else if(lhound) then + iaptype=nhaptypes(nQSOProgress,isubp2-4) + iaptype2=iaptype + if(iaptype.eq.0) cycle + if(lnomycall .and. iaptype.gt.1 .and. iaptype.lt.31) cycle ! skip AP if mycall is missed in config + if(lhiscallstd .and. iaptype.eq.31 .and. .not.lcqsignal) cycle ! not CQ signal, skip CQ DXCall DXgrid mask + if(lqsomsgdcd .and. iaptype.gt.0 .and. iaptype.lt.25) cycle ! QSO message already decoded + if(.not.stophint .and. (iaptype.eq.31 .or. iaptype.eq.36)) cycle ! CQ and RR73 decoding not needed if TX is on + if(nQSOProgress.eq.1) then + if(lfoxspecrpt) then + if(iaptype.eq.21) cycle ! it is not standard message report signal + if((iaptype.eq.31 .or. iaptype.eq.36) .and. nfoxspecrpt.gt.3) cycle ! probably special message signal + else + if(iaptype.eq.22) cycle ! it is not special message report signal + if((iaptype.eq.31 .or. iaptype.eq.36) .and. nmic.gt.3) cycle ! probably standard message signal with mybcall + endif + endif + if(nQSOProgress.eq.3) then + if(lfoxspecrpt) then + if(iaptype.eq.21) cycle ! it is not standard message report signal + else + if(iaptype.eq.22) cycle ! it is not special message report signal + endif + if(lfoxstdr73) then + if(iaptype.eq.24) cycle ! it is not special message RR73 signal + else + if(iaptype.eq.23) cycle ! it is not standard message RR73 signal + endif + endif +! can be staying in queue, need to process possible incoming report iaptype 21/22 even if TX is switched off + if(.not.lapmyc .and. (iaptype.eq.23 .or. iaptype.eq.24)) cycle ! skip AP for mycall RR73 in 2..3 minutes after last TX + fdelta=abs(f1-nfqso) + fdeltam=modulo(fdelta,60.) ! dupe string to prevent compiler warning + if(nQSOProgress.gt.0 .and. iaptype.lt.31 .and. (fdelta.gt.245.0 .or. & + fdeltam.gt.3.0)) cycle ! AP shall be applied to Fox frequencies only + if((iaptype.eq.31 .or. iaptype.eq.36) .and. .not.lwidedxcsearch .and. & + (fdelta.gt.245.0 .or. fdeltam.gt.3.0)) cycle ! only Fox frequencies DX Call searching + if(iaptype.eq.31 .and. .not.lhiscallstd .and. lapcqonly) cycle ! skip weak CQ signals with std call + if(iaptype.eq.36 .and. lwidedxcsearch .and. lapcqonly) cycle ! skip weak CQ signals + if(iaptype.eq.111 .and. lapcqonly) cycle ! skip weak CQ signals with std call + + apmask=0 + if(iaptype.eq.1) then ! CQ ??? ??? type 1 msg + if(isubp2.eq.20) then + llrz=llrc + else if(isubp2.eq.21) then + llrz=llrb + else if(isubp2.eq.22) then + llrz=llra + endif + apmask(1:29)=1 + llrz(1:29)=apmag*mcq(1:29) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.21) then ! MyBaseCall DxBaseCall ??? ! report + if(isubp2.eq.5) then + llrz=llrc + else if(isubp2.eq.6) then + llrz=llrb + else if(isubp2.eq.7) then + llrz=llra + endif + apmask(1:58)=1 + llrz(1:58)=apmag*apsym + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else if(iaptype.eq.22) then ! ??? RR73; MyCall <???> ??? ! report + if(isubp2.eq.8) then + llrz=llrc + else if(isubp2.eq.9) then + llrz=llrb + else if(isubp2.eq.10) then + llrz=llra + endif + apmask(29:66)=1 + llrz(29:66)=apmag*apsymsp(29:66) + apmask(72:77)=1 + llrz(72:73)=apmag*(-1) + llrz(74)=apmag*(+1) + llrz(75:77)=apmag*(-1) + else if(iaptype.eq.23) then ! MyBaseCall DxBaseCall RR73 + if(isubp2.eq.11) then + llrz=llrc + else if(isubp2.eq.12) then + llrz=llrb + else if(isubp2.eq.13) then + llrz=llra + endif + apmask(1:77)=1 + llrz(1:58)=apmag*apsym + llrz(59:77)=apmag*mrr73 + else if(iaptype.eq.24) then ! MyCall RR73; ??? <???> ??? + if(isubp2.eq.14) then + llrz=llrc + else if(isubp2.eq.15) then + llrz=llrb + else if(isubp2.eq.16) then + llrz=llra + endif + apmask(1:28)=1 + apmask(57:66)=1 + llrz(1:28)=apmag*apsymsp(1:28) + llrz(57:66)=apmag*apsymsp(57:66) + apmask(72:77)=1 + llrz(72:73)=apmag*(-1) + llrz(74)=apmag*(+1) + llrz(75:77)=apmag*(-1) + else if(iaptype.eq.31) then ! CQ DxCall Grid(???) + if(isubp2.eq.23) then + llrz=llrc + else if(isubp2.eq.24) then + llrz=llrb + else if(isubp2.eq.25) then + llrz=llra + endif + if(lhiscallstd) then + if(lnohisgrid) then + apmask(1:58)=1 + llrz(1:58)=apmag*apcqsym(1:58) + apmask(75:77)=1 + llrz(75:76)=apmag*(-1) + llrz(77)=apmag*(+1) + else + apmask(1:77)=1 + llrz(1:77)=apmag*apcqsym + endif + else + apmask(1:77)=1 + llrz(1:77)=apmag*apcqsym + endif + else if(iaptype.eq.36) then + if(isubp2.eq.26) then + llrz=llrc + else if(isubp2.eq.27) then + llrz=llrb + else if(isubp2.eq.28) then + llrz=llra + endif + if(lhiscallstd .or. (.not.lhiscallstd .and. & + len_trim(hiscall).gt.2 & + .and. index(hiscall,"/").gt.0)) then + apmask(30:77)=1 + llrz(30:58)=apmag*apsym(30:58) + llrz(59:77)=apmag*mrr73 ! ??? DxBaseCall RR73 + else + cycle ! (noncompound .and. nonstandard) Fox callsign being not supported by Fox WSJT-X + endif + else if(iaptype.eq.111) then ! CQ ??? type 4 msg (iflip,nrpt,icq,i3 001100) + if(isubp2.eq.29) then + llrz=llrc + else if(isubp2.eq.30) then + llrz=llrb + else if(isubp2.eq.31) then + llrz=llra + endif + apmask(72:77)=1 + llrz(72:73)=apmag*(-1) + llrz(74:75)=apmag*(1) + llrz(76:77)=apmag*(-1) + endif + else + cycle ! fallback + endif + endif + cw=0 + call bpdecode174_91var(llrz,apmask,max_iterations,message77,cw, & + nharderrors,niterations) + dmin=0.0 + if(nharderrors.lt.0) then + ndeep=3 + if(lqsosig .or. lmycsignal) then + if((dfqso.lt.napwid .or. (abs(nftx-f1).lt.napwid .and. lapmyc)) & + .and. .not.nagainfil) ndeep=4 + if(lapmyc .and. lqsomsgdcd .or. iaptype.eq.0) ndeep=3 ! deep is not needed, reduce number of CPU cycles + if(.not.stophint .and. len_trim(hiscall).gt.2) ndeep=3 ! unload CPU, let ft8svar pick up QSO message + endif + if(ldxcsig .and. stophint .and. dfqso.lt.napwid) ndeep=4 ! DXCall search inside RX napwid + if(lhound) ndeep=3 ! we have no enough CPU resources to decode all Fox slots with ndeep=4 +! if(nagainfil .or. swl) ndeep=5 ! 30 against 26 -23dB, more than 15sec to decode and many false decodes +! if(swl) ndeep=4 ! 29 decodes -23dB, 7..12sec to decode + if(nagainfil) ndeep=5 +!print *,omp_get_nested(),OMP_get_num_threads() + + call osd174_91var(llrz,apmask,ndeep,message77,cw,nharderrors,dmin,nthr) + endif + + nbadcrc=1 + msg37='' + if(count(cw.eq.0).eq.174) cycle !Reject the all-zero codeword + if(nharderrors.lt.0 .or. nharderrors+dmin.ge.60.0 .or. (isubp2.gt.2 & + .and. nharderrors.gt.39)) then ! chk isubp2 value + if(nweak.eq.2 .and. isubp1.eq.2) then + if(ipass.eq.npass-1) then + if(lcqsignal) then + if(isubp2.eq.22) then ! last pass, std and nonstd mycall + lfoundcq=.false. + do ik=1,numdeccq + if(tmpcqdec(ik)%freq.gt.5001.0) exit + if(abs(tmpcqdec(ik)%freq-f1).lt.5.0 .and. abs(tmpcqdec(ik)%xdt-xdt).lt.0.05) then ! max signal delay + lfoundcq=.true. + exit + endif + enddo + if(.not.lfoundcq .and. ncqsignal.lt.numcqsig) then + ncqsignal=ncqsignal+1 + tmpcqsig(ncqsignal)%freq=f1 + tmpcqsig(ncqsignal)%xdt=xdt + tmpcqsig(ncqsignal)%cs=cstmp2 + endif + endif + endif + if(lmycsignal .and. isubp2.eq.19) then ! last pass + lfoundmyc=.false. + do ik=1,numdecmyc + if(tmpmyc(ik)%freq.gt.5001.0) exit + if(abs(tmpmyc(ik)%freq-f1).lt.5.0 .and. & + abs(tmpmyc(ik)%xdt-xdt).lt.0.05) then ! max signal delay + lfoundmyc=.true. + exit + endif + enddo + if(.not.lfoundmyc .and. nmycsignal.lt.nummycsig) then + nmycsignal=nmycsignal+1 + tmpmycsig(nmycsignal)%freq=f1 + tmpmycsig(nmycsignal)%xdt=xdt + tmpmycsig(nmycsignal)%cs=cstmp2 + endif + endif + endif + if(ipass.eq.npass) then + if(lqsocandave .and. (iaptype.eq.3 .or. iaptype.eq.6)) then + tmpqsosig(1)%freq=f1 + tmpqsosig(1)%xdt=xdt + tmpqsosig(1)%cs=cstmp2 + endif + endif + endif + !print*,'line 2149 iaptype,isubp1,isubp2,ndeep = ',iaptype,isubp1,isubp2,ndeep + + if(isubp1.gt.1) cycle + ! print*,'line 2150 did not cycle' + if(lqsothread .and. (.not.lhound .and. iaptype.ge.3 .or. lhound & + .and. (iaptype.eq.21 .or. iaptype.eq.23)) .and. .not.lsdone) then + if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. & + .not.lhiscallstd)) then + if(.not.lft8sdec .and. .not.stophint .and. dfqso.lt.2.0) then + call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint) + if(lft8s) then + if(index(msg37,'<').gt.0) then + lhashmsg=.true. + endif + nbadcrc=0 + lft8sdec=.true. + endif + endif + endif + lsdone=.true. + endif + if(nbadcrc.eq.0) then + i3=1 + n3=1 + exit + endif + + if(lsd .and. isubp2.eq.3 .and. nbadcrc.eq.1 .and. srr.lt.7.0) then ! low DR setups shall not try FT8SDvar for strong signals + call ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq) + if(lft8sd) then + if(levenint) then + evencopy(isd)%lstate=.false. + elseif(loddint) then + oddcopy(isd)%lstate=.false. + endif + i3=1 + n3=1 + iaptype2=iaptype + iaptype=0 + nbadcrc=0 + lsd=.false. + exit + endif + endif + + if(nweak.eq.1 .and. isubp1.eq.1) then + if(ipass.eq.npass-1) then + if(lcqsignal) then + if(isubp2.eq.22) then ! last pass, std and nonstd mycall + lfoundcq=.false. + do ik=1,numdeccq + if(tmpcqdec(ik)%freq.gt.5001.0) exit + if(abs(tmpcqdec(ik)%freq-f1).lt.5.0 .and. & + abs(tmpcqdec(ik)%xdt-xdt).lt.0.05) then ! max signal delay + lfoundcq=.true. + exit + endif + enddo + if(.not.lfoundcq .and. ncqsignal.lt.numcqsig) then + ncqsignal=ncqsignal+1 + tmpcqsig(ncqsignal)%freq=f1 + tmpcqsig(ncqsignal)%xdt=xdt + tmpcqsig(ncqsignal)%cs=cstmp2 + endif + endif + endif + if(lmycsignal .and. isubp2.eq.19) then ! last pass + lfoundmyc=.false. + do ik=1,numdecmyc + if(tmpmyc(ik)%freq.gt.5001.0) exit + if(abs(tmpmyc(ik)%freq-f1).lt.5.0 .and. & + abs(tmpmyc(ik)%xdt-xdt).lt.0.05) then ! max signal delay + lfoundmyc=.true. + exit + endif + enddo + if(.not.lfoundmyc .and. nmycsignal.lt.nummycsig) then + nmycsignal=nmycsignal+1 + tmpmycsig(nmycsignal)%freq=f1 + tmpmycsig(nmycsignal)%xdt=xdt + tmpmycsig(nmycsignal)%cs=cstmp2 + endif + endif + endif + if(ipass.eq.npass) then + if(lqsocandave .and. (iaptype.eq.3 .or. iaptype.eq.6)) then + tmpqsosig(1)%freq=f1 + tmpqsosig(1)%xdt=xdt + tmpqsosig(1)%cs=cstmp2 + endif + endif + endif + ! print*,'line 2242 nbadcrc=',nbadcrc + + if(nbadcrc.eq.1) cycle + endif + + write(c77,'(77i1)') message77 + read(c77(72:74),'(b3)') n3 + read(c77(75:77),'(b3)') i3 + !print*,'line 2247 iaptype=',iaptype,' i3=',i3,' n3=',n3 + if((i3.gt.4 .or. (i3.eq.0 .and. n3.gt.5)) .and. (.not.(i3.eq.5 .and. & + (n3.eq.1 .or. n3.eq.7 .or.n3.eq.6 .or.n3.eq.4 .or.n3.eq.3 .or.n3.eq.0 & + .or.n3.eq.5 .or. n3.eq.2 .or. n3.eq.8 .or. n3.eq.9)))) cycle + ! ft8md added n3.eq.6 and n3.eq.4 and n3.eq.3 and n3.eq.0 + ! and n3.eq.5 for USA calls with EU VHF + ! added .or. n3.eq.2 .or. n3.eq.8 .or. n3.eq.9 as test for EU VHF + !print*,'did not cycle at line 2248' + call unpack77var(c77,1,msg37,unpk77_successvar,nthr) + if(.not.unpk77_successvar) then + if(lqsothread .and. (.not.lhound .and. iaptype.ge.3 .or. lhound .and. & + (iaptype.eq.21 .or. iaptype.eq.23)) .and. .not.lsdone) then + if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. & + .not.lhiscallstd)) then + if(.not.lft8sdec .and. .not.stophint .and. dfqso.lt.2.0) then + call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint) + if(lft8s) then + if(index(msg37,'<').gt.0) then + lhashmsg=.true. + endif + nbadcrc=0 + lft8sdec=.true. + endif + endif + endif + lsdone=.true. + if(nbadcrc.eq.0) then + i3=1 + n3=1 + exit + endif + endif + cycle + endif + + if(iaptype.eq.1 .and. msg37(1:10).eq.'CQ DE AA00') then + nbadcrc=1 + cycle + endif + lcall1hash=.false. + if(msg37(1:1).eq.'<') lcall1hash=.true. + nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message. + call get_tones_from_77bits(message77,itone) +! 0.1 K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 71 DXpedition Mode + i3bit=0 + if(i3.eq.0 .and. n3.eq.1) i3bit=1 +! iFreeText=message77(57) +! 0.0 Free text + if(i3.eq.0 .and. n3.eq.0) then + lFreeText=.true. + else + lFreeText=.false. + endif +! delete braces + lcall2hash=.false. + if(.not.lFreeText .and. i3bit.ne.1 .and. index(msg37,'<').gt.0) then + if(index(msg37,'<').gt.4) lcall2hash=.true. + if(index(msg37,'<').gt.0) then + lhashmsg=.true. + endif + endif + if(nbadcrc.eq.0) exit + enddo ! ap passes + if(nbadcrc.eq.0) exit + enddo ! weak sigs + if(nbadcrc.eq.0) exit + enddo !nqso sync + +2 if(nbadcrc.eq.0) then +! check for the false FT8Svar decode + if(lft8s .and. lrepliedother) then + msg37='' + nbadcrc=1 + return + endif + msg37_2='' + if(i3bit.eq.1 .and. .not.lft8s .and. .not.lft8sd) then + call msgparservar(msg37,msg37_2) + lspecial=.true. !only in ft8var + +!protection against a false FT8Svar decode in Hound mode + if(lhound .and. dfqso.lt.2.0) lqsomsgdcd=.true. !$OMP FLUSH (lqsomsgdcd) + endif + qual=1.0-(nharderrors+dmin)/60.0 + xsnr=0.001 + xnoi=1.E-8 + xsnrtmp=0.001 + do i=1,79 + xsig=s8(itone(i),i)**2 + xnoi=(sum(s8(0:7,i)**2) - xsig)/7.0 + if(xnoi.lt.0.01) xnoi=0.01 ! safe division and better accuracy + if(xnoi.lt.xsig) then + xsnr=xsig/xnoi + else + xsnr=1.01 + endif + xsnrtmp=xsnrtmp+xsnr + enddo + + xsnr=xsnrtmp/79.0-1.0 + xsnr=10.0*log10(xsnr)-26.5 + if(xsnr.gt.7.0) xsnr=xsnr+(xsnr-7.0)/2.0 + if(xsnr.gt.30.0) then + xsnr=xsnr-1.0 + if(xsnr.gt.40.0) xsnr=xsnr-1.0 + if(xsnr.gt.49.0) xsnr=49.0 + endif + xsnrs=xsnr + if(xsnr .lt. -17.0) then + if(xsnr.lt.-22.5 .and. xsnr.gt.-23.5) xsnr=-22.5 ! safe division and better accuracy + xsnr=xsnr-(1.0+1.4/(23.0+xsnr))**2+1.2 + endif + if(iaptype.eq.0) then + if(xsnr.lt.-23.0) xsnr=-23.0 + else + if(xsnr.lt.-24.0) xsnr=-24.0 + endif + if(lft8s .or. lft8sd) then + if(xsnr.lt.-22.0) xsnr=xsnrs-1.0 ! correction offset + if(xsnr.lt.-26.0) xsnr=-26.0 + +! -26 0.1 1477 ~ AC1MX AC1MX R-17 ^ + if(len_trim(mycall).gt.3 .and. index(msg37,' '//trim(mycall)//' ').gt.1) then + msg37='' + return + endif + go to 4 ! bypass checking to false decode + endif + !if(len_trim(msg37)>0) print*,'line 2371 ',msg37 + + rxdt=xdt-0.5 + if(iaptype.gt.34 .and. iaptype.lt.40) then ! DX Call searching false iaptype 35,36: 'CS7CYU/R FO5QB 73', 'T57KWP/R FO5QB RR73' + ispc1=index(msg37,' ') + if(ispc1.gt.5) then + if(msg37((ispc1-2):(ispc1-1)).eq.'/R') then ! have to cascade it to prevent getting out of index range + call_a='' + call_a=msg37(1:(ispc1-3)) + lfound=.false. + call searchcallsvar(call_a," ",lfound) + if(.not.lfound) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + else if(qual.lt.0.39 .or. xsnr.lt.-20.5 .or. rxdt.lt.-0.5 .or. rxdt.gt.1.9 & + .or. (iaptype.gt.0 .and. iaptype.lt.4) .or. iaptype.eq.11 .or. & + iaptype.eq.21 .or. iaptype.eq.40 .or. iaptype.eq.41) then + if(iaptype.gt.3 .and. iaptype.lt.7) go to 4 ! skip, nothing to check + if(iaptype.ne.2 .and. iaptype.ne.3 .and. iaptype.ne.11 .and. iaptype.ne.21 & + .and. iaptype.ne.40 .and. iaptype.ne.41) then + if((mybcall.ne." " .and. index(msg37,mybcall).gt.0) .or. & + (hisbcall.ne." " .and. index(msg37,hisbcall).gt.0)) go to 256 + endif + + if(i3bit.eq.1) then + ! print*,'nbadcrc line 2400',nbadcrc + call chkspecial8var(msg37,msg37_2,nbadcrc) + ! print*,'nbadcrc line 2402',nbadcrc + else + ! print*,'nbadcrc line 2404 nbadcrc,i3,n3',nbadcrc,i3,n3 + call chkfalse8var(msg37,i3,n3,nbadcrc,iaptype,lcall1hash) + ! print*,'nbadcrc line 2406',nbadcrc + endif + if(nbadcrc.eq.1) then + msg37='' + return + endif + endif + if(iaptype.eq.2 .or. iaptype.eq.3 .or. iaptype.eq.11 .or. iaptype.eq.21 .or. & + iaptype.eq.40 .or. iaptype.eq.41) go to 4 ! already checked + +! decoded without AP masks: +! CQ PLIB U40OKH FE61 +! CQ 000 RO8JSV GJ38 +256 if(iaptype.eq.0 .and. i3.eq.1 .and. msg37(1:3).eq.'CQ ') then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if((ispc2-ispc1).eq.4 .or. (ispc2-ispc1).eq.5) then + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + ispc4=index(msg37((ispc3+1):),' ')+ispc3 + if((ispc3-ispc2).gt.3 .and. (ispc4-ispc3).eq.5) then + grid='' + if(msg37(ispc3+1:ispc3+1).gt.'@' .and. msg37(ispc3+1:ispc3+1).lt.'S' & + .and. msg37(ispc3+2:ispc3+2).gt.'@' .and. & + msg37(ispc3+2:ispc3+2).lt.'S' .and. & + msg37(ispc3+3:ispc3+3).lt.':' .and. & + msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1) + if(grid.ne.'') then + callsign='' + callsign=msg37(ispc2+1:ispc3-1) + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + endif + endif + +! i3=1,2 false decodes with ' R ' +! 3B4NDC/R C40AUZ/R R IR83 i3=1 +! MS8QQS UX3QBS/P R NG63 i3=2 +! <...> P32WRF R LR56 +! P32WRF <...> R LR56 + + if((i3.eq.1 .or. i3.eq.2) .and. index(msg37,' R ').gt.0) then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + if(ispc3-ispc2.eq.2) then + if(msg37(ispc2:ispc3).eq.' R ') then + call_b='' + if((i3.eq.1 .and. msg37(ispc2-2:ispc2-1).eq.'/R') .or. & + (i3.eq.2 .and. msg37(ispc2-2:ispc2-1).eq.'/P')) then + call_b=msg37(ispc1+1:ispc2-3) + else + call_b=msg37(ispc1+1:ispc2-1) + endif + if(lcall2hash) then ! valid call_b can be found in hash table, check call_a then + call_a='' + if((i3.eq.1 .and. msg37(ispc1-2:ispc1-1).eq.'/R') .or. & + (i3.eq.2 .and. msg37(ispc1-2:ispc1-1).eq.'/R')) then + call_a=msg37(1:ispc1-3) + else + call_a=msg37(1:ispc1-1) + endif + falsedec=.false. + call chkflscallvar('CQ ',call_a,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif + else if(len_trim(call_b).gt.2) then + ispc4=index(msg37((ispc3+1):),' ')+ispc3 + grid='' + if(ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc3+1).gt.'@' .and. & + msg37(ispc3+1:ispc3+1).lt.'S' .and. & + msg37(ispc3+2:ispc3+2).gt.'@' .and. & + msg37(ispc3+2:ispc3+2).lt.'S' .and. & + msg37(ispc3+3:ispc3+3).lt.':' .and. & + msg37(ispc3+4:ispc3+4).lt.':') grid=msg37(ispc3+1:ispc4-1) + if(grid.ne.'') then + call chkgridvar(call_b,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + endif + endif + endif + +! 0.3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day +! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day +! -23 3.1 197 ~ Z67BGE H67HJI 22G EMA i3=0 n3=4 +! -3 2.2 FY4IML UV7BEA R 24F NNJ i3=0 n3=4 + + if(i3.eq.0 .and. n3.gt.2 .and. n3.lt.5) then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if(ispc1.gt.3 .and. ispc2.gt.7) then + call_a='' + call_b='' + if(msg37(1:ispc1-1).eq.'/R' .or. msg37(1:ispc1-1).eq.'/P') then + call_a=msg37(1:ispc1-3) + else + call_a=msg37(1:ispc1-1) + endif + if(msg37(ispc1+1:ispc2-1).eq.'/R' .or. msg37(ispc1+1:ispc2-1).eq.'/P') then + call_b=msg37(ispc1+1:ispc2-3) + else + call_b=msg37(ispc1+1:ispc2-1) + endif + +! operators outside USA and Canada shall transmit ' DX ' + if(call_b(1:1).ne.'A' .and. call_b(1:1).ne.'K' .and. call_b(1:1).ne.'N' & + .and. call_b(1:1).ne.'W' .and. call_b(1:1).ne.'V' .and. & + call_b(1:1).ne.'C' .and. call_b(1:1).ne.'X') then + if(index(msg37,' DX ').lt.1) then + nbadcrc=1 + msg37='' + return + endif + endif + +! USA AA..AL + if(call_b(1:1).eq.'A' .and. (call_b(2:2).lt.'A' .or. call_b(2:2).gt.'L')) then + if(index(msg37,' DX ').lt.1) then + nbadcrc=1 + msg37='' + return + endif + endif + +! Canada CF..CK,CY,CZ,VA..VG,VO,VX,VY,XJ..XO + if(call_b(1:1).eq.'C' .and. (call_b(2:2).lt.'F' .or. call_b(2:2).gt.'K')) then + if(call_b(2:2).ne.'Y' .and. call_b(2:2).ne.'Z') then + if(index(msg37,' DX ').lt.1) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + + if(call_b(1:1).eq.'V' .and. (call_b(2:2).lt.'A' .or. call_b(2:2).gt.'G')) then + if(call_b(2:2).ne.'O' .and. call_b(2:2).ne.'X' .and. call_b(2:2).ne.'Y') then + if(index(msg37,' DX ').lt.1) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + if(call_b(1:1).eq.'X' .and. (call_b(2:2).lt.'J' .or. call_b(2:2).gt.'O')) then + if(index(msg37,' DX ').lt.1) then + nbadcrc=1 + msg37='' + return + endif + endif + if(xsnr.lt.-19.0 .or. rxdt.lt.-0.5 .or. rxdt.gt.1.0) then + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + endif + +! EU VHF contest exchange i3=5 +! <PA3XYZ> <G4ABC/P> R 590003 IO91NP h12 h22 r1 s3 S11 g25 +! packing is not implemented in WSJT-X 2.5.4? +! old implementation with i3=0 n3=2 +! JL6GSC/P R 571553 CJ76MV i3=5 +! G59XTB R 521562 RA82SJ + + if(i3.eq.5 .and. n3.eq.1 .and. (xsnr.lt.-19.0 .or. rxdt.lt.-0.5 .or. & + rxdt.gt.1.0)) then ! was if i3-0 and n3=2 + ispc1=index(msg37,' ') + if(ispc1.gt.3) then + call_b='' + if(msg37(ispc1-2:ispc1-1).eq.'/P') then + call_b=msg37(1:ispc1-3) + else + call_b=msg37(1:ispc1-1) + endif + falsedec=.false. + call chkflscallvar('CQ ',call_b,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + +! FT8OPG/R Z27HRN/R OH12 check all standard messages with contest callsigns +! /P has i3.eq.2 .and. n3.eq.0 + if(iaptype.eq.0 .and. i3.eq.1 .and. n3.eq.0 .and. index(msg37,'/R ').gt.3) then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if(ispc1.gt.3 .and. ispc2.gt.6) then + call_a='' + call_b='' + if(msg37(ispc1-2:ispc1-1).eq.'/R') then + call_a=msg37(1:ispc1-3) + else + call_a=msg37(1:ispc1-1) + endif + if(msg37(ispc2-2:ispc2-1).eq.'/R') then + call_b=msg37(ispc1+1:ispc2-3) + else + call_b=msg37(ispc1+1:ispc2-1) + endif + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + +! -23 -0.5 2533 ~ <...> W LKNQZG2K4 RR73 invalid message, iaptype=0 this type of message is not allowed for transmission with RR73 +! -23 -1.2 1335 ~ <...> Z7VENB8R G9 RRR non AP decode, iaptype=0 invalid message, this type of message is not allowed +! for transmission with RRR + + if(msg37(1:2).eq.'<.') then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + ispc4=index(msg37((ispc3+1):),' ')+ispc3 + if((ispc4-ispc3.eq.4 .and. msg37(ispc3+1:ispc4-1).eq.'RRR') .or. & + (ispc4-ispc3.eq.5 .and. msg37(ispc3+1:ispc4-1).eq.'RR73') .or. & + (ispc4-ispc3.eq.3 .and. msg37(ispc3+1:ispc4-1).eq.'73')) then + nbadcrc=1 + msg37='' + return + endif + +! -19 0.0 2256 ~ <...> 9T4DQZ RP53 non AP decode, iaptype=0 i3=1 n3=1 SAME AS CQ MSG +! <...> 9T4DQZ -15(R-15) message has i3=1 n3=4 + if(i3.eq.1 .and. n3.eq.1 .and. (xsnr.lt.-18.0 .or. rxdt.lt.-0.5 .or. & + rxdt.gt.1.0)) then + callsign=' ' + callsign=msg37(ispc1+1:ispc2-1) + grid=msg37(ispc2+1:ispc3-1) + include 'callsign_q.f90' + call chkgridvar(callsign,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall) then + nbadcrc=1 + msg37='' + return + endif + if(lchkcall .or. .not.lgvalid) then + falsedec=.false. + call chkflscallvar('CQ ',callsign,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + endif + +! -22 0.3 1000 ~ 9Y4DWY <...> BF70 iaptype=0 i3=1 n3=2 invalid message in FT8 +! protocol, can be transmitted manually + + if(i3.eq.1) then + ispc1=index(msg37,' ') + if(msg37(ispc1+1:ispc1+2).eq.'<.') then + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + if(ispc3-ispc2.eq.5 .and. msg37(ispc2+1:ispc2+1).gt.'@' .and. & + msg37(ispc2+1:ispc2+1).lt.'S' .and. & + msg37(ispc2+2:ispc2+2).gt.'@' .and. & + msg37(ispc2+2:ispc2+2).lt.'S' .and. & + msg37(ispc2+3:ispc2+3).lt.':' .and. & + msg37(ispc2+4:ispc2+4).lt.':') then ! there is a valid grid in message + call_b='' + call_b=msg37(1:ispc1-1) + falsedec=.false. + call chkflscallvar('CQ ',call_b,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + endif + +! i3=3 parse ARRL RTTY contest message +! i3 n3 Bits Total Message type +! 3 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest +! 3 TU; W9XYZ G8ABC R 559 0013 1 28 28 1 3 13 74 ARRL RTTY (DX) +! TU; D47IAQ <...> 559 032' does protocol support the message? + + if(i3.eq.3 .and. msg37(1:3).eq.'TU;') then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + call_a='' + call_b='' + call_a=msg37(ispc1+1:ispc2-1) + call_b=msg37(ispc2+1:ispc3-1) +! check for false, too tough, need to rework if contest is supported + falsedec=.false. + call chkflscallvar(call_a,call_b,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif +! parse + lspecial=.true. + msg37_2=msg37(5:37)//' ' + msg37='' + msg37='DE '//trim(call_b)//' TU' + endif + +! DX Call searching false decodes, search for 1st callsign in ALLCALL7 +! 6W6VIV EY8MM 73 +! 6Y9KOZ EY8MM RR73 + if(iaptype.gt.34 .and. iaptype.lt.40 .and. (xsnr.lt.-21.0 .or. rxdt.lt.-0.5 & + .or. rxdt.gt.1.0)) then + ispc1=index(msg37,' ') + if(ispc1.gt.1) then + call_b='' + call_b=msg37(1:ispc1-1) + falsedec=.false. + call chkflscallvar('CQ ',call_b,falsedec) + if(falsedec) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + +4 continue +!### Possibly call ft8_a8d() here ??? ### + + ldupemsg=.false. + if(ndecodes.gt.0) then + do i=1,ndecodes + if(allmessages(i).eq.msg37 .and. abs(allfreq(i)-f1).lt.45.0) then + ldupemsg=.true. + endif + enddo + endif + + if(.not.ldupemsg .and. dfqso.lt.2.0 .and. ((i3.eq.1 .and. .not.lft8s) .or. & + lft8s)) then + if(msg37(1:msgrootlen+1).eq.trim(msgroot)//' ') then + lasthcall=hiscall + lastrxmsg(1)%lastmsg=msg37 + lastrxmsg(1)%xdt=xdt-0.5 + lastrxmsg(1)%lstate=.true. + lqsomsgdcd=.true. +!$OMP FLUSH (lqsomsgdcd) + else if(.not.lft8s .and. mycalllen1.gt.2) then + if(msg37(1:mycalllen1).ne.trim(mycall)//' ' .and. & + index(msg37,' '//trim(hiscall)//' ').gt.0) then + lrepliedother=.true. + endif + endif + endif + + if(len_trim(hiscall).gt.3 .and. .not.lqsomsgdcd) then + if(msg37(1:msgrootlen+1).eq.trim(msgroot)//' ') then + lqsomsgdcd=.true. +!$OMP FLUSH (lqsomsgdcd) + endif + endif + + if(.not.stophint .and. .not.ldupemsg .and. dfqso.lt.2.0 .and. nlasttx.gt.0 & + .and. nlasttx.lt.6 .and. msg37(1:3).eq.'CQ ') then + nlength=len_trim(hiscall) + if(nlength.gt.2) then + if(msg37(4:4+nlength).eq.trim(hiscall)//' ' .or. & + msg37(7:7+nlength).eq.trim(hiscall)//' ') lrepliedother=.true. + endif + endif + + if(mycalllen1.gt.2) then + if(.not.ldupemsg .and. msg37(1:mycalllen1).eq.trim(mycall)//' ') then + nincallthr(nthr)=nincallthr(nthr)+1 + nindex=maskincallthr(nthr)+nincallthr(nthr) + if(nindex.lt.maskincallthr(nthr+1)) then + msgincall(nindex)=msg37 + xdtincall(nindex)=xdt-0.5 + else + nincallthr(nthr)=nincallthr(nthr)-1 + endif + endif + endif + + ldupeft8sd=.false. + if(ncount.gt.0 .and. lft8sd) then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + msgbase37='' + msgbase37=msg37(1:ispc2-1) + do i=1,ncount + if(trim(msgbase37).eq.trim(msgsrcvd(i))) then + ldupeft8sd=.true. + exit + endif + enddo + endif + + if(ldupeft8sd) then + msg37='' + nbadcrc=1 + return + endif + + if(.not.ldupemsg .and. i3.eq.1 .and. .not.lft8sd .and. .not.lft8s .and. & + msg37(1:3).ne.'CQ ') then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ncount=ncount+1 + msgsrcvd(ncount)=msg37(1:ispc2-1) + endif + +! -23 0.0 1606 ~ <...> 3U1TBM/R CC65 i3=4 n3=0 +! -18 0.3 1609 ~ CQ 6U6MBL/R IJ90 i3=1 in some noisy setups false decode with any SNR value is possible + + if((i3.eq.4 .and. n3.eq.0) .or. (i3.eq.1 .and. msg37(1:3).eq."CQ ")) then + if(index(msg37,'/R ').gt.9) then + ispc1=index(msg37,' ') + ispc2=index(msg37((ispc1+1):),' ')+ispc1 + if(ispc2.gt.11) then + ispc3=index(msg37((ispc2+1):),' ')+ispc2 + if(msg37((ispc2-2):(ispc2-1)).eq.'/R') then + if((ispc3-ispc2).eq.5) then + grid=msg37(ispc2+1:ispc3-1) +! grid can not be txed, invalid message: + if(i3.eq.4 .and. len_trim(grid).eq.4) then + nbadcrc=1 + msg37='' + return + endif + call_b='' + call_b=msg37((ispc1+1):(ispc2-3)) + call chkgridvar(call_b,grid,lchkcall,lgvalid,lwrongcall) + if(lwrongcall .or. .not.lgvalid) then + nbadcrc=1 + msg37='' + return + endif + endif + endif + endif + endif + endif + +! protocol violations +! 713STG 869TK NO05 i3=2 n3=5, false decode, as per protocol type2 shall be /P message + if(i3.eq.2 .and. index(msg37,'/P ').lt.1) then + msg37='' + nbadcrc=1 + return + endif + +! -18 0.5 584 ~ UA3ALE <...> PR07 * AP decode with grid + if(iaptype.eq.2) then + nhash=index(msg37,"<...>") + if(nhash.gt.4 .and. nhash.lt.13 .and. msg37(nhash+6:nhash+6).gt.'@' .and. & + msg37(nhash+7:nhash+7).gt.'@') then + msg37='' + nbadcrc=1 + return + endif + endif + + if(lsubtract) then + noff=10 + sync0=0. + syncp=0. + syncm=0. + k=1 + call gen_ft8wavevar(itone,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680) + do i=0,78 + do j=1,32 + csig(j)=csig0(k) + k=k+60 + enddo + i21=i0+i*32 + z1=0. + z1=sum(cd0(i21:i21+31)*conjg(csig)) + sync0 = sync0 + real(z1)**2 + aimag(z1)**2 + i21=i0+i*32+noff + z1=0. + z1=sum(cd0(i21:i21+31)*conjg(csig)) + syncp = syncp + real(z1)**2 + aimag(z1)**2 + i21=i21-noff*2 + z1=0. + z1=sum(cd0(i21:i21+31)*conjg(csig)) + syncm = syncm + real(z1)**2 + aimag(z1)**2 + enddo + call peakup(syncm,sync0,syncp,dx) + if(abs(dx).gt.1.0) then + scorr=0. + else + scorr=real(noff)*(dx) ! was * dx ft8md + endif + xdt3=xdt+scorr*dt2 + call subtractft8var(itone,f1,xdt3) + lsubtracted=.true. ! inside current thread + if(npos.lt.200) then + npos=npos+1 + freqsub(npos)=f1 + endif + endif + endif + + return +end subroutine ft8bvar + +subroutine normalizebmetvar(bmet,n) + real bmet(n) + +! bmetav=sum(bmet)/real(n) + bmet2av=sum(bmet*bmet)/real(n) +! var=bmet2av-bmetav*bmetav +! if( var .gt. 0.0 ) then +! bmetsig=sqrt(var) +! else + bmetsig=sqrt(bmet2av) +! endif + bmet=bmet/bmetsig + + return +end subroutine normalizebmetvar diff --git a/lib/ft8var/ft8mf1var.f90 b/lib/ft8var/ft8mf1var.f90 index f9c1d784..eff9f236 100755..100644 --- a/lib/ft8var/ft8mf1var.f90 +++ b/lib/ft8var/ft8mf1var.f90 @@ -1,81 +1,81 @@ -
-subroutine ft8mf1var(s8,itone,msgd,msg37,lft8sd)
-
- use ft8_mod1, only : itone76,idtone76,msgsd76
- real, intent(in) :: s8(0:7,79)
- real s8d(0:7,58)
- character msgd*37,msg37*37,msggrid*37,c1*12,c2*12,grid*4
- integer itone(79),mrs(58),mrs2(58)
- logical(1) lft8sd,lr73,lgrid,lreport,lrreport,lrrr
-
- lr73=.false.; lgrid=.false.; lreport=.false.; lrreport=.false.; lrrr=.false.
- c1=' '; c2=' '
- ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1; ispc3=index(msgd((ispc2+1):),' ')+ispc2
- if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then
- c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1)
- else
- return
- endif
- if(len_trim(c1).lt.3 .or. len_trim(c2).lt.3) return
- if(msgd(ispc2+1:ispc3-1).eq.'RR73' .or. msgd(ispc2+1:ispc3-1).eq.'73') lr73=.true.
- if(.not.lr73 .and. (ispc3-ispc2).eq.5 .and. msgd(ispc2+1:ispc2+2).ne.'R+' .and. msgd(ispc2+1:ispc2+2).ne.'R-') &
- lgrid=.true.
- if(msgd(ispc2+1:ispc2+1).eq.'+' .or. msgd(ispc2+1:ispc2+1).eq.'-') lreport=.true.
- if(msgd(ispc2+1:ispc2+2).eq.'R+' .or. msgd(ispc2+1:ispc2+2).eq.'R-') lrreport=.true.
- if(msgd(ispc2+1:ispc3-1).eq.'RRR') lrrr=.true.
-
- thresh=0.0; i1=0; i2=0
- do i=1,58; if(i.le.29) then; s8d(0:7,i)=s8(0:7,i+7); else; s8d(0:7,i)=s8(0:7,i+14); endif; enddo
- do j=1,58
- s1=-1.0E6; s2=-1.0E6
- do i=0,7; if(s8d(i,j).gt.s1) then; s1=s8d(i,j); i1=i; endif; enddo
- do i=0,7; if(i.ne.i1 .and. s8d(i,j).gt.s2) then; s2=s8d(i,j); i2=i; endif; enddo
- mrs(j)=i1; mrs2(j)=i2
- enddo
- ref0=0.0
- do i=1,58; ref0=ref0 + s8d(mrs(i),i); enddo
-
- ipk=0; u1=0.0; u2=0.0
- do k=1,76
- psum=0.; ref=ref0
- do j=1,58; i3=idtone76(k,j); psum=psum + s8d(i3,j); if(i3.eq.mrs(j)) ref=ref - s8d(i3,j) + s8d(mrs2(j),j); enddo
- p=psum/ref
- if(p.gt.u1) then; u2=u1; u1=p; ipk=k
- else; if(p.gt.u2) u2=p
- endif
- enddo
-!/'+09 ','+08 ','+07 ','+06 ','+05 ','+04 ','+03 ','+02 ','+01 ','+00 ', &
-! '-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', &
-! '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ', &
-! '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R+09','R+08','R+07','R+06', &
-! 'R+05','R+04','R+03','R+02','R+01','R+00','R-01','R-02','R-03','R-04', &
-! 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14', &
-! 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24', &
-! 'R-25','R-26','RRR ','RR73','73 ','AA00'/
- if(ipk.ne.0) then
- if(lgrid) then
- if(ipk.eq.76) then
- msggrid=msgsd76(76)
- ispc1=index(msggrid,' '); ispc2=index(msggrid((ispc1+1):),' ')+ispc1; ispc3=index(msggrid((ispc2+1):),' ')+ispc2
- grid=msggrid(ispc2+1:ispc3-1)
- if(grid.eq.'AA00') return
- endif
- if(ipk.lt.37 .or. (ipk.gt.72 .and. ipk.lt.76)) return
- endif
- if(lreport) then; if((ipk.gt.36 .and. ipk.lt.73) .or. ipk.eq.76) return; endif
- if(lrreport) then; if(ipk.lt.37 .or. ipk.eq.73 .or. ipk.eq.76) return; endif
- if(lrrr) then; if(ipk.lt.73 .or. ipk.eq.76) return; endif
- if(lr73) then; if(ipk.lt.74 .or. ipk.eq.76) return; endif
-
- qual=100.0*(u1-u2)
- thresh=(qual+10.0)*(u1-0.6)
- if(thresh.gt.4.0 .and. qual.gt.2.6 .and. u1.gt.0.77) then
-!print *,'matched',thresh
-!print *,msgsd76(ipk)
-! if(trim(msgsd76(ipk)).eq.'CQ DE AA00') return ! triggered by memory corruption?
- lft8sd=.true.; msg37=msgsd76(ipk); itone(1:79)=itone76(ipk,1:79); return
- endif
- endif
-
- return
-end subroutine ft8mf1var
+ +subroutine ft8mf1var(s8,itone,msgd,msg37,lft8sd) + + use ft8_mod1, only : itone76,idtone76,msgsd76 + real, intent(in) :: s8(0:7,79) + real s8d(0:7,58) + character msgd*37,msg37*37,msggrid*37,c1*12,c2*12,grid*4 + integer itone(79),mrs(58),mrs2(58) + logical(1) lft8sd,lr73,lgrid,lreport,lrreport,lrrr + + lr73=.false.; lgrid=.false.; lreport=.false.; lrreport=.false.; lrrr=.false. + c1=' '; c2=' ' + ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1; ispc3=index(msgd((ispc2+1):),' ')+ispc2 + if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then + c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1) + else + return + endif + if(len_trim(c1).lt.3 .or. len_trim(c2).lt.3) return + if(msgd(ispc2+1:ispc3-1).eq.'RR73' .or. msgd(ispc2+1:ispc3-1).eq.'73') lr73=.true. + if(.not.lr73 .and. (ispc3-ispc2).eq.5 .and. msgd(ispc2+1:ispc2+2).ne.'R+' .and. msgd(ispc2+1:ispc2+2).ne.'R-') & + lgrid=.true. + if(msgd(ispc2+1:ispc2+1).eq.'+' .or. msgd(ispc2+1:ispc2+1).eq.'-') lreport=.true. + if(msgd(ispc2+1:ispc2+2).eq.'R+' .or. msgd(ispc2+1:ispc2+2).eq.'R-') lrreport=.true. + if(msgd(ispc2+1:ispc3-1).eq.'RRR') lrrr=.true. + + thresh=0.0; i1=0; i2=0 + do i=1,58; if(i.le.29) then; s8d(0:7,i)=s8(0:7,i+7); else; s8d(0:7,i)=s8(0:7,i+14); endif; enddo + do j=1,58 + s1=-1.0E6; s2=-1.0E6 + do i=0,7; if(s8d(i,j).gt.s1) then; s1=s8d(i,j); i1=i; endif; enddo + do i=0,7; if(i.ne.i1 .and. s8d(i,j).gt.s2) then; s2=s8d(i,j); i2=i; endif; enddo + mrs(j)=i1; mrs2(j)=i2 + enddo + ref0=0.0 + do i=1,58; ref0=ref0 + s8d(mrs(i),i); enddo + + ipk=0; u1=0.0; u2=0.0 + do k=1,76 + psum=0.; ref=ref0 + do j=1,58; i3=idtone76(k,j); psum=psum + s8d(i3,j); if(i3.eq.mrs(j)) ref=ref - s8d(i3,j) + s8d(mrs2(j),j); enddo + p=psum/ref + if(p.gt.u1) then; u2=u1; u1=p; ipk=k + else; if(p.gt.u2) u2=p + endif + enddo +!/'+09 ','+08 ','+07 ','+06 ','+05 ','+04 ','+03 ','+02 ','+01 ','+00 ', & +! '-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', & +! '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ', & +! '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R+09','R+08','R+07','R+06', & +! 'R+05','R+04','R+03','R+02','R+01','R+00','R-01','R-02','R-03','R-04', & +! 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14', & +! 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24', & +! 'R-25','R-26','RRR ','RR73','73 ','AA00'/ + if(ipk.ne.0) then + if(lgrid) then + if(ipk.eq.76) then + msggrid=msgsd76(76) + ispc1=index(msggrid,' '); ispc2=index(msggrid((ispc1+1):),' ')+ispc1; ispc3=index(msggrid((ispc2+1):),' ')+ispc2 + grid=msggrid(ispc2+1:ispc3-1) + if(grid.eq.'AA00') return + endif + if(ipk.lt.37 .or. (ipk.gt.72 .and. ipk.lt.76)) return + endif + if(lreport) then; if((ipk.gt.36 .and. ipk.lt.73) .or. ipk.eq.76) return; endif + if(lrreport) then; if(ipk.lt.37 .or. ipk.eq.73 .or. ipk.eq.76) return; endif + if(lrrr) then; if(ipk.lt.73 .or. ipk.eq.76) return; endif + if(lr73) then; if(ipk.lt.74 .or. ipk.eq.76) return; endif + + qual=100.0*(u1-u2) + thresh=(qual+10.0)*(u1-0.6) + if(thresh.gt.4.0 .and. qual.gt.2.6 .and. u1.gt.0.77) then +!print *,'matched',thresh +!print *,msgsd76(ipk) +! if(trim(msgsd76(ipk)).eq.'CQ DE AA00') return ! triggered by memory corruption? + lft8sd=.true.; msg37=msgsd76(ipk); itone(1:79)=itone76(ipk,1:79); return + endif + endif + + return +end subroutine ft8mf1var diff --git a/lib/ft8var/ft8mfcqvar.f90 b/lib/ft8var/ft8mfcqvar.f90 index 9f6ccddf..092493da 100755..100644 --- a/lib/ft8var/ft8mfcqvar.f90 +++ b/lib/ft8var/ft8mfcqvar.f90 @@ -1,51 +1,51 @@ -
-subroutine ft8mfcqvar(s8,itone,msgd,msg37,lft8sd)
-
- use ft8_mod1, only : idtone25
- real, intent(in) :: s8(0:7,79)
- real s8d(0:7,58)
- character*37 msgd,msg37,msgsent37
- integer itone(79),mrs(58),mrs2(58)
- integer*1 msgbits(77)
- logical(1) lft8sd
-
- if(len_trim(msgd).lt.6) return
- i3=-1; n3=-1
- call genft8sdvar(msgd,i3,n3,msgsent37,msgbits,itone)
- idtone25(1,1:29)=itone(8:36)
- idtone25(1,30:58)=itone(44:72)
-
- thresh=0.0; i1=0; i2=0
- do i=1,58; if(i.le.29) then; s8d(0:7,i)=s8(0:7,i+7); else; s8d(0:7,i)=s8(0:7,i+14); endif; enddo
- do j=1,58
- s1=-1.0E6; s2=-1.0E6
- do i=0,7; if(s8d(i,j).gt.s1) then; s1=s8d(i,j); i1=i; endif; enddo
- do i=0,7; if(i.ne.i1 .and. s8d(i,j).gt.s2) then; s2=s8d(i,j); i2=i; endif; enddo
- mrs(j)=i1; mrs2(j)=i2
- enddo
- ref0=0.0
- do i=1,58; ref0=ref0 + s8d(mrs(i),i); enddo
-
- ipk=0; u1=0.0; u2=0.0
- do k=1,25
- psum=0.; ref=ref0
- do j=1,58; i3=idtone25(k,j); psum=psum + s8d(i3,j); if(i3.eq.mrs(j)) ref=ref - s8d(i3,j) + s8d(mrs2(j),j); enddo
- p=psum/ref
- if(p.gt.u1) then; u2=u1; u1=p; ipk=k
- else; if(p.gt.u2) u2=p
- endif
- enddo
-
- if(ipk.eq.1) then
- qual=100.0*(u1-u2)
- thresh=(qual+10.0)*(u1-0.6)
- if(thresh.gt.4.0 .and. qual.gt.2.6 .and. u1.gt.0.77) then
-!print *,'matched',thresh
-!print *,msgsd76(ipk)
-! if(msgd(1:10).eq.'CQ DE AA00') return ! triggered by memory corruption?
- lft8sd=.true.; msg37=msgd; return
- endif
- endif
-
- return
-end subroutine ft8mfcqvar
+ +subroutine ft8mfcqvar(s8,itone,msgd,msg37,lft8sd) + + use ft8_mod1, only : idtone25 + real, intent(in) :: s8(0:7,79) + real s8d(0:7,58) + character*37 msgd,msg37,msgsent37 + integer itone(79),mrs(58),mrs2(58) + integer*1 msgbits(77) + logical(1) lft8sd + + if(len_trim(msgd).lt.6) return + i3=-1; n3=-1 + call genft8sdvar(msgd,i3,n3,msgsent37,msgbits,itone) + idtone25(1,1:29)=itone(8:36) + idtone25(1,30:58)=itone(44:72) + + thresh=0.0; i1=0; i2=0 + do i=1,58; if(i.le.29) then; s8d(0:7,i)=s8(0:7,i+7); else; s8d(0:7,i)=s8(0:7,i+14); endif; enddo + do j=1,58 + s1=-1.0E6; s2=-1.0E6 + do i=0,7; if(s8d(i,j).gt.s1) then; s1=s8d(i,j); i1=i; endif; enddo + do i=0,7; if(i.ne.i1 .and. s8d(i,j).gt.s2) then; s2=s8d(i,j); i2=i; endif; enddo + mrs(j)=i1; mrs2(j)=i2 + enddo + ref0=0.0 + do i=1,58; ref0=ref0 + s8d(mrs(i),i); enddo + + ipk=0; u1=0.0; u2=0.0 + do k=1,25 + psum=0.; ref=ref0 + do j=1,58; i3=idtone25(k,j); psum=psum + s8d(i3,j); if(i3.eq.mrs(j)) ref=ref - s8d(i3,j) + s8d(mrs2(j),j); enddo + p=psum/ref + if(p.gt.u1) then; u2=u1; u1=p; ipk=k + else; if(p.gt.u2) u2=p + endif + enddo + + if(ipk.eq.1) then + qual=100.0*(u1-u2) + thresh=(qual+10.0)*(u1-0.6) + if(thresh.gt.4.0 .and. qual.gt.2.6 .and. u1.gt.0.77) then +!print *,'matched',thresh +!print *,msgsd76(ipk) +! if(msgd(1:10).eq.'CQ DE AA00') return ! triggered by memory corruption? + lft8sd=.true.; msg37=msgd; return + endif + endif + + return +end subroutine ft8mfcqvar diff --git a/lib/ft8var/ft8sd1var.f90 b/lib/ft8var/ft8sd1var.f90 index 05ae3005..7436e586 100755..100644 --- a/lib/ft8var/ft8sd1var.f90 +++ b/lib/ft8var/ft8sd1var.f90 @@ -1,113 +1,113 @@ -subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq)
-
- use ft8_mod1, only : mycall
- real, intent(in) :: s8(0:7,79)
- real s8_1(0:7,79)
- character msgd*37,msg37*37,msg372*37,msgsent37*37,c1*12,c2*12
- character*37 msg4(4)
- integer idtone4(4,58),itone4(4,79)
- integer itone(79),itonedem(58),idtone(58),ip1(1)
- integer*1 msgbits(77)
- logical(1), intent(in) :: lcq
- logical(1) lft8sd,lr73,lgrid,lmatched(58)
-
- lmatched=.false.; lr73=.false.; lgrid=.false.
- itonedem=11
-
- if(.not.lcq) then
- c1=' '; c2=' '
- ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1; ispc3=index(msgd((ispc2+1):),' ')+ispc2
- if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then
- c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1)
- else
- return
- endif
- if(len_trim(c1).lt.3 .or. len_trim(c2).lt.3 .or. c2.eq.trim(mycall)) return
- if(index(msgd,' RR73').gt.0 .or. index(msgd,' 73').gt.0) lr73=.true.
- if(.not.lr73 .and. (ispc3-ispc2).eq.5 .and. msgd(ispc2+1:ispc2+2).ne.'R+' &
- .and. msgd(ispc2+1:ispc2+2).ne.'R-') lgrid=.true.
- if(.not.lgrid .and. .not.lr73) then
- do i=1,4
- msg4(i)=' '
- if(i.eq.1) msg4(i)=msgd
- if(i.eq.2) msg4(i)=trim(c1)//' '//trim(c2)//' RRR'
- if(i.eq.3) msg4(i)=trim(c1)//' '//trim(c2)//' RR73'
- if(i.eq.4) msg4(i)=trim(c1)//' '//trim(c2)//' 73'
- enddo
- endif
- endif
-
- if(lcq .or. lgrid .or. lr73) then
- i3=-1; n3=-1
- msg372=msgd
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
- idtone(1:29)=itone(8:36)
- idtone(30:58)=itone(44:72)
- else
- do i=1,4
- msg372=msg4(i)
- i3=-1; n3=-1
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
- idtone4(i,1:29)=itone(8:36)
- idtone4(i,30:58)=itone(44:72)
- itone4(i,1:79)=itone(1:79)
- enddo
- endif
-
- s8_1=s8
- do i=1,58
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
-
- imax=0
- if(lcq .or. lgrid .or. lr73) then
- nmatch1=0; ncrcpaty1=0
- do k=1,58
- if(idtone(k).eq.itonedem(k)) then; nmatch1=nmatch1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif
- enddo
- if(nmatch1.gt.29 .and. ncrcpaty1.gt.10) then; lft8sd=.true.; msg37=msgd; return; endif
- else
- nmatchditer1=0; ncrcpatyiter1=0
- do i=1,4
- nmatch1=0; ncrcpaty1=0
- do k=1,58
- if(idtone4(i,k).eq.itonedem(k)) then; nmatch1=nmatch1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif
- enddo
- if(nmatch1.gt.nmatchditer1) then; imax=i; nmatchditer1=nmatch1; ncrcpatyiter1=ncrcpaty1; endif
- enddo
- if(imax.eq.0) return
- if(lr73 .and. imax.eq.2) return ! RRR is not a valid message
- nmatch1=nmatchditer1; ncrcpaty1=ncrcpatyiter1
- idtone(1:58)=idtone4(imax,1:58)
- if(nmatch1.gt.29 .and. ncrcpaty1.gt.10) then; lft8sd=.true.; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); return; endif
- endif
-
- if(nmatch1.ge.22) then
- do k=1,58
- if(idtone(k).eq.itonedem(k)) lmatched(k)=.true.
- enddo
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1)
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); endif
- enddo
-
- nmatch2=nmatch1; ncrcpaty2=ncrcpaty1
- if(lcq .or. lgrid .or. lr73) then
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif
- enddo
- if(nmatch2.gt.41 .and. ncrcpaty2.gt.19) then; lft8sd=.true.; msg37=msgd; return; endif
- else
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif
- enddo
- if(nmatch2.gt.41 .and. ncrcpaty2.gt.19) then; lft8sd=.true.; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); return; endif
- endif
- endif
-
- return
-end subroutine ft8sd1var
+subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq) + + use ft8_mod1, only : mycall + real, intent(in) :: s8(0:7,79) + real s8_1(0:7,79) + character msgd*37,msg37*37,msg372*37,msgsent37*37,c1*12,c2*12 + character*37 msg4(4) + integer idtone4(4,58),itone4(4,79) + integer itone(79),itonedem(58),idtone(58),ip1(1) + integer*1 msgbits(77) + logical(1), intent(in) :: lcq + logical(1) lft8sd,lr73,lgrid,lmatched(58) + + lmatched=.false.; lr73=.false.; lgrid=.false. + itonedem=11 + + if(.not.lcq) then + c1=' '; c2=' ' + ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1; ispc3=index(msgd((ispc2+1):),' ')+ispc2 + if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then + c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1) + else + return + endif + if(len_trim(c1).lt.3 .or. len_trim(c2).lt.3 .or. c2.eq.trim(mycall)) return + if(index(msgd,' RR73').gt.0 .or. index(msgd,' 73').gt.0) lr73=.true. + if(.not.lr73 .and. (ispc3-ispc2).eq.5 .and. msgd(ispc2+1:ispc2+2).ne.'R+' & + .and. msgd(ispc2+1:ispc2+2).ne.'R-') lgrid=.true. + if(.not.lgrid .and. .not.lr73) then + do i=1,4 + msg4(i)=' ' + if(i.eq.1) msg4(i)=msgd + if(i.eq.2) msg4(i)=trim(c1)//' '//trim(c2)//' RRR' + if(i.eq.3) msg4(i)=trim(c1)//' '//trim(c2)//' RR73' + if(i.eq.4) msg4(i)=trim(c1)//' '//trim(c2)//' 73' + enddo + endif + endif + + if(lcq .or. lgrid .or. lr73) then + i3=-1; n3=-1 + msg372=msgd + call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone) + idtone(1:29)=itone(8:36) + idtone(30:58)=itone(44:72) + else + do i=1,4 + msg372=msg4(i) + i3=-1; n3=-1 + call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone) + idtone4(i,1:29)=itone(8:36) + idtone4(i,30:58)=itone(44:72) + itone4(i,1:79)=itone(1:79) + enddo + endif + + s8_1=s8 + do i=1,58 + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + + imax=0 + if(lcq .or. lgrid .or. lr73) then + nmatch1=0; ncrcpaty1=0 + do k=1,58 + if(idtone(k).eq.itonedem(k)) then; nmatch1=nmatch1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif + enddo + if(nmatch1.gt.29 .and. ncrcpaty1.gt.10) then; lft8sd=.true.; msg37=msgd; return; endif + else + nmatchditer1=0; ncrcpatyiter1=0 + do i=1,4 + nmatch1=0; ncrcpaty1=0 + do k=1,58 + if(idtone4(i,k).eq.itonedem(k)) then; nmatch1=nmatch1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif + enddo + if(nmatch1.gt.nmatchditer1) then; imax=i; nmatchditer1=nmatch1; ncrcpatyiter1=ncrcpaty1; endif + enddo + if(imax.eq.0) return + if(lr73 .and. imax.eq.2) return ! RRR is not a valid message + nmatch1=nmatchditer1; ncrcpaty1=ncrcpatyiter1 + idtone(1:58)=idtone4(imax,1:58) + if(nmatch1.gt.29 .and. ncrcpaty1.gt.10) then; lft8sd=.true.; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); return; endif + endif + + if(nmatch1.ge.22) then + do k=1,58 + if(idtone(k).eq.itonedem(k)) lmatched(k)=.true. + enddo + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1) + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); endif + enddo + + nmatch2=nmatch1; ncrcpaty2=ncrcpaty1 + if(lcq .or. lgrid .or. lr73) then + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif + enddo + if(nmatch2.gt.41 .and. ncrcpaty2.gt.19) then; lft8sd=.true.; msg37=msgd; return; endif + else + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif + enddo + if(nmatch2.gt.41 .and. ncrcpaty2.gt.19) then; lft8sd=.true.; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); return; endif + endif + endif + + return +end subroutine ft8sd1var diff --git a/lib/ft8var/ft8sdvar.f90 b/lib/ft8var/ft8sdvar.f90 index ed8cb00a..202aa711 100755..100644 --- a/lib/ft8var/ft8sdvar.f90 +++ b/lib/ft8var/ft8sdvar.f90 @@ -1,178 +1,178 @@ -subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq)
-
- use ft8_mod1, only : mycall
- real, intent(in) :: s8(0:7,79)
- real s8_1(0:7,79)
- character msgd*37,msg37*37,msg372*37,msgsent37*37,c1*12,c2*12
- character*37 msg4(4)
- integer idtone4(4,58),itone4(4,79)
- integer itone(79),itonedem(58),idtone(58),ip1(1)
- integer*1 msgbits(77)
- logical(1), intent(in) :: lcq
- logical(1) lft8sd,lmatched(58)
-
- if(index(msgd,' RR73').gt.0 .or. index(msgd,' 73').gt.0) return ! do not process 73 messages
-! do not process messages with grid
- if(.not.(msgd(1:3).eq.'CQ ' .or. index(msgd,'-').gt.0 .or. index(msgd,'+').gt.0 .or. index(msgd,' RRR').gt.0)) return
-
- lmatched=.false.; s8_1=s8; itonedem=11
-
- if(.not.lcq) then
- c1=' '; c2=' '
- ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1
- if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then
- c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1)
- else
- return
- endif
- if(len_trim(c1).lt.3 .or. len_trim(c2).lt.3 .or. c2.eq.trim(mycall)) return
- do i=1,4
- msg4(i)=' '
- if(i.eq.1) msg4(i)=msgd
- if(i.eq.2) msg4(i)=trim(c1)//' '//trim(c2)//' RRR'
- if(i.eq.3) msg4(i)=trim(c1)//' '//trim(c2)//' RR73'
- if(i.eq.4) msg4(i)=trim(c1)//' '//trim(c2)//' 73'
- enddo
- endif
-
- if(lcq) then
- i3=-1; n3=-1
- msg372=msgd
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
- idtone(1:29)=itone(8:36)
- idtone(30:58)=itone(44:72)
- else
- do i=1,4
- msg372=msg4(i)
- i3=-1; n3=-1
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
- idtone4(i,1:29)=itone(8:36)
- idtone4(i,30:58)=itone(44:72)
- itone4(i,1:79)=itone(1:79)
- enddo
- endif
-
- do i=1,58
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
-
- imax=0
- if(lcq) then
- nmatch1=0; ncrcpaty1=0
- do k=1,58
- if(idtone(k).eq.itonedem(k)) then; nmatch1=nmatch1+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif
- enddo
- if(nmatch1.gt.26) then; lft8sd=.true.; msg37=msgd; return; endif
- else
- nmatchditer1=0; nbaseiter1=0; ncrcpatyiter1=0;
- do i=1,4
- nmatch1=0; nbase1=0; ncrcpaty1=0
- do k=1,58
- if(idtone4(i,k).eq.itonedem(k)) then
- nmatch1=nmatch1+1; if(k.lt.23) nbase1=nbase1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1 ! CRC+parity
- endif
- enddo
- if(nmatch1.gt.nmatchditer1) then
- imax=i; nmatchditer1=nmatch1; nbaseiter1=nbase1; ncrcpatyiter1=ncrcpaty1
- endif
- enddo
- if(imax.eq.0) return
- if(srr.gt.3.0 .and. nbaseiter1.lt.12) return ! prevent false decodes from the strong signals
- nmatch1=nmatchditer1; ncrcpaty1=ncrcpatyiter1!; nbase1=nbaseiter1
- idtone(1:58)=idtone4(imax,1:58)
- if(nmatch1.gt.26 .and. ncrcpaty1.gt.10) then
- lft8sd=.true.; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); return
- endif
- do k=1,58
- if(idtone(k).eq.itonedem(k)) lmatched(k)=.true.
- enddo
- endif
-
- if(nmatch1.ge.16) then
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch2=nmatch1; ncrcpaty2=ncrcpaty1
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif
- enddo
- if(nmatch2.gt.38 .and. ncrcpaty2.gt.19) then
- lft8sd=.true.
- if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif
- return
- endif
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch3=nmatch2; ncrcpaty3=ncrcpaty2
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch3=nmatch3+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty3=ncrcpaty3+1; endif
- enddo
- if(nmatch3.gt.44 .and. ncrcpaty3.gt.21) then
- lft8sd=.true.
- if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif
- return
- endif
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch4=nmatch3; ncrcpaty4=ncrcpaty3
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch4=nmatch4+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty4=ncrcpaty4+1; endif
- enddo
- if(nmatch4.gt.47 .and. ncrcpaty4.gt.23) then
- lft8sd=.true.
- if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif
- return
- endif
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch5=nmatch4; ncrcpaty5=ncrcpaty4
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch5=nmatch5+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty5=ncrcpaty5+1; endif
- enddo
- if(nmatch5.gt.50 .and. (nmatch1.gt.21 .or. nmatch2.gt.31 .or. nmatch3.gt.38 .or. nmatch4.gt.46) .and. &
- ncrcpaty5.gt.25) then
- lft8sd=.true.
- if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif
- return
- endif
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch6=nmatch5; ncrcpaty6=ncrcpaty5
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch6=nmatch6+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty6=ncrcpaty6+1; endif
- enddo
- if(nmatch6.gt.54 .and. (nmatch1.gt.22 .or. nmatch2.gt.27 .or. nmatch3.gt.35 .or. &
- (nmatch2-nmatch1).gt.9 .or. (nmatch3-nmatch2).gt.10) .and. ncrcpaty6.gt.29) then
- lft8sd=.true.
- if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif
- return
- endif
-
- endif
-
- return
-end subroutine ft8sdvar
+subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq) + + use ft8_mod1, only : mycall + real, intent(in) :: s8(0:7,79) + real s8_1(0:7,79) + character msgd*37,msg37*37,msg372*37,msgsent37*37,c1*12,c2*12 + character*37 msg4(4) + integer idtone4(4,58),itone4(4,79) + integer itone(79),itonedem(58),idtone(58),ip1(1) + integer*1 msgbits(77) + logical(1), intent(in) :: lcq + logical(1) lft8sd,lmatched(58) + + if(index(msgd,' RR73').gt.0 .or. index(msgd,' 73').gt.0) return ! do not process 73 messages +! do not process messages with grid + if(.not.(msgd(1:3).eq.'CQ ' .or. index(msgd,'-').gt.0 .or. index(msgd,'+').gt.0 .or. index(msgd,' RRR').gt.0)) return + + lmatched=.false.; s8_1=s8; itonedem=11 + + if(.not.lcq) then + c1=' '; c2=' ' + ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1 + if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then + c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1) + else + return + endif + if(len_trim(c1).lt.3 .or. len_trim(c2).lt.3 .or. c2.eq.trim(mycall)) return + do i=1,4 + msg4(i)=' ' + if(i.eq.1) msg4(i)=msgd + if(i.eq.2) msg4(i)=trim(c1)//' '//trim(c2)//' RRR' + if(i.eq.3) msg4(i)=trim(c1)//' '//trim(c2)//' RR73' + if(i.eq.4) msg4(i)=trim(c1)//' '//trim(c2)//' 73' + enddo + endif + + if(lcq) then + i3=-1; n3=-1 + msg372=msgd + call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone) + idtone(1:29)=itone(8:36) + idtone(30:58)=itone(44:72) + else + do i=1,4 + msg372=msg4(i) + i3=-1; n3=-1 + call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone) + idtone4(i,1:29)=itone(8:36) + idtone4(i,30:58)=itone(44:72) + itone4(i,1:79)=itone(1:79) + enddo + endif + + do i=1,58 + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + + imax=0 + if(lcq) then + nmatch1=0; ncrcpaty1=0 + do k=1,58 + if(idtone(k).eq.itonedem(k)) then; nmatch1=nmatch1+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif + enddo + if(nmatch1.gt.26) then; lft8sd=.true.; msg37=msgd; return; endif + else + nmatchditer1=0; nbaseiter1=0; ncrcpatyiter1=0; + do i=1,4 + nmatch1=0; nbase1=0; ncrcpaty1=0 + do k=1,58 + if(idtone4(i,k).eq.itonedem(k)) then + nmatch1=nmatch1+1; if(k.lt.23) nbase1=nbase1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1 ! CRC+parity + endif + enddo + if(nmatch1.gt.nmatchditer1) then + imax=i; nmatchditer1=nmatch1; nbaseiter1=nbase1; ncrcpatyiter1=ncrcpaty1 + endif + enddo + if(imax.eq.0) return + if(srr.gt.3.0 .and. nbaseiter1.lt.12) return ! prevent false decodes from the strong signals + nmatch1=nmatchditer1; ncrcpaty1=ncrcpatyiter1!; nbase1=nbaseiter1 + idtone(1:58)=idtone4(imax,1:58) + if(nmatch1.gt.26 .and. ncrcpaty1.gt.10) then + lft8sd=.true.; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); return + endif + do k=1,58 + if(idtone(k).eq.itonedem(k)) lmatched(k)=.true. + enddo + endif + + if(nmatch1.ge.16) then + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch2=nmatch1; ncrcpaty2=ncrcpaty1 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif + enddo + if(nmatch2.gt.38 .and. ncrcpaty2.gt.19) then + lft8sd=.true. + if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif + return + endif + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch3=nmatch2; ncrcpaty3=ncrcpaty2 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch3=nmatch3+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty3=ncrcpaty3+1; endif + enddo + if(nmatch3.gt.44 .and. ncrcpaty3.gt.21) then + lft8sd=.true. + if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif + return + endif + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch4=nmatch3; ncrcpaty4=ncrcpaty3 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch4=nmatch4+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty4=ncrcpaty4+1; endif + enddo + if(nmatch4.gt.47 .and. ncrcpaty4.gt.23) then + lft8sd=.true. + if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif + return + endif + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch5=nmatch4; ncrcpaty5=ncrcpaty4 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch5=nmatch5+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty5=ncrcpaty5+1; endif + enddo + if(nmatch5.gt.50 .and. (nmatch1.gt.21 .or. nmatch2.gt.31 .or. nmatch3.gt.38 .or. nmatch4.gt.46) .and. & + ncrcpaty5.gt.25) then + lft8sd=.true. + if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif + return + endif + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch6=nmatch5; ncrcpaty6=ncrcpaty5 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch6=nmatch6+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty6=ncrcpaty6+1; endif + enddo + if(nmatch6.gt.54 .and. (nmatch1.gt.22 .or. nmatch2.gt.27 .or. nmatch3.gt.35 .or. & + (nmatch2-nmatch1).gt.9 .or. (nmatch3-nmatch2).gt.10) .and. ncrcpaty6.gt.29) then + lft8sd=.true. + if(lcq) then; msg37=msgd; else; msg37=msg4(imax); itone(1:79)=itone4(imax,1:79); endif + return + endif + + endif + + return +end subroutine ft8sdvar diff --git a/lib/ft8var/ft8svar.f90 b/lib/ft8var/ft8svar.f90 index 83a4ac03..17aa58f7 100755..100644 --- a/lib/ft8var/ft8svar.f90 +++ b/lib/ft8var/ft8svar.f90 @@ -1,368 +1,368 @@ -
-subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
-
- use ft8_mod1, only : itone56,idtone56,msg,nlasttx,lastrxmsg,mycall,hiscall
- real, intent(in) :: s8(0:7,79),srr
- real s8_1(0:7,79),s8d(0:7,58),xsync(21),xmsync(21),xdata(58),xmdata(58),xnoise(79),xmnoise(79)
- character, intent(out) :: msg37*37
- character*37 lastrcvdmsg,msgsent37
- integer, intent(out) :: itone(79)
- integer, intent(in) :: nft8rxfsens
- integer itonedem(58),idtone(58),mrs(58),mrs2(58),mrs3(58),mrs4(58),ip1(1)
- logical(1), intent(in) :: stophint
- logical(1), intent(out) :: lft8s
- logical(1) lmatched(58),lmycall,lhiscall,lrrr,lr73,lcallingrprt,lastrrprt,lastreport,lgrid
-
-! taken from ft8_mod1
-! integer itone56(56,79),idtone56(56,58)
-! character*37 msg(56)
-
-!nlasttx last TX message
-! 0 Tx was halted
-! 1 AA1AA BB1BB PL35
-! 2 AA1AA BB1BB -15
-! 3 AA1AA BB1BB R-15
-! 4 AA1AA BB1BB RRR/RR73
-! 5 AA1AA BB1BB 73
-! 6 CQ BB1BB PL35
-
- lft8s=.false.
- if(stophint) return; if(len_trim(hiscall).lt.3) return; if(nlasttx.eq.6 .or. nlasttx.eq.0) return ! CQ or TX halted
- lgrid=.false.; nft8rxfslow=nft8rxfsens; lmycall=.false.; lastrcvdmsg=''
- lmatched=.false.; s8_1=s8; lhiscall=.false.; lrrr=.false.; lr73=.false.; lcallingrprt=.false.; lastrrprt=.false.
- lastreport=.false.; itonedem=11; ntresh1=26; ntresh2=38; if(srr.gt.7.0) then; ntresh1=29; ntresh2=41; endif
-
- if(lastrxmsg(1)%lstate) then; lastrcvdmsg=lastrxmsg(1)%lastmsg; else; lastrcvdmsg=''; endif
-
- if(lastrcvdmsg.ne.' ') then
- if(index(lastrcvdmsg,trim(hiscall)).gt.0) lhiscall=.true.
- if(index(lastrcvdmsg,trim(mycall)).eq.1) lmycall=.true.
- if(lmycall .and. lhiscall) then
- if(index(lastrcvdmsg,' RRR').gt.0) lrrr=.true.
- if(index(lastrcvdmsg,' RR73').gt.0 .or. index(lastrcvdmsg,' 73').gt.0) lr73=.true.
- endif
- else
- if(nlasttx.eq.2) lcallingrprt=.true. ! calling with REPORT scenario
- endif
- if(lmycall .and. lhiscall) then
- if(index(lastrcvdmsg,' +').gt.0 .or. index(lastrcvdmsg,' -').gt.0) lastreport=.true.
- if(index(lastrcvdmsg,' R+').gt.0 .or. index(lastrcvdmsg,' R-').gt.0) lastrrprt=.true.
- endif
- if(lastrxmsg(1)%lstate .and. lmycall .and. lhiscall .and. .not.lastreport .and. .not. lastrrprt .and. .not.lrrr .and. &
- .not.lr73) lgrid=.true.
- if(lastrxmsg(1)%lstate .and. .not.lmycall .and. lhiscall .and. nlasttx.eq.2) lcallingrprt=.true. ! calling with REPORT
-
- if(lgrid .and. index(msg(53),trim(mycall)//' '//trim(hiscall)//' AA00').eq.1) then ! standard callsigns
- i3=-1; n3=-1
- msg(53)=lastrxmsg(1)%lastmsg
- call genft8sdvar(msg(53),i3,n3,msgsent37,msgbits,itone)
- idtone56(53,1:29)=itone(8:36)
- idtone56(53,30:58)=itone(44:72)
- itone56(53,1:79)=itone(1:79)
- endif
-
- do i=1,58
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
-
- nmycall1=0; nbase1=0
- do k=1,19
- if(idtone56(1,k).eq.itonedem(k)) then; if(k.lt.10) nmycall1=nmycall1+1; nbase1=nbase1+1; endif
- enddo
-
-! /'-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ',
-! '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ',
-! '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R-01','R-02','R-03','R-04',
-! 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14',
-! 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24',
-! 'R-25','R-26','AA00','RRR ','RR73','73 '/
-
- ilow=1; ihigh=56
- if(nlasttx.eq.1) then; ilow=1; ihigh=26 ! GRID R+REPORT RRR RR73 73 are not valid msgs
- elseif(lgrid) then; ilow=27; ihigh=53 ! REPORT RRR RR73 73 are not valid msgs
- elseif(lcallingrprt) then; ilow=27; ihigh=52 ! GRID REPORT RRR RR73 73 are not valid msgs
- elseif(lastrrprt) then; ilow=27; ihigh=56 ! REPORT is not a valid msg, GRID shall be excluded later
- elseif(lr73 .or. lrrr) then; ilow=54; ihigh=56 ! GRID, REPORT or R+REPORT is not a valid msg,
-! MF GRID shall be excluded later
- endif
-
- nmatchditer1=0; ncrcpatyiter1=0; imax=0
- do i=ilow,ihigh
- if(lastreport .and. i.gt.26 .and. i.lt.54) cycle ! RREPORT is not a valid msg, direction change is not allowed
- nmatch1=0; ncrcpaty1=0
- do k=1,58
- if(idtone56(i,k).eq.itonedem(k)) then; nmatch1=nmatch1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif
- enddo
- if(nmatch1.gt.nmatchditer1) then
- imax=i; nmatchditer1=nmatch1; ncrcpatyiter1=ncrcpaty1
- endif
- enddo
-!write (*,"(i2,1x,i2,1x,i2,1x,i2)") nmatchlast1,nmatchditer1,ncrcpatylast1,ncrcpatyiter1
- if(imax.eq.0) return
- if(srr.gt.3.0 .and. (nmycall1.lt.5 .or. nbase1.lt.10)) return ! prevent false decodes from the strong signals
- if((nlasttx.eq.1 .or. lcallingrprt) .and. nmycall1.eq.0) return ! answer to other operator
- if(lr73 .and. (imax.eq.53 .or. imax.eq.54)) return ! RRR,GRID is not a valid msg
-
- nmatch1=nmatchditer1; ncrcpaty1=ncrcpatyiter1
- idtone(1:58)=idtone56(imax,1:58)
- do k=1,58
- if(idtone(k).eq.itonedem(k)) lmatched(k)=.true.
- enddo
-
- if(ncrcpaty1.lt.8) return
-
- thresh=0.0; i1=0; i2=0; i33=0; i4=0
- do i=1,58; if(i.le.29) then; s8d(0:7,i)=s8(0:7,i+7); else; s8d(0:7,i)=s8(0:7,i+14); endif; enddo
- do j=1,58
- s1=-1.0E6; s2=-1.0E6; s3=-1.0E6; s4=-1.0E6
- do i=0,7; if(s8d(i,j).gt.s1) then; s1=s8d(i,j); i1=i; endif; enddo
- do i=0,7; if(i.ne.i1 .and. s8d(i,j).gt.s2) then; s2=s8d(i,j); i2=i; endif; enddo
- do i=0,7; if(i.ne.i1 .and. i.ne.i2 .and. s8d(i,j).gt.s3) then; s3=s8d(i,j); i33=i; endif; enddo
- do i=0,7; if(i.ne.i1 .and. i.ne.i2 .and. i.ne.i33 .and. s8d(i,j).gt.s4) then; s4=s8d(i,j); i4=i; endif; enddo
- mrs(j)=i1; mrs2(j)=i2; mrs3(j)=i33; mrs4(j)=i4
- enddo
- ref0=0.; ref0paty=0.; ref0mycl=0.; ref0oth=0.
- do i=1,58
- ref0=ref0 + s8d(mrs(i),i)
- if(i.gt.26) then; ref0paty=ref0paty + s8d(mrs(i),i)
- else if(i.lt.10) then; ref0mycl=ref0mycl + s8d(mrs(i),i)
- endif
- enddo
- ref0oth=ref0mycl+ref0paty
- ipk=0; u1=0.; u2=0.; u1paty=0.; u2paty=0.; u1oth=0.; u2oth=0.
- do k=ilow,ihigh
- if(lastreport .and. k.gt.26 .and. k.lt.54) cycle ! GRID, RREPORT is not a valid msg, direction change is not allowed
- psum=0.0; ref=ref0; psumpaty=0.; refpaty=ref0paty; psumoth=0.; refoth=ref0oth
- do j=1,58; i=idtone56(k,j); psum=psum + s8d(i,j)
- if(j.gt.26) then; psumpaty=psumpaty + s8d(i,j); psumoth=psumoth + s8d(i,j)
- else if(j.lt.10) then; psumoth=psumoth + s8d(i,j)
- endif
- if(i.eq.mrs(j)) then
- stmp=s8d(mrs2(j),j)-s8d(i,j); ref=ref + stmp
- if(j.gt.26) then; refpaty=refpaty + stmp; refoth=refoth + stmp
- else if(j.lt.10) then; refoth=refoth + stmp
- endif
- endif
- if(i.eq.mrs2(j)) then
- stmp=s8d(mrs3(j),j) - s8d(mrs2(j),j); ref=ref + stmp
- if(j.gt.26) then; refpaty=refpaty + stmp; refoth=refoth + stmp
- else if(j.lt.10) then; refoth=refoth + stmp
- endif
- endif
- if(i.eq.mrs3(j)) then
- stmp=s8d(mrs4(j),j) - s8d(mrs3(j),j); ref=ref + stmp
- if(j.gt.26) then; refpaty=refpaty + stmp; refoth=refoth + stmp
- else if(j.lt.10) then; refoth=refoth + stmp
- endif
- endif
-!! if(i.eq.mrs2(j)) then; ref=ref - s8d(mrs(j),j) + s8d(mrs3(j),j); endif
-!! if(i.eq.mrs3(j)) then; ref=ref - s8d(mrs(j),j) + s8d(mrs4(j),j); endif
- enddo
- p=psum/ref; ppaty=psumpaty/refpaty; poth=psumoth/refoth
- if(p.gt.u1) then; u2=u1; u1=p; u2paty=u1paty; u1paty=ppaty; u2oth=u1oth; u1oth=poth; ipk=k
- else if(p.gt.u2) then; u2=p; u2paty=ppaty; u2oth=poth
- endif
- enddo
- if(lastrrprt .and. ipk.eq.53) return ! GRID is not valid
- if(lr73 .and. ipk.lt.55) return
-
- if(lcallingrprt .or. nlasttx.eq.1) nft8rxfslow=1
-
- if(ipk.ne.0) then
- qual=100.0*(u1-u2); qualp=100.0*(u1paty-u2paty); qualo=100.0*(u1oth-u2oth)
- thresh=(qual+10.0)*(u1-0.6); if(thresh.lt.1.5) return
- threshp=(qualp+10.0)*(u1paty-0.6); thresho=(qualo+10.0)*(u1oth-0.6)
- if((lcallingrprt .or. nlasttx.eq.1) .and. thresho.lt.3.43) return
- if(thresho.lt.2.63 .or. threshp.lt.2.45) return
- if(((nft8rxfslow.eq.1 .and. thresh.gt.4.0) .or. (nft8rxfslow.eq.2 .and. thresh.gt.3.55) &
- .or. (nft8rxfslow.eq.3 .and. thresh.gt.3.0)) .and. qual.gt.2.6 .and. u1.gt.0.77) then
-!if(ipk.ne.7) print *,'match1',thresh
- lft8s=.true.; msg37=msg(ipk); itone(1:79)=itone56(ipk,1:79); go to 2
- endif
- endif
-
- if(imax.eq.ipk .and. (nft8rxfslow.gt.1 .or. (nft8rxfslow.eq.1 .and. thresh.gt.2.7)) .and. srr.lt.7.0 &
- .and. (ncrcpaty1.gt.14 .or. (nmatch1.gt.22 .and. ncrcpaty1.gt.13))) then
-!if(imax.ne.7) print *,'11',thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
-
- if(imax.eq.ipk .and. nmatch1.gt.ntresh1 .and. ncrcpaty1.gt.10) then
-!if(imax.ne.7) print *,'12',thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
-
- if(nmatchditer1.ge.16) then
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch2=nmatch1; ncrcpaty2=ncrcpaty1
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif
- enddo
- if(nmatch2.gt.ntresh2 .and. ncrcpaty2.gt.19) then
-!if(imax.ne.7) print *,'2',thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
-
- if(srr.gt.7.0) return ! do not process strong signals anymore
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch3=nmatch2; ncrcpaty3=ncrcpaty2
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch3=nmatch3+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty3=ncrcpaty3+1; endif
- enddo
- if(nmatch3.gt.44 .and. ncrcpaty3.gt.21) then
-!if(imax.ne.7) print *,'3',thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch4=nmatch3; ncrcpaty4=ncrcpaty3
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch4=nmatch4+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty4=ncrcpaty4+1; endif
- enddo
- if((nft8rxfslow.eq.3 .or. (nft8rxfslow.eq.2 .and. thresh.gt.2.2)) .and. nmatch4.gt.47 .and. ncrcpaty4.gt.23) then
-!if(imax.ne.7) print *,'4',thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch5=nmatch4; ncrcpaty5=ncrcpaty4
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch5=nmatch5+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty5=ncrcpaty5+1; endif
- enddo
- if((nft8rxfslow.eq.3 .or. (nft8rxfslow.eq.1 .and. thresh.gt.3.4) .or. (nft8rxfslow.eq.2 .and. thresh.gt.3.25)) &
- .and. nmatch5.gt.50 .and. (nmatch1.gt.21 .or. nmatch2.gt.31 .or. nmatch3.gt.38 .or. nmatch4.gt.46) &
- .and. ncrcpaty5.gt.25) then
-!if(imax.ne.7) print *,'5',thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
-
- do i=1,58
- if(lmatched(i)) cycle
- if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0
- else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif
- enddo
- nmatch6=nmatch5; ncrcpaty6=ncrcpaty5
- do k=1,58
- if(lmatched(k)) cycle
- if(idtone(k).eq.itonedem(k)) then; nmatch6=nmatch6+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty6=ncrcpaty6+1; endif
- enddo
- if(((nft8rxfslow.eq.2 .and. thresh.gt.2.6) .or. (nft8rxfslow.eq.3 .and. thresh.gt.2.22)) &
- .and. imax.eq.ipk .and. ncrcpaty6.gt.26) then
-!if(imax.ne.7) print *,'61',thresh
-!print *,'61',thresh
-!write (*,"(i2,1x,i2,1x,f5.2)") 6,ncrcpaty6,thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
-
- if(nft8rxfslow.eq.1) then
- if(nmatch6.gt.54 .and. (nmatch1.gt.22 .or. nmatch2.gt.27 .or. nmatch3.gt.35 .or. &
- (nmatch2-nmatch1).gt.9 .or. (nmatch3-nmatch2).gt.10) .and. ncrcpaty6.gt.29 .and. thresh.gt.3.15) then
-!if(imax.ne.7) print *,'62',thresh
-!print *,'62',thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
- endif
-
- if(ncrcpaty6.gt.29) then
- if((nft8rxfslow.eq.3 .or. (nft8rxfslow.eq.3 .and. thresh.gt.1.94)) .and. imax.eq.ipk .and. ncrcpaty2-ncrcpaty1.gt.3 &
- .and. ncrcpaty3-ncrcpaty2.gt.3 .and. ncrcpaty4-ncrcpaty3.gt.3 .and. ncrcpaty6-ncrcpaty5.lt.6) then
-!if(imax.ne.7) print *,'63',thresh
-!print *,'63',thresh
-!if(imax.ne.7) write (*,"(i2,1x,f5.2,1x,f5.2,1x,f5.2)") 62,u1,qual,thresh
- lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2
- endif
- endif
- endif
-
-2 if(lft8s) then
- snr=0.0; snrbase=0.0; snrpaty=0.0; snrdata=0.0; snrsync=0.0; snrmycall=0.0; snrother=0.0
- do i=1,79
- xsig=s8(itone(i),i); xnoi=(sum(s8(0:7,i)) - xsig)/7.0; snr1=xsig/(xnoi+1E-6); snr=snr+snr1
- if(i.gt.7 .and. i.lt.34) then; snrbase=snrbase + snr1; if(i.lt.17) snrmycall=snrmycall + snr1; endif
- if((i.gt.43 .and. i.lt.73) .or. (i.gt.33 .and. i.lt.37)) then; snrpaty=snrpaty+snr1; endif
- enddo
- snrdata=snrbase+snrpaty; snrsync=snr-snrdata; snrother=snrmycall+snrpaty
- snrsync=snrsync/21.0; snrother=snrother/48.0; snrpaty=snrpaty/32.0
- if(lcallingrprt .or. nlasttx.eq.1) then
- soratio=snrsync/snrother
- if(soratio.gt.1.29) then;lft8s=.false.; msg37=''; return; endif
- endif
- spratio=snrsync/snrpaty
- if(spratio.lt.0.6 .or. spratio.gt.1.25) then;lft8s=.false.; msg37=''; return; endif
-
- do i=1,7; xsync(i)=s8(itone(i),i); enddo; do i=8,14; k=i+29; xsync(i)=s8(itone(k),k); enddo
- do i=15,21; k=i+58; xsync(i)=s8(itone(k),k); enddo
- do i=1,29; k=i+7; xdata(i)=s8(itone(k),k); enddo; do i=30,58; k=i+14; xdata(i)=s8(itone(k),k); enddo
- do i=1,79; k=modulo(itone(i)+4,8); xnoise(i)=s8(k,i); enddo
-
- do i=1,19
- if((xsync(i).gt.xsync(i+1) .and. xsync(i).lt.xsync(i+2)) &
- .or. (xsync(i).lt.xsync(i+1) .and. xsync(i).gt.xsync(i+2))) then; xmsync(i)=xsync(i)
- else if((xsync(i+1).gt.xsync(i) .and. xsync(i+1).lt.xsync(i+2)) &
- .or. (xsync(i+1).lt.xsync(i) .and. xsync(i+1).gt.xsync(i+2))) then; xmsync(i)=xsync(i+1)
- else if((xsync(i+2).gt.xsync(i) .and. xsync(i+2).lt.xsync(i+1)) &
- .or. (xsync(i+2).lt.xsync(i) .and. xsync(i+2).gt.xsync(i+1))) then; xmsync(i)=xsync(i+2)
- else; xmsync(i)=xsync(i)
- endif
- enddo
- xmsync(20)=xmsync(18); xmsync(21)=xmsync(19)
-
- do i=1,56
- if((xdata(i).gt.xdata(i+1) .and. xdata(i).lt.xdata(i+2)) &
- .or. (xdata(i).lt.xdata(i+1) .and. xdata(i).gt.xdata(i+2))) then; xmdata(i)=xdata(i)
- else if((xdata(i+1).gt.xdata(i) .and. xdata(i+1).lt.xdata(i+2)) &
- .or. (xdata(i+1).lt.xdata(i) .and. xdata(i+1).gt.xdata(i+2))) then; xmdata(i)=xdata(i+1)
- else if((xdata(i+2).gt.xdata(i) .and. xdata(i+2).lt.xdata(i+1)) &
- .or. (xdata(i+2).lt.xdata(i) .and. xdata(i+2).gt.xdata(i+1))) then; xmdata(i)=xdata(i+2)
- else; xmdata(i)=xdata(i)
- endif
- enddo
- xmdata(57)=xmdata(55); xmdata(58)=xmdata(56)
-
- do i=1,77
- if((xnoise(i).gt.xnoise(i+1) .and. xnoise(i).lt.xnoise(i+2)) &
- .or. (xnoise(i).lt.xnoise(i+1) .and. xnoise(i).gt.xnoise(i+2))) then; xmnoise(i)=xnoise(i)
- else if((xnoise(i+1).gt.xnoise(i) .and. xnoise(i+1).lt.xnoise(i+2)) &
- .or. (xnoise(i+1).lt.xnoise(i) .and. xnoise(i+1).gt.xnoise(i+2))) then; xmnoise(i)=xnoise(i+1)
- else if((xnoise(i+2).gt.xnoise(i) .and. xnoise(i+2).lt.xnoise(i+1)) &
- .or. (xnoise(i+2).lt.xnoise(i) .and. xnoise(i+2).gt.xnoise(i+1))) then; xmnoise(i)=xnoise(i+2)
- else; xmnoise(i)=xnoise(i)
- endif
- enddo
- xmnoise(78)=xmnoise(76); xmnoise(79)=xmnoise(77)
-
- ssync=sum(xmsync)/21.0; spaty=sum(xmdata(27:58))/32.0; spnoise=(sum(xmnoise(34:36)) + sum(xmnoise(44:72)))/32.0
- spother=(sum(xmdata(1:9)) + sum(xmdata(27:58)))/41.0
- spratiom=ssync/(spaty+1E-6); spnratiom=spaty/(spnoise+1E-6); sporatiom=ssync/(spother+1E-6)
- if(spnratiom.gt.2.3) then
- if(lcallingrprt .or. nlasttx.eq.1) then; if(sporatiom.gt.1.35) then; lft8s=.false.; msg37=''; return; endif
- else; if(spratiom.gt.1.35) then; lft8s=.false.; msg37=''; return; endif
- endif
- endif
- endif
-
- return
-end subroutine ft8svar
+ +subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint) + + use ft8_mod1, only : itone56,idtone56,msg,nlasttx,lastrxmsg,mycall,hiscall + real, intent(in) :: s8(0:7,79),srr + real s8_1(0:7,79),s8d(0:7,58),xsync(21),xmsync(21),xdata(58),xmdata(58),xnoise(79),xmnoise(79) + character, intent(out) :: msg37*37 + character*37 lastrcvdmsg,msgsent37 + integer, intent(out) :: itone(79) + integer, intent(in) :: nft8rxfsens + integer itonedem(58),idtone(58),mrs(58),mrs2(58),mrs3(58),mrs4(58),ip1(1) + logical(1), intent(in) :: stophint + logical(1), intent(out) :: lft8s + logical(1) lmatched(58),lmycall,lhiscall,lrrr,lr73,lcallingrprt,lastrrprt,lastreport,lgrid + +! taken from ft8_mod1 +! integer itone56(56,79),idtone56(56,58) +! character*37 msg(56) + +!nlasttx last TX message +! 0 Tx was halted +! 1 AA1AA BB1BB PL35 +! 2 AA1AA BB1BB -15 +! 3 AA1AA BB1BB R-15 +! 4 AA1AA BB1BB RRR/RR73 +! 5 AA1AA BB1BB 73 +! 6 CQ BB1BB PL35 + + lft8s=.false. + if(stophint) return; if(len_trim(hiscall).lt.3) return; if(nlasttx.eq.6 .or. nlasttx.eq.0) return ! CQ or TX halted + lgrid=.false.; nft8rxfslow=nft8rxfsens; lmycall=.false.; lastrcvdmsg='' + lmatched=.false.; s8_1=s8; lhiscall=.false.; lrrr=.false.; lr73=.false.; lcallingrprt=.false.; lastrrprt=.false. + lastreport=.false.; itonedem=11; ntresh1=26; ntresh2=38; if(srr.gt.7.0) then; ntresh1=29; ntresh2=41; endif + + if(lastrxmsg(1)%lstate) then; lastrcvdmsg=lastrxmsg(1)%lastmsg; else; lastrcvdmsg=''; endif + + if(lastrcvdmsg.ne.' ') then + if(index(lastrcvdmsg,trim(hiscall)).gt.0) lhiscall=.true. + if(index(lastrcvdmsg,trim(mycall)).eq.1) lmycall=.true. + if(lmycall .and. lhiscall) then + if(index(lastrcvdmsg,' RRR').gt.0) lrrr=.true. + if(index(lastrcvdmsg,' RR73').gt.0 .or. index(lastrcvdmsg,' 73').gt.0) lr73=.true. + endif + else + if(nlasttx.eq.2) lcallingrprt=.true. ! calling with REPORT scenario + endif + if(lmycall .and. lhiscall) then + if(index(lastrcvdmsg,' +').gt.0 .or. index(lastrcvdmsg,' -').gt.0) lastreport=.true. + if(index(lastrcvdmsg,' R+').gt.0 .or. index(lastrcvdmsg,' R-').gt.0) lastrrprt=.true. + endif + if(lastrxmsg(1)%lstate .and. lmycall .and. lhiscall .and. .not.lastreport .and. .not. lastrrprt .and. .not.lrrr .and. & + .not.lr73) lgrid=.true. + if(lastrxmsg(1)%lstate .and. .not.lmycall .and. lhiscall .and. nlasttx.eq.2) lcallingrprt=.true. ! calling with REPORT + + if(lgrid .and. index(msg(53),trim(mycall)//' '//trim(hiscall)//' AA00').eq.1) then ! standard callsigns + i3=-1; n3=-1 + msg(53)=lastrxmsg(1)%lastmsg + call genft8sdvar(msg(53),i3,n3,msgsent37,msgbits,itone) + idtone56(53,1:29)=itone(8:36) + idtone56(53,30:58)=itone(44:72) + itone56(53,1:79)=itone(1:79) + endif + + do i=1,58 + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + + nmycall1=0; nbase1=0 + do k=1,19 + if(idtone56(1,k).eq.itonedem(k)) then; if(k.lt.10) nmycall1=nmycall1+1; nbase1=nbase1+1; endif + enddo + +! /'-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', +! '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ', +! '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R-01','R-02','R-03','R-04', +! 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14', +! 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24', +! 'R-25','R-26','AA00','RRR ','RR73','73 '/ + + ilow=1; ihigh=56 + if(nlasttx.eq.1) then; ilow=1; ihigh=26 ! GRID R+REPORT RRR RR73 73 are not valid msgs + elseif(lgrid) then; ilow=27; ihigh=53 ! REPORT RRR RR73 73 are not valid msgs + elseif(lcallingrprt) then; ilow=27; ihigh=52 ! GRID REPORT RRR RR73 73 are not valid msgs + elseif(lastrrprt) then; ilow=27; ihigh=56 ! REPORT is not a valid msg, GRID shall be excluded later + elseif(lr73 .or. lrrr) then; ilow=54; ihigh=56 ! GRID, REPORT or R+REPORT is not a valid msg, +! MF GRID shall be excluded later + endif + + nmatchditer1=0; ncrcpatyiter1=0; imax=0 + do i=ilow,ihigh + if(lastreport .and. i.gt.26 .and. i.lt.54) cycle ! RREPORT is not a valid msg, direction change is not allowed + nmatch1=0; ncrcpaty1=0 + do k=1,58 + if(idtone56(i,k).eq.itonedem(k)) then; nmatch1=nmatch1+1; if(k.gt.25) ncrcpaty1=ncrcpaty1+1; endif + enddo + if(nmatch1.gt.nmatchditer1) then + imax=i; nmatchditer1=nmatch1; ncrcpatyiter1=ncrcpaty1 + endif + enddo +!write (*,"(i2,1x,i2,1x,i2,1x,i2)") nmatchlast1,nmatchditer1,ncrcpatylast1,ncrcpatyiter1 + if(imax.eq.0) return + if(srr.gt.3.0 .and. (nmycall1.lt.5 .or. nbase1.lt.10)) return ! prevent false decodes from the strong signals + if((nlasttx.eq.1 .or. lcallingrprt) .and. nmycall1.eq.0) return ! answer to other operator + if(lr73 .and. (imax.eq.53 .or. imax.eq.54)) return ! RRR,GRID is not a valid msg + + nmatch1=nmatchditer1; ncrcpaty1=ncrcpatyiter1 + idtone(1:58)=idtone56(imax,1:58) + do k=1,58 + if(idtone(k).eq.itonedem(k)) lmatched(k)=.true. + enddo + + if(ncrcpaty1.lt.8) return + + thresh=0.0; i1=0; i2=0; i33=0; i4=0 + do i=1,58; if(i.le.29) then; s8d(0:7,i)=s8(0:7,i+7); else; s8d(0:7,i)=s8(0:7,i+14); endif; enddo + do j=1,58 + s1=-1.0E6; s2=-1.0E6; s3=-1.0E6; s4=-1.0E6 + do i=0,7; if(s8d(i,j).gt.s1) then; s1=s8d(i,j); i1=i; endif; enddo + do i=0,7; if(i.ne.i1 .and. s8d(i,j).gt.s2) then; s2=s8d(i,j); i2=i; endif; enddo + do i=0,7; if(i.ne.i1 .and. i.ne.i2 .and. s8d(i,j).gt.s3) then; s3=s8d(i,j); i33=i; endif; enddo + do i=0,7; if(i.ne.i1 .and. i.ne.i2 .and. i.ne.i33 .and. s8d(i,j).gt.s4) then; s4=s8d(i,j); i4=i; endif; enddo + mrs(j)=i1; mrs2(j)=i2; mrs3(j)=i33; mrs4(j)=i4 + enddo + ref0=0.; ref0paty=0.; ref0mycl=0.; ref0oth=0. + do i=1,58 + ref0=ref0 + s8d(mrs(i),i) + if(i.gt.26) then; ref0paty=ref0paty + s8d(mrs(i),i) + else if(i.lt.10) then; ref0mycl=ref0mycl + s8d(mrs(i),i) + endif + enddo + ref0oth=ref0mycl+ref0paty + ipk=0; u1=0.; u2=0.; u1paty=0.; u2paty=0.; u1oth=0.; u2oth=0. + do k=ilow,ihigh + if(lastreport .and. k.gt.26 .and. k.lt.54) cycle ! GRID, RREPORT is not a valid msg, direction change is not allowed + psum=0.0; ref=ref0; psumpaty=0.; refpaty=ref0paty; psumoth=0.; refoth=ref0oth + do j=1,58; i=idtone56(k,j); psum=psum + s8d(i,j) + if(j.gt.26) then; psumpaty=psumpaty + s8d(i,j); psumoth=psumoth + s8d(i,j) + else if(j.lt.10) then; psumoth=psumoth + s8d(i,j) + endif + if(i.eq.mrs(j)) then + stmp=s8d(mrs2(j),j)-s8d(i,j); ref=ref + stmp + if(j.gt.26) then; refpaty=refpaty + stmp; refoth=refoth + stmp + else if(j.lt.10) then; refoth=refoth + stmp + endif + endif + if(i.eq.mrs2(j)) then + stmp=s8d(mrs3(j),j) - s8d(mrs2(j),j); ref=ref + stmp + if(j.gt.26) then; refpaty=refpaty + stmp; refoth=refoth + stmp + else if(j.lt.10) then; refoth=refoth + stmp + endif + endif + if(i.eq.mrs3(j)) then + stmp=s8d(mrs4(j),j) - s8d(mrs3(j),j); ref=ref + stmp + if(j.gt.26) then; refpaty=refpaty + stmp; refoth=refoth + stmp + else if(j.lt.10) then; refoth=refoth + stmp + endif + endif +!! if(i.eq.mrs2(j)) then; ref=ref - s8d(mrs(j),j) + s8d(mrs3(j),j); endif +!! if(i.eq.mrs3(j)) then; ref=ref - s8d(mrs(j),j) + s8d(mrs4(j),j); endif + enddo + p=psum/ref; ppaty=psumpaty/refpaty; poth=psumoth/refoth + if(p.gt.u1) then; u2=u1; u1=p; u2paty=u1paty; u1paty=ppaty; u2oth=u1oth; u1oth=poth; ipk=k + else if(p.gt.u2) then; u2=p; u2paty=ppaty; u2oth=poth + endif + enddo + if(lastrrprt .and. ipk.eq.53) return ! GRID is not valid + if(lr73 .and. ipk.lt.55) return + + if(lcallingrprt .or. nlasttx.eq.1) nft8rxfslow=1 + + if(ipk.ne.0) then + qual=100.0*(u1-u2); qualp=100.0*(u1paty-u2paty); qualo=100.0*(u1oth-u2oth) + thresh=(qual+10.0)*(u1-0.6); if(thresh.lt.1.5) return + threshp=(qualp+10.0)*(u1paty-0.6); thresho=(qualo+10.0)*(u1oth-0.6) + if((lcallingrprt .or. nlasttx.eq.1) .and. thresho.lt.3.43) return + if(thresho.lt.2.63 .or. threshp.lt.2.45) return + if(((nft8rxfslow.eq.1 .and. thresh.gt.4.0) .or. (nft8rxfslow.eq.2 .and. thresh.gt.3.55) & + .or. (nft8rxfslow.eq.3 .and. thresh.gt.3.0)) .and. qual.gt.2.6 .and. u1.gt.0.77) then +!if(ipk.ne.7) print *,'match1',thresh + lft8s=.true.; msg37=msg(ipk); itone(1:79)=itone56(ipk,1:79); go to 2 + endif + endif + + if(imax.eq.ipk .and. (nft8rxfslow.gt.1 .or. (nft8rxfslow.eq.1 .and. thresh.gt.2.7)) .and. srr.lt.7.0 & + .and. (ncrcpaty1.gt.14 .or. (nmatch1.gt.22 .and. ncrcpaty1.gt.13))) then +!if(imax.ne.7) print *,'11',thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + + if(imax.eq.ipk .and. nmatch1.gt.ntresh1 .and. ncrcpaty1.gt.10) then +!if(imax.ne.7) print *,'12',thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + + if(nmatchditer1.ge.16) then + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch2=nmatch1; ncrcpaty2=ncrcpaty1 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch2=nmatch2+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty2=ncrcpaty2+1; endif + enddo + if(nmatch2.gt.ntresh2 .and. ncrcpaty2.gt.19) then +!if(imax.ne.7) print *,'2',thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + + if(srr.gt.7.0) return ! do not process strong signals anymore + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch3=nmatch2; ncrcpaty3=ncrcpaty2 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch3=nmatch3+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty3=ncrcpaty3+1; endif + enddo + if(nmatch3.gt.44 .and. ncrcpaty3.gt.21) then +!if(imax.ne.7) print *,'3',thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch4=nmatch3; ncrcpaty4=ncrcpaty3 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch4=nmatch4+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty4=ncrcpaty4+1; endif + enddo + if((nft8rxfslow.eq.3 .or. (nft8rxfslow.eq.2 .and. thresh.gt.2.2)) .and. nmatch4.gt.47 .and. ncrcpaty4.gt.23) then +!if(imax.ne.7) print *,'4',thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch5=nmatch4; ncrcpaty5=ncrcpaty4 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch5=nmatch5+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty5=ncrcpaty5+1; endif + enddo + if((nft8rxfslow.eq.3 .or. (nft8rxfslow.eq.1 .and. thresh.gt.3.4) .or. (nft8rxfslow.eq.2 .and. thresh.gt.3.25)) & + .and. nmatch5.gt.50 .and. (nmatch1.gt.21 .or. nmatch2.gt.31 .or. nmatch3.gt.38 .or. nmatch4.gt.46) & + .and. ncrcpaty5.gt.25) then +!if(imax.ne.7) print *,'5',thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + + do i=1,58 + if(lmatched(i)) cycle + if(i.le.29) then; ip1=maxloc(s8_1(:,i+7))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+7)=0.0 + else; ip1=maxloc(s8_1(:,i+14))-1; itonedem(i)=ip1(1); s8_1(ip1(1),i+14)=0.0; endif + enddo + nmatch6=nmatch5; ncrcpaty6=ncrcpaty5 + do k=1,58 + if(lmatched(k)) cycle + if(idtone(k).eq.itonedem(k)) then; nmatch6=nmatch6+1; lmatched(k)=.true.; if(k.gt.25) ncrcpaty6=ncrcpaty6+1; endif + enddo + if(((nft8rxfslow.eq.2 .and. thresh.gt.2.6) .or. (nft8rxfslow.eq.3 .and. thresh.gt.2.22)) & + .and. imax.eq.ipk .and. ncrcpaty6.gt.26) then +!if(imax.ne.7) print *,'61',thresh +!print *,'61',thresh +!write (*,"(i2,1x,i2,1x,f5.2)") 6,ncrcpaty6,thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + + if(nft8rxfslow.eq.1) then + if(nmatch6.gt.54 .and. (nmatch1.gt.22 .or. nmatch2.gt.27 .or. nmatch3.gt.35 .or. & + (nmatch2-nmatch1).gt.9 .or. (nmatch3-nmatch2).gt.10) .and. ncrcpaty6.gt.29 .and. thresh.gt.3.15) then +!if(imax.ne.7) print *,'62',thresh +!print *,'62',thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + endif + + if(ncrcpaty6.gt.29) then + if((nft8rxfslow.eq.3 .or. (nft8rxfslow.eq.3 .and. thresh.gt.1.94)) .and. imax.eq.ipk .and. ncrcpaty2-ncrcpaty1.gt.3 & + .and. ncrcpaty3-ncrcpaty2.gt.3 .and. ncrcpaty4-ncrcpaty3.gt.3 .and. ncrcpaty6-ncrcpaty5.lt.6) then +!if(imax.ne.7) print *,'63',thresh +!print *,'63',thresh +!if(imax.ne.7) write (*,"(i2,1x,f5.2,1x,f5.2,1x,f5.2)") 62,u1,qual,thresh + lft8s=.true.; msg37=msg(imax); itone(1:79)=itone56(imax,1:79); go to 2 + endif + endif + endif + +2 if(lft8s) then + snr=0.0; snrbase=0.0; snrpaty=0.0; snrdata=0.0; snrsync=0.0; snrmycall=0.0; snrother=0.0 + do i=1,79 + xsig=s8(itone(i),i); xnoi=(sum(s8(0:7,i)) - xsig)/7.0; snr1=xsig/(xnoi+1E-6); snr=snr+snr1 + if(i.gt.7 .and. i.lt.34) then; snrbase=snrbase + snr1; if(i.lt.17) snrmycall=snrmycall + snr1; endif + if((i.gt.43 .and. i.lt.73) .or. (i.gt.33 .and. i.lt.37)) then; snrpaty=snrpaty+snr1; endif + enddo + snrdata=snrbase+snrpaty; snrsync=snr-snrdata; snrother=snrmycall+snrpaty + snrsync=snrsync/21.0; snrother=snrother/48.0; snrpaty=snrpaty/32.0 + if(lcallingrprt .or. nlasttx.eq.1) then + soratio=snrsync/snrother + if(soratio.gt.1.29) then;lft8s=.false.; msg37=''; return; endif + endif + spratio=snrsync/snrpaty + if(spratio.lt.0.6 .or. spratio.gt.1.25) then;lft8s=.false.; msg37=''; return; endif + + do i=1,7; xsync(i)=s8(itone(i),i); enddo; do i=8,14; k=i+29; xsync(i)=s8(itone(k),k); enddo + do i=15,21; k=i+58; xsync(i)=s8(itone(k),k); enddo + do i=1,29; k=i+7; xdata(i)=s8(itone(k),k); enddo; do i=30,58; k=i+14; xdata(i)=s8(itone(k),k); enddo + do i=1,79; k=modulo(itone(i)+4,8); xnoise(i)=s8(k,i); enddo + + do i=1,19 + if((xsync(i).gt.xsync(i+1) .and. xsync(i).lt.xsync(i+2)) & + .or. (xsync(i).lt.xsync(i+1) .and. xsync(i).gt.xsync(i+2))) then; xmsync(i)=xsync(i) + else if((xsync(i+1).gt.xsync(i) .and. xsync(i+1).lt.xsync(i+2)) & + .or. (xsync(i+1).lt.xsync(i) .and. xsync(i+1).gt.xsync(i+2))) then; xmsync(i)=xsync(i+1) + else if((xsync(i+2).gt.xsync(i) .and. xsync(i+2).lt.xsync(i+1)) & + .or. (xsync(i+2).lt.xsync(i) .and. xsync(i+2).gt.xsync(i+1))) then; xmsync(i)=xsync(i+2) + else; xmsync(i)=xsync(i) + endif + enddo + xmsync(20)=xmsync(18); xmsync(21)=xmsync(19) + + do i=1,56 + if((xdata(i).gt.xdata(i+1) .and. xdata(i).lt.xdata(i+2)) & + .or. (xdata(i).lt.xdata(i+1) .and. xdata(i).gt.xdata(i+2))) then; xmdata(i)=xdata(i) + else if((xdata(i+1).gt.xdata(i) .and. xdata(i+1).lt.xdata(i+2)) & + .or. (xdata(i+1).lt.xdata(i) .and. xdata(i+1).gt.xdata(i+2))) then; xmdata(i)=xdata(i+1) + else if((xdata(i+2).gt.xdata(i) .and. xdata(i+2).lt.xdata(i+1)) & + .or. (xdata(i+2).lt.xdata(i) .and. xdata(i+2).gt.xdata(i+1))) then; xmdata(i)=xdata(i+2) + else; xmdata(i)=xdata(i) + endif + enddo + xmdata(57)=xmdata(55); xmdata(58)=xmdata(56) + + do i=1,77 + if((xnoise(i).gt.xnoise(i+1) .and. xnoise(i).lt.xnoise(i+2)) & + .or. (xnoise(i).lt.xnoise(i+1) .and. xnoise(i).gt.xnoise(i+2))) then; xmnoise(i)=xnoise(i) + else if((xnoise(i+1).gt.xnoise(i) .and. xnoise(i+1).lt.xnoise(i+2)) & + .or. (xnoise(i+1).lt.xnoise(i) .and. xnoise(i+1).gt.xnoise(i+2))) then; xmnoise(i)=xnoise(i+1) + else if((xnoise(i+2).gt.xnoise(i) .and. xnoise(i+2).lt.xnoise(i+1)) & + .or. (xnoise(i+2).lt.xnoise(i) .and. xnoise(i+2).gt.xnoise(i+1))) then; xmnoise(i)=xnoise(i+2) + else; xmnoise(i)=xnoise(i) + endif + enddo + xmnoise(78)=xmnoise(76); xmnoise(79)=xmnoise(77) + + ssync=sum(xmsync)/21.0; spaty=sum(xmdata(27:58))/32.0; spnoise=(sum(xmnoise(34:36)) + sum(xmnoise(44:72)))/32.0 + spother=(sum(xmdata(1:9)) + sum(xmdata(27:58)))/41.0 + spratiom=ssync/(spaty+1E-6); spnratiom=spaty/(spnoise+1E-6); sporatiom=ssync/(spother+1E-6) + if(spnratiom.gt.2.3) then + if(lcallingrprt .or. nlasttx.eq.1) then; if(sporatiom.gt.1.35) then; lft8s=.false.; msg37=''; return; endif + else; if(spratiom.gt.1.35) then; lft8s=.false.; msg37=''; return; endif + endif + endif + endif + + return +end subroutine ft8svar diff --git a/lib/ft8var/gen_ft8wavevar.f90 b/lib/ft8var/gen_ft8wavevar.f90 index a7dac56e..2920332a 100755..100644 --- a/lib/ft8var/gen_ft8wavevar.f90 +++ b/lib/ft8var/gen_ft8wavevar.f90 @@ -1,79 +1,79 @@ -subroutine gen_ft8wavevar(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave)
-!
-! generate ft8 waveform using Gaussian-filtered frequency pulses.
-!
- parameter(MAX_SECONDS=20,NTAB=65536)
- real wave(nwave)
- complex cwave(nwave),ctab(0:NTAB-1)
- real pulse(23040)
- real dphi(0:(nsym+2)*nsps-1)
- integer itone(nsym)
- data ibt0/0/
- save pulse,twopi,dt,hmod,ibt0,ctab
-
- ibt=nint(10*bt)
- if(ibt0.ne.ibt) then
- twopi=8.0*atan(1.0)
- dt=1.0/fsample
- hmod=1.0
-! Compute the frequency-smoothing pulse
- do i=1,3*nsps
- tt=(i-1.5*nsps)/real(nsps)
- pulse(i)=gfsk_pulse(bt,tt)
- enddo
- ibt0=nint(10*bt)
- do i=0,NTAB-1
- phi=i*twopi/NTAB
- ctab(i)=cmplx(cos(phi),sin(phi))
- enddo
- endif
-
-! Compute the smoothed frequency waveform.
-! Length = (nsym+2)*nsps samples, first and last symbols extended
- dphi_peak=twopi*hmod/real(nsps)
- dphi=0.0
- do j=1,nsym
- ib=(j-1)*nsps
- ie=ib+3*nsps-1
- dphi(ib:ie) = dphi(ib:ie) + dphi_peak*pulse(1:3*nsps)*itone(j)
- enddo
-! Add dummy symbols at beginning and end with tone values equal to 1st and last symbol, respectively
- dphi(0:2*nsps-1)=dphi(0:2*nsps-1)+dphi_peak*itone(1)*pulse(nsps+1:3*nsps)
- dphi(nsym*nsps:(nsym+2)*nsps-1)=dphi(nsym*nsps:(nsym+2)*nsps-1)+dphi_peak*itone(nsym)*pulse(1:2*nsps)
-
-! Calculate and insert the audio waveform
- phi=0.0
- dphi = dphi + twopi*f0*dt !Shift frequency up by f0
- if(icmplx .eq. 0) wave=0.
- if(icmplx .ne. 0) cwave=0. !Avoid writing to memory we may not have access to
-
- k=0
- do j=nsps,nsps+nwave-1 !Don't include dummy symbols
- k=k+1
- if(icmplx.eq.0) then
- wave(k)=sin(phi)
- else
- i=phi*float(NTAB)/twopi
- cwave(k)=ctab(i)
- endif
- phi=mod(phi+dphi(j),twopi)
- enddo
-
-! Apply envelope shaping to the first and last symbols
- nramp=nint(nsps/8.0)
- if(icmplx.eq.0) then
- wave(1:nramp)=wave(1:nramp) * &
- (1.0-cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
- k1=nsym*nsps-nramp+1
- wave(k1:k1+nramp-1)=wave(k1:k1+nramp-1) * &
- (1.0+cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
- else
- cwave(1:nramp)=cwave(1:nramp) * &
- (1.0-cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
- k1=nsym*nsps-nramp+1
- cwave(k1:k1+nramp-1)=cwave(k1:k1+nramp-1) * &
- (1.0+cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
- endif
-
- return
-end subroutine gen_ft8wavevar
+subroutine gen_ft8wavevar(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave) +! +! generate ft8 waveform using Gaussian-filtered frequency pulses. +! + parameter(MAX_SECONDS=20,NTAB=65536) + real wave(nwave) + complex cwave(nwave),ctab(0:NTAB-1) + real pulse(23040) + real dphi(0:(nsym+2)*nsps-1) + integer itone(nsym) + data ibt0/0/ + save pulse,twopi,dt,hmod,ibt0,ctab + + ibt=nint(10*bt) + if(ibt0.ne.ibt) then + twopi=8.0*atan(1.0) + dt=1.0/fsample + hmod=1.0 +! Compute the frequency-smoothing pulse + do i=1,3*nsps + tt=(i-1.5*nsps)/real(nsps) + pulse(i)=gfsk_pulse(bt,tt) + enddo + ibt0=nint(10*bt) + do i=0,NTAB-1 + phi=i*twopi/NTAB + ctab(i)=cmplx(cos(phi),sin(phi)) + enddo + endif + +! Compute the smoothed frequency waveform. +! Length = (nsym+2)*nsps samples, first and last symbols extended + dphi_peak=twopi*hmod/real(nsps) + dphi=0.0 + do j=1,nsym + ib=(j-1)*nsps + ie=ib+3*nsps-1 + dphi(ib:ie) = dphi(ib:ie) + dphi_peak*pulse(1:3*nsps)*itone(j) + enddo +! Add dummy symbols at beginning and end with tone values equal to 1st and last symbol, respectively + dphi(0:2*nsps-1)=dphi(0:2*nsps-1)+dphi_peak*itone(1)*pulse(nsps+1:3*nsps) + dphi(nsym*nsps:(nsym+2)*nsps-1)=dphi(nsym*nsps:(nsym+2)*nsps-1)+dphi_peak*itone(nsym)*pulse(1:2*nsps) + +! Calculate and insert the audio waveform + phi=0.0 + dphi = dphi + twopi*f0*dt !Shift frequency up by f0 + if(icmplx .eq. 0) wave=0. + if(icmplx .ne. 0) cwave=0. !Avoid writing to memory we may not have access to + + k=0 + do j=nsps,nsps+nwave-1 !Don't include dummy symbols + k=k+1 + if(icmplx.eq.0) then + wave(k)=sin(phi) + else + i=phi*float(NTAB)/twopi + cwave(k)=ctab(i) + endif + phi=mod(phi+dphi(j),twopi) + enddo + +! Apply envelope shaping to the first and last symbols + nramp=nint(nsps/8.0) + if(icmplx.eq.0) then + wave(1:nramp)=wave(1:nramp) * & + (1.0-cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0 + k1=nsym*nsps-nramp+1 + wave(k1:k1+nramp-1)=wave(k1:k1+nramp-1) * & + (1.0+cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0 + else + cwave(1:nramp)=cwave(1:nramp) * & + (1.0-cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0 + k1=nsym*nsps-nramp+1 + cwave(k1:k1+nramp-1)=cwave(k1:k1+nramp-1) * & + (1.0+cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0 + endif + + return +end subroutine gen_ft8wavevar diff --git a/lib/ft8var/genft8sdvar.f90 b/lib/ft8var/genft8sdvar.f90 index fb33b4a3..57d1560e 100755..100644 --- a/lib/ft8var/genft8sdvar.f90 +++ b/lib/ft8var/genft8sdvar.f90 @@ -1,38 +1,38 @@ -
-subroutine genft8sdvar(msg,i3,n3,msgsent,msgbits,itone)
-
-! Encode an FT8 message, producing array itone().
-
- use packjt77sdvar
- use ft8_mod1, only : icos7,graymap
- character msg*37,msgsent*37,c77*77
- integer*1 msgbits(77),codeword(174)
- integer itone(79)
- logical unpk77_success
-
- i3=-1
- n3=-1
- call pack77sdvar(msg,i3,n3,c77)
- call unpack77sdvar(c77,msgsent,unpk77_success)
- read(c77,'(77i1)',err=1) msgbits
- if(unpk77_success) go to 2
-1 msgbits=0
- itone=0
- msgsent='*** bad message *** '
- go to 900
-
-2 call encode174_91var(msgbits,codeword) !Encode the test message
-
-! Message structure: S7 D29 S7 D29 S7
- itone(1:7)=icos7; itone(37:43)=icos7; itone(73:79)=icos7
- k=7
- do j=1,58
- i=3*j -2
- k=k+1
- if(j.eq.30) k=k+7
- indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
- itone(k)=graymap(indx)
- enddo
-
-900 return
-end subroutine genft8sdvar
+ +subroutine genft8sdvar(msg,i3,n3,msgsent,msgbits,itone) + +! Encode an FT8 message, producing array itone(). + + use packjt77sdvar + use ft8_mod1, only : icos7,graymap + character msg*37,msgsent*37,c77*77 + integer*1 msgbits(77),codeword(174) + integer itone(79) + logical unpk77_successvar + + i3=-1 + n3=-1 + call pack77sdvar(msg,i3,n3,c77) + call unpack77sdvar(c77,msgsent,unpk77_successvar) + read(c77,'(77i1)',err=1) msgbits + if(unpk77_successvar) go to 2 +1 msgbits=0 + itone=0 + msgsent='*** bad message *** ' + go to 900 + +2 call encode174_91var(msgbits,codeword) !Encode the test message + +! Message structure: S7 D29 S7 D29 S7 + itone(1:7)=icos7; itone(37:43)=icos7; itone(73:79)=icos7 + k=7 + do j=1,58 + i=3*j -2 + k=k+1 + if(j.eq.30) k=k+7 + indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2) + itone(k)=graymap(indx) + enddo + +900 return +end subroutine genft8sdvar diff --git a/lib/ft8var/genft8var.f90 b/lib/ft8var/genft8var.f90 index defc879e..5166e580 100755..100644 --- a/lib/ft8var/genft8var.f90 +++ b/lib/ft8var/genft8var.f90 @@ -1,43 +1,43 @@ -subroutine genft8var(msg,i3,n3,ntxhash,msgsent,msgbits,itone)
-
-! Encode an FT8 message, producing array itone().
-
- use packjt77var
- use ft8_mod1, only : icos7,graymap
- character msg*37,msgsent*37,c77*77
- integer*1 msgbits(77),codeword(174)
- integer itone(79)
- logical unpk77_success
-
- i3=-1
- n3=-1
- call pack77var(msg,i3,n3,c77,ntxhash)
- if(ntxhash.eq.1) then
- call unpack77var(c77,0,msgsent,unpk77_success,26) !TX message, unpack to get msgsent, use TX hash tables and do not save RX hash values
- else
- call unpack77var(c77,0,msgsent,unpk77_success,27) !service message, unpack to get msgsent. Do not save hash values
- endif
- read(c77,'(77i1)',err=1) msgbits
- if(unpk77_success) go to 2
-1 msgbits=0
- itone=0
- msgsent='*** bad message *** '
- go to 900
-
-entry get_tones_from_77bits(msgbits,itone)
-
-2 call encode174_91var(msgbits,codeword) !Encode the test message
-
-! Message structure: S7 D29 S7 D29 S7
- itone(1:7)=icos7; itone(37:43)=icos7; itone(73:79)=icos7
- k=7
- do j=1,58
- i=3*j -2
- k=k+1
- if(j.eq.30) k=k+7
- indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
- itone(k)=graymap(indx)
- enddo
-
-900 return
-end subroutine genft8var
+subroutine genft8var(msg,i3,n3,ntxhash,msgsent,msgbits,itone) + +! Encode an FT8 message, producing array itone(). + + use packjt77 + use ft8_mod1, only : icos7,graymap + character msg*37,msgsent*37,c77*77 + integer*1 msgbits(77),codeword(174) + integer itone(79) + logical unpk77_successvar + + i3=-1 + n3=-1 + call pack77var(msg,i3,n3,c77,ntxhash) + if(ntxhash.eq.1) then + call unpack77var(c77,0,msgsent,unpk77_successvar,26) !TX message, unpack to get msgsent, use TX hash tables and do not save RX hash values + else + call unpack77var(c77,0,msgsent,unpk77_successvar,27) !service message, unpack to get msgsent. Do not save hash values + endif + read(c77,'(77i1)',err=1) msgbits + if(unpk77_successvar) go to 2 +1 msgbits=0 + itone=0 + msgsent='*** bad message *** ' + go to 900 + +entry get_tones_from_77bits(msgbits,itone) + +2 call encode174_91var(msgbits,codeword) !Encode the test message + +! Message structure: S7 D29 S7 D29 S7 + itone(1:7)=icos7; itone(37:43)=icos7; itone(73:79)=icos7 + k=7 + do j=1,58 + i=3*j -2 + k=k+1 + if(j.eq.30) k=k+7 + indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2) + itone(k)=graymap(indx) + enddo + +900 return +end subroutine genft8var diff --git a/lib/ft8var/jt65_mod2var.f90 b/lib/ft8var/jt65_mod2var.f90 index 459f0290..5d53efd1 100755..100644 --- a/lib/ft8var/jt65_mod2var.f90 +++ b/lib/ft8var/jt65_mod2var.f90 @@ -1,7 +1,7 @@ -
-module jt65_mod2var
-
- real s3(64,63),s3a(64,63)
- integer correct(63),correct_hint(63)
-
+ +module jt65_mod2var + + real s3(64,63),s3a(64,63) + integer correct(63),correct_hint(63) + end module jt65_mod2var
\ No newline at end of file diff --git a/lib/ft8var/jt65_mod5.f90 b/lib/ft8var/jt65_mod5.f90 index accef1b0..b6d9dfdc 100755..100644 --- a/lib/ft8var/jt65_mod5.f90 +++ b/lib/ft8var/jt65_mod5.f90 @@ -1,6 +1,6 @@ -
-module jt65_mod5
-
- real, save :: ref(3413)
-
+ +module jt65_mod5 + + real, save :: ref(3413) + end module jt65_mod5
\ No newline at end of file diff --git a/lib/ft8var/jt65_mod9.f90 b/lib/ft8var/jt65_mod9.f90 index 22ca14ac..6fc3413d 100755..100644 --- a/lib/ft8var/jt65_mod9.f90 +++ b/lib/ft8var/jt65_mod9.f90 @@ -1,19 +1,19 @@ -module jt65_mod9
-! stores callsign DB in memory for false decodes checking
-
- parameter (MAXC=200000)
-! supporting 7-char Australian callsigns
- character*7 call0c(11500),calld(11100),callef(9000),callgh(7500),calli(7600),callj(10000),callk(24000),calllm(6500), &
- calln(9400),callo(6700),callpq(5800),callr(6500),callst(7500),calluv(10400),callw(13700),callxz(5800)
- character callsign*12
- character*180 line
- integer ncall0c,ncalld,ncallef,ncallgh,ncalli,ncallj,ncallk,ncalllm,ncalln,ncallo,ncallpq,ncallr,ncallst,ncalluv, &
- ncallw,ncallxz
- logical ldbvalid
- data ldbvalid/.true./
- data ncall0c,ncalld,ncallef,ncallgh,ncalli,ncallj,ncallk,ncalllm,ncalln,ncallo,ncallpq,ncallr,ncallst,ncalluv,ncallw, &
- ncallxz/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/
-
-end module jt65_mod9
-
-!callj dim was 9000; increased 20250709 to accommodate size of new ALLCALL7.TXT file dated 20250619
+module jt65_mod9 +! stores callsign DB in memory for false decodes checking + + parameter (MAXC=200000) +! supporting 7-char Australian callsigns + character*7 call0c(11500),calld(11100),callef(9000),callgh(7500),calli(7600),callj(10000),callk(24000),calllm(6500), & + calln(9400),callo(6700),callpq(5800),callr(6500),callst(7500),calluv(10400),callw(13700),callxz(5800) + character callsign*12 + character*180 line + integer ncall0c,ncalld,ncallef,ncallgh,ncalli,ncallj,ncallk,ncalllm,ncalln,ncallo,ncallpq,ncallr,ncallst,ncalluv, & + ncallw,ncallxz + logical ldbvalid + data ldbvalid/.true./ + data ncall0c,ncalld,ncallef,ncallgh,ncalli,ncallj,ncallk,ncalllm,ncalln,ncallo,ncallpq,ncallr,ncallst,ncalluv,ncallw, & + ncallxz/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/ + +end module jt65_mod9 + +!callj dim was 9000; increased 20250709 to accommodate size of new ALLCALL7.TXT file dated 20250619 diff --git a/lib/ft8var/ldpc_174_91_c_reordered_parity.f90 b/lib/ft8var/ldpc_174_91_c_reordered_parity.f90 index 135c9de9..2309ad8e 100755..100644 --- a/lib/ft8var/ldpc_174_91_c_reordered_parity.f90 +++ b/lib/ft8var/ldpc_174_91_c_reordered_parity.f90 @@ -1,270 +1,270 @@ -data Mn/ &
- 16, 45, 73, &
- 25, 51, 62, &
- 33, 58, 78, &
- 1, 44, 45, &
- 2, 7, 61, &
- 3, 6, 54, &
- 4, 35, 48, &
- 5, 13, 21, &
- 8, 56, 79, &
- 9, 64, 69, &
- 10, 19, 66, &
- 11, 36, 60, &
- 12, 37, 58, &
- 14, 32, 43, &
- 15, 63, 80, &
- 17, 28, 77, &
- 18, 74, 83, &
- 22, 53, 81, &
- 23, 30, 34, &
- 24, 31, 40, &
- 26, 41, 76, &
- 27, 57, 70, &
- 29, 49, 65, &
- 3, 38, 78, &
- 5, 39, 82, &
- 46, 50, 73, &
- 51, 52, 74, &
- 55, 71, 72, &
- 44, 67, 72, &
- 43, 68, 78, &
- 1, 32, 59, &
- 2, 6, 71, &
- 4, 16, 54, &
- 7, 65, 67, &
- 8, 30, 42, &
- 9, 22, 31, &
- 10, 18, 76, &
- 11, 23, 82, &
- 12, 28, 61, &
- 13, 52, 79, &
- 14, 50, 51, &
- 15, 81, 83, &
- 17, 29, 60, &
- 19, 33, 64, &
- 20, 26, 73, &
- 21, 34, 40, &
- 24, 27, 77, &
- 25, 55, 58, &
- 35, 53, 66, &
- 36, 48, 68, &
- 37, 46, 75, &
- 38, 45, 47, &
- 39, 57, 69, &
- 41, 56, 62, &
- 20, 49, 53, &
- 46, 52, 63, &
- 45, 70, 75, &
- 27, 35, 80, &
- 1, 15, 30, &
- 2, 68, 80, &
- 3, 36, 51, &
- 4, 28, 51, &
- 5, 31, 56, &
- 6, 20, 37, &
- 7, 40, 82, &
- 8, 60, 69, &
- 9, 10, 49, &
- 11, 44, 57, &
- 12, 39, 59, &
- 13, 24, 55, &
- 14, 21, 65, &
- 16, 71, 78, &
- 17, 30, 76, &
- 18, 25, 80, &
- 19, 61, 83, &
- 22, 38, 77, &
- 23, 41, 50, &
- 7, 26, 58, &
- 29, 32, 81, &
- 33, 40, 73, &
- 18, 34, 48, &
- 13, 42, 64, &
- 5, 26, 43, &
- 47, 69, 72, &
- 54, 55, 70, &
- 45, 62, 68, &
- 10, 63, 67, &
- 14, 66, 72, &
- 22, 60, 74, &
- 35, 39, 79, &
- 1, 46, 64, &
- 1, 24, 66, &
- 2, 5, 70, &
- 3, 31, 65, &
- 4, 49, 58, &
- 1, 4, 5, &
- 6, 60, 67, &
- 7, 32, 75, &
- 8, 48, 82, &
- 9, 35, 41, &
- 10, 39, 62, &
- 11, 14, 61, &
- 12, 71, 74, &
- 13, 23, 78, &
- 11, 35, 55, &
- 15, 16, 79, &
- 7, 9, 16, &
- 17, 54, 63, &
- 18, 50, 57, &
- 19, 30, 47, &
- 20, 64, 80, &
- 21, 28, 69, &
- 22, 25, 43, &
- 13, 22, 37, &
- 2, 47, 51, &
- 23, 54, 74, &
- 26, 34, 72, &
- 27, 36, 37, &
- 21, 36, 63, &
- 29, 40, 44, &
- 19, 26, 57, &
- 3, 46, 82, &
- 14, 15, 58, &
- 33, 52, 53, &
- 30, 43, 52, &
- 6, 9, 52, &
- 27, 33, 65, &
- 25, 69, 73, &
- 38, 55, 83, &
- 20, 39, 77, &
- 18, 29, 56, &
- 32, 48, 71, &
- 42, 51, 59, &
- 28, 44, 79, &
- 34, 60, 62, &
- 31, 45, 61, &
- 46, 68, 77, &
- 6, 24, 76, &
- 8, 10, 78, &
- 40, 41, 70, &
- 17, 50, 53, &
- 42, 66, 68, &
- 4, 22, 72, &
- 36, 64, 81, &
- 13, 29, 47, &
- 2, 8, 81, &
- 56, 67, 73, &
- 5, 38, 50, &
- 12, 38, 64, &
- 59, 72, 80, &
- 3, 26, 79, &
- 45, 76, 81, &
- 1, 65, 74, &
- 7, 18, 77, &
- 11, 56, 59, &
- 14, 39, 54, &
- 16, 37, 66, &
- 10, 28, 55, &
- 15, 60, 70, &
- 17, 25, 82, &
- 20, 30, 31, &
- 12, 67, 68, &
- 23, 75, 80, &
- 27, 32, 62, &
- 24, 69, 75, &
- 19, 21, 71, &
- 34, 53, 61, &
- 35, 46, 47, &
- 33, 59, 76, &
- 40, 43, 83, &
- 41, 42, 63, &
- 49, 75, 83, &
- 20, 44, 48, &
- 42, 49, 57/
-
-data Nm/ &
- 4, 31, 59, 91, 92, 96, 153, &
- 5, 32, 60, 93, 115, 146, 0, &
- 6, 24, 61, 94, 122, 151, 0, &
- 7, 33, 62, 95, 96, 143, 0, &
- 8, 25, 63, 83, 93, 96, 148, &
- 6, 32, 64, 97, 126, 138, 0, &
- 5, 34, 65, 78, 98, 107, 154, &
- 9, 35, 66, 99, 139, 146, 0, &
- 10, 36, 67, 100, 107, 126, 0, &
- 11, 37, 67, 87, 101, 139, 158, &
- 12, 38, 68, 102, 105, 155, 0, &
- 13, 39, 69, 103, 149, 162, 0, &
- 8, 40, 70, 82, 104, 114, 145, &
- 14, 41, 71, 88, 102, 123, 156, &
- 15, 42, 59, 106, 123, 159, 0, &
- 1, 33, 72, 106, 107, 157, 0, &
- 16, 43, 73, 108, 141, 160, 0, &
- 17, 37, 74, 81, 109, 131, 154, &
- 11, 44, 75, 110, 121, 166, 0, &
- 45, 55, 64, 111, 130, 161, 173, &
- 8, 46, 71, 112, 119, 166, 0, &
- 18, 36, 76, 89, 113, 114, 143, &
- 19, 38, 77, 104, 116, 163, 0, &
- 20, 47, 70, 92, 138, 165, 0, &
- 2, 48, 74, 113, 128, 160, 0, &
- 21, 45, 78, 83, 117, 121, 151, &
- 22, 47, 58, 118, 127, 164, 0, &
- 16, 39, 62, 112, 134, 158, 0, &
- 23, 43, 79, 120, 131, 145, 0, &
- 19, 35, 59, 73, 110, 125, 161, &
- 20, 36, 63, 94, 136, 161, 0, &
- 14, 31, 79, 98, 132, 164, 0, &
- 3, 44, 80, 124, 127, 169, 0, &
- 19, 46, 81, 117, 135, 167, 0, &
- 7, 49, 58, 90, 100, 105, 168, &
- 12, 50, 61, 118, 119, 144, 0, &
- 13, 51, 64, 114, 118, 157, 0, &
- 24, 52, 76, 129, 148, 149, 0, &
- 25, 53, 69, 90, 101, 130, 156, &
- 20, 46, 65, 80, 120, 140, 170, &
- 21, 54, 77, 100, 140, 171, 0, &
- 35, 82, 133, 142, 171, 174, 0, &
- 14, 30, 83, 113, 125, 170, 0, &
- 4, 29, 68, 120, 134, 173, 0, &
- 1, 4, 52, 57, 86, 136, 152, &
- 26, 51, 56, 91, 122, 137, 168, &
- 52, 84, 110, 115, 145, 168, 0, &
- 7, 50, 81, 99, 132, 173, 0, &
- 23, 55, 67, 95, 172, 174, 0, &
- 26, 41, 77, 109, 141, 148, 0, &
- 2, 27, 41, 61, 62, 115, 133, &
- 27, 40, 56, 124, 125, 126, 0, &
- 18, 49, 55, 124, 141, 167, 0, &
- 6, 33, 85, 108, 116, 156, 0, &
- 28, 48, 70, 85, 105, 129, 158, &
- 9, 54, 63, 131, 147, 155, 0, &
- 22, 53, 68, 109, 121, 174, 0, &
- 3, 13, 48, 78, 95, 123, 0, &
- 31, 69, 133, 150, 155, 169, 0, &
- 12, 43, 66, 89, 97, 135, 159, &
- 5, 39, 75, 102, 136, 167, 0, &
- 2, 54, 86, 101, 135, 164, 0, &
- 15, 56, 87, 108, 119, 171, 0, &
- 10, 44, 82, 91, 111, 144, 149, &
- 23, 34, 71, 94, 127, 153, 0, &
- 11, 49, 88, 92, 142, 157, 0, &
- 29, 34, 87, 97, 147, 162, 0, &
- 30, 50, 60, 86, 137, 142, 162, &
- 10, 53, 66, 84, 112, 128, 165, &
- 22, 57, 85, 93, 140, 159, 0, &
- 28, 32, 72, 103, 132, 166, 0, &
- 28, 29, 84, 88, 117, 143, 150, &
- 1, 26, 45, 80, 128, 147, 0, &
- 17, 27, 89, 103, 116, 153, 0, &
- 51, 57, 98, 163, 165, 172, 0, &
- 21, 37, 73, 138, 152, 169, 0, &
- 16, 47, 76, 130, 137, 154, 0, &
- 3, 24, 30, 72, 104, 139, 0, &
- 9, 40, 90, 106, 134, 151, 0, &
- 15, 58, 60, 74, 111, 150, 163, &
- 18, 42, 79, 144, 146, 152, 0, &
- 25, 38, 65, 99, 122, 160, 0, &
- 17, 42, 75, 129, 170, 172, 0/
-
-data nrw/ &
-7,6,6,6,7,6,7,6,6,7,6,6,7,7,6,6, &
-6,7,6,7,6,7,6,6,6,7,6,6,6,7,6,6, &
-6,6,7,6,6,6,7,7,6,6,6,6,7,7,6,6, &
-6,6,7,6,6,6,7,6,6,6,6,7,6,6,6,7, &
-6,6,6,7,7,6,6,7,6,6,6,6,6,6,6,7, &
-6,6,6/
-
-ncw=3
+data Mn/ & + 16, 45, 73, & + 25, 51, 62, & + 33, 58, 78, & + 1, 44, 45, & + 2, 7, 61, & + 3, 6, 54, & + 4, 35, 48, & + 5, 13, 21, & + 8, 56, 79, & + 9, 64, 69, & + 10, 19, 66, & + 11, 36, 60, & + 12, 37, 58, & + 14, 32, 43, & + 15, 63, 80, & + 17, 28, 77, & + 18, 74, 83, & + 22, 53, 81, & + 23, 30, 34, & + 24, 31, 40, & + 26, 41, 76, & + 27, 57, 70, & + 29, 49, 65, & + 3, 38, 78, & + 5, 39, 82, & + 46, 50, 73, & + 51, 52, 74, & + 55, 71, 72, & + 44, 67, 72, & + 43, 68, 78, & + 1, 32, 59, & + 2, 6, 71, & + 4, 16, 54, & + 7, 65, 67, & + 8, 30, 42, & + 9, 22, 31, & + 10, 18, 76, & + 11, 23, 82, & + 12, 28, 61, & + 13, 52, 79, & + 14, 50, 51, & + 15, 81, 83, & + 17, 29, 60, & + 19, 33, 64, & + 20, 26, 73, & + 21, 34, 40, & + 24, 27, 77, & + 25, 55, 58, & + 35, 53, 66, & + 36, 48, 68, & + 37, 46, 75, & + 38, 45, 47, & + 39, 57, 69, & + 41, 56, 62, & + 20, 49, 53, & + 46, 52, 63, & + 45, 70, 75, & + 27, 35, 80, & + 1, 15, 30, & + 2, 68, 80, & + 3, 36, 51, & + 4, 28, 51, & + 5, 31, 56, & + 6, 20, 37, & + 7, 40, 82, & + 8, 60, 69, & + 9, 10, 49, & + 11, 44, 57, & + 12, 39, 59, & + 13, 24, 55, & + 14, 21, 65, & + 16, 71, 78, & + 17, 30, 76, & + 18, 25, 80, & + 19, 61, 83, & + 22, 38, 77, & + 23, 41, 50, & + 7, 26, 58, & + 29, 32, 81, & + 33, 40, 73, & + 18, 34, 48, & + 13, 42, 64, & + 5, 26, 43, & + 47, 69, 72, & + 54, 55, 70, & + 45, 62, 68, & + 10, 63, 67, & + 14, 66, 72, & + 22, 60, 74, & + 35, 39, 79, & + 1, 46, 64, & + 1, 24, 66, & + 2, 5, 70, & + 3, 31, 65, & + 4, 49, 58, & + 1, 4, 5, & + 6, 60, 67, & + 7, 32, 75, & + 8, 48, 82, & + 9, 35, 41, & + 10, 39, 62, & + 11, 14, 61, & + 12, 71, 74, & + 13, 23, 78, & + 11, 35, 55, & + 15, 16, 79, & + 7, 9, 16, & + 17, 54, 63, & + 18, 50, 57, & + 19, 30, 47, & + 20, 64, 80, & + 21, 28, 69, & + 22, 25, 43, & + 13, 22, 37, & + 2, 47, 51, & + 23, 54, 74, & + 26, 34, 72, & + 27, 36, 37, & + 21, 36, 63, & + 29, 40, 44, & + 19, 26, 57, & + 3, 46, 82, & + 14, 15, 58, & + 33, 52, 53, & + 30, 43, 52, & + 6, 9, 52, & + 27, 33, 65, & + 25, 69, 73, & + 38, 55, 83, & + 20, 39, 77, & + 18, 29, 56, & + 32, 48, 71, & + 42, 51, 59, & + 28, 44, 79, & + 34, 60, 62, & + 31, 45, 61, & + 46, 68, 77, & + 6, 24, 76, & + 8, 10, 78, & + 40, 41, 70, & + 17, 50, 53, & + 42, 66, 68, & + 4, 22, 72, & + 36, 64, 81, & + 13, 29, 47, & + 2, 8, 81, & + 56, 67, 73, & + 5, 38, 50, & + 12, 38, 64, & + 59, 72, 80, & + 3, 26, 79, & + 45, 76, 81, & + 1, 65, 74, & + 7, 18, 77, & + 11, 56, 59, & + 14, 39, 54, & + 16, 37, 66, & + 10, 28, 55, & + 15, 60, 70, & + 17, 25, 82, & + 20, 30, 31, & + 12, 67, 68, & + 23, 75, 80, & + 27, 32, 62, & + 24, 69, 75, & + 19, 21, 71, & + 34, 53, 61, & + 35, 46, 47, & + 33, 59, 76, & + 40, 43, 83, & + 41, 42, 63, & + 49, 75, 83, & + 20, 44, 48, & + 42, 49, 57/ + +data Nm/ & + 4, 31, 59, 91, 92, 96, 153, & + 5, 32, 60, 93, 115, 146, 0, & + 6, 24, 61, 94, 122, 151, 0, & + 7, 33, 62, 95, 96, 143, 0, & + 8, 25, 63, 83, 93, 96, 148, & + 6, 32, 64, 97, 126, 138, 0, & + 5, 34, 65, 78, 98, 107, 154, & + 9, 35, 66, 99, 139, 146, 0, & + 10, 36, 67, 100, 107, 126, 0, & + 11, 37, 67, 87, 101, 139, 158, & + 12, 38, 68, 102, 105, 155, 0, & + 13, 39, 69, 103, 149, 162, 0, & + 8, 40, 70, 82, 104, 114, 145, & + 14, 41, 71, 88, 102, 123, 156, & + 15, 42, 59, 106, 123, 159, 0, & + 1, 33, 72, 106, 107, 157, 0, & + 16, 43, 73, 108, 141, 160, 0, & + 17, 37, 74, 81, 109, 131, 154, & + 11, 44, 75, 110, 121, 166, 0, & + 45, 55, 64, 111, 130, 161, 173, & + 8, 46, 71, 112, 119, 166, 0, & + 18, 36, 76, 89, 113, 114, 143, & + 19, 38, 77, 104, 116, 163, 0, & + 20, 47, 70, 92, 138, 165, 0, & + 2, 48, 74, 113, 128, 160, 0, & + 21, 45, 78, 83, 117, 121, 151, & + 22, 47, 58, 118, 127, 164, 0, & + 16, 39, 62, 112, 134, 158, 0, & + 23, 43, 79, 120, 131, 145, 0, & + 19, 35, 59, 73, 110, 125, 161, & + 20, 36, 63, 94, 136, 161, 0, & + 14, 31, 79, 98, 132, 164, 0, & + 3, 44, 80, 124, 127, 169, 0, & + 19, 46, 81, 117, 135, 167, 0, & + 7, 49, 58, 90, 100, 105, 168, & + 12, 50, 61, 118, 119, 144, 0, & + 13, 51, 64, 114, 118, 157, 0, & + 24, 52, 76, 129, 148, 149, 0, & + 25, 53, 69, 90, 101, 130, 156, & + 20, 46, 65, 80, 120, 140, 170, & + 21, 54, 77, 100, 140, 171, 0, & + 35, 82, 133, 142, 171, 174, 0, & + 14, 30, 83, 113, 125, 170, 0, & + 4, 29, 68, 120, 134, 173, 0, & + 1, 4, 52, 57, 86, 136, 152, & + 26, 51, 56, 91, 122, 137, 168, & + 52, 84, 110, 115, 145, 168, 0, & + 7, 50, 81, 99, 132, 173, 0, & + 23, 55, 67, 95, 172, 174, 0, & + 26, 41, 77, 109, 141, 148, 0, & + 2, 27, 41, 61, 62, 115, 133, & + 27, 40, 56, 124, 125, 126, 0, & + 18, 49, 55, 124, 141, 167, 0, & + 6, 33, 85, 108, 116, 156, 0, & + 28, 48, 70, 85, 105, 129, 158, & + 9, 54, 63, 131, 147, 155, 0, & + 22, 53, 68, 109, 121, 174, 0, & + 3, 13, 48, 78, 95, 123, 0, & + 31, 69, 133, 150, 155, 169, 0, & + 12, 43, 66, 89, 97, 135, 159, & + 5, 39, 75, 102, 136, 167, 0, & + 2, 54, 86, 101, 135, 164, 0, & + 15, 56, 87, 108, 119, 171, 0, & + 10, 44, 82, 91, 111, 144, 149, & + 23, 34, 71, 94, 127, 153, 0, & + 11, 49, 88, 92, 142, 157, 0, & + 29, 34, 87, 97, 147, 162, 0, & + 30, 50, 60, 86, 137, 142, 162, & + 10, 53, 66, 84, 112, 128, 165, & + 22, 57, 85, 93, 140, 159, 0, & + 28, 32, 72, 103, 132, 166, 0, & + 28, 29, 84, 88, 117, 143, 150, & + 1, 26, 45, 80, 128, 147, 0, & + 17, 27, 89, 103, 116, 153, 0, & + 51, 57, 98, 163, 165, 172, 0, & + 21, 37, 73, 138, 152, 169, 0, & + 16, 47, 76, 130, 137, 154, 0, & + 3, 24, 30, 72, 104, 139, 0, & + 9, 40, 90, 106, 134, 151, 0, & + 15, 58, 60, 74, 111, 150, 163, & + 18, 42, 79, 144, 146, 152, 0, & + 25, 38, 65, 99, 122, 160, 0, & + 17, 42, 75, 129, 170, 172, 0/ + +data nrw/ & +7,6,6,6,7,6,7,6,6,7,6,6,7,7,6,6, & +6,7,6,7,6,7,6,6,6,7,6,6,6,7,6,6, & +6,6,7,6,6,6,7,7,6,6,6,6,7,7,6,6, & +6,6,7,6,6,6,7,6,6,6,6,7,6,6,6,7, & +6,6,6,7,7,6,6,7,6,6,6,6,6,6,6,7, & +6,6,6/ + +ncw=3 diff --git a/lib/ft8var/msgparservar.f90 b/lib/ft8var/msgparservar.f90 index 276047d1..fdc4167d 100755..100644 --- a/lib/ft8var/msgparservar.f90 +++ b/lib/ft8var/msgparservar.f90 @@ -1,26 +1,26 @@ -subroutine msgparservar(msg37,msg37_2)
-
- character msg37*37,msg37_2*37,call1*12,call2*12,call3*12,report*6
-
-! ES1JA RR73; TA1BM <...> -22
-! ES1JA RR73; TA1BM <SX60RAAG> -22
-
- call1=' '; call2=' '; call3=' '; report=' '
- ispc1=index(msg37,' '); ispc2=index(msg37((ispc1+1):),' ')+ispc1
- ispc3=index(msg37((ispc2+1):),' ')+ispc2; ispc4=index(msg37((ispc3+1):),' ')+ispc3
- ispc5=index(msg37((ispc4+1):),' ')+ispc4
- if(ispc5.gt.20) then
- call1=msg37(1:ispc1-1); call2=msg37(ispc2+1:ispc3-1)
- if(msg37(ispc3+1:ispc3+2).eq.'<.') then
- call3='<...>'
- else
- call3=msg37(ispc3+1:ispc4-1)
- endif
- if(len_trim(call3).lt.11) then; report=msg37(ispc4+1:ispc5-1); else; report=msg37(ispc4+1:37); endif
-! build standard messages
- msg37=trim(call1)//' RR73; '//trim(call2)//' '//trim(call3)//' '//trim(report) !ft8md reformat msg37
- msg37_2=trim(call2)//' '//trim(call3)//' '//trim(report)
- endif
-
- return
-end subroutine msgparservar
+subroutine msgparservar(msg37,msg37_2) + + character msg37*37,msg37_2*37,call1*12,call2*12,call3*12,report*6 + +! ES1JA RR73; TA1BM <...> -22 +! ES1JA RR73; TA1BM <SX60RAAG> -22 + + call1=' '; call2=' '; call3=' '; report=' ' + ispc1=index(msg37,' '); ispc2=index(msg37((ispc1+1):),' ')+ispc1 + ispc3=index(msg37((ispc2+1):),' ')+ispc2; ispc4=index(msg37((ispc3+1):),' ')+ispc3 + ispc5=index(msg37((ispc4+1):),' ')+ispc4 + if(ispc5.gt.20) then + call1=msg37(1:ispc1-1); call2=msg37(ispc2+1:ispc3-1) + if(msg37(ispc3+1:ispc3+2).eq.'<.') then + call3='<...>' + else + call3=msg37(ispc3+1:ispc4-1) + endif + if(len_trim(call3).lt.11) then; report=msg37(ispc4+1:ispc5-1); else; report=msg37(ispc4+1:37); endif +! build standard messages + msg37=trim(call1)//' RR73; '//trim(call2)//' '//trim(call3)//' '//trim(report) !ft8md reformat msg37 + msg37_2=trim(call2)//' '//trim(call3)//' '//trim(report) + endif + + return +end subroutine msgparservar diff --git a/lib/ft8var/osd174_91var.f90 b/lib/ft8var/osd174_91var.f90 index 27cd11bf..d46fd377 100755..100644 --- a/lib/ft8var/osd174_91var.f90 +++ b/lib/ft8var/osd174_91var.f90 @@ -1,400 +1,400 @@ -subroutine osd174_91var(llr,apmask,ndeep,message77,cw,nhardmin,dmin,nthr)
-!
-! An ordered-statistics decoder for the (174,91) code.
-!
-use ft8_mod1, only : first_osd,gen
-integer, parameter:: N=174, K=91, M=N-K
-integer*1 apmask(N),apmaskr(N)
-integer*1 genmrb(K,N),g2(N,K)
-integer*1 temp(K),m0(K),me(K),mi(K),misub(K),e2sub(N-K),e2(N-K),ui(N-K)
-integer*1 r2pat(N-K)
-integer indices(N),nxor(N)
-integer*1 cw(N),ce(N),c0(N),hdec(N)
-integer*1 decoded(K)
-integer*1 message77(77)
-integer indx(N)
-real llr(N),rx(N),absrx(N)
-include '/lib/ft8/ldpc_174_91_c_generator.f90'
-logical reset
-
-integer, DIMENSION(:,:), ALLOCATABLE :: indexes
-integer, DIMENSION(:), ALLOCATABLE :: fp
-integer, DIMENSION(:), ALLOCATABLE :: np
-
-interface
- subroutine boxit91var(indexes,fp,np,reset,e2,ntau,npindex,i1,i2)
- integer indexes(:,:),fp(0:),np(:),ntau
- integer*1 e2(1:ntau)
- integer npindex,i1,i2
- logical reset
- end subroutine boxit91var
- subroutine fetchit91var(indexes,fp,np,reset,e2,ntau,i1,i2,nthr)
- integer indexes(:,:),fp(0:),np(:),ntau
- integer*1 e2(1:ntau)
- integer i1,i2,nthr
- logical reset
- end subroutine fetchit91var
-end interface
-
-npre1=0; npre2=0; d1=0.
-if(first_osd) then ! fill the generator matrix
-!$omp critical(first_osd)
- gen=0
- do i=1,M
- do j=1,23
- read(g(i)(j:j),"(Z1)") istr
- ibmax=4
- if(j.eq.23) ibmax=3
- do jj=1, ibmax
- irow=(j-1)*4+jj
- if( btest(istr,4-jj) ) gen(irow,K+i)=1
- enddo
- enddo
- enddo
- do irow=1,K
- gen(irow,irow)=1
- enddo
-first_osd=.false.
-!$omp end critical(first_osd)
-endif
-
-rx=llr
-apmaskr=apmask
-
-! Hard decisions on the received word.
-hdec=0
-where(rx .ge. 0) hdec=1
-
-! Use magnitude of received symbols as a measure of reliability.
-absrx=abs(rx)
-call indexx(absrx,N,indx)
-
-! Re-order the columns of the generator matrix in order of decreasing reliability.
-do i=1,N
- genmrb(1:K,i)=gen(1:K,indx(N+1-i))
- indices(i)=indx(N+1-i)
-enddo
-
-! Do gaussian elimination to create a generator matrix with the most reliable
-! received bits in positions 1:K in order of decreasing reliability (more or less).
-do id=1,K ! diagonal element indices
- do icol=id,K+20 ! The 20 is ad hoc - beware
- iflag=0
- if( genmrb(id,icol) .eq. 1 ) then
- iflag=1
- if( icol .ne. id ) then ! reorder column
- temp(1:K)=genmrb(1:K,id)
- genmrb(1:K,id)=genmrb(1:K,icol)
- genmrb(1:K,icol)=temp(1:K)
- itmp=indices(id)
- indices(id)=indices(icol)
- indices(icol)=itmp
- endif
- do ii=1,K
- if( ii .ne. id .and. genmrb(ii,id) .eq. 1 ) then
- genmrb(ii,1:N)=ieor(genmrb(ii,1:N),genmrb(id,1:N))
- endif
- enddo
- exit
- endif
- enddo
-enddo
-
-g2=transpose(genmrb)
-
-! The hard decisions for the K MRB bits define the order 0 message, m0.
-! Encode m0 using the modified generator matrix to find the "order 0" codeword.
-! Flip various combinations of bits in m0 and re-encode to generate a list of
-! codewords. Return the member of the list that has the smallest Euclidean
-! distance to the received word.
-
-hdec=hdec(indices) ! hard decisions from received symbols
-m0=hdec(1:K) ! zero'th order message
-absrx=absrx(indices)
-rx=rx(indices)
-apmaskr=apmaskr(indices)
-
-call mrbencode91var(m0,c0,g2,N,K)
-nxor=ieor(c0,hdec)
-nhardmin=sum(nxor)
-dmin=sum(nxor*absrx)
-
-cw=c0
-ntotal=0
-nrejected=0
-
-if(ndeep.eq.0) goto 998 ! norder=0
-if(ndeep.gt.5) ndeep=5
-if( ndeep.eq. 1) then
- nord=1
- npre1=0
- npre2=0
- nt=40
- ntheta=12
-elseif(ndeep.eq.2) then
- nord=1
- npre1=1
- npre2=0
- nt=40
- ntheta=12
-elseif(ndeep.eq.3) then
- nord=1
- npre1=1
- npre2=1
- nt=40
- ntheta=12
- ntau=14
-elseif(ndeep.eq.4) then
- nord=2
- npre1=1
- npre2=0
- nt=40
- ntheta=12
- ntau=19
-elseif(ndeep.eq.5) then
- nord=2
- npre1=1
- npre2=1
- nt=40
- ntheta=12
- ntau=19
-endif
-
-do iorder=1,nord
- misub(1:K-iorder)=0
- misub(K-iorder+1:K)=1
- iflag=K-iorder+1
- do while(iflag .ge.0)
- if(iorder.eq.nord .and. npre1.eq.0) then
- iend=iflag
- else
- iend=1
- endif
- do n1=iflag,iend,-1
- mi=misub
- mi(n1)=1
- if(any(iand(apmaskr(1:K),mi).eq.1)) cycle
- ntotal=ntotal+1
- me=ieor(m0,mi)
- if(n1.eq.iflag) then
- call mrbencode91var(me,ce,g2,N,K)
- e2sub=ieor(ce(K+1:N),hdec(K+1:N))
- e2=e2sub
- nd1Kpt=sum(e2sub(1:nt))+1
- d1=sum(ieor(me(1:K),hdec(1:K))*absrx(1:K))
- else
- e2=ieor(e2sub,g2(K+1:N,n1))
- nd1Kpt=sum(e2(1:nt))+2
- endif
- if(nd1Kpt .le. ntheta) then
- call mrbencode91var(me,ce,g2,N,K)
- nxor=ieor(ce,hdec)
- if(n1.eq.iflag) then
- dd=d1+sum(e2sub*absrx(K+1:N))
- else
- dd=d1+ieor(ce(n1),hdec(n1))*absrx(n1)+sum(e2*absrx(K+1:N))
- endif
- if( dd .lt. dmin ) then
- dmin=dd
- cw=ce
- nhardmin=sum(nxor)
- nd1Kptbest=nd1Kpt
- endif
- else
- nrejected=nrejected+1
- endif
- enddo
-! Get the next test error pattern, iflag will go negative
-! when the last pattern with weight iorder has been generated.
- call nextpat91var(misub,k,iorder,iflag)
- enddo
-enddo
-
-if(npre2.eq.1) then
- allocate(indexes(5000,2), STAT = nAllocateStatus1)
- if (nAllocateStatus1 .ne. 0) STOP "Not enough memory"
- allocate(fp(0:525000), STAT = nAllocateStatus1)
- if (nAllocateStatus1 .ne. 0) STOP "Not enough memory"
- allocate(np(5000), STAT = nAllocateStatus1)
- if (nAllocateStatus1 .ne. 0) STOP "Not enough memory"
- reset=.true.
- ntotal=0
- do i1=K,1,-1
- do i2=i1-1,1,-1
- ntotal=ntotal+1
- mi(1:ntau)=ieor(g2(K+1:K+ntau,i1),g2(K+1:K+ntau,i2))
- call boxit91var(indexes,fp,np,reset,mi(1:ntau),ntau,ntotal,i1,i2)
- enddo
- enddo
-
- ncount2=0
- ntotal2=0
- reset=.true.
-! Now run through again and do the second pre-processing rule
- misub(1:K-nord)=0
- misub(K-nord+1:K)=1
- iflag=K-nord+1
- do while(iflag .ge.0)
- me=ieor(m0,misub)
- call mrbencode91var(me,ce,g2,N,K)
- e2sub=ieor(ce(K+1:N),hdec(K+1:N))
- do i2=0,ntau
- ntotal2=ntotal2+1
- ui=0
- if(i2.gt.0) ui(i2)=1
- r2pat=ieor(e2sub,ui)
-778 continue
- call fetchit91var(indexes,fp,np,reset,r2pat(1:ntau),ntau,in1,in2,nthr)
- if(in1.gt.0.and.in2.gt.0) then
- ncount2=ncount2+1
- mi=misub
- mi(in1)=1
- mi(in2)=1
- if(sum(mi).lt.nord+npre1+npre2.or.any(iand(apmaskr(1:K),mi).eq.1)) cycle
- me=ieor(m0,mi)
- call mrbencode91var(me,ce,g2,N,K)
- nxor=ieor(ce,hdec)
- dd=sum(nxor*absrx)
- if( dd .lt. dmin ) then
- dmin=dd
- cw=ce
- nhardmin=sum(nxor)
- endif
- goto 778
- endif
- enddo
- call nextpat91var(misub,K,nord,iflag)
- enddo
- deallocate (indexes, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
- deallocate (fp, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
- deallocate (np, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
-endif
-
-998 continue
-! Re-order the codeword to [message bits][parity bits] format.
-cw(indices)=cw
-hdec(indices)=hdec
-decoded=cw(1:K)
-call chkcrc14a(decoded,nbadcrc)
-message77=decoded(1:77)
-if(nbadcrc.eq.1) nhardmin=-nhardmin
-
-return
-end subroutine osd174_91var
-
-subroutine mrbencode91var(me,codeword,g2,N,K)
-integer*1 me(K),codeword(N),g2(N,K)
-! fast encoding for low-weight test patterns
- codeword=0
- do i=1,K
- if( me(i) .eq. 1 ) then
- codeword=ieor(codeword,g2(1:N,i))
- endif
- enddo
-return
-end subroutine mrbencode91var
-
-subroutine nextpat91var(mi,k,iorder,iflag)
- integer*1 mi(k),ms(k)
-! generate the next test error pattern
- ind=-1
- do i=1,k-1
- if( mi(i).eq.0 .and. mi(i+1).eq.1) ind=i
- enddo
- if( ind .lt. 0 ) then ! no more patterns of this order
- iflag=ind
- return
- endif
- ms=0
- ms(1:ind-1)=mi(1:ind-1)
- ms(ind)=1
- ms(ind+1)=0
- if( ind+1 .lt. k ) then
- nz=iorder-sum(ms)
- ms(k-nz+1:k)=1
- endif
- mi=ms
- do i=1,k ! iflag will point to the lowest-index 1 in mi
- if(mi(i).eq.1) then
- iflag=i
- exit
- endif
- enddo
- return
-end subroutine nextpat91var
-
-subroutine boxit91var(indexes,fp,np,reset,e2,ntau,npindex,i1,i2)
- integer indexes(:,:),fp(0:),np(:)
- integer*1 e2(1:ntau)
- logical reset
-
- if(reset) then
- patterns=-1
- fp=-1
- np=-1
- sc=-1
- indexes=-1
- reset=.false.
- endif
-
- indexes(npindex,1)=i1
- indexes(npindex,2)=i2
- ipat=0
- do i=1,ntau
- if(e2(i).eq.1) then
- ipat=ipat+ishft(1,ntau-i)
- endif
- enddo
-
- ip=fp(ipat) ! see what's currently stored in fp(ipat)
- if(ip.eq.-1) then
- fp(ipat)=npindex
- else
- do while (np(ip).ne.-1)
- ip=np(ip)
- enddo
- np(ip)=npindex
- endif
- return
-end subroutine boxit91var
-
-subroutine fetchit91var(indexes,fp,np,reset,e2,ntau,i1,i2,nthr)
- integer indexes(:,:),fp(0:),np(:)
- integer lastpat(24),inext(24)
- integer*1 e2(1:ntau)
- logical reset
- save lastpat,inext
-
- if(reset) then
- lastpat(nthr)=-1
- reset=.false.
- endif
-
- ipat=0
- do i=1,ntau
- if(e2(i).eq.1) then
- ipat=ipat+ishft(1,ntau-i)
- endif
- enddo
- index=fp(ipat)
-
- if(lastpat(nthr).ne.ipat .and. index.gt.0) then ! return first set of indices
- i1=indexes(index,1)
- i2=indexes(index,2)
- inext(nthr)=np(index)
- elseif(lastpat(nthr).eq.ipat .and. inext(nthr).gt.0) then
- i1=indexes(inext(nthr),1)
- i2=indexes(inext(nthr),2)
- inext(nthr)=np(inext(nthr))
- else
- i1=-1
- i2=-1
- inext(nthr)=-1
- endif
- lastpat(nthr)=ipat
-
- return
+subroutine osd174_91var(llr,apmask,ndeep,message77,cw,nhardmin,dmin,nthr) +! +! An ordered-statistics decoder for the (174,91) code. +! +use ft8_mod1, only : first_osd,gen +integer, parameter:: N=174, K=91, M=N-K +integer*1 apmask(N),apmaskr(N) +integer*1 genmrb(K,N),g2(N,K) +integer*1 temp(K),m0(K),me(K),mi(K),misub(K),e2sub(N-K),e2(N-K),ui(N-K) +integer*1 r2pat(N-K) +integer indices(N),nxor(N) +integer*1 cw(N),ce(N),c0(N),hdec(N) +integer*1 decoded(K) +integer*1 message77(77) +integer indx(N) +real llr(N),rx(N),absrx(N) +include '/lib/ft8/ldpc_174_91_c_generator.f90' +logical reset + +integer, DIMENSION(:,:), ALLOCATABLE :: indexes +integer, DIMENSION(:), ALLOCATABLE :: fp +integer, DIMENSION(:), ALLOCATABLE :: np + +interface + subroutine boxit91var(indexes,fp,np,reset,e2,ntau,npindex,i1,i2) + integer indexes(:,:),fp(0:),np(:),ntau + integer*1 e2(1:ntau) + integer npindex,i1,i2 + logical reset + end subroutine boxit91var + subroutine fetchit91var(indexes,fp,np,reset,e2,ntau,i1,i2,nthr) + integer indexes(:,:),fp(0:),np(:),ntau + integer*1 e2(1:ntau) + integer i1,i2,nthr + logical reset + end subroutine fetchit91var +end interface + +npre1=0; npre2=0; d1=0. +if(first_osd) then ! fill the generator matrix +!$omp critical(first_osd) + gen=0 + do i=1,M + do j=1,23 + read(g(i)(j:j),"(Z1)") istr + ibmax=4 + if(j.eq.23) ibmax=3 + do jj=1, ibmax + irow=(j-1)*4+jj + if( btest(istr,4-jj) ) gen(irow,K+i)=1 + enddo + enddo + enddo + do irow=1,K + gen(irow,irow)=1 + enddo +first_osd=.false. +!$omp end critical(first_osd) +endif + +rx=llr +apmaskr=apmask + +! Hard decisions on the received word. +hdec=0 +where(rx .ge. 0) hdec=1 + +! Use magnitude of received symbols as a measure of reliability. +absrx=abs(rx) +call indexx(absrx,N,indx) + +! Re-order the columns of the generator matrix in order of decreasing reliability. +do i=1,N + genmrb(1:K,i)=gen(1:K,indx(N+1-i)) + indices(i)=indx(N+1-i) +enddo + +! Do gaussian elimination to create a generator matrix with the most reliable +! received bits in positions 1:K in order of decreasing reliability (more or less). +do id=1,K ! diagonal element indices + do icol=id,K+20 ! The 20 is ad hoc - beware + iflag=0 + if( genmrb(id,icol) .eq. 1 ) then + iflag=1 + if( icol .ne. id ) then ! reorder column + temp(1:K)=genmrb(1:K,id) + genmrb(1:K,id)=genmrb(1:K,icol) + genmrb(1:K,icol)=temp(1:K) + itmp=indices(id) + indices(id)=indices(icol) + indices(icol)=itmp + endif + do ii=1,K + if( ii .ne. id .and. genmrb(ii,id) .eq. 1 ) then + genmrb(ii,1:N)=ieor(genmrb(ii,1:N),genmrb(id,1:N)) + endif + enddo + exit + endif + enddo +enddo + +g2=transpose(genmrb) + +! The hard decisions for the K MRB bits define the order 0 message, m0. +! Encode m0 using the modified generator matrix to find the "order 0" codeword. +! Flip various combinations of bits in m0 and re-encode to generate a list of +! codewords. Return the member of the list that has the smallest Euclidean +! distance to the received word. + +hdec=hdec(indices) ! hard decisions from received symbols +m0=hdec(1:K) ! zero'th order message +absrx=absrx(indices) +rx=rx(indices) +apmaskr=apmaskr(indices) + +call mrbencode91var(m0,c0,g2,N,K) +nxor=ieor(c0,hdec) +nhardmin=sum(nxor) +dmin=sum(nxor*absrx) + +cw=c0 +ntotal=0 +nrejected=0 + +if(ndeep.eq.0) goto 998 ! norder=0 +if(ndeep.gt.5) ndeep=5 +if( ndeep.eq. 1) then + nord=1 + npre1=0 + npre2=0 + nt=40 + ntheta=12 +elseif(ndeep.eq.2) then + nord=1 + npre1=1 + npre2=0 + nt=40 + ntheta=12 +elseif(ndeep.eq.3) then + nord=1 + npre1=1 + npre2=1 + nt=40 + ntheta=12 + ntau=14 +elseif(ndeep.eq.4) then + nord=2 + npre1=1 + npre2=0 + nt=40 + ntheta=12 + ntau=19 +elseif(ndeep.eq.5) then + nord=2 + npre1=1 + npre2=1 + nt=40 + ntheta=12 + ntau=19 +endif + +do iorder=1,nord + misub(1:K-iorder)=0 + misub(K-iorder+1:K)=1 + iflag=K-iorder+1 + do while(iflag .ge.0) + if(iorder.eq.nord .and. npre1.eq.0) then + iend=iflag + else + iend=1 + endif + do n1=iflag,iend,-1 + mi=misub + mi(n1)=1 + if(any(iand(apmaskr(1:K),mi).eq.1)) cycle + ntotal=ntotal+1 + me=ieor(m0,mi) + if(n1.eq.iflag) then + call mrbencode91var(me,ce,g2,N,K) + e2sub=ieor(ce(K+1:N),hdec(K+1:N)) + e2=e2sub + nd1Kpt=sum(e2sub(1:nt))+1 + d1=sum(ieor(me(1:K),hdec(1:K))*absrx(1:K)) + else + e2=ieor(e2sub,g2(K+1:N,n1)) + nd1Kpt=sum(e2(1:nt))+2 + endif + if(nd1Kpt .le. ntheta) then + call mrbencode91var(me,ce,g2,N,K) + nxor=ieor(ce,hdec) + if(n1.eq.iflag) then + dd=d1+sum(e2sub*absrx(K+1:N)) + else + dd=d1+ieor(ce(n1),hdec(n1))*absrx(n1)+sum(e2*absrx(K+1:N)) + endif + if( dd .lt. dmin ) then + dmin=dd + cw=ce + nhardmin=sum(nxor) + nd1Kptbest=nd1Kpt + endif + else + nrejected=nrejected+1 + endif + enddo +! Get the next test error pattern, iflag will go negative +! when the last pattern with weight iorder has been generated. + call nextpat91var(misub,k,iorder,iflag) + enddo +enddo + +if(npre2.eq.1) then + allocate(indexes(5000,2), STAT = nAllocateStatus1) + if (nAllocateStatus1 .ne. 0) STOP "Not enough memory" + allocate(fp(0:525000), STAT = nAllocateStatus1) + if (nAllocateStatus1 .ne. 0) STOP "Not enough memory" + allocate(np(5000), STAT = nAllocateStatus1) + if (nAllocateStatus1 .ne. 0) STOP "Not enough memory" + reset=.true. + ntotal=0 + do i1=K,1,-1 + do i2=i1-1,1,-1 + ntotal=ntotal+1 + mi(1:ntau)=ieor(g2(K+1:K+ntau,i1),g2(K+1:K+ntau,i2)) + call boxit91var(indexes,fp,np,reset,mi(1:ntau),ntau,ntotal,i1,i2) + enddo + enddo + + ncount2=0 + ntotal2=0 + reset=.true. +! Now run through again and do the second pre-processing rule + misub(1:K-nord)=0 + misub(K-nord+1:K)=1 + iflag=K-nord+1 + do while(iflag .ge.0) + me=ieor(m0,misub) + call mrbencode91var(me,ce,g2,N,K) + e2sub=ieor(ce(K+1:N),hdec(K+1:N)) + do i2=0,ntau + ntotal2=ntotal2+1 + ui=0 + if(i2.gt.0) ui(i2)=1 + r2pat=ieor(e2sub,ui) +778 continue + call fetchit91var(indexes,fp,np,reset,r2pat(1:ntau),ntau,in1,in2,nthr) + if(in1.gt.0.and.in2.gt.0) then + ncount2=ncount2+1 + mi=misub + mi(in1)=1 + mi(in2)=1 + if(sum(mi).lt.nord+npre1+npre2.or.any(iand(apmaskr(1:K),mi).eq.1)) cycle + me=ieor(m0,mi) + call mrbencode91var(me,ce,g2,N,K) + nxor=ieor(ce,hdec) + dd=sum(nxor*absrx) + if( dd .lt. dmin ) then + dmin=dd + cw=ce + nhardmin=sum(nxor) + endif + goto 778 + endif + enddo + call nextpat91var(misub,K,nord,iflag) + enddo + deallocate (indexes, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + deallocate (fp, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + deallocate (np, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' +endif + +998 continue +! Re-order the codeword to [message bits][parity bits] format. +cw(indices)=cw +hdec(indices)=hdec +decoded=cw(1:K) +call chkcrc14a(decoded,nbadcrc) +message77=decoded(1:77) +if(nbadcrc.eq.1) nhardmin=-nhardmin + +return +end subroutine osd174_91var + +subroutine mrbencode91var(me,codeword,g2,N,K) +integer*1 me(K),codeword(N),g2(N,K) +! fast encoding for low-weight test patterns + codeword=0 + do i=1,K + if( me(i) .eq. 1 ) then + codeword=ieor(codeword,g2(1:N,i)) + endif + enddo +return +end subroutine mrbencode91var + +subroutine nextpat91var(mi,k,iorder,iflag) + integer*1 mi(k),ms(k) +! generate the next test error pattern + ind=-1 + do i=1,k-1 + if( mi(i).eq.0 .and. mi(i+1).eq.1) ind=i + enddo + if( ind .lt. 0 ) then ! no more patterns of this order + iflag=ind + return + endif + ms=0 + ms(1:ind-1)=mi(1:ind-1) + ms(ind)=1 + ms(ind+1)=0 + if( ind+1 .lt. k ) then + nz=iorder-sum(ms) + ms(k-nz+1:k)=1 + endif + mi=ms + do i=1,k ! iflag will point to the lowest-index 1 in mi + if(mi(i).eq.1) then + iflag=i + exit + endif + enddo + return +end subroutine nextpat91var + +subroutine boxit91var(indexes,fp,np,reset,e2,ntau,npindex,i1,i2) + integer indexes(:,:),fp(0:),np(:) + integer*1 e2(1:ntau) + logical reset + + if(reset) then + patterns=-1 + fp=-1 + np=-1 + sc=-1 + indexes=-1 + reset=.false. + endif + + indexes(npindex,1)=i1 + indexes(npindex,2)=i2 + ipat=0 + do i=1,ntau + if(e2(i).eq.1) then + ipat=ipat+ishft(1,ntau-i) + endif + enddo + + ip=fp(ipat) ! see what's currently stored in fp(ipat) + if(ip.eq.-1) then + fp(ipat)=npindex + else + do while (np(ip).ne.-1) + ip=np(ip) + enddo + np(ip)=npindex + endif + return +end subroutine boxit91var + +subroutine fetchit91var(indexes,fp,np,reset,e2,ntau,i1,i2,nthr) + integer indexes(:,:),fp(0:),np(:) + integer lastpat(24),inext(24) + integer*1 e2(1:ntau) + logical reset + save lastpat,inext + + if(reset) then + lastpat(nthr)=-1 + reset=.false. + endif + + ipat=0 + do i=1,ntau + if(e2(i).eq.1) then + ipat=ipat+ishft(1,ntau-i) + endif + enddo + index=fp(ipat) + + if(lastpat(nthr).ne.ipat .and. index.gt.0) then ! return first set of indices + i1=indexes(index,1) + i2=indexes(index,2) + inext(nthr)=np(index) + elseif(lastpat(nthr).eq.ipat .and. inext(nthr).gt.0) then + i1=indexes(inext(nthr),1) + i2=indexes(inext(nthr),2) + inext(nthr)=np(inext(nthr)) + else + i1=-1 + i2=-1 + inext(nthr)=-1 + endif + lastpat(nthr)=ipat + + return end subroutine fetchit91var
\ No newline at end of file diff --git a/lib/ft8var/osd174var.f90 b/lib/ft8var/osd174var.f90 index 2d8257a7..974acad5 100755..100644 --- a/lib/ft8var/osd174var.f90 +++ b/lib/ft8var/osd174var.f90 @@ -1,399 +1,399 @@ -
-subroutine osd174var(llr,apmask,ndeep,decoded,cw,nhardmin,dmin,nthr)
-!
-! An ordered-statistics decoder for the (174,87) code.
-!
-include "ldpc_174_87_params.f90"
-
-integer*1 apmask(N),apmaskr(N)
-integer*1 gen(K,N)
-integer*1 genmrb(K,N),g2(N,K)
-integer*1 temp(K),m0(K),me(K),mi(K),misub(K),e2sub(N-K),e2(N-K),ui(N-K)
-integer*1 r2pat(N-K)
-integer indices(N),nxor(N)
-integer*1 cw(N),ce(N),c0(N),hdec(N)
-integer*1 decoded(K)
-integer indx(N)
-real llr(N),rx(N),absrx(N)
-logical first,reset
-data first/.true./
-
-integer, DIMENSION(:,:), ALLOCATABLE :: indexes
-integer, DIMENSION(:), ALLOCATABLE :: fp
-integer, DIMENSION(:), ALLOCATABLE :: np
-
-interface
- subroutine boxitvar(indexes,fp,np,reset,e2,ntau,npindex,i1,i2)
- integer indexes(:,:),fp(0:),np(:),ntau
- integer*1 e2(1:ntau)
- integer npindex,i1,i2
- logical reset
- end subroutine boxitvar
- subroutine fetchitvar(indexes,fp,np,reset,e2,ntau,i1,i2,nthr)
- integer indexes(:,:),fp(0:),np(:),ntau
- integer*1 e2(1:ntau)
- integer i1,i2,nthr
- logical reset
- end subroutine fetchitvar
-end interface
-
-save first,gen
-
-npre1=0; npre2=0; d1=0.
-
-if( first ) then ! fill the generator matrix
- gen=0
- do i=1,M
- do j=1,22
- read(g(i)(j:j),"(Z1)") istr
- do jj=1, 4
- irow=(j-1)*4+jj
- if( btest(istr,4-jj) ) gen(irow,i)=1
- enddo
- enddo
- enddo
- do irow=1,K
- gen(irow,M+irow)=1
- enddo
-first=.false.
-endif
-
-! Re-order received vector to place systematic msg bits at the end.
-rx=llr(colorder+1)
-apmaskr=apmask(colorder+1)
-
-! Hard decisions on the received word.
-hdec=0
-where(rx .ge. 0) hdec=1
-
-! Use magnitude of received symbols as a measure of reliability.
-absrx=abs(rx)
-call indexx(absrx,N,indx)
-
-! Re-order the columns of the generator matrix in order of decreasing reliability.
-do i=1,N
- genmrb(1:K,i)=gen(1:K,indx(N+1-i))
- indices(i)=indx(N+1-i)
-enddo
-
-! Do gaussian elimination to create a generator matrix with the most reliable
-! received bits in positions 1:K in order of decreasing reliability (more or less).
-do id=1,K ! diagonal element indices
- do icol=id,K+20 ! The 20 is ad hoc - beware
- iflag=0
- if( genmrb(id,icol) .eq. 1 ) then
- iflag=1
- if( icol .ne. id ) then ! reorder column
- temp(1:K)=genmrb(1:K,id)
- genmrb(1:K,id)=genmrb(1:K,icol)
- genmrb(1:K,icol)=temp(1:K)
- itmp=indices(id)
- indices(id)=indices(icol)
- indices(icol)=itmp
- endif
- do ii=1,K
- if( ii .ne. id .and. genmrb(ii,id) .eq. 1 ) then
- genmrb(ii,1:N)=ieor(genmrb(ii,1:N),genmrb(id,1:N))
- endif
- enddo
- exit
- endif
- enddo
-enddo
-
-g2=transpose(genmrb)
-
-! The hard decisions for the K MRB bits define the order 0 message, m0.
-! Encode m0 using the modified generator matrix to find the "order 0" codeword.
-! Flip various combinations of bits in m0 and re-encode to generate a list of
-! codewords. Return the member of the list that has the smallest Euclidean
-! distance to the received word.
-
-hdec=hdec(indices) ! hard decisions from received symbols
-m0=hdec(1:K) ! zero'th order message
-absrx=absrx(indices)
-rx=rx(indices)
-apmaskr=apmaskr(indices)
-
-call mrbencodevar(m0,c0,g2,N,K)
-nxor=ieor(c0,hdec)
-nhardmin=sum(nxor)
-dmin=sum(nxor*absrx)
-
-cw=c0
-ntotal=0
-nrejected=0
-
-if(ndeep.eq.0) goto 998 ! norder=0
-if(ndeep.gt.5) ndeep=5
-if( ndeep.eq. 1) then
- nord=1
- npre1=0
- npre2=0
- nt=40
- ntheta=12
-elseif(ndeep.eq.2) then
- nord=1
- npre1=1
- npre2=0
- nt=40
- ntheta=12
-elseif(ndeep.eq.3) then
- nord=1
- npre1=1
- npre2=1
- nt=40
- ntheta=12
- ntau=14
-elseif(ndeep.eq.4) then
- nord=2
- npre1=1
- npre2=0
- nt=40
- ntheta=12
- ntau=19
-elseif(ndeep.eq.5) then
- nord=2
- npre1=1
- npre2=1
- nt=40
- ntheta=12
- ntau=19
-endif
-
-do iorder=1,nord
- misub(1:K-iorder)=0
- misub(K-iorder+1:K)=1
- iflag=K-iorder+1
- do while(iflag .ge.0)
- if(iorder.eq.nord .and. npre1.eq.0) then
- iend=iflag
- else
- iend=1
- endif
- do n1=iflag,iend,-1
- mi=misub
- mi(n1)=1
- if(any(iand(apmaskr(1:K),mi).eq.1)) cycle
- ntotal=ntotal+1
- me=ieor(m0,mi)
- if(n1.eq.iflag) then
- call mrbencodevar(me,ce,g2,N,K)
- e2sub=ieor(ce(K+1:N),hdec(K+1:N))
- e2=e2sub
- nd1Kpt=sum(e2sub(1:nt))+1
- d1=sum(ieor(me(1:K),hdec(1:K))*absrx(1:K))
- else
- e2=ieor(e2sub,g2(K+1:N,n1))
- nd1Kpt=sum(e2(1:nt))+2
- endif
- if(nd1Kpt .le. ntheta) then
- call mrbencodevar(me,ce,g2,N,K)
- nxor=ieor(ce,hdec)
- if(n1.eq.iflag) then
- dd=d1+sum(e2sub*absrx(K+1:N))
- else
- dd=d1+ieor(ce(n1),hdec(n1))*absrx(n1)+sum(e2*absrx(K+1:N))
- endif
- if( dd .lt. dmin ) then
- dmin=dd
- cw=ce
- nhardmin=sum(nxor)
- nd1Kptbest=nd1Kpt
- endif
- else
- nrejected=nrejected+1
- endif
- enddo
-! Get the next test error pattern, iflag will go negative
-! when the last pattern with weight iorder has been generated.
- call nextpatvar(misub,k,iorder,iflag)
- enddo
-enddo
-
-if(npre2.eq.1) then
- allocate(indexes(4000,2), STAT = nAllocateStatus1)
- if (nAllocateStatus1 .ne. 0) STOP "Not enough memory"
- allocate(fp(0:525000), STAT = nAllocateStatus1)
- if (nAllocateStatus1 .ne. 0) STOP "Not enough memory"
- allocate(np(4000), STAT = nAllocateStatus1)
- if (nAllocateStatus1 .ne. 0) STOP "Not enough memory"
- reset=.true.
- ntotal=0
- do i1=K,1,-1
- do i2=i1-1,1,-1
- ntotal=ntotal+1
- mi(1:ntau)=ieor(g2(K+1:K+ntau,i1),g2(K+1:K+ntau,i2))
- call boxitvar(indexes,fp,np,reset,mi(1:ntau),ntau,ntotal,i1,i2)
- enddo
- enddo
-
- ncount2=0
- ntotal2=0
- reset=.true.
-! Now run through again and do the second pre-processing rule
- misub(1:K-nord)=0
- misub(K-nord+1:K)=1
- iflag=K-nord+1
- do while(iflag .ge.0)
- me=ieor(m0,misub)
- call mrbencodevar(me,ce,g2,N,K)
- e2sub=ieor(ce(K+1:N),hdec(K+1:N))
- do i2=0,ntau
- ntotal2=ntotal2+1
- ui=0
- if(i2.gt.0) ui(i2)=1
- r2pat=ieor(e2sub,ui)
-778 continue
- call fetchitvar(indexes,fp,np,reset,r2pat(1:ntau),ntau,in1,in2,nthr)
- if(in1.gt.0.and.in2.gt.0) then
- ncount2=ncount2+1
- mi=misub
- mi(in1)=1
- mi(in2)=1
- if(sum(mi).lt.nord+npre1+npre2.or.any(iand(apmaskr(1:K),mi).eq.1)) cycle
- me=ieor(m0,mi)
- call mrbencodevar(me,ce,g2,N,K)
- nxor=ieor(ce,hdec)
- dd=sum(nxor*absrx)
- if( dd .lt. dmin ) then
- dmin=dd
- cw=ce
- nhardmin=sum(nxor)
- endif
- goto 778
- endif
- enddo
- call nextpatvar(misub,K,nord,iflag)
- enddo
- deallocate (indexes, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
- deallocate (fp, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
- deallocate (np, STAT = nDeAllocateStatus1)
- if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory'
-endif
-
-998 continue
-! Re-order the codeword to place message bits at the end.
-cw(indices)=cw
-hdec(indices)=hdec
-decoded=cw(M+1:N)
-cw(colorder+1)=cw ! put the codeword back into received-word order
-return
-end subroutine osd174var
-
-subroutine mrbencodevar(me,codeword,g2,N,K)
-integer*1 me(K),codeword(N),g2(N,K)
-! fast encoding for low-weight test patterns
- codeword=0
- do i=1,K
- if( me(i) .eq. 1 ) then
- codeword=ieor(codeword,g2(1:N,i))
- endif
- enddo
-return
-end subroutine mrbencodevar
-
-subroutine nextpatvar(mi,k,iorder,iflag)
- integer*1 mi(k),ms(k)
-! generate the next test error pattern
- ind=-1
- do i=1,k-1
- if( mi(i).eq.0 .and. mi(i+1).eq.1) ind=i
- enddo
- if( ind .lt. 0 ) then ! no more patterns of this order
- iflag=ind
- return
- endif
- ms=0
- ms(1:ind-1)=mi(1:ind-1)
- ms(ind)=1
- ms(ind+1)=0
- if( ind+1 .lt. k ) then
- nz=iorder-sum(ms)
- ms(k-nz+1:k)=1
- endif
- mi=ms
- do i=1,k ! iflag will point to the lowest-index 1 in mi
- if(mi(i).eq.1) then
- iflag=i
- exit
- endif
- enddo
- return
-end subroutine nextpatvar
-
-subroutine boxitvar(indexes,fp,np,reset,e2,ntau,npindex,i1,i2)
- integer indexes(:,:),fp(0:),np(:)
- integer*1 e2(1:ntau)
- logical reset
-
- if(reset) then
- patterns=-1
- fp=-1
- np=-1
- sc=-1
- indexes=-1
- reset=.false.
- endif
-
- indexes(npindex,1)=i1
- indexes(npindex,2)=i2
- ipat=0
- do i=1,ntau
- if(e2(i).eq.1) then
- ipat=ipat+ishft(1,ntau-i)
- endif
- enddo
-
- ip=fp(ipat) ! see what's currently stored in fp(ipat)
- if(ip.eq.-1) then
- fp(ipat)=npindex
- else
- do while (np(ip).ne.-1)
- ip=np(ip)
- enddo
- np(ip)=npindex
- endif
- return
-end subroutine boxitvar
-
-subroutine fetchitvar(indexes,fp,np,reset,e2,ntau,i1,i2,nthr)
- integer indexes(:,:),fp(0:),np(:)
- integer lastpat(36),inext(36) ! up to 36 threads in FT8 decoding
- integer*1 e2(1:ntau)
- logical reset
- save lastpat,inext
-
- if(reset) then
- lastpat(nthr)=-1
- reset=.false.
- endif
-
- ipat=0
- do i=1,ntau
- if(e2(i).eq.1) then
- ipat=ipat+ishft(1,ntau-i)
- endif
- enddo
- index=fp(ipat)
-
- if(lastpat(nthr).ne.ipat .and. index.gt.0) then ! return first set of indices
- i1=indexes(index,1)
- i2=indexes(index,2)
- inext(nthr)=np(index)
- elseif(lastpat(nthr).eq.ipat .and. inext(nthr).gt.0) then
- i1=indexes(inext(nthr),1)
- i2=indexes(inext(nthr),2)
- inext(nthr)=np(inext(nthr))
- else
- i1=-1
- i2=-1
- inext(nthr)=-1
- endif
- lastpat(nthr)=ipat
-
- return
-end subroutine fetchitvar
-
+ +subroutine osd174var(llr,apmask,ndeep,decoded,cw,nhardmin,dmin,nthr) +! +! An ordered-statistics decoder for the (174,87) code. +! +include "ldpc_174_87_params.f90" + +integer*1 apmask(N),apmaskr(N) +integer*1 gen(K,N) +integer*1 genmrb(K,N),g2(N,K) +integer*1 temp(K),m0(K),me(K),mi(K),misub(K),e2sub(N-K),e2(N-K),ui(N-K) +integer*1 r2pat(N-K) +integer indices(N),nxor(N) +integer*1 cw(N),ce(N),c0(N),hdec(N) +integer*1 decoded(K) +integer indx(N) +real llr(N),rx(N),absrx(N) +logical first,reset +data first/.true./ + +integer, DIMENSION(:,:), ALLOCATABLE :: indexes +integer, DIMENSION(:), ALLOCATABLE :: fp +integer, DIMENSION(:), ALLOCATABLE :: np + +interface + subroutine boxitvar(indexes,fp,np,reset,e2,ntau,npindex,i1,i2) + integer indexes(:,:),fp(0:),np(:),ntau + integer*1 e2(1:ntau) + integer npindex,i1,i2 + logical reset + end subroutine boxitvar + subroutine fetchitvar(indexes,fp,np,reset,e2,ntau,i1,i2,nthr) + integer indexes(:,:),fp(0:),np(:),ntau + integer*1 e2(1:ntau) + integer i1,i2,nthr + logical reset + end subroutine fetchitvar +end interface + +save first,gen + +npre1=0; npre2=0; d1=0. + +if( first ) then ! fill the generator matrix + gen=0 + do i=1,M + do j=1,22 + read(g(i)(j:j),"(Z1)") istr + do jj=1, 4 + irow=(j-1)*4+jj + if( btest(istr,4-jj) ) gen(irow,i)=1 + enddo + enddo + enddo + do irow=1,K + gen(irow,M+irow)=1 + enddo +first=.false. +endif + +! Re-order received vector to place systematic msg bits at the end. +rx=llr(colorder+1) +apmaskr=apmask(colorder+1) + +! Hard decisions on the received word. +hdec=0 +where(rx .ge. 0) hdec=1 + +! Use magnitude of received symbols as a measure of reliability. +absrx=abs(rx) +call indexx(absrx,N,indx) + +! Re-order the columns of the generator matrix in order of decreasing reliability. +do i=1,N + genmrb(1:K,i)=gen(1:K,indx(N+1-i)) + indices(i)=indx(N+1-i) +enddo + +! Do gaussian elimination to create a generator matrix with the most reliable +! received bits in positions 1:K in order of decreasing reliability (more or less). +do id=1,K ! diagonal element indices + do icol=id,K+20 ! The 20 is ad hoc - beware + iflag=0 + if( genmrb(id,icol) .eq. 1 ) then + iflag=1 + if( icol .ne. id ) then ! reorder column + temp(1:K)=genmrb(1:K,id) + genmrb(1:K,id)=genmrb(1:K,icol) + genmrb(1:K,icol)=temp(1:K) + itmp=indices(id) + indices(id)=indices(icol) + indices(icol)=itmp + endif + do ii=1,K + if( ii .ne. id .and. genmrb(ii,id) .eq. 1 ) then + genmrb(ii,1:N)=ieor(genmrb(ii,1:N),genmrb(id,1:N)) + endif + enddo + exit + endif + enddo +enddo + +g2=transpose(genmrb) + +! The hard decisions for the K MRB bits define the order 0 message, m0. +! Encode m0 using the modified generator matrix to find the "order 0" codeword. +! Flip various combinations of bits in m0 and re-encode to generate a list of +! codewords. Return the member of the list that has the smallest Euclidean +! distance to the received word. + +hdec=hdec(indices) ! hard decisions from received symbols +m0=hdec(1:K) ! zero'th order message +absrx=absrx(indices) +rx=rx(indices) +apmaskr=apmaskr(indices) + +call mrbencodevar(m0,c0,g2,N,K) +nxor=ieor(c0,hdec) +nhardmin=sum(nxor) +dmin=sum(nxor*absrx) + +cw=c0 +ntotal=0 +nrejected=0 + +if(ndeep.eq.0) goto 998 ! norder=0 +if(ndeep.gt.5) ndeep=5 +if( ndeep.eq. 1) then + nord=1 + npre1=0 + npre2=0 + nt=40 + ntheta=12 +elseif(ndeep.eq.2) then + nord=1 + npre1=1 + npre2=0 + nt=40 + ntheta=12 +elseif(ndeep.eq.3) then + nord=1 + npre1=1 + npre2=1 + nt=40 + ntheta=12 + ntau=14 +elseif(ndeep.eq.4) then + nord=2 + npre1=1 + npre2=0 + nt=40 + ntheta=12 + ntau=19 +elseif(ndeep.eq.5) then + nord=2 + npre1=1 + npre2=1 + nt=40 + ntheta=12 + ntau=19 +endif + +do iorder=1,nord + misub(1:K-iorder)=0 + misub(K-iorder+1:K)=1 + iflag=K-iorder+1 + do while(iflag .ge.0) + if(iorder.eq.nord .and. npre1.eq.0) then + iend=iflag + else + iend=1 + endif + do n1=iflag,iend,-1 + mi=misub + mi(n1)=1 + if(any(iand(apmaskr(1:K),mi).eq.1)) cycle + ntotal=ntotal+1 + me=ieor(m0,mi) + if(n1.eq.iflag) then + call mrbencodevar(me,ce,g2,N,K) + e2sub=ieor(ce(K+1:N),hdec(K+1:N)) + e2=e2sub + nd1Kpt=sum(e2sub(1:nt))+1 + d1=sum(ieor(me(1:K),hdec(1:K))*absrx(1:K)) + else + e2=ieor(e2sub,g2(K+1:N,n1)) + nd1Kpt=sum(e2(1:nt))+2 + endif + if(nd1Kpt .le. ntheta) then + call mrbencodevar(me,ce,g2,N,K) + nxor=ieor(ce,hdec) + if(n1.eq.iflag) then + dd=d1+sum(e2sub*absrx(K+1:N)) + else + dd=d1+ieor(ce(n1),hdec(n1))*absrx(n1)+sum(e2*absrx(K+1:N)) + endif + if( dd .lt. dmin ) then + dmin=dd + cw=ce + nhardmin=sum(nxor) + nd1Kptbest=nd1Kpt + endif + else + nrejected=nrejected+1 + endif + enddo +! Get the next test error pattern, iflag will go negative +! when the last pattern with weight iorder has been generated. + call nextpatvar(misub,k,iorder,iflag) + enddo +enddo + +if(npre2.eq.1) then + allocate(indexes(4000,2), STAT = nAllocateStatus1) + if (nAllocateStatus1 .ne. 0) STOP "Not enough memory" + allocate(fp(0:525000), STAT = nAllocateStatus1) + if (nAllocateStatus1 .ne. 0) STOP "Not enough memory" + allocate(np(4000), STAT = nAllocateStatus1) + if (nAllocateStatus1 .ne. 0) STOP "Not enough memory" + reset=.true. + ntotal=0 + do i1=K,1,-1 + do i2=i1-1,1,-1 + ntotal=ntotal+1 + mi(1:ntau)=ieor(g2(K+1:K+ntau,i1),g2(K+1:K+ntau,i2)) + call boxitvar(indexes,fp,np,reset,mi(1:ntau),ntau,ntotal,i1,i2) + enddo + enddo + + ncount2=0 + ntotal2=0 + reset=.true. +! Now run through again and do the second pre-processing rule + misub(1:K-nord)=0 + misub(K-nord+1:K)=1 + iflag=K-nord+1 + do while(iflag .ge.0) + me=ieor(m0,misub) + call mrbencodevar(me,ce,g2,N,K) + e2sub=ieor(ce(K+1:N),hdec(K+1:N)) + do i2=0,ntau + ntotal2=ntotal2+1 + ui=0 + if(i2.gt.0) ui(i2)=1 + r2pat=ieor(e2sub,ui) +778 continue + call fetchitvar(indexes,fp,np,reset,r2pat(1:ntau),ntau,in1,in2,nthr) + if(in1.gt.0.and.in2.gt.0) then + ncount2=ncount2+1 + mi=misub + mi(in1)=1 + mi(in2)=1 + if(sum(mi).lt.nord+npre1+npre2.or.any(iand(apmaskr(1:K),mi).eq.1)) cycle + me=ieor(m0,mi) + call mrbencodevar(me,ce,g2,N,K) + nxor=ieor(ce,hdec) + dd=sum(nxor*absrx) + if( dd .lt. dmin ) then + dmin=dd + cw=ce + nhardmin=sum(nxor) + endif + goto 778 + endif + enddo + call nextpatvar(misub,K,nord,iflag) + enddo + deallocate (indexes, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + deallocate (fp, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + deallocate (np, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' +endif + +998 continue +! Re-order the codeword to place message bits at the end. +cw(indices)=cw +hdec(indices)=hdec +decoded=cw(M+1:N) +cw(colorder+1)=cw ! put the codeword back into received-word order +return +end subroutine osd174var + +subroutine mrbencodevar(me,codeword,g2,N,K) +integer*1 me(K),codeword(N),g2(N,K) +! fast encoding for low-weight test patterns + codeword=0 + do i=1,K + if( me(i) .eq. 1 ) then + codeword=ieor(codeword,g2(1:N,i)) + endif + enddo +return +end subroutine mrbencodevar + +subroutine nextpatvar(mi,k,iorder,iflag) + integer*1 mi(k),ms(k) +! generate the next test error pattern + ind=-1 + do i=1,k-1 + if( mi(i).eq.0 .and. mi(i+1).eq.1) ind=i + enddo + if( ind .lt. 0 ) then ! no more patterns of this order + iflag=ind + return + endif + ms=0 + ms(1:ind-1)=mi(1:ind-1) + ms(ind)=1 + ms(ind+1)=0 + if( ind+1 .lt. k ) then + nz=iorder-sum(ms) + ms(k-nz+1:k)=1 + endif + mi=ms + do i=1,k ! iflag will point to the lowest-index 1 in mi + if(mi(i).eq.1) then + iflag=i + exit + endif + enddo + return +end subroutine nextpatvar + +subroutine boxitvar(indexes,fp,np,reset,e2,ntau,npindex,i1,i2) + integer indexes(:,:),fp(0:),np(:) + integer*1 e2(1:ntau) + logical reset + + if(reset) then + patterns=-1 + fp=-1 + np=-1 + sc=-1 + indexes=-1 + reset=.false. + endif + + indexes(npindex,1)=i1 + indexes(npindex,2)=i2 + ipat=0 + do i=1,ntau + if(e2(i).eq.1) then + ipat=ipat+ishft(1,ntau-i) + endif + enddo + + ip=fp(ipat) ! see what's currently stored in fp(ipat) + if(ip.eq.-1) then + fp(ipat)=npindex + else + do while (np(ip).ne.-1) + ip=np(ip) + enddo + np(ip)=npindex + endif + return +end subroutine boxitvar + +subroutine fetchitvar(indexes,fp,np,reset,e2,ntau,i1,i2,nthr) + integer indexes(:,:),fp(0:),np(:) + integer lastpat(36),inext(36) ! up to 36 threads in FT8 decoding + integer*1 e2(1:ntau) + logical reset + save lastpat,inext + + if(reset) then + lastpat(nthr)=-1 + reset=.false. + endif + + ipat=0 + do i=1,ntau + if(e2(i).eq.1) then + ipat=ipat+ishft(1,ntau-i) + endif + enddo + index=fp(ipat) + + if(lastpat(nthr).ne.ipat .and. index.gt.0) then ! return first set of indices + i1=indexes(index,1) + i2=indexes(index,2) + inext(nthr)=np(index) + elseif(lastpat(nthr).eq.ipat .and. inext(nthr).gt.0) then + i1=indexes(inext(nthr),1) + i2=indexes(inext(nthr),2) + inext(nthr)=np(inext(nthr)) + else + i1=-1 + i2=-1 + inext(nthr)=-1 + endif + lastpat(nthr)=ipat + + return +end subroutine fetchitvar + diff --git a/lib/ft8var/packjt77sdvar.f90 b/lib/ft8var/packjt77sdvar.f90 index a55a7015..5d02407c 100755..100644 --- a/lib/ft8var/packjt77sdvar.f90 +++ b/lib/ft8var/packjt77sdvar.f90 @@ -1,558 +1,558 @@ -
-module packjt77sdvar
-
-! These variables are accessible from outside via "use packjt77sdvar":
-! integer n28a,n28b
-
- contains
-
-subroutine pack77sdvar(msg0,i3,n3,c77)
-
- use packjt
- character*37 msg,msg0
- character*13 w(19)
- character*77 c77
- integer nw(19)
-
- msg=msg0
-
-! Convert msg to upper case; collapse multiple blanks; parse into words.
- call split77var(msg,nwords,nw,w)
- i3=-1
- n3=-1
- if(msg(1:3).eq.'CQ ' .or. msg(1:3).eq.'DE ' .or. msg(1:4).eq.'QRZ ') go to 100
-
-! Check Type 1 (Standard 77-bit message) or Type 2, with optional "/P"
-100 call pack77_1var(nwords,w,i3,n3,c77)
- if(i3.ge.0) go to 900
-
-! It defaults to free text
- i3=0
- n3=0
- msg(14:)=' '
- call packtext77var(msg(1:13),c77(1:71))
- write(c77(72:77),'(2b3.3)') n3,i3
-
-900 return
-end subroutine pack77sdvar
-
-subroutine unpack77sdvar(c77,msg,unpk77_success)
-
- parameter (MAXGRID4=32400)
- integer*8 n58
- character*77 c77*77,msg*37,c*38,call_1*13,call_2*13,c11*11,grid4*4,crpt*3
- logical unpk28_success,unpk77_success
-
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/
-
- unpk77_success=.true.
-
-! Check for bad data
- do i=1,77
- if(c77(i:i).ne.'0' .and. c77(i:i).ne.'1') then
- msg='failed unpack'
- unpk77_success=.false.
- return
- endif
- enddo
-
- read(c77(72:77),'(2b3)') n3,i3
- msg=repeat(' ',37)
- if(i3.eq.0 .and. n3.eq.0) then
-! 0.0 Free text
- call unpacktext77var(c77(1:71),msg(1:13))
- msg(14:)=' '
- msg=adjustl(msg)
-
- else if(i3.eq.1 .or. i3.eq.2) then
-! Type 1 (standard message) or Type 2 ("/P" form for EU VHF contest)
- read(c77,1000) n28a,ipa,n28b,ipb,ir,igrid4,i3
-1000 format(2(b28,b1),b1,b15,b3)
- call unpack28var(n28a,call_1,unpk28_success)
- if(.not.unpk28_success) unpk77_success=.false.
- call unpack28var(n28b,call_2,unpk28_success)
- if(.not.unpk28_success) unpk77_success=.false.
- if(call_1(1:3).eq.'CQ_') call_1(3:3)=' '
- if(index(call_1,'<').le.0) then
- i=index(call_1,' ')
- if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.1) call_1(i:i+1)='/R'
- if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.2) call_1(i:i+1)='/P'
- endif
- if(index(call_2,'<').le.0) then
- i=index(call_2,' ')
- if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.1) call_2(i:i+1)='/R'
- if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.2) call_2(i:i+1)='/P'
- endif
- if(igrid4.le.MAXGRID4) then
- n=igrid4
- j1=n/(18*10*10)
- n=n-j1*18*10*10
- j2=n/(10*10)
- n=n-j2*10*10
- j3=n/10
- j4=n-j3*10
- grid4(1:1)=char(j1+ichar('A'))
- grid4(2:2)=char(j2+ichar('A'))
- grid4(3:3)=char(j3+ichar('0'))
- grid4(4:4)=char(j4+ichar('0'))
- if(ir.eq.0) msg=trim(call_1)//' '//trim(call_2)//' '//grid4
- if(ir.eq.1) msg=trim(call_1)//' '//trim(call_2)//' R '//grid4
- if(msg(1:3).eq.'CQ ' .and. ir.eq.1) unpk77_success=.false.
- else
- irpt=igrid4-MAXGRID4
- if(irpt.eq.1) msg=trim(call_1)//' '//trim(call_2)
- if(irpt.eq.2) msg=trim(call_1)//' '//trim(call_2)//' RRR'
- if(irpt.eq.3) msg=trim(call_1)//' '//trim(call_2)//' RR73'
- if(irpt.eq.4) msg=trim(call_1)//' '//trim(call_2)//' 73'
- if(irpt.ge.5) then
- write(crpt,'(i3.2)') irpt-35
- if(crpt(1:1).eq.' ') crpt(1:1)='+'
- if(ir.eq.0) msg=trim(call_1)//' '//trim(call_2)//' '//crpt
- if(ir.eq.1) msg=trim(call_1)//' '//trim(call_2)//' R'//crpt
- endif
- if(msg(1:3).eq.'CQ ' .and. irpt.ge.2) unpk77_success=.false.
- endif
-
- else if(i3.eq.4) then
- read(c77,1050) n12,n58,iflip,nrpt,icq
-1050 format(b12,b58,b1,b2,b1)
- if(icq.eq.1) then
- do i=11,1,-1
- j=mod(n58,38)+1
- c11(i:i)=c(j:j)
- n58=n58/38
- enddo
- call_2=adjustl(c11)//' '
- msg='CQ '//trim(call_2)
- if(msg(1:4).eq.'CQ <') unpk77_success=.false.
- else
- unpk77_success=.false.
- endif
- endif
-
- return
-end subroutine unpack77sdvar
-
-subroutine pack28var(c13,n28)
-
-! Pack a special token, a 22-bit hash code, or a valid base call into a 28-bit
-! integer.
-
- parameter (NTOKENS=2063592,MAX22=4194304)
- logical is_digit,is_letter
- character*13 c13
- character*6 callsign
- character*1 c
- character*4 c4
- character*37 a1
- character*36 a2
- character*10 a3
- character*27 a4
- data a1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data a2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data a3/'0123456789'/
- data a4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
-
- is_digit(c)=c.ge.'0' .and. c.le.'9'
- is_letter(c)=c.ge.'A' .and. c.le.'Z'
-
- n28=-1
-! Work-around for Swaziland prefix:
- if(c13(1:4).eq.'3DA0') callsign='3D0'//c13(5:7)
-! Work-around for Guinea prefixes:
- if(c13(1:2).eq.'3X' .and. c13(3:3).ge.'A' .and. &
- c13(3:3).le.'Z') callsign='Q'//c13(3:6)
-
-! Check for special tokens first
- if(c13(1:3).eq.'DE ') then
- n28=0
- go to 900
- endif
-
- if(c13(1:4).eq.'QRZ ') then
- n28=1
- go to 900
- endif
-
- if(c13(1:3).eq.'CQ ') then
- n28=2
- go to 900
- endif
-
- if(c13(1:3).eq.'CQ_') then
- n=len(trim(c13))
- if(n.ge.4 .and. n.le.7) then
- nlet=0
- nnum=0
- do i=4,n
- c=c13(i:i)
- if(c.ge.'A' .and. c.le.'Z') nlet=nlet+1
- if(c.ge.'0' .and. c.le.'9') nnum=nnum+1
- enddo
- if(nnum.eq.3 .and. nlet.eq.0) then
- read(c13(4:3+nnum),*) nqsy
- n28=3+nqsy
- go to 900
- endif
- if(nlet.ge.1 .and. nlet.le.4 .and. nnum.eq.0) then
- c4=c13(4:n)
- c4=adjustr(c4)
- m=0
- do i=1,4
- j=0
- c=c4(i:i)
- if(c.ge.'A' .and. c.le.'Z') j=ichar(c)-ichar('A')+1
- m=27*m + j
- enddo
- n28=3+1000+m
- go to 900
- endif
- endif
- endif
-
-! Check for standard callsign
- iarea=-1
- n=len(trim(c13))
- do i=n,2,-1
- if(is_digit(c13(i:i))) exit
- enddo
- iarea=i !Call-area digit
- npdig=0 !Digits before call area
- nplet=0 !Letters before call area
- do i=1,iarea-1
- if(is_digit(c13(i:i))) npdig=npdig+1
- if(is_letter(c13(i:i))) nplet=nplet+1
- enddo
- nslet=0
- do i=iarea+1,n
- if(is_letter(c13(i:i))) nslet=nslet+1
- enddo
-
- n=len(trim(c13))
-! This is a standard callsign
- if(iarea.eq.2) callsign=' '//c13(1:5)
- if(iarea.eq.3) callsign=c13(1:6)
- i1=index(a1,callsign(1:1))-1
- i2=index(a2,callsign(2:2))-1
- i3=index(a3,callsign(3:3))-1
- i4=index(a4,callsign(4:4))-1
- i5=index(a4,callsign(5:5))-1
- i6=index(a4,callsign(6:6))-1
- n28=36*10*27*27*27*i1 + 10*27*27*27*i2 + 27*27*27*i3 + 27*27*i4 + &
- 27*i5 + i6
- n28=n28 + NTOKENS + MAX22
-
-900 n28=iand(n28,ishft(1,28)-1)
- return
-end subroutine pack28var
-
-
-subroutine unpack28var(n28_0,c13,success)
-
- parameter (NTOKENS=2063592,MAX22=4194304)
- logical success
- character*13 c13
- character*37 c1
- character*36 c2
- character*10 c3
- character*27 c4
- data c1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data c2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data c3/'0123456789'/
- data c4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
-
- success=.true.
- n28=n28_0
- if(n28.lt.NTOKENS) then
-! Special tokens DE, QRZ, CQ, CQ_nnn, CQ_aaaa
- if(n28.eq.0) c13='DE '
- if(n28.eq.1) c13='QRZ '
- if(n28.eq.2) c13='CQ '
- if(n28.le.2) go to 900
- if(n28.le.1002) then
- write(c13,1002) n28-3
-1002 format('CQ_',i3.3)
- go to 900
- endif
- if(n28.le.532443) then
- n=n28-1003
- n0=n
- i1=n/(27*27*27)
- n=n-27*27*27*i1
- i2=n/(27*27)
- n=n-27*27*i2
- i3=n/27
- i4=n-27*i3
- c13=c4(i1+1:i1+1)//c4(i2+1:i2+1)//c4(i3+1:i3+1)//c4(i4+1:i4+1)
- c13=adjustl(c13)
- c13='CQ_'//c13(1:10)
- go to 900
- endif
- endif
- n28=n28-NTOKENS
-
-! Standard callsign
- n=n28 - MAX22
- i1=n/(36*10*27*27*27)
- n=n-36*10*27*27*27*i1
- i2=n/(10*27*27*27)
- n=n-10*27*27*27*i2
- i3=n/(27*27*27)
- n=n-27*27*27*i3
- i4=n/(27*27)
- n=n-27*27*i4
- i5=n/27
- i6=n-27*i5
- c13=c1(i1+1:i1+1)//c2(i2+1:i2+1)//c3(i3+1:i3+1)//c4(i4+1:i4+1)// &
- c4(i5+1:i5+1)//c4(i6+1:i6+1)
- c13=adjustl(c13)
-
-900 i0=index(c13,' ')
- if(i0.ne.0 .and. i0.lt.len(trim(c13))) then
- c13='QU1RK'
- success=.false.
- endif
- return
-end subroutine unpack28var
-
-subroutine split77var(msg,nwords,nw,w)
-
-! Convert msg to upper case; collapse multiple blanks; parse into words.
-
- character*37 msg
- character*13 w(19)
- character*1 c,c0
- character*6 bcall_1
- logical ok1
- integer nw(19)
-
- iz=len(trim(msg))
- j=0
- k=0
- n=0
- c0=' '
- w=' '
- do i=1,iz
- if(ichar(msg(i:i)).eq.0) msg(i:i)=' '
- c=msg(i:i) !Single character
- if(c.eq.' ' .and. c0.eq.' ') cycle !Skip leading/repeated blanks
- if(c.ne.' ' .and. c0.eq.' ') then
- k=k+1 !New word
- n=0
- endif
- j=j+1 !Index in msg
- n=n+1 !Index in word
- if(c.ge.'a' .and. c.le.'z') c=char(ichar(c)-32) !Force upper case
- msg(j:j)=c
- if(n.le.13) w(k)(n:n)=c !Copy character c into word
- c0=c
- enddo
- iz=j !Message length
- nwords=k !Number of words in msg
- if(nwords.le.0) go to 900
- nw(k)=len(trim(w(k)))
- msg(iz+1:)=' '
- if(nwords.lt.3) go to 900
- call chkcall(w(3),bcall_1,ok1)
- if(ok1 .and. w(1)(1:3).eq.'CQ ') then
- w(1)='CQ_'//w(2)(1:10) !Make "CQ " into "CQ_"
- w(2:12)=w(3:13) !Move all remeining words down by one
- nwords=nwords-1
- endif
-
-900 return
-end subroutine split77var
-
-subroutine pack77_1var(nwords,w,i3,n3,c77)
-! Check Type 1 (Standard 77-bit message) and Type 2 (ditto, with a "/P" call)
-
- parameter (MAXGRID4=32400)
- character*13 w(19),c13
- character*77 c77
- character*6 bcall_1,bcall_2
- character*4 grid4
- character c1*1,c2*2
- logical is_grid4
- logical ok1,ok2
- is_grid4(grid4)=len(trim(grid4)).eq.4 .and. &
- grid4(1:1).ge.'A' .and. grid4(1:1).le.'R' .and. &
- grid4(2:2).ge.'A' .and. grid4(2:2).le.'R' .and. &
- grid4(3:3).ge.'0' .and. grid4(3:3).le.'9' .and. &
- grid4(4:4).ge.'0' .and. grid4(4:4).le.'9'
-
- if(nwords.lt.2 .or. nwords.gt.4) return
- call chkcall(w(1),bcall_1,ok1)
- call chkcall(w(2),bcall_2,ok2)
- if(w(1)(1:3).eq.'DE ' .or. w(1)(1:3).eq.'CQ_' .or. w(1)(1:3).eq.'CQ ' .or. &
- w(1)(1:4).eq.'QRZ ') ok1=.true.
- if(w(1)(1:1).eq.'<' .and. index(w(1),'>').ge.5) ok1=.true.
- if(w(2)(1:1).eq.'<' .and. index(w(2),'>').ge.5) ok2=.true.
- if(.not.ok1 .or. .not.ok2) return
- if(w(1)(1:1).eq.'<' .and. index(w(2),'/').gt.0) return
- if(w(2)(1:1).eq.'<' .and. index(w(1),'/').gt.0) return
- if(nwords.eq.2 .and. (.not.ok2 .or. index(w(2),'/').ge.2)) return
- if(nwords.eq.2) go to 10
-
- c1=w(nwords)(1:1)
- c2=w(nwords)(1:2)
- if(.not.is_grid4(w(nwords)(1:4)) .and. c1.ne.'+' .and. c1.ne.'-' &
- .and. c2.ne.'R+' .and. c2.ne.'R-' .and. trim(w(nwords)).ne.'RRR' .and. &
- trim(w(nwords)).ne.'RR73' .and. trim(w(nwords)).ne.'73') return
- if(c1.eq.'+' .or. c1.eq.'-') then
- ir=0
- read(w(nwords),*,err=900) irpt
- irpt=irpt+35
- else if(c2.eq.'R+' .or. c2.eq.'R-') then
- ir=1
- read(w(nwords)(2:),*) irpt
- irpt=irpt+35
- else if(trim(w(nwords)).eq.'RRR') then
- ir=0
- irpt=2
- else if(trim(w(nwords)).eq.'RR73') then
- ir=0
- irpt=3
- else if(trim(w(nwords)).eq.'73') then
- ir=0
- irpt=4
- endif
-
-! 1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg
-! 2 PA3XYZ/P GM4ABC/P R JO22 28 1 28 1 1 15 74 EU VHF contest
-
-10 i1psuffix=index(w(1)//' ' ,'/P ')
- i2psuffix=index(w(2)//' ','/P ')
- if(nwords.eq.2 .or. nwords.eq.3 .or. (nwords.eq.4 .and. &
- w(3)(1:2).eq.'R ')) then
- n3=0
- i3=1 !Type 1: Standard message, possibly with "/R"
- if (i1psuffix.ge.4.or.i2psuffix.ge.4) i3=2 !Type 2, with "/P"
- endif
- c13=bcall_1
- if(c13(1:3).eq.'CQ_' .or. w(1)(1:1).eq.'<') c13=w(1)
- call pack28var(c13,n28a)
- c13=bcall_2
- if(w(2)(1:1).eq.'<') c13=w(2)
- call pack28var(c13,n28b)
- ipa=0
- ipb=0
- if(i1psuffix.ge.4.or.index(w(1)//' ','/R ').ge.4) ipa=1
- if(i2psuffix.ge.4.or.index(w(2)//' ','/R ').ge.4) ipb=1
-
- grid4=w(nwords)(1:4)
- if(is_grid4(grid4)) then
- ir=0
- if(w(3).eq.'R ') ir=1
- j1=(ichar(grid4(1:1))-ichar('A'))*18*10*10
- j2=(ichar(grid4(2:2))-ichar('A'))*10*10
- j3=(ichar(grid4(3:3))-ichar('0'))*10
- j4=(ichar(grid4(4:4))-ichar('0'))
- igrid4=j1+j2+j3+j4
- else
- igrid4=MAXGRID4 + irpt
- endif
- if(nwords.eq.2) then
- ir=0
- irpt=1
- igrid4=MAXGRID4+irpt
- endif
- write(c77,1000) n28a,ipa,n28b,ipb,ir,igrid4,i3
-1000 format(2(b28.28,b1),b1,b15.15,b3.3)
- return
-
-900 return
-end subroutine pack77_1var
-
-subroutine packtext77var(c13,c71)
-
- character*13 c13,w
- character*71 c71
- character*42 c
- character*1 qa(10),qb(10)
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?'/
-
- call mp_short_init
- qa=char(0)
- w=adjustr(c13)
- do i=1,13
- j=index(c,w(i:i))-1
- if(j.lt.0) j=0
- call mp_short_mult(qb,qa(2:10),9,42) !qb(1:9)=42*qa(2:9)
- call mp_short_add(qa,qb(2:10),9,j) !qa(1:9)=qb(2:9)+j
- enddo
-
- write(c71,1010) qa(2:10)
-1010 format(b7.7,8b8.8)
-
- return
-end subroutine packtext77var
-
-subroutine unpacktext77var(c71,c13)
-
- integer*1 ia(10)
- character*1 qa(10),qb(10)
- character*13 c13
- character*71 c71
- character*42 c
- equivalence (qa,ia),(qb,ib)
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?'/
-
- qa(1)=char(0)
- read(c71,1010) qa(2:10)
-1010 format(b7.7,8b8.8)
-
- do i=13,1,-1
- call mp_short_div(qb,qa(2:10),9,42,ir)
- c13(i:i)=c(ir+1:ir+1)
- qa(2:10)=qb(1:9)
- enddo
-
- return
-end subroutine unpacktext77var
-
-subroutine mp_short_opsvar(w,u)
- character*1 w(*),u(*)
- integer i,ireg,j,n,ir,iv,ii1,ii2
- character*1 creg(4)
- save ii1,ii2
- equivalence (ireg,creg)
-
- entry mp_short_init
- ireg=256*ichar('2')+ichar('1')
- do j=1,4
- if (creg(j).eq.'1') ii1=j
- if (creg(j).eq.'2') ii2=j
- enddo
- return
-
- entry mp_short_add(w,u,n,iv)
- ireg=256*iv
- do j=n,1,-1
- ireg=ichar(u(j))+ichar(creg(ii2))
- w(j+1)=creg(ii1)
- enddo
- w(1)=creg(ii2)
- return
-
- entry mp_short_mult(w,u,n,iv)
- ireg=0
- do j=n,1,-1
- ireg=ichar(u(j))*iv+ichar(creg(ii2))
- w(j+1)=creg(ii1)
- enddo
- w(1)=creg(ii2)
- return
-
- entry mp_short_div(w,u,n,iv,ir)
- ir=0
- do j=1,n
- i=256*ir+ichar(u(j))
- w(j)=char(i/iv)
- ir=mod(i,iv)
- enddo
- return
-
- return
-end subroutine mp_short_opsvar
-
-end module packjt77sdvar
+ +module packjt77sdvar + +! These variables are accessible from outside via "use packjt77sdvar": +! integer n28avar,n28bvar + + contains + +subroutine pack77sdvar(msg0,i3,n3,c77) + + use packjt + character*37 msg,msg0 + character*13 w(19) + character*77 c77 + integer nw(19) + + msg=msg0 + +! Convert msg to upper case; collapse multiple blanks; parse into words. + call split77var(msg,nwords,nw,w) + i3=-1 + n3=-1 + if(msg(1:3).eq.'CQ ' .or. msg(1:3).eq.'DE ' .or. msg(1:4).eq.'QRZ ') go to 100 + +! Check Type 1 (Standard 77-bit message) or Type 2, with optional "/P" +100 call pack77_1var(nwords,w,i3,n3,c77) + if(i3.ge.0) go to 900 + +! It defaults to free text + i3=0 + n3=0 + msg(14:)=' ' + call packtext77var(msg(1:13),c77(1:71)) + write(c77(72:77),'(2b3.3)') n3,i3 + +900 return +end subroutine pack77sdvar + +subroutine unpack77sdvar(c77,msg,unpk77_successvar) + + parameter (MAXGRID4=32400) + integer*8 n58 + character*77 c77*77,msg*37,c*38,call_1*13,call_2*13,c11*11,grid4*4,crpt*3 + logical unpk28_success,unpk77_successvar + + data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/ + + unpk77_successvar=.true. + +! Check for bad data + do i=1,77 + if(c77(i:i).ne.'0' .and. c77(i:i).ne.'1') then + msg='failed unpack' + unpk77_successvar=.false. + return + endif + enddo + + read(c77(72:77),'(2b3)') n3,i3 + msg=repeat(' ',37) + if(i3.eq.0 .and. n3.eq.0) then +! 0.0 Free text + call unpacktext77var(c77(1:71),msg(1:13)) + msg(14:)=' ' + msg=adjustl(msg) + + else if(i3.eq.1 .or. i3.eq.2) then +! Type 1 (standard message) or Type 2 ("/P" form for EU VHF contest) + read(c77,1000) n28avar,ipa,n28bvar,ipb,ir,igrid4,i3 +1000 format(2(b28,b1),b1,b15,b3) + call unpack28var(n28avar,call_1,unpk28_success) + if(.not.unpk28_success) unpk77_successvar=.false. + call unpack28var(n28bvar,call_2,unpk28_success) + if(.not.unpk28_success) unpk77_successvar=.false. + if(call_1(1:3).eq.'CQ_') call_1(3:3)=' ' + if(index(call_1,'<').le.0) then + i=index(call_1,' ') + if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.1) call_1(i:i+1)='/R' + if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.2) call_1(i:i+1)='/P' + endif + if(index(call_2,'<').le.0) then + i=index(call_2,' ') + if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.1) call_2(i:i+1)='/R' + if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.2) call_2(i:i+1)='/P' + endif + if(igrid4.le.MAXGRID4) then + n=igrid4 + j1=n/(18*10*10) + n=n-j1*18*10*10 + j2=n/(10*10) + n=n-j2*10*10 + j3=n/10 + j4=n-j3*10 + grid4(1:1)=char(j1+ichar('A')) + grid4(2:2)=char(j2+ichar('A')) + grid4(3:3)=char(j3+ichar('0')) + grid4(4:4)=char(j4+ichar('0')) + if(ir.eq.0) msg=trim(call_1)//' '//trim(call_2)//' '//grid4 + if(ir.eq.1) msg=trim(call_1)//' '//trim(call_2)//' R '//grid4 + if(msg(1:3).eq.'CQ ' .and. ir.eq.1) unpk77_successvar=.false. + else + irpt=igrid4-MAXGRID4 + if(irpt.eq.1) msg=trim(call_1)//' '//trim(call_2) + if(irpt.eq.2) msg=trim(call_1)//' '//trim(call_2)//' RRR' + if(irpt.eq.3) msg=trim(call_1)//' '//trim(call_2)//' RR73' + if(irpt.eq.4) msg=trim(call_1)//' '//trim(call_2)//' 73' + if(irpt.ge.5) then + write(crpt,'(i3.2)') irpt-35 + if(crpt(1:1).eq.' ') crpt(1:1)='+' + if(ir.eq.0) msg=trim(call_1)//' '//trim(call_2)//' '//crpt + if(ir.eq.1) msg=trim(call_1)//' '//trim(call_2)//' R'//crpt + endif + if(msg(1:3).eq.'CQ ' .and. irpt.ge.2) unpk77_successvar=.false. + endif + + else if(i3.eq.4) then + read(c77,1050) n12,n58,iflip,nrpt,icq +1050 format(b12,b58,b1,b2,b1) + if(icq.eq.1) then + do i=11,1,-1 + j=mod(n58,38)+1 + c11(i:i)=c(j:j) + n58=n58/38 + enddo + call_2=adjustl(c11)//' ' + msg='CQ '//trim(call_2) + if(msg(1:4).eq.'CQ <') unpk77_successvar=.false. + else + unpk77_successvar=.false. + endif + endif + + return +end subroutine unpack77sdvar + +subroutine pack28var(c13,n28) + +! Pack a special token, a 22-bit hash code, or a valid base call into a 28-bit +! integer. + + parameter (NTOKENS=2063592,MAX22=4194304) + logical is_digit,is_letter + character*13 c13 + character*6 callsign + character*1 c + character*4 c4 + character*37 a1 + character*36 a2 + character*10 a3 + character*27 a4 + data a1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ + data a2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ + data a3/'0123456789'/ + data a4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ + + is_digit(c)=c.ge.'0' .and. c.le.'9' + is_letter(c)=c.ge.'A' .and. c.le.'Z' + + n28=-1 +! Work-around for Swaziland prefix: + if(c13(1:4).eq.'3DA0') callsign='3D0'//c13(5:7) +! Work-around for Guinea prefixes: + if(c13(1:2).eq.'3X' .and. c13(3:3).ge.'A' .and. & + c13(3:3).le.'Z') callsign='Q'//c13(3:6) + +! Check for special tokens first + if(c13(1:3).eq.'DE ') then + n28=0 + go to 900 + endif + + if(c13(1:4).eq.'QRZ ') then + n28=1 + go to 900 + endif + + if(c13(1:3).eq.'CQ ') then + n28=2 + go to 900 + endif + + if(c13(1:3).eq.'CQ_') then + n=len(trim(c13)) + if(n.ge.4 .and. n.le.7) then + nlet=0 + nnum=0 + do i=4,n + c=c13(i:i) + if(c.ge.'A' .and. c.le.'Z') nlet=nlet+1 + if(c.ge.'0' .and. c.le.'9') nnum=nnum+1 + enddo + if(nnum.eq.3 .and. nlet.eq.0) then + read(c13(4:3+nnum),*) nqsy + n28=3+nqsy + go to 900 + endif + if(nlet.ge.1 .and. nlet.le.4 .and. nnum.eq.0) then + c4=c13(4:n) + c4=adjustr(c4) + m=0 + do i=1,4 + j=0 + c=c4(i:i) + if(c.ge.'A' .and. c.le.'Z') j=ichar(c)-ichar('A')+1 + m=27*m + j + enddo + n28=3+1000+m + go to 900 + endif + endif + endif + +! Check for standard callsign + iarea=-1 + n=len(trim(c13)) + do i=n,2,-1 + if(is_digit(c13(i:i))) exit + enddo + iarea=i !Call-area digit + npdig=0 !Digits before call area + nplet=0 !Letters before call area + do i=1,iarea-1 + if(is_digit(c13(i:i))) npdig=npdig+1 + if(is_letter(c13(i:i))) nplet=nplet+1 + enddo + nslet=0 + do i=iarea+1,n + if(is_letter(c13(i:i))) nslet=nslet+1 + enddo + + n=len(trim(c13)) +! This is a standard callsign + if(iarea.eq.2) callsign=' '//c13(1:5) + if(iarea.eq.3) callsign=c13(1:6) + i1=index(a1,callsign(1:1))-1 + i2=index(a2,callsign(2:2))-1 + i3=index(a3,callsign(3:3))-1 + i4=index(a4,callsign(4:4))-1 + i5=index(a4,callsign(5:5))-1 + i6=index(a4,callsign(6:6))-1 + n28=36*10*27*27*27*i1 + 10*27*27*27*i2 + 27*27*27*i3 + 27*27*i4 + & + 27*i5 + i6 + n28=n28 + NTOKENS + MAX22 + +900 n28=iand(n28,ishft(1,28)-1) + return +end subroutine pack28var + + +subroutine unpack28var(n28_0,c13,success) + + parameter (NTOKENS=2063592,MAX22=4194304) + logical success + character*13 c13 + character*37 c1 + character*36 c2 + character*10 c3 + character*27 c4 + data c1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ + data c2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ + data c3/'0123456789'/ + data c4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ + + success=.true. + n28=n28_0 + if(n28.lt.NTOKENS) then +! Special tokens DE, QRZ, CQ, CQ_nnn, CQ_aaaa + if(n28.eq.0) c13='DE ' + if(n28.eq.1) c13='QRZ ' + if(n28.eq.2) c13='CQ ' + if(n28.le.2) go to 900 + if(n28.le.1002) then + write(c13,1002) n28-3 +1002 format('CQ_',i3.3) + go to 900 + endif + if(n28.le.532443) then + n=n28-1003 + n0=n + i1=n/(27*27*27) + n=n-27*27*27*i1 + i2=n/(27*27) + n=n-27*27*i2 + i3=n/27 + i4=n-27*i3 + c13=c4(i1+1:i1+1)//c4(i2+1:i2+1)//c4(i3+1:i3+1)//c4(i4+1:i4+1) + c13=adjustl(c13) + c13='CQ_'//c13(1:10) + go to 900 + endif + endif + n28=n28-NTOKENS + +! Standard callsign + n=n28 - MAX22 + i1=n/(36*10*27*27*27) + n=n-36*10*27*27*27*i1 + i2=n/(10*27*27*27) + n=n-10*27*27*27*i2 + i3=n/(27*27*27) + n=n-27*27*27*i3 + i4=n/(27*27) + n=n-27*27*i4 + i5=n/27 + i6=n-27*i5 + c13=c1(i1+1:i1+1)//c2(i2+1:i2+1)//c3(i3+1:i3+1)//c4(i4+1:i4+1)// & + c4(i5+1:i5+1)//c4(i6+1:i6+1) + c13=adjustl(c13) + +900 i0=index(c13,' ') + if(i0.ne.0 .and. i0.lt.len(trim(c13))) then + c13='QU1RK' + success=.false. + endif + return +end subroutine unpack28var + +subroutine split77var(msg,nwords,nw,w) + +! Convert msg to upper case; collapse multiple blanks; parse into words. + + character*37 msg + character*13 w(19) + character*1 c,c0 + character*6 bcall_1 + logical ok1 + integer nw(19) + + iz=len(trim(msg)) + j=0 + k=0 + n=0 + c0=' ' + w=' ' + do i=1,iz + if(ichar(msg(i:i)).eq.0) msg(i:i)=' ' + c=msg(i:i) !Single character + if(c.eq.' ' .and. c0.eq.' ') cycle !Skip leading/repeated blanks + if(c.ne.' ' .and. c0.eq.' ') then + k=k+1 !New word + n=0 + endif + j=j+1 !Index in msg + n=n+1 !Index in word + if(c.ge.'a' .and. c.le.'z') c=char(ichar(c)-32) !Force upper case + msg(j:j)=c + if(n.le.13) w(k)(n:n)=c !Copy character c into word + c0=c + enddo + iz=j !Message length + nwords=k !Number of words in msg + if(nwords.le.0) go to 900 + nw(k)=len(trim(w(k))) + msg(iz+1:)=' ' + if(nwords.lt.3) go to 900 + call chkcall(w(3),bcall_1,ok1) + if(ok1 .and. w(1)(1:3).eq.'CQ ') then + w(1)='CQ_'//w(2)(1:10) !Make "CQ " into "CQ_" + w(2:12)=w(3:13) !Move all remeining words down by one + nwords=nwords-1 + endif + +900 return +end subroutine split77var + +subroutine pack77_1var(nwords,w,i3,n3,c77) +! Check Type 1 (Standard 77-bit message) and Type 2 (ditto, with a "/P" call) + + parameter (MAXGRID4=32400) + character*13 w(19),c13 + character*77 c77 + character*6 bcall_1,bcall_2 + character*4 grid4 + character c1*1,c2*2 + logical is_grid4 + logical ok1,ok2 + is_grid4(grid4)=len(trim(grid4)).eq.4 .and. & + grid4(1:1).ge.'A' .and. grid4(1:1).le.'R' .and. & + grid4(2:2).ge.'A' .and. grid4(2:2).le.'R' .and. & + grid4(3:3).ge.'0' .and. grid4(3:3).le.'9' .and. & + grid4(4:4).ge.'0' .and. grid4(4:4).le.'9' + + if(nwords.lt.2 .or. nwords.gt.4) return + call chkcall(w(1),bcall_1,ok1) + call chkcall(w(2),bcall_2,ok2) + if(w(1)(1:3).eq.'DE ' .or. w(1)(1:3).eq.'CQ_' .or. w(1)(1:3).eq.'CQ ' .or. & + w(1)(1:4).eq.'QRZ ') ok1=.true. + if(w(1)(1:1).eq.'<' .and. index(w(1),'>').ge.5) ok1=.true. + if(w(2)(1:1).eq.'<' .and. index(w(2),'>').ge.5) ok2=.true. + if(.not.ok1 .or. .not.ok2) return + if(w(1)(1:1).eq.'<' .and. index(w(2),'/').gt.0) return + if(w(2)(1:1).eq.'<' .and. index(w(1),'/').gt.0) return + if(nwords.eq.2 .and. (.not.ok2 .or. index(w(2),'/').ge.2)) return + if(nwords.eq.2) go to 10 + + c1=w(nwords)(1:1) + c2=w(nwords)(1:2) + if(.not.is_grid4(w(nwords)(1:4)) .and. c1.ne.'+' .and. c1.ne.'-' & + .and. c2.ne.'R+' .and. c2.ne.'R-' .and. trim(w(nwords)).ne.'RRR' .and. & + trim(w(nwords)).ne.'RR73' .and. trim(w(nwords)).ne.'73') return + if(c1.eq.'+' .or. c1.eq.'-') then + ir=0 + read(w(nwords),*,err=900) irpt + irpt=irpt+35 + else if(c2.eq.'R+' .or. c2.eq.'R-') then + ir=1 + read(w(nwords)(2:),*) irpt + irpt=irpt+35 + else if(trim(w(nwords)).eq.'RRR') then + ir=0 + irpt=2 + else if(trim(w(nwords)).eq.'RR73') then + ir=0 + irpt=3 + else if(trim(w(nwords)).eq.'73') then + ir=0 + irpt=4 + endif + +! 1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg +! 2 PA3XYZ/P GM4ABC/P R JO22 28 1 28 1 1 15 74 EU VHF contest + +10 i1psuffix=index(w(1)//' ' ,'/P ') + i2psuffix=index(w(2)//' ','/P ') + if(nwords.eq.2 .or. nwords.eq.3 .or. (nwords.eq.4 .and. & + w(3)(1:2).eq.'R ')) then + n3=0 + i3=1 !Type 1: Standard message, possibly with "/R" + if (i1psuffix.ge.4.or.i2psuffix.ge.4) i3=2 !Type 2, with "/P" + endif + c13=bcall_1 + if(c13(1:3).eq.'CQ_' .or. w(1)(1:1).eq.'<') c13=w(1) + call pack28var(c13,n28avar) + c13=bcall_2 + if(w(2)(1:1).eq.'<') c13=w(2) + call pack28var(c13,n28bvar) + ipa=0 + ipb=0 + if(i1psuffix.ge.4.or.index(w(1)//' ','/R ').ge.4) ipa=1 + if(i2psuffix.ge.4.or.index(w(2)//' ','/R ').ge.4) ipb=1 + + grid4=w(nwords)(1:4) + if(is_grid4(grid4)) then + ir=0 + if(w(3).eq.'R ') ir=1 + j1=(ichar(grid4(1:1))-ichar('A'))*18*10*10 + j2=(ichar(grid4(2:2))-ichar('A'))*10*10 + j3=(ichar(grid4(3:3))-ichar('0'))*10 + j4=(ichar(grid4(4:4))-ichar('0')) + igrid4=j1+j2+j3+j4 + else + igrid4=MAXGRID4 + irpt + endif + if(nwords.eq.2) then + ir=0 + irpt=1 + igrid4=MAXGRID4+irpt + endif + write(c77,1000) n28avar,ipa,n28bvar,ipb,ir,igrid4,i3 +1000 format(2(b28.28,b1),b1,b15.15,b3.3) + return + +900 return +end subroutine pack77_1var + +subroutine packtext77var(c13,c71) + + character*13 c13,w + character*71 c71 + character*42 c + character*1 qa(10),qb(10) + data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?'/ + + call mp_short_init + qa=char(0) + w=adjustr(c13) + do i=1,13 + j=index(c,w(i:i))-1 + if(j.lt.0) j=0 + call mp_short_mult(qb,qa(2:10),9,42) !qb(1:9)=42*qa(2:9) + call mp_short_add(qa,qb(2:10),9,j) !qa(1:9)=qb(2:9)+j + enddo + + write(c71,1010) qa(2:10) +1010 format(b7.7,8b8.8) + + return +end subroutine packtext77var + +subroutine unpacktext77var(c71,c13) + + integer*1 ia(10) + character*1 qa(10),qb(10) + character*13 c13 + character*71 c71 + character*42 c + equivalence (qa,ia),(qb,ib) + data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?'/ + + qa(1)=char(0) + read(c71,1010) qa(2:10) +1010 format(b7.7,8b8.8) + + do i=13,1,-1 + call mp_short_div(qb,qa(2:10),9,42,ir) + c13(i:i)=c(ir+1:ir+1) + qa(2:10)=qb(1:9) + enddo + + return +end subroutine unpacktext77var + +subroutine mp_short_opsvar(w,u) + character*1 w(*),u(*) + integer i,ireg,j,n,ir,iv,ii1,ii2 + character*1 creg(4) + save ii1,ii2 + equivalence (ireg,creg) + + entry mp_short_init + ireg=256*ichar('2')+ichar('1') + do j=1,4 + if (creg(j).eq.'1') ii1=j + if (creg(j).eq.'2') ii2=j + enddo + return + + entry mp_short_add(w,u,n,iv) + ireg=256*iv + do j=n,1,-1 + ireg=ichar(u(j))+ichar(creg(ii2)) + w(j+1)=creg(ii1) + enddo + w(1)=creg(ii2) + return + + entry mp_short_mult(w,u,n,iv) + ireg=0 + do j=n,1,-1 + ireg=ichar(u(j))*iv+ichar(creg(ii2)) + w(j+1)=creg(ii1) + enddo + w(1)=creg(ii2) + return + + entry mp_short_div(w,u,n,iv,ir) + ir=0 + do j=1,n + i=256*ir+ichar(u(j)) + w(j)=char(i/iv) + ir=mod(i,iv) + enddo + return + + return +end subroutine mp_short_opsvar + +end module packjt77sdvar diff --git a/lib/ft8var/packjt77var.f90 b/lib/ft8var/packjt77var.f90 deleted file mode 100755 index 46d1e760..00000000 --- a/lib/ft8var/packjt77var.f90 +++ /dev/null @@ -1,1805 +0,0 @@ -module packjt77var
-
-! use packjt77, only : hash10,hash12,hash22
-
-! These variables are accessible from outside via "use packjt77var":
- parameter (MAXHASH=1000,MAXTXHASH=5,MAXRECENT=10)
- character (len=13), dimension(0:1023) :: calls10=''
- character (len=13), dimension(0:4095) :: calls12=''
- character (len=13), dimension(1:MAXHASH) :: calls22=''
- character (len=13), dimension(0:1023) :: txcalls10=''
- character (len=13), dimension(0:4095) :: txcalls12=''
- character (len=13), dimension(1:MAXTXHASH) :: txcalls22=''
- character (len=13), dimension(1:MAXRECENT) :: recent_calls=''
- character (len=13), dimension(1:840) :: last_calls=''
- character (len=13) :: mycall13=''
- character (len=13) :: dxcall13=''
- character (len=13) :: mycall13_0=''
- character (len=13) :: dxcall13_0=''
- integer hashmy10,hashmy12,hashmy22,hashdx10
- logical :: dxcall13_set=.false.
- logical :: mycall13_set=.false.
-
- integer, dimension(1:MAXHASH) :: ihash22=-1
- integer, dimension(1:5) :: itxhash22=-1
- integer, dimension(1:24) :: nlast_calls=0
- integer, dimension(1:25) :: nthrindex=(/0,200,300,370,420,460,500,530,560,590,610,630,650,670,690,710, &
- 730,750,770,790,800,810,820,830,840/)
- integer :: nzhash=0
- integer :: nztxhash=0
- integer n28a,n28b
-!$omp threadprivate(recent_calls,n28a,n28b)
- logical(1) lcommonft8b
-
- contains
-
-subroutine hash10var(n10,c13,nthr)
-
- character*13 c13
- integer, intent(in) :: nthr
-
- c13='<...>'
- if(n10.lt.0 .or. n10.gt.1023) return
- if(nthr.gt.25) then ! TX message
- if(len(trim(txcalls10(n10))).gt.0) then
- c13=txcalls10(n10)
- c13='<'//trim(c13)//'>'
- endif
- else
- if(len(trim(calls10(n10))).gt.0) then
- c13=calls10(n10)
- c13='<'//trim(c13)//'>'
- endif
- endif
- return
-
-end subroutine hash10var
-
-subroutine hash12var(n12,c13,nthr)
-
- character*13 c13
- integer, intent(in) :: nthr
-
- c13='<...>'
- if(n12.lt.0 .or. n12.gt.4095) return
- if(nthr.gt.25) then ! TX message
- if(len(trim(txcalls12(n12))).gt.0) then
- c13=txcalls12(n12)
- c13='<'//trim(c13)//'>'
- endif
- else
- if(len(trim(calls12(n12))).gt.0) then
- c13=calls12(n12)
- c13='<'//trim(c13)//'>'
- endif
- endif
-
- return
-
-end subroutine hash12var
-
-
-subroutine hash22var(n22,c13,nthr)
-
- character*13 c13
- integer, intent(in) :: nthr
-
- c13='<...>'
- if(nthr.gt.25) then ! TX message
- do i=1,nztxhash
- if(itxhash22(i).eq.n22) then
- c13=txcalls22(i)
- c13='<'//trim(c13)//'>'
- go to 900
- endif
- enddo
- else
- do i=1,nzhash
- if(ihash22(i).eq.n22) then
- c13=calls22(i)
- c13='<'//trim(c13)//'>'
- go to 900
- endif
- enddo
- endif
-
-900 return
-end subroutine hash22var
-
-
-integer function ihashcall(c0,m)
-
- integer*8 n8
- character*13 c0
- character*38 c
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/
-
- n8=0
- do i=1,11
- j=index(c,c0(i:i)) - 1
- n8=38*n8 + j
- enddo
- ihashcall=ishft(47055833459_8*n8,m-64)
-
- return
-end function ihashcall
-
-subroutine save_hash_mycallvar(c13,n10,n12,n22)
-
- character*13 c13,cw
-
- cw=c13
- if(cw(1:1).eq.' ' .or. cw(1:5).eq.'<...>') return
- if(cw(1:1).eq.'<') cw=cw(2:)
- i=index(cw,'>')
- if(i.gt.0) cw(i:)=' '
- if(len(trim(cw)) .lt. 3) return
-
- n12=ihashcall(cw,12)
- if(n12.ge.0 .and. n12 .le. 4095 .and. cw.ne.mycall13) calls12(n12)=cw
-
- n10=ihashcall(cw,10)
- if(n10.ge.0 .and. n10 .le. 1023 .and. cw.ne.mycall13) calls10(n10)=cw
-
- n22=ihashcall(cw,22)
- if(any(ihash22.eq.n22)) then ! If entry exists, make sure callsign is the most recently received one
- where(ihash22.eq.n22) calls22=cw
- go to 1900
- endif
-
-! New entry: move table down, making room for new one at the top
- ihash22(nzhash:2:-1)=ihash22(nzhash-1:1:-1)
-
-! Add the new entry
- calls22(nzhash:2:-1)=calls22(nzhash-1:1:-1)
- ihash22(1)=n22
- calls22(1)=cw
- if(nzhash.lt.MAXHASH) nzhash=nzhash+1
-
-1900 continue
-
- return
-end subroutine save_hash_mycallvar
-
-subroutine save_hash_txcallvar(c13,n10,n12,n22,lhashit)
-
- character*13 c13,cw
- logical, intent(in) :: lhashit
-
- cw=c13
- if(cw(1:1).eq.' ' .or. cw(1:5).eq.'<...>') return
- if(cw(1:1).eq.'<') cw=cw(2:)
- i=index(cw,'>')
- if(i.gt.0) cw(i:)=' '
-
- if(len(trim(cw)) .lt. 3) return
-
- n12=ihashcall(cw,12)
-
- if(lhashit) then
- if(n12.ge.0 .and. n12 .le. 4095 .and. cw.ne.mycall13) txcalls12(n12)=cw
-
- n10=ihashcall(cw,10)
- if(n10.ge.0 .and. n10 .le. 1023 .and. cw.ne.mycall13) txcalls10(n10)=cw
-
- n22=ihashcall(cw,22)
- if(any(itxhash22.eq.n22)) then ! If entry exists, make sure callsign is the most recently received one
- where(itxhash22.eq.n22) txcalls22=cw
- go to 1900
- endif
-
-! New entry: move table down, making room for new one at the top
- itxhash22(nztxhash:2:-1)=itxhash22(nztxhash-1:1:-1)
-
-! Add the new entry
- txcalls22(nztxhash:2:-1)=txcalls22(nztxhash-1:1:-1)
- itxhash22(1)=n22
- txcalls22(1)=cw
- if(nztxhash.lt.MAXTXHASH) nztxhash=nztxhash+1
-
-1900 continue
- endif
-
- return
-end subroutine save_hash_txcallvar
-
-subroutine save_hash_callvar(c13,nthr)
-
- character*13 c13,cw
- integer, intent(in) :: nthr
-
- if(nthr.gt.24) return
- cw=c13
- if(cw(1:1).eq.' ' .or. cw(1:5).eq.'<...>') return
- if(cw(1:1).eq.'<') cw=cw(2:)
- i=index(cw,'>')
- if(i.gt.0) cw(i:)=' '
- if(len(trim(cw)) .lt. 3) return
-
- nposition=nthrindex(nthr)+nlast_calls(nthr)
- if(nposition.lt.nthrindex(nthr+1)) then
- nlast_calls(nthr)=nlast_calls(nthr)+1
- last_calls(nposition+1)=cw
-!print *,nthr,nlast_calls(nthr),nposition+1,last_calls(nposition+1)
- endif
-
- return
-end subroutine save_hash_callvar
-
-subroutine pack77var(msg0,i3,n3,c77,ntxhash)
-
- use packjt
- character*37 msg,msg0
- character*18 c18
- character*13 w(19)
- character*77 c77
- integer nw(19)
- integer ntel(3)
- integer, intent(in) :: ntxhash
-
- msg=msg0
- i3_hint=i3
- n3_hint=n3
- i3=-1
- n3=-1
- if(i3_hint.eq.0 .and. n3_hint.eq.5) go to 5
-
-! Convert msg to upper case; collapse multiple blanks; parse into words.
- call split77var(msg,nwords,nw,w)
- if(msg(1:3).eq.'CQ ' .or. msg(1:3).eq.'DE ' .or. msg(1:4).eq.'QRZ ') go to 100
-
-! Check 0.1 (DXpedition mode)
- call pack77_01var(nwords,w,i3,n3,c77,ntxhash)
- if(i3.ge.0 .or. n3.ge.1) go to 900
-! Check 0.2 (EU VHF contest exchange)
-! call pack77_02(nwords,w,i3,n3,c77)
-! if(i3.ge.0) go to 900
-
-! Check 0.3 and 0.4 (ARRL Field Day exchange)
- call pack77_03var(nwords,w,i3,n3,c77,ntxhash)
- if(i3.ge.0) go to 900
- if(nwords.ge.2) go to 100
-
- ! Check 0.5 (telemetry)
-5 i0=index(msg,' ')
- c18=msg(1:i0-1)
- c18=adjustr(c18)
- ntel=-99
- read(c18,1005,err=6) ntel
-1005 format(3z6)
- if(ntel(1).ge.2**23) go to 800
-6 if(ntel(1).ge.0 .and. ntel(2).ge.0 .and. ntel(3).ge.0) then
- i3=0
- n3=5
- write(c77,1006) ntel,n3,i3
-1006 format(b23.23,2b24.24,2b3.3)
- go to 900
- endif
-
-100 call pack77_06var(nwords,w,i3,n3,c77,i3_hint,n3_hint,ntxhash)
- if(i3.ge.0) go to 900
-
-! Check Type 1 (Standard 77-bit message) or Type 2, with optional "/P"
- call pack77_1var(nwords,w,i3,n3,c77,ntxhash)
- if(i3.ge.0) go to 900
-
-! Check Type 3 (ARRL RTTY contest exchange)
- call pack77_3var(nwords,w,i3,n3,c77,ntxhash)
- if(i3.ge.0) go to 900
-
-! Check Type 4 (One nonstandard call and one hashed call)
- call pack77_4var(nwords,w,i3,n3,c77,ntxhash)
- if(i3.ge.0) go to 900
-
-! Check Type 5 (EU VHF Contest with 2 hashed calls, report, serial, and grid6)
- call pack77_5var(nwords,w,i3,n3,c77,ntxhash)
- if(i3.ge.0) go to 900
-
-! It defaults to free text
-800 i3=0
- n3=0
- msg(14:)=' '
- call packtext77var(msg(1:13),c77(1:71))
- write(c77(72:77),'(2b3.3)') n3,i3
-
-900 return
-end subroutine pack77var
-
-subroutine unpack77var(c77,nrx,msg,unpk77_success,nthr)
-!
-! nrx=1 when unpacking a received message
-! nrx=0 when unpacking a to-be-transmitted message
-! the value of nrx is used to decide when mycall13 or dxcall13 should
-! be used in place of a callsign from the hashtable
-!
- parameter (NSEC=86) !Number of ARRL Sections
- parameter (NUSCAN=171) !Number of States and Provinces
- parameter (MAXGRID4=32400)
- integer*8 n58
- integer ntel(3)
- character*77 c77
- character*37 msg
- character*13 call_1,call_2,call_3,call_1a
- character*11 c11
- character*3 crpt,cntx,cpfx
- character*3 cmult(NUSCAN)
- character*6 cexch,grid6
- character*4 grid4,cserial
- character*3 csec(NSEC)
- character*38 c
- character*36 a2
- logical unpk28_success,unpk77_success,unpkg4_success
- integer, intent(in) :: nthr
-
- data a2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/,nzzz/46656/
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/
- data csec/ &
- "AB ","AK ","AL ","AR ","AZ ","BC ","CO ","CT ","DE ","EB ", &
- "EMA","ENY","EPA","EWA","GA ","GH ","IA ","ID ","IL ","IN ", &
- "KS ","KY ","LA ","LAX","NS ","MB ","MDC","ME ","MI ","MN ", &
- "MO ","MS ","MT ","NC ","ND ","NE ","NFL","NH ","NL ","NLI", &
- "NM ","NNJ","NNY","TER","NTX","NV ","OH ","OK ","ONE","ONN", &
- "ONS","OR ","ORG","PAC","PR ","QC ","RI ","SB ","SC ","SCV", &
- "SD ","SDG","SF ","SFL","SJV","SK ","SNJ","STX","SV ","TN ", &
- "UT ","VA ","VI ","VT ","WCF","WI ","WMA","WNY","WPA","WTX", &
- "WV ","WWA","WY ","DX ","PE ","NB "/
- data cmult/ &
- "AL ","AK ","AZ ","AR ","CA ","CO ","CT ","DE ","FL ","GA ", &
- "HI ","ID ","IL ","IN ","IA ","KS ","KY ","LA ","ME ","MD ", &
- "MA ","MI ","MN ","MS ","MO ","MT ","NE ","NV ","NH ","NJ ", &
- "NM ","NY ","NC ","ND ","OH ","OK ","OR ","PA ","RI ","SC ", &
- "SD ","TN ","TX ","UT ","VT ","VA ","WA ","WV ","WI ","WY ", &
- "NB ","NS ","QC ","ON ","MB ","SK ","AB ","BC ","NWT","NF ", &
- "LB ","NU ","YT ","PEI","DC ","DR ","FR ","GD ","GR ","OV ", &
- "ZH ","ZL ","X01","X02","X03","X04","X05","X06","X07","X08", &
- "X09","X10","X11","X12","X13","X14","X15","X16","X17","X18", &
- "X19","X20","X21","X22","X23","X24","X25","X26","X27","X28", &
- "X29","X30","X31","X32","X33","X34","X35","X36","X37","X38", &
- "X39","X40","X41","X42","X43","X44","X45","X46","X47","X48", &
- "X49","X50","X51","X52","X53","X54","X55","X56","X57","X58", &
- "X59","X60","X61","X62","X63","X64","X65","X66","X67","X68", &
- "X69","X70","X71","X72","X73","X74","X75","X76","X77","X78", &
- "X79","X80","X81","X82","X83","X84","X85","X86","X87","X88", &
- "X89","X90","X91","X92","X93","X94","X95","X96","X97","X98", &
- "X99"/
-
- unpk77_success=.true.
-
-! Check for bad data
- do i=1,77
- if(c77(i:i).ne.'0' .and. c77(i:i).ne.'1') then
- msg='failed unpack'
- unpk77_success=.false.
- return
- endif
- enddo
-
- read(c77(72:77),'(2b3)') n3,i3
- msg=repeat(' ',37)
- if(i3.eq.0 .and. n3.eq.0) then
-! 0.0 Free text
- call unpacktext77var(c77(1:71),msg(1:13))
- msg(14:)=' '
- msg=adjustl(msg)
- if(msg(1:1).eq.' ') then
- unpk77_success=.false.
- return
- endif
- else if(i3.eq.0 .and. n3.eq.1) then
-! 0.1 K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 71 DXpedition Mode
- read(c77,1010) n28a,n28b,n10,n5
-1010 format(2b28,b10,b5)
- irpt=2*n5 - 30
- write(crpt,1012) irpt
-1012 format(i3.2)
- if(irpt.ge.0) crpt(1:1)='+'
- call unpack28var(n28a,call_1,unpk28_success,nthr)
- if(.not.unpk28_success .or. n28a.le.2) unpk77_success=.false.
- call unpack28var(n28b,call_2,unpk28_success,nthr)
- if(.not.unpk28_success .or. n28b.le.2) unpk77_success=.false.
- call hash10var(n10,call_3,nthr)
-! if(call_3.eq.'<...>') then
-! ! print*,'pre std n10 ',n10,' call_3 ',call_3
-! call hash10(n10,call_3)
-! ! print*,'std n10 ',n10,' call_3 ',call_3
-! endif
-
- if(nrx.eq.1) then
- if(dxcall13_set .and. len(trim(dxcall13)).ge.3 .and. hashdx10.eq.n10) then; call_3='<'//trim(dxcall13)//'>'
- elseif(.not.dxcall13_set .and. len(trim(dxcall13)).ge.3 .and. .not.lcommonft8b .and. hashdx10.eq.n10) then
- call_3='<'//trim(dxcall13_0)//'>'
- elseif(.not.dxcall13_set .and. len(trim(dxcall13)).ge.3 .and. .not.lcommonft8b .and. hashdx10.ne.n10) then
- call_3=trim(call_3)
- elseif(.not.dxcall13_set .and. len(trim(dxcall13)).ge.3 .and. lcommonft8b .and. hashdx10.eq.n10) then
- call_3='<'//trim(dxcall13_0)//'>'
- elseif(.not.dxcall13_set .and. len(trim(dxcall13)).ge.3 .and. lcommonft8b .and. hashdx10.ne.n10) then
- call_3='<...>'
- endif
- endif
- if(nrx.eq.0 .and. mycall13_set .and. n10.eq.hashmy10) call_3='<'//trim(mycall13)//'>'
- msg=trim(call_1)//' RR73; '//trim(call_2)//' '//trim(call_3)//' '//crpt
-
- else if(i3.eq.0 .and. n3.eq.2) then
- unpk77_success=.false.
-
- else if(i3.eq.0 .and. (n3.eq.3 .or. n3.eq.4)) then
-! 0.3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day
-! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day
- read(c77,1030) n28a,n28b,ir,intx,nclass,isec
-1030 format(2b28,b1,b4,b3,b7)
- if(isec.gt.NSEC .or. isec.lt.1) then
- unpk77_success=.false.
- isec=1
- endif
- call unpack28var(n28a,call_1,unpk28_success,nthr)
- if(.not.unpk28_success .or. n28a.le.2) unpk77_success=.false.
- call unpack28var(n28b,call_2,unpk28_success,nthr)
- if(.not.unpk28_success .or. n28b.le.2) unpk77_success=.false.
- ntx=intx+1
- if(n3.eq.4) ntx=ntx+16
- write(cntx(1:2),1032) ntx
-1032 format(i2)
- cntx(3:3)=char(ichar('A')+nclass)
- if(ir.eq.0 .and. ntx.lt.10) msg=trim(call_1)//' '//trim(call_2)// &
- cntx//' '//csec(isec)
- if(ir.eq.1 .and. ntx.lt.10) msg=trim(call_1)//' '//trim(call_2)// &
- ' R'//cntx//' '//csec(isec)
- if(ir.eq.0 .and. ntx.ge.10) msg=trim(call_1)//' '//trim(call_2)// &
- ' '//cntx//' '//csec(isec)
- if(ir.eq.1 .and. ntx.ge.10) msg=trim(call_1)//' '//trim(call_2)// &
- ' R '//cntx//' '//csec(isec)
-
- else if(i3.eq.0 .and. n3.eq.5) then
-! 0.5 0123456789abcdef01 71 71 Telemetry (18 hex)
- read(c77,1006) ntel
-1006 format(b23,2b24)
- write(msg,1007) ntel
-1007 format(3z6.6)
- do i=1,18
- if(msg(i:i).ne.'0') exit
- msg(i:i)=' '
- enddo
- msg=adjustl(msg)
-
- else if(i3.eq.0 .and. n3.eq.6) then
- read(c77(49:50),'(2b1)') j2a,j2b
- itype=2
- if(j2b.eq.0 .and. j2a.eq.0) itype=1
- if(j2b.eq.0 .and. j2a.eq.1) itype=3
- if(itype.eq.1) then
-! WSPR Type 1
- read(c77,2010) n28,igrid4,idbm
-2010 format(b28.28,b15.15,b5.5)
- idbm=nint(idbm*10.0/3.0)
- call unpack28var(n28,call_1,unpk28_success,nthr)
- if(.not.unpk28_success) unpk77_success=.false.
- call to_grid4var(igrid4,grid4,unpkg4_success)
- if(.not.unpkg4_success) unpk77_success=.false.
- write(crpt,'(i3)') idbm
- msg=trim(call_1)//' '//grid4//' '//trim(adjustl(crpt))
- if (unpk77_success) call save_hash_callvar(call_1,nthr) !### Is this OK here? ###
-
- else if(itype.eq.2) then
-! WSPR Type 2
- read(c77,2020) n28,npfx,idbm
-2020 format(b28.28,b16.16,b5.5)
- idbm=nint(idbm*10.0/3.0)
- call unpack28var(n28,call_1,unpk28_success,nthr)
- if(.not.unpk28_success) unpk77_success=.false.
- write(crpt,'(i3)') idbm
- cpfx=' '
- if(npfx.lt.nzzz) then
-! Prefix
- do i=3,1,-1
- j=mod(npfx,36)+1
- cpfx(i:i)=a2(j:j)
- npfx=npfx/36
- if(npfx.eq.0) exit
- enddo
- msg=trim(adjustl(cpfx))//'/'//trim(call_1)//' '//trim(adjustl(crpt))
- call_1a=trim(adjustl(cpfx))//'/'//trim(call_1)
- call save_hash_callvar(call_1a,nthr) !### Is this OK here? ###
- else
-! Suffix
- npfx=npfx-nzzz
- if(npfx.le.35) then
- cpfx(1:1)=a2(npfx+1:npfx+1)
- else if(npfx.gt.35 .and. npfx.le.1295) then
- cpfx(1:1)=a2(npfx/36+1:npfx/36+1)
- cpfx(2:2)=a2(mod(npfx,36)+1:mod(npfx,36)+1)
- else if(npfx.gt.1295 .and. npfx.le.12959) then
- cpfx(1:1)=a2(npfx/360+1:npfx/360+1)
- cpfx(2:2)=a2(mod(npfx/10,36)+1:mod(npfx/10,36)+1)
- cpfx(3:3)=a2(mod(npfx,10)+1:mod(npfx,10)+1)
- else
- unpk77_success=.false.
- return
- endif
- msg=trim(call_1)//'/'//trim(adjustl(cpfx))//' '//trim(adjustl(crpt))
- call_1a=trim(call_1)//'/'//trim(adjustl(cpfx))
- call save_hash_callvar(call_1a,nthr) !### Is this OK here? ###
- endif
-
- else if(itype.eq.3) then
-! WSPR Type 3
- read(c77,2030) n22,igrid6
-2030 format(b22.22,b25.25)
- n28=n22+2063592
- call unpack28var(n28,call_1,unpk28_success,nthr)
- if(.not.unpk28_success) unpk77_success=.false.
- call to_gridvar(igrid6,grid6,unpkg4_success)
- if(.not.unpkg4_success) unpk77_success=.false.
- msg=trim(call_1)//' '//grid6
- endif
-
- else if(i3.eq.0 .and. n3.gt.6) then
- unpk77_success=.false.
-
- else if(i3.eq.1 .or. i3.eq.2) then
-! Type 1 (standard message) or Type 2 ("/P" form for EU VHF contest)
- read(c77,1000) n28a,ipa,n28b,ipb,ir,igrid4,i3
-1000 format(2(b28,b1),b1,b15,b3)
- call unpack28var(n28a,call_1,unpk28_success,nthr)
- if(nrx.eq.1 .and. mycall13_set .and. hashmy22.eq.(n28a-2063592)) then
- call_1='<'//trim(mycall13)//'>'
- unpk28_success=.true.
- endif
- if(.not.unpk28_success) unpk77_success=.false.
- call unpack28var(n28b,call_2,unpk28_success,nthr)
- if(.not.unpk28_success) unpk77_success=.false.
- if(call_1(1:3).eq.'CQ_') call_1(3:3)=' '
- if(index(call_1,'<').le.0) then
- i=index(call_1,' ')
- if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.1) call_1(i:i+1)='/R'
- if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.2) call_1(i:i+1)='/P'
- if(i.ge.4) call add_call_to_recent_callsvar(call_1,nthr)
- endif
- if(index(call_2,'<').le.0) then
- i=index(call_2,' ')
- if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.1) call_2(i:i+1)='/R'
- if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.2) call_2(i:i+1)='/P'
- if(i.ge.4) then
- call add_call_to_recent_callsvar(call_2,nthr)
-! only hash the "from" call
- call save_hash_callvar(call_2,nthr)
- endif
- endif
- if(igrid4.le.MAXGRID4) then
- call to_grid4var(igrid4,grid4,unpkg4_success)
- if(.not.unpkg4_success) unpk77_success=.false.
- if(ir.eq.0) msg=trim(call_1)//' '//trim(call_2)//' '//grid4
- if(ir.eq.1) msg=trim(call_1)//' '//trim(call_2)//' R '//grid4
- if(msg(1:3).eq.'CQ ' .and. ir.eq.1) unpk77_success=.false.
-!out of current realisation of protocol: GRID is always dropped at WSJT-X/JTDX transmission of the messages below
-! i3 n3
-! 1 0
-!110015 -23 0.5 1450 ~ <...> Y96IHQ/R GL12
-!112215 -23 0.0 1606 ~ <...> 3U1TBM/R CC65
-!000102 -23 0.5 801 ~ <...> NV3QHV/R JF62
- if(ir.eq.0 .and. call_1(1:1).eq.'<' .and. grid4.ne.'RR73') then ! hash value can also be associated with a valid callsign
- nlencall2=len_trim(call_2)
- if(nlencall2.gt.1) then
- if(call_2(nlencall2-1:nlencall2).eq.'/R') unpk77_success=.false.
- endif
- endif
- else
- irpt=igrid4-MAXGRID4
- if(irpt.eq.1) msg=trim(call_1)//' '//trim(call_2)
- if(irpt.eq.2) msg=trim(call_1)//' '//trim(call_2)//' RRR'
- if(irpt.eq.3) msg=trim(call_1)//' '//trim(call_2)//' RR73'
- if(irpt.eq.4) msg=trim(call_1)//' '//trim(call_2)//' 73'
- if(irpt.ge.5) then
- isnr=irpt-35
- if(isnr.gt.50) isnr=isnr-101
- write(crpt,'(i3.2)') isnr
- if(crpt(1:1).eq.' ') crpt(1:1)='+'
- if(ir.eq.0) msg=trim(call_1)//' '//trim(call_2)//' '//crpt
- if(ir.eq.1) msg=trim(call_1)//' '//trim(call_2)//' R'//crpt
- endif
- if(msg(1:3).eq.'CQ ' .and. irpt.ge.2) unpk77_success=.false.
- endif
-
- else if(i3.eq.3) then
-! Type 3: ARRL RTTY Contest
- read(c77,1040) itu,n28a,n28b,ir,irpt,nexch,i3
-1040 format(b1,2b28.28,b1,b3.3,b13.13,b3.3)
- write(crpt,1042) irpt+2
-1042 format('5',i1,'9')
- nserial=nexch
- imult=-1
- if(nexch.gt.8000) then
- imult=nexch-8000
- nserial=-1
- endif
- call unpack28var(n28a,call_1,unpk28_success,nthr)
- if(.not.unpk28_success) unpk77_success=.false.
- call unpack28var(n28b,call_2,unpk28_success,nthr)
- if(.not.unpk28_success) unpk77_success=.false.
- imult=0
- nserial=0
- if(nexch.gt.8000) imult=nexch-8000
- if(nexch.lt.8000) nserial=nexch
-
- if(imult.ge.1 .and.imult.le.NUSCAN) then
- if(itu.eq.0 .and. ir.eq.0) msg=trim(call_1)//' '//trim(call_2)// &
- ' '//crpt//' '//cmult(imult)
- if(itu.eq.1 .and. ir.eq.0) msg='TU; '//trim(call_1)//' '//trim(call_2)// &
- ' '//crpt//' '//cmult(imult)
- if(itu.eq.0 .and. ir.eq.1) msg=trim(call_1)//' '//trim(call_2)// &
- ' R '//crpt//' '//cmult(imult)
- if(itu.eq.1 .and. ir.eq.1) msg='TU; '//trim(call_1)//' '//trim(call_2)// &
- ' R '//crpt//' '//cmult(imult)
- else if(nserial.ge.1 .and. nserial.le.7999) then
- write(cserial,'(i4.4)') nserial
- if(itu.eq.0 .and. ir.eq.0) msg=trim(call_1)//' '//trim(call_2)// &
- ' '//crpt//' '//cserial
- if(itu.eq.1 .and. ir.eq.0) msg='TU; '//trim(call_1)//' '//trim(call_2)// &
- ' '//crpt//' '//cserial
- if(itu.eq.0 .and. ir.eq.1) msg=trim(call_1)//' '//trim(call_2)// &
- ' R '//crpt//' '//cserial
- if(itu.eq.1 .and. ir.eq.1) msg='TU; '//trim(call_1)//' '//trim(call_2)// &
- ' R '//crpt//' '//cserial
- endif
-
- else if(i3.eq.4) then
-! Type 4
- read(c77,1050) n12,n58,iflip,nrpt,icq
-1050 format(b12,b58,b1,b2,b1)
- do i=11,1,-1
- j=mod(n58,38)+1
- c11(i:i)=c(j:j)
- n58=n58/38
- enddo
- call hash12var(n12,call_3,nthr)
-! if(call_3.eq.'<...>') then
-! ! print*,'pre std n12 1 ',n12,' call_3 ',call_3
-! call hash12(n12,call_3)
-! ! print*,'std n12 1 ',n12,' call_3 ',call_3
-! endif
- if(iflip.eq.0) then ! 12 bit hash for TO call
- call_1=call_3
- call_2=adjustl(c11)//' '
- call add_call_to_recent_callsvar(call_2,nthr)
- if(nrx.eq.1 .and. &
- dxcall13_set .and. mycall13_set .and. &
- call_2.eq.dxcall13 .and. &
- n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>'
- if(nrx.eq.1 .and. &
- mycall13_set .and. &
- index(call_1,'<...>').gt.0 .and. &
- n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>'
- else ! 12 bit hash for DE call
- call_1=adjustl(c11)
- call_2=call_3
- call add_call_to_recent_callsvar(call_1,nthr)
- if(nrx.eq.0 .and. &
- mycall13_set .and. &
- n12.eq.hashmy12) call_2='<'//trim(mycall13)//'>'
- endif
- if(icq.eq.0) then
- if(nrpt.eq.0) msg=trim(call_1)//' '//trim(call_2)
- if(nrpt.eq.1) msg=trim(call_1)//' '//trim(call_2)//' RRR'
- if(nrpt.eq.2) msg=trim(call_1)//' '//trim(call_2)//' RR73'
- if(nrpt.eq.3) msg=trim(call_1)//' '//trim(call_2)//' 73'
- else
- msg='CQ '//trim(call_2)
- endif
- if(call_2(1:1).lt.':' .and. call_2(1:1).gt.'/' .and. call_2(2:2).lt.':' .and. call_2(2:2).gt.'/') unpk77_success=.false.
- if(len_trim(call_2).eq.11) then
- ispace=index(call_2,' '); if(ispace.gt.0 .and. ispace.lt.12) unpk77_success=.false.
- islash=index(call_2,'/'); if(islash.eq.1 .or. islash.eq.2 .or. islash.eq.11 .or. (islash.eq.10 .and. &
- call_2(11:11).gt.'@' .and. call_2(11:11).lt.'[' .and. call_2(11:11).ne.'P')) unpk77_success=.false.
- if(islash.lt.6 .and. call_2(11:11).lt.':' .and. call_2(11:11).gt.'/') unpk77_success=.false.
- endif
- if(msg(1:3).ne.'CQ ') then
- if(call_1(1:1).lt.':' .and. call_1(1:1).gt.'/' .and. call_1(2:2).lt.':' .and.call_1(2:2).gt.'/') unpk77_success=.false.
- if(len_trim(call_1).eq.11) then
- ispace=index(call_1,' '); if(ispace.gt.0 .and. ispace.lt.12) unpk77_success=.false.
- islash=index(call_1,'/'); if(islash.eq.1 .or. islash.eq.2 .or. islash.eq.11 .or. (islash.eq.10 .and. &
- call_1(11:11).gt.'@' .and. call_1(11:11).lt.'[' .and. call_1(11:11).ne.'P')) unpk77_success=.false.
- if(islash.lt.6 .and. call_1(11:11).lt.':' .and. call_1(11:11).gt.'/') unpk77_success=.false.
- endif
- endif
- nmsglen=len_trim(msg)
-! protocol violations, also reported at wrong TX message packing
-! prevent broken message transmission
- if(unpk77_success .and. nmsglen.gt.0) then
- indxp=index(msg,'/P ')
- if((icq.eq.0 .and. nrpt.eq.0 .and. (indxp.lt.1 .or. indxp.gt.7)) .or. icq.eq.1) then
-! -23 -3.3 N0S/W45ETOE <...>
-!071445 -14 0.1 779 ~ <...>
-!071445 -14 0.1 779 ~ W5JZ ! hash was associated
-! CQ <...>
-! with exception to broken by packing message 'JQ1AHT/P <JL1LOF/1> -15' wrongly being transmitted as type 4 message 'JQ1AHT/P <JL1LOF/1>'
- if(msg(nmsglen:nmsglen).eq.'>') unpk77_success=.false.
- endif
- endif
-! <...> /BZZ/0ZZ/C
-! <...> ZZZZ/0Z/Z/
-! <...> OZZZZ/0ZZZ/
-! <...> 0I/IZZZ/O K
-! <...> J/IZZZ/O K
- if(unpk77_success .and. iflip.eq.0 .and. icq.eq.0 .and. nrpt.eq.0) then
- nlencall2=len_trim(call_2)
- if(nlencall2.gt.9) then
- if(call_2(1:1).eq.'/' .or. call_2(nlencall2:nlencall2).eq.'/') unpk77_success=.false.
- nindxspace=index(call_2,' ')
- if(nindxspace.gt.0 .and. nindxspace.lt.nlencall2) unpk77_success=.false.
- endif
- endif
-
- else if(i3.eq.5) then
-
-! Type 5 <PA3XYZ> <G4ABC/P> R 590003 IO91NP h12 h22 r1 s3 S11 g25
-! EU VHF contest
- read(c77,1060) n12,n22,ir,irpt,iserial,igrid6
-1060 format(b12,b22,b1,b3,b11,b25)
- if(igrid6.lt.0 .or. igrid6.gt.18662399) then
- unpk77_success=.false.
- return
- endif
- call hash12var(n12,call_1,nthr)
-! if(call_1.eq.'<...>') then
-! ! print*,'pre std n12 1 ',n12,' call_1 ',call_1
-! call hash12(n12,call_1)
-! ! print*,'std n12 2 ',n12,' call_1 ',call_1
-! endif
- if(n12.eq.hashmy12) call_1='<'//trim(mycall13)//'>'
- call hash22var(n22,call_2,nthr)
-! if(call_2.eq.'<...>') then
-! ! print*,'pre std n22 ',n22,' call_2 ',call_2
-! call hash22(n22,call_2)
-! ! print*,'std n22 ',n22,' call_2 ',call_2
-! endif
- nrs=52+irpt
- write(cexch,1022) nrs,iserial
-1022 format(i2,i4.4)
- call to_grid6var(igrid6,grid6,unpk77_success)
- if(ir.eq.0) msg=trim(call_1)//' '//trim(call_2)//' '//cexch//' '//grid6
- if(ir.eq.1) msg=trim(call_1)//' '//trim(call_2)//' R '//cexch//' '//grid6
-
- else if(i3.ge.6) then ! i3 values 6 and 7 are not yet defined
- unpk77_success=.false.
- endif
- if(msg(1:4).eq.'CQ <') unpk77_success=.false.
- return
-end subroutine unpack77var
-
-subroutine pack28var(c13,n28,ntxhash)
-
-! Pack a special token, a 22-bit hash code, or a valid base call into a 28-bit
-! integer.
-
- parameter (NTOKENS=2063592,MAX22=4194304)
- logical is_digit,is_letter,lhashit
- character*13 c13
- character*6 callsign
- character*1 c
- character*4 c4
- character*37 a1
- character*36 a2
- character*10 a3
- character*27 a4
- integer, intent(in) :: ntxhash
- data a1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data a2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data a3/'0123456789'/
- data a4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
-
- is_digit(c)=c.ge.'0' .and. c.le.'9'
- is_letter(c)=c.ge.'A' .and. c.le.'Z'
-
- n28=-1
-! Work-around for Swaziland prefix:
- if(c13(1:4).eq.'3DA0') callsign='3D0'//c13(5:7)
-! Work-around for Guinea prefixes:
- if(c13(1:2).eq.'3X' .and. c13(3:3).ge.'A' .and. &
- c13(3:3).le.'Z') callsign='Q'//c13(3:6)
-
-! Check for special tokens first
- if(c13(1:3).eq.'DE ') then
- n28=0
- go to 900
- endif
-
- if(c13(1:4).eq.'QRZ ') then
- n28=1
- go to 900
- endif
-
- if(c13(1:3).eq.'CQ ') then
- n28=2
- go to 900
- endif
-
- if(c13(1:3).eq.'CQ_') then
- n=len(trim(c13))
- if(n.ge.4 .and. n.le.7) then
- nlet=0
- nnum=0
- do i=4,n
- c=c13(i:i)
- if(c.ge.'A' .and. c.le.'Z') nlet=nlet+1
- if(c.ge.'0' .and. c.le.'9') nnum=nnum+1
- enddo
- if(nnum.eq.3 .and. nlet.eq.0) then
- read(c13(4:3+nnum),*) nqsy
- n28=3+nqsy
- go to 900
- endif
- if(nlet.ge.1 .and. nlet.le.4 .and. nnum.eq.0) then
- c4=c13(4:n)
- c4=adjustr(c4)
- m=0
- do i=1,4
- j=0
- c=c4(i:i)
- if(c.ge.'A' .and. c.le.'Z') j=ichar(c)-ichar('A')+1
- m=27*m + j
- enddo
- n28=3+1000+m
- go to 900
- endif
- endif
- endif
-
- lhashit=.false.; if(ntxhash.eq.1) lhashit=.true.
-! Check for <...> callsign
- if(c13(1:1).eq.'<')then
- call save_hash_txcallvar(c13,n10,n12,n22,lhashit) !Save callsign in hash table
- i2=index(c13,'>')
- c13=c13(2:i2-1)
- n22=ihashcall(c13,22)
- n28=NTOKENS + n22
- go to 900
- endif
-
-! Check for standard callsign
- iarea=-1
- n=len(trim(c13))
- do i=n,2,-1
- if(is_digit(c13(i:i))) exit
- enddo
- iarea=i !Call-area digit
- npdig=0 !Digits before call area
- nplet=0 !Letters before call area
- do i=1,iarea-1
- if(is_digit(c13(i:i))) npdig=npdig+1
- if(is_letter(c13(i:i))) nplet=nplet+1
- enddo
- nslet=0
- do i=iarea+1,n
- if(is_letter(c13(i:i))) nslet=nslet+1
- enddo
- if(iarea.lt.2 .or. iarea.gt.3 .or. nplet.eq.0 .or. &
- npdig.ge.iarea-1 .or. nslet.gt.3) then
-! Treat this as a nonstandard callsign: compute its 22-bit hash
- call save_hash_txcallvar(c13,n10,n12,n22,lhashit) !Save callsign in hash table
- n22=ihashcall(c13,22)
- n28=NTOKENS + n22
- go to 900
- endif
-
- n=len(trim(c13))
-! This is a standard callsign
- call save_hash_txcallvar(c13,n10,n12,n22,lhashit) !Save callsign in hash table
- if(iarea.eq.2) callsign=' '//c13(1:5)
- if(iarea.eq.3) callsign=c13(1:6)
- i1=index(a1,callsign(1:1))-1
- i2=index(a2,callsign(2:2))-1
- i3=index(a3,callsign(3:3))-1
- i4=index(a4,callsign(4:4))-1
- i5=index(a4,callsign(5:5))-1
- i6=index(a4,callsign(6:6))-1
- n28=36*10*27*27*27*i1 + 10*27*27*27*i2 + 27*27*27*i3 + 27*27*i4 + &
- 27*i5 + i6
- n28=n28 + NTOKENS + MAX22
-
-900 n28=iand(n28,ishft(1,28)-1)
- return
-end subroutine pack28var
-
-
-subroutine unpack28var(n28_0,c13,success,nthr)
-
- parameter (NTOKENS=2063592,MAX22=4194304)
- logical success
- character*13 c13
- character*37 c1
- character*36 c2
- character*10 c3
- character*27 c4
- integer, intent(in) :: nthr
- data c1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data c2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
- data c3/'0123456789'/
- data c4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
-
- success=.true.
- n28=n28_0
- if(n28.lt.NTOKENS) then
-! Special tokens DE, QRZ, CQ, CQ_nnn, CQ_aaaa
- if(n28.eq.0) c13='DE '
- if(n28.eq.1) c13='QRZ '
- if(n28.eq.2) c13='CQ '
- if(n28.le.2) go to 900
- if(n28.le.1002) then
- write(c13,1002) n28-3
-1002 format('CQ_',i3.3)
- go to 900
- endif
- if(n28.le.532443) then
- n=n28-1003
- n0=n
- i1=n/(27*27*27)
- n=n-27*27*27*i1
- i2=n/(27*27)
- n=n-27*27*i2
- i3=n/27
- i4=n-27*i3
- c13=c4(i1+1:i1+1)//c4(i2+1:i2+1)//c4(i3+1:i3+1)//c4(i4+1:i4+1)
- c13=adjustl(c13)
- c13='CQ_'//c13(1:10)
- go to 900
- endif
- endif
- n28=n28-NTOKENS
- if(n28.lt.MAX22) then
-! This is a 22-bit hash of a callsign
- n22=n28
- call hash22var(n22,c13,nthr) !Retrieve callsign from hash table
-! if(c13.eq.'<...>') then
-! ! print*,'pre std n22 ',n22,' c13 ',c13
-! call hash22(n22,c13)
-! ! print*,'std n22 ',n22,' c13 ',c13
-! endif
- go to 900
- endif
-
-! Standard callsign
- n=n28 - MAX22
- i1=n/(36*10*27*27*27)
- n=n-36*10*27*27*27*i1
- i2=n/(10*27*27*27)
- n=n-10*27*27*27*i2
- i3=n/(27*27*27)
- n=n-27*27*27*i3
- i4=n/(27*27)
- n=n-27*27*i4
- i5=n/27
- i6=n-27*i5
- c13=c1(i1+1:i1+1)//c2(i2+1:i2+1)//c3(i3+1:i3+1)//c4(i4+1:i4+1)// &
- c4(i5+1:i5+1)//c4(i6+1:i6+1)
- c13=adjustl(c13)
-
-900 i0=index(c13,' ')
-
- if((i0.ne.0 .and. i0.lt.len(trim(c13))) .or. (c13(1:1).lt.':' .and. c13(1:1).gt.'/' .and. &
- c13(2:2).lt.':' .and. c13(2:2).gt.'/')) then
- c13='QU1RK'
- success=.false.
- endif
-
- return
-end subroutine unpack28var
-
-subroutine split77var(msg,nwords,nw,w)
-
-! Convert msg to upper case; collapse multiple blanks; parse into words.
-
- character*37 msg
- character*13 w(19)
- character*1 c,c0
- character*6 bcall_1
- logical ok1
- integer nw(19)
-
- iz=len(trim(msg))
- j=0
- k=0
- n=0
- c0=' '
- w=' '
- do i=1,iz
- if(ichar(msg(i:i)).eq.0) msg(i:i)=' '
- c=msg(i:i) !Single character
- if(c.eq.' ' .and. c0.eq.' ') cycle !Skip leading/repeated blanks
- if(c.ne.' ' .and. c0.eq.' ') then
- k=k+1 !New word
- n=0
- endif
- j=j+1 !Index in msg
- n=n+1 !Index in word
- if(c.ge.'a' .and. c.le.'z') c=char(ichar(c)-32) !Force upper case
- msg(j:j)=c
- if(n.le.13) w(k)(n:n)=c !Copy character c into word
- c0=c
- enddo
- iz=j !Message length
- nwords=k !Number of words in msg
- if(nwords.le.0) go to 900
- nw(k)=len(trim(w(k)))
- msg(iz+1:)=' '
- if(nwords.lt.3) go to 900
- call chkcall(w(3),bcall_1,ok1)
- if(ok1 .and. w(1)(1:3).eq.'CQ ') then
- w(1)='CQ_'//w(2)(1:10) !Make "CQ " into "CQ_"
- w(2:12)=w(3:13) !Move all remeining words down by one
- nwords=nwords-1
- endif
-
-900 return
-end subroutine split77var
-
-
-subroutine pack77_01var(nwords,w,i3,n3,c77,ntxhash)
-
-! Pack a Type 0.1 message: DXpedition mode
-! Example message: "K1ABC RR73; W9XYZ <KH1/KH7Z> -11" 28 28 10 5
-
- character*13 w(19),c13
- character*77 c77
- character*6 bcall_1,bcall_2
- logical ok1,ok2,lhashit
- integer, intent(in) :: ntxhash
-
- if(nwords.ne.5) go to 900 !Must have 5 words
- if(trim(w(2)).ne.'RR73;') go to 900 !2nd word must be "RR73;"
- if(w(4)(1:1).ne.'<') go to 900 !4th word must have <...>
- if(index(w(4),'>').lt.1) go to 900
- n=-99
- read(w(5),*,err=1) n
-1 if(n.eq.-99) go to 900 !5th word must be a valid report
- n5=(n+30)/2
- if(n5.lt.0) n5=0
- if(n5.gt.31) n5=31
- call chkcall(w(1),bcall_1,ok1)
- if(.not.ok1) go to 900 !1st word must be a valid basecall
- call chkcall(w(3),bcall_2,ok2)
- if(.not.ok2) go to 900 !3rd word must be a valid basecall
-
-! Type 0.1: K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 71 DXpedition special msg
- i3=0
- n3=1
- call pack28var(w(1),n28a,ntxhash)
- call pack28var(w(3),n28b,ntxhash)
- lhashit=.false.; if(ntxhash.eq.1) lhashit=.true.
- call save_hash_txcallvar(w(4),n10,n12,n22,lhashit)
- i2=index(w(4),'>')
- c13=w(4)(2:i2-1)
- n10=ihashcall(c13,10)
- write(c77,1010) n28a,n28b,n10,n5,n3,i3
-1010 format(2b28.28,b10.10,b5.5,2b3.3)
-
-900 return
-end subroutine pack77_01var
-
-subroutine pack77_03var(nwords,w,i3,n3,c77,ntxhash)
-
-! Check 0.3 and 0.4 (ARRL Field Day exchange)
-! Example message: WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71
-
- parameter (NSEC=86) !Number of ARRL Sections
- character*13 w(19)
- character*77 c77
- character*6 bcall_1,bcall_2
- character*3 csec(NSEC)
- logical ok1,ok2
- integer, intent(in) :: ntxhash
- data csec/ &
- "AB ","AK ","AL ","AR ","AZ ","BC ","CO ","CT ","DE ","EB ", &
- "EMA","ENY","EPA","EWA","GA ","GH ","IA ","ID ","IL ","IN ", &
- "KS ","KY ","LA ","LAX","NS ","MB ","MDC","ME ","MI ","MN ", &
- "MO ","MS ","MT ","NC ","ND ","NE ","NFL","NH ","NL ","NLI", &
- "NM ","NNJ","NNY","TER","NTX","NV ","OH ","OK ","ONE","ONN", &
- "ONS","OR ","ORG","PAC","PR ","QC ","RI ","SB ","SC ","SCV", &
- "SD ","SDG","SF ","SFL","SJV","SK ","SNJ","STX","SV ","TN ", &
- "UT ","VA ","VI ","VT ","WCF","WI ","WMA","WNY","WPA","WTX", &
- "WV ","WWA","WY ","DX ","PE ","NB "/
-
- if(nwords.lt.4 .or. nwords.gt.5) return
- call chkcall(w(1),bcall_1,ok1)
- call chkcall(w(2),bcall_2,ok2)
- if(.not.ok1 .or. .not.ok2) return
- isec=-1
- do i=1,NSEC
- if(csec(i).eq.w(nwords)(1:3)) then
- isec=i
- exit
- endif
- enddo
- if(isec.eq.-1) return
- if(nwords.eq.5 .and. trim(w(3)).ne.'R') return
-
- ntx=-1
- j=len(trim(w(nwords-1)))-1
- read(w(nwords-1)(1:j),*,err=1,end=1) ntx !Number of transmitters
-1 if(ntx.lt.1 .or. ntx.gt.32) return
- nclass=ichar(w(nwords-1)(j+1:j+1))-ichar('A')
-
- m=len(trim(w(nwords))) !Length of section abbreviation
- if(m.lt.2 .or. m.gt.3) return
-
-! 0.3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day
-! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day
-
- i3=0
- n3=3 !Type 0.3 ARRL Field Day
- intx=ntx-1
- if(intx.ge.16) then
- n3=4 !Type 0.4 ARRL Field Day
- intx=ntx-17
- endif
- call pack28var(w(1),n28a,ntxhash)
- call pack28var(w(2),n28b,ntxhash)
- ir=0
- if(w(3)(1:2).eq.'R ') ir=1
- write(c77,1010) n28a,n28b,ir,intx,nclass,isec,n3,i3
-1010 format(2b28.28,b1,b4.4,b3.3,b7.7,2b3.3)
-
- return
-end subroutine pack77_03var
-
-subroutine pack77_06var(nwords,w,i3,n3,c77,i3_hint,n3_hint,ntxhash)
-
- character*13 w(19)
- character*77 c77
- character*6 bcall,grid6
- character*4 grid4
- character*1 c
- character*36 a2
- integer, intent(in) :: ntxhash
- data a2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/,nzzz/46656/
-
- logical is_grid4,is_grid6,is_digit,ok
- is_grid4(grid4)=len(trim(grid4)).eq.4 .and. &
- grid4(1:1).ge.'A' .and. grid4(1:1).le.'R' .and. &
- grid4(2:2).ge.'A' .and. grid4(2:2).le.'R' .and. &
- grid4(3:3).ge.'0' .and. grid4(3:3).le.'9' .and. &
- grid4(4:4).ge.'0' .and. grid4(4:4).le.'9'
-
- is_grid6(grid6)=(len(trim(grid6)).eq.6.or.len(trim(grid6)).eq.4).and. &
- grid6(1:1).ge.'A' .and. grid6(1:1).le.'R' .and. &
- grid6(2:2).ge.'A' .and. grid6(2:2).le.'R' .and. &
- grid6(3:3).ge.'0' .and. grid6(3:3).le.'9' .and. &
- grid6(4:4).ge.'0' .and. grid6(4:4).le.'9' .and. &
- (len(trim(grid6)).eq.4.or. &
- (grid6(5:5).ge.'A' .and. grid6(5:5).le.'X' .and. &
- grid6(6:6).ge.'A' .and. grid6(6:6).le.'X'))
-
- is_digit(c)=c.ge.'0' .and. c.le.'9'
-
- m1=len(trim(w(1)))
- m2=len(trim(w(2)))
- m3=len(trim(w(3)))
- if(nwords.eq.3 .and. m1.ge.3 .and. m1.le.6 .and. m2.eq.4 .and. m3.le.2) then
-! WSPR Type 1
- if(.not.is_grid4(w(2)(1:4))) go to 900
- if(.not.is_digit(w(3)(1:1))) go to 900
- if(m3.eq.2) then
- if(.not.is_digit(w(3)(2:2))) go to 900
- endif
- i3=0
- n3=6
- call pack28var(w(1),n28,ntxhash)
- grid4=w(2)(1:4)
- k1=(ichar(grid4(1:1))-ichar('A'))*18*10*10
- k2=(ichar(grid4(2:2))-ichar('A'))*10*10
- k3=(ichar(grid4(3:3))-ichar('0'))*10
- k4=(ichar(grid4(4:4))-ichar('0'))
- igrid4=k1+k2+k3+k4
- read(w(3),*) idbm
- if(idbm.lt.0) idbm=0
- if(idbm.gt.60) idbm=60
- idbm=nint(0.3*idbm)
- write(c77,1010) n28,igrid4,idbm,0,0,0,n3,i3
-1010 format(b28.28,b15.15,b5.5,2i1,b21.21,2b3.3)
- go to 900
- endif
- if(nwords.eq.2 .and. m1.ge.5 .and. m1.le.10 .and. m2.le.2) then
-! WSPR Type 2
- i1=index(w(1),'/')
- if(i1.lt.2 .or. i1.eq.m1) go to 900
- if(.not.is_digit(w(2)(1:1))) go to 900
- if(i1.eq.(m1-3) .and. .not.is_digit(w(1)(m1:m1))) go to 900
- if(m2.eq.2) then
- if(.not.is_digit(w(2)(2:2))) go to 900
- endif
- call chkcall(w(1),bcall,ok)
- if(.not.ok) go to 900
- if(i1.le.4) then
-! We have a prefix
- npfx=index(a2,w(1)(1:1))-1
- if(i1.ge.3) npfx=36*npfx + index(a2,w(1)(2:2))-1
- if(i1.eq.4) npfx=36*npfx + index(a2,w(1)(3:3))-1
- else
-! We have a suffix
- if((m1-i1).eq.1) npfx=index(a2,w(1)(i1+1:i1+1))-1
- if((m1-i1).eq.2) npfx=36*(index(a2,w(1)(i1+1:i1+1))-1) + &
- index(a2,w(1)(i1+2:i1+2))-1
- if((m1-i1).eq.3) then
-! Third character of a suffix must be a digit
- if(.not.is_digit(w(1)(i1+3:i1+3))) go to 900
- npfx=36*10*(index(a2,w(1)(i1+1:i1+1))-1) + &
- 10*(index(a2,w(1)(i1+2:i1+2))-1) + index(a2,w(1)(i1+3:i1+3))-1
- endif
- npfx=npfx + nzzz
- endif
- i3=0
- n3=6
- call pack28var(bcall//' ',n28,ntxhash)
- read(w(2),*) idbm
- if(idbm.lt.0) idbm=0
- if(idbm.gt.60) idbm=60
- idbm=nint(0.3*idbm)
- write(c77,1020) n28,npfx,idbm,1,0,n3,i3
-1020 format(b28.28,b16.16,b5.5,i1,b21.21,2b3.3)
- go to 900
- endif
-
- if(i3_hint.eq.0.and.n3_hint.eq.6.and.nwords.eq.2 .and. m1.ge.5 &
- .and. m1.le.12 .and. m2.le.6) then
-! WSPR Type 3
-
- !n3_hint=6 and i3_hint=0 is a hint that the caller wanted a
- !50-bit encoding rather than the possible alternative n3=4 77-bit
- !encoding
- if(index(w(1),'<').lt.1 .or. index(w(1),'>').lt.1) go to 900
- grid6=w(2)(1:6)
- if(.not.is_grid6(grid6)) go to 900
- i3=0
- n3=6
- call pack28var(w(1),n28,ntxhash)
- n22=n28-2063592
- k1=(ichar(grid6(1:1))-ichar('A'))*18*10*10*25*25
- k2=(ichar(grid6(2:2))-ichar('A'))*10*10*25*25
- k3=(ichar(grid6(3:3))-ichar('0'))*10*25*25
- k4=(ichar(grid6(4:4))-ichar('0'))*25*25
- if (grid6(5:6).eq.' ') then
- igrid6=k1+k2+k3+k4+24*25+24
- else
- k5=(ichar(grid6(5:5))-ichar('A'))*25
- k6=(ichar(grid6(6:6))-ichar('A'))
- igrid6=k1+k2+k3+k4+k5+k6
- endif
- write(c77,1030) n22,igrid6,2,0,n3,i3
-1030 format(b22.22,b25.25,b3.3,b21.21,2b3.3)
- endif
-
-900 return
-end subroutine pack77_06var
-
-subroutine pack77_1var(nwords,w,i3,n3,c77,ntxhash)
-
-! Check Type 1 (Standard 77-bit message) and Type 2 (ditto, with a "/P" call)
-! Example message: WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74
-
- parameter (MAXGRID4=32400)
- character*13 w(19),c13
- character*77 c77
- character*6 bcall_1,bcall_2
- character*4 grid4
- character c1*1,c2*2
- logical is_grid4
- logical ok1,ok2
- integer, intent(in) :: ntxhash
- is_grid4(grid4)=len(trim(grid4)).eq.4 .and. &
- grid4(1:1).ge.'A' .and. grid4(1:1).le.'R' .and. &
- grid4(2:2).ge.'A' .and. grid4(2:2).le.'R' .and. &
- grid4(3:3).ge.'0' .and. grid4(3:3).le.'9' .and. &
- grid4(4:4).ge.'0' .and. grid4(4:4).le.'9'
-
- if(nwords.lt.2 .or. nwords.gt.4) return
- call chkcall(w(1),bcall_1,ok1)
- call chkcall(w(2),bcall_2,ok2)
- if(w(1)(1:3).eq.'DE ' .or. w(1)(1:3).eq.'CQ_' .or. w(1)(1:3).eq.'CQ ' .or. &
- w(1)(1:4).eq.'QRZ ') ok1=.true.
- if(w(1)(1:1).eq.'<' .and. index(w(1),'>').ge.5) ok1=.true.
- if(w(2)(1:1).eq.'<' .and. index(w(2),'>').ge.5) ok2=.true.
- if(.not.ok1 .or. .not.ok2) return
- if(w(1)(1:1).eq.'<' .and. index(w(2),'/').gt.0) return
- if(w(2)(1:1).eq.'<' .and. index(w(1),'/').gt.0) return
- if(nwords.eq.2 .and. (.not.ok2 .or. index(w(2),'/').ge.2)) return
- if(nwords.eq.2) go to 10
-
- c1=w(nwords)(1:1)
- c2=w(nwords)(1:2)
- if(.not.is_grid4(w(nwords)(1:4)) .and. c1.ne.'+' .and. c1.ne.'-' &
- .and. c2.ne.'R+' .and. c2.ne.'R-' .and. trim(w(nwords)).ne.'RRR' .and. &
- trim(w(nwords)).ne.'RR73' .and. trim(w(nwords)).ne.'73') return
- if(c1.eq.'+' .or. c1.eq.'-') then
- ir=0
- read(w(nwords),*,err=900) irpt
- if(irpt.ge.-50 .and. irpt.le.-31) irpt=irpt+101
- irpt=irpt+35
- else if(c2.eq.'R+' .or. c2.eq.'R-') then
- ir=1
- read(w(nwords)(2:),*,err=900) irpt
- if(irpt.ge.-50 .and. irpt.le.-31) irpt=irpt+101
- irpt=irpt+35
- else if(trim(w(nwords)).eq.'RRR') then
- ir=0
- irpt=2
- else if(trim(w(nwords)).eq.'RR73') then
- ir=0
- irpt=3
- else if(trim(w(nwords)).eq.'73') then
- ir=0
- irpt=4
- endif
-
-! 1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg
-! 2 PA3XYZ/P GM4ABC/P R JO22 28 1 28 1 1 15 74 EU VHF contest
-
-10 i1psuffix=index(w(1)//' ' ,'/P ')
- i2psuffix=index(w(2)//' ','/P ')
- if(nwords.eq.2 .or. nwords.eq.3 .or. (nwords.eq.4 .and. &
- w(3)(1:2).eq.'R ')) then
- n3=0
- i3=1 !Type 1: Standard message, possibly with "/R"
- if (i1psuffix.ge.4.or.i2psuffix.ge.4) i3=2 !Type 2, with "/P"
- endif
- c13=bcall_1
- if(c13(1:3).eq.'CQ_' .or. w(1)(1:1).eq.'<') c13=w(1)
- call pack28var(c13,n28a,ntxhash)
- c13=bcall_2
- if(w(2)(1:1).eq.'<') c13=w(2)
- call pack28var(c13,n28b,ntxhash)
- ipa=0
- ipb=0
- if(i1psuffix.ge.4.or.index(w(1)//' ','/R ').ge.4) ipa=1
- if(i2psuffix.ge.4.or.index(w(2)//' ','/R ').ge.4) ipb=1
-
- grid4=w(nwords)(1:4)
- if(is_grid4(grid4)) then
- ir=0
- if(w(3).eq.'R ') ir=1
- j1=(ichar(grid4(1:1))-ichar('A'))*18*10*10
- j2=(ichar(grid4(2:2))-ichar('A'))*10*10
- j3=(ichar(grid4(3:3))-ichar('0'))*10
- j4=(ichar(grid4(4:4))-ichar('0'))
- igrid4=j1+j2+j3+j4
- else
- igrid4=MAXGRID4 + irpt
- endif
- if(nwords.eq.2) then
- ir=0
- irpt=1
- igrid4=MAXGRID4+irpt
- endif
- write(c77,1000) n28a,ipa,n28b,ipb,ir,igrid4,i3
-1000 format(2(b28.28,b1),b1,b15.15,b3.3)
- return
-
-900 return
-end subroutine pack77_1var
-
-
-subroutine pack77_3var(nwords,w,i3,n3,c77,ntxhash)
-! Check Type 3 (ARRL RTTY contest exchange)
-!ARRL RTTY - US/Can: rpt state/prov R 579 MA
-! - DX: rpt serial R 559 0013
-! Example message: TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74
-
- parameter (NUSCAN=171) !Number of US states and Canadian provinces/territories
- character*13 w(19)
- character*77 c77
- character*6 bcall_1,bcall_2
- character*3 cmult(NUSCAN),mult
- character crpt*3
- integer, intent(in) :: ntxhash
- logical ok1,ok2
- data cmult/ &
- "AL ","AK ","AZ ","AR ","CA ","CO ","CT ","DE ","FL ","GA ", &
- "HI ","ID ","IL ","IN ","IA ","KS ","KY ","LA ","ME ","MD ", &
- "MA ","MI ","MN ","MS ","MO ","MT ","NE ","NV ","NH ","NJ ", &
- "NM ","NY ","NC ","ND ","OH ","OK ","OR ","PA ","RI ","SC ", &
- "SD ","TN ","TX ","UT ","VT ","VA ","WA ","WV ","WI ","WY ", &
- "NB ","NS ","QC ","ON ","MB ","SK ","AB ","BC ","NWT","NF ", &
- "LB ","NU ","YT ","PEI","DC ","DR ","FR ","GD ","GR ","OV ", &
- "ZH ","ZL ","X01","X02","X03","X04","X05","X06","X07","X08", &
- "X09","X10","X11","X12","X13","X14","X15","X16","X17","X18", &
- "X19","X20","X21","X22","X23","X24","X25","X26","X27","X28", &
- "X29","X30","X31","X32","X33","X34","X35","X36","X37","X38", &
- "X39","X40","X41","X42","X43","X44","X45","X46","X47","X48", &
- "X49","X50","X51","X52","X53","X54","X55","X56","X57","X58", &
- "X59","X60","X61","X62","X63","X64","X65","X66","X67","X68", &
- "X69","X70","X71","X72","X73","X74","X75","X76","X77","X78", &
- "X79","X80","X81","X82","X83","X84","X85","X86","X87","X88", &
- "X89","X90","X91","X92","X93","X94","X95","X96","X97","X98", &
- "X99"/
-
- if(w(1)(1:1).eq.'<' .and. w(2)(1:1).eq.'<') go to 900
- if(nwords.eq.4 .or. nwords.eq.5 .or. nwords.eq.6) then
- i1=1
- if(trim(w(1)).eq.'TU;') i1=2
- call chkcall(w(i1),bcall_1,ok1)
- call chkcall(w(i1+1),bcall_2,ok2)
- if(.not.ok1 .or. .not.ok2) go to 900
- crpt=w(nwords-1)(1:3)
- if(index(crpt,'-').ge.1 .or. index(crpt,'+').ge.1) go to 900
- if(crpt(1:1).eq.'5' .and. crpt(2:2).ge.'2' .and. crpt(2:2).le.'9' .and. &
- crpt(3:3).eq.'9') then
- nserial=0
- read(w(nwords),*,err=1) nserial
- endif
-1 mult=' '
- imult=-1
- do i=1,NUSCAN
- if(cmult(i).eq.w(nwords)) then
- imult=i
- mult=cmult(i)
- exit
- endif
- enddo
- nexch=0
- if(nserial.gt.0) nexch=nserial
- if(imult.gt.0) nexch=8000+imult
- if(mult.ne.' ' .or. nserial.gt.0) then
- i3=3
- n3=0
- itu=0
- if(trim(w(1)).eq.'TU;') itu=1
- call pack28var(w(1+itu),n28a,ntxhash)
- call pack28var(w(2+itu),n28b,ntxhash)
- ir=0
- if(w(3+itu)(1:2).eq.'R ') ir=1
- read(w(3+itu+ir),*,err=900) irpt
- irpt=(irpt-509)/10 - 2
- if(irpt.lt.0) irpt=0
- if(irpt.gt.7) irpt=7
-! 3 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest
-! 3 TU; W9XYZ G8ABC R 559 0013 1 28 28 1 3 13 74 ARRL RTTY (DX)
- write(c77,1010) itu,n28a,n28b,ir,irpt,nexch,i3
-1010 format(b1,2b28.28,b1,b3.3,b13.13,b3.3)
- endif
- endif
-
-900 return
-end subroutine pack77_3var
-
-subroutine pack77_4var(nwords,w,i3,n3,c77,ntxhash)
-
-! Check Type 4 (One nonstandard call and one hashed call)
-! Example message: <WA9XYZ> PJ4/KA1ABC RR73 12 58 1 2 1 74
-
- integer*8 n58
- logical ok1,ok2,lhashit
- character*13 w(19)
- character*77 c77
- character*13 call_1,call_2
- character*11 c11
- character*6 bcall_1,bcall_2
- character*38 c
- integer, intent(in) :: ntxhash
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/
-
- iflip=0
- i3=-1
- if(nwords.eq.2 .or. nwords.eq.3) then
- call_1=w(1)
- if(call_1(1:1).eq.'<') call_1=w(1)(2:len(trim(w(1)))-1)
- call_2=w(2)
- if(call_2(1:1).eq.'<') call_2=w(2)(2:len(trim(w(2)))-1)
- call chkcall(call_1,bcall_1,ok1)
- call chkcall(call_2,bcall_2,ok2)
- if(call_1.eq.bcall_1 .and. call_2.eq.bcall_2 .and. ok1 .and. ok2) go to 900
- icq=0
- if(trim(w(1)).eq.'CQ' .or. (ok1.and.ok2)) then
- if(trim(w(1)).eq.'CQ' .and. len(trim(w(2))).le.4) go to 900
- i3=4
- n3=0
- if(trim(w(1)).eq.'CQ') icq=1
- endif
-
- lhashit=.false.; if(ntxhash.eq.1) lhashit=.true.
- if(icq.eq.1) then
- iflip=0
- n12=0
- c11=adjustr(call_2(1:11))
- call save_hash_txcallvar(w(2),n10,n12,n22,lhashit)
- else if(w(1)(1:1).eq.'<') then
- iflip=0
- i3=4
- call save_hash_txcallvar(w(1),n10,n12,n22,lhashit)
- c11=adjustr(call_2(1:11))
- else if(w(2)(1:1).eq.'<') then
- iflip=1
- i3=4
- call save_hash_txcallvar(w(2),n10,n12,n22,lhashit)
- c11=adjustr(call_1(1:11))
- endif
- n58=0
- do i=1,11
- n58=n58*38 + index(c,c11(i:i)) - 1
- enddo
- nrpt=0
- if(trim(w(3)).eq.'RRR') nrpt=1
- if(trim(w(3)).eq.'RR73') nrpt=2
- if(trim(w(3)).eq.'73') nrpt=3
- if(icq.eq.1) then
- iflip=0
- nrpt=0
- endif
- write(c77,1010) n12,n58,iflip,nrpt,icq,i3
-1010 format(b12.12,b58.58,b1,b2.2,b1,b3.3)
- do i=1,77
- if(c77(i:i).eq.'*') c77(i:i)='0' !### Clean up any illegal chars ###
- enddo
- endif
-
-900 return
-end subroutine pack77_4var
-
-subroutine pack77_5var(nwords,w,i3,n3,c77,ntxhash)
-
-! Pack a Type 0.2 message: EU VHF Contest mode
-! Example message: PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25
-! <PA3XYZ> <G4ABC/P> R 590003 IO91NP h10 h20 r1 s3 s12 g25
-
- character*13 w(19),c13
- character*77 c77
- character*6 grid6
- logical is_grid6,lhashit
- integer, intent(in) :: ntxhash
-
- is_grid6(grid6)=len(trim(grid6)).eq.6 .and. &
- grid6(1:1).ge.'A' .and. grid6(1:1).le.'R' .and. &
- grid6(2:2).ge.'A' .and. grid6(2:2).le.'R' .and. &
- grid6(3:3).ge.'0' .and. grid6(3:3).le.'9' .and. &
- grid6(4:4).ge.'0' .and. grid6(4:4).le.'9' .and. &
- grid6(5:5).ge.'A' .and. grid6(5:5).le.'X' .and. &
- grid6(6:6).ge.'A' .and. grid6(6:6).le.'X'
-
- if(nwords.lt.4 .or. nwords.gt.5) return !nwords must be 4 or 5
- if(w(1)(1:1).ne.'<' .or. w(2)(1:1).ne.'<') return !Both calls must be hashed
- nx=-1
- read(w(nwords-1),*,err=2) nx
-2 if(nx.lt.520001 .or. nx.gt.594095) return !Exchange between 520001 - 594095
- if(.not.is_grid6(w(nwords)(1:6))) return !Last word must be a valid grid6
-
-! Type 0.2: <PA3XYZ> <G4ABC/P> R 590003 IO91NP h10 h20 r1 s3 s12 g25
-
- i3=5
- n3=0
-
- lhashit=.false.; if(ntxhash.eq.1) lhashit=.true.
- call save_hash_txcallvar(w(1),n10,n12,n22,lhashit)
- i2=index(w(1),'>')
- c13=w(1)(2:i2-1)
- n12=ihashcall(c13,12)
-
- call save_hash_txcallvar(w(2),n10a,n12a,n22,lhashit)
- i2=index(w(2),'>')
- c13=w(2)(2:i2-1)
- n22=ihashcall(c13,22)
-
- ir=0
- if(w(3)(1:2).eq.'R ') ir=1
- irpt=nx/10000 - 52
- iserial=mod(nx,10000)
- if(iserial.gt.2047) iserial=2047
- grid6=w(nwords)(1:6)
- j1=(ichar(grid6(1:1))-ichar('A'))*18*10*10*24*24
- j2=(ichar(grid6(2:2))-ichar('A'))*10*10*24*24
- j3=(ichar(grid6(3:3))-ichar('0'))*10*24*24
- j4=(ichar(grid6(4:4))-ichar('0'))*24*24
- j5=(ichar(grid6(5:5))-ichar('A'))*24
- j6=(ichar(grid6(6:6))-ichar('A'))
- igrid6=j1+j2+j3+j4+j5+j6
- write(c77,1010) n12,n22,ir,irpt,iserial,igrid6,i3
-1010 format(b12.12,b22.22,b1,b3.3,b11.11,b25.25,b3.3)
-
- return
-end subroutine pack77_5var
-
-subroutine packtext77var(c13,c71)
-
- character*13 c13,w
- character*71 c71
- character*42 c
- character*1 qa(10),qb(10)
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?'/
-
- call mp_short_init
- qa=char(0)
- w=adjustr(c13)
- do i=1,13
- j=index(c,w(i:i))-1
- if(j.lt.0) j=0
- call mp_short_mult(qb,qa(2:10),9,42) !qb(1:9)=42*qa(2:9)
- call mp_short_add(qa,qb(2:10),9,j) !qa(1:9)=qb(2:9)+j
- enddo
-
- write(c71,1010) qa(2:10)
-1010 format(b7.7,8b8.8)
-
- return
-end subroutine packtext77var
-
-subroutine unpacktext77var(c71,c13)
-
- integer*1 ia(10)
- character*1 qa(10),qb(10)
- character*13 c13
- character*71 c71
- character*42 c
- equivalence (qa,ia),(qb,ib)
- data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?'/
-
- qa(1)=char(0)
- read(c71,1010) qa(2:10)
-1010 format(b7.7,8b8.8)
-
- do i=13,1,-1
- call mp_short_div(qb,qa(2:10),9,42,ir)
- c13(i:i)=c(ir+1:ir+1)
- qa(2:10)=qb(1:9)
- enddo
-
- return
-end subroutine unpacktext77var
-
-subroutine mp_short_opsvar(w,u)
- character*1 w(*),u(*)
- integer i,ireg,j,n,ir,iv,ii1,ii2
- character*1 creg(4)
- save ii1,ii2
- equivalence (ireg,creg)
-
- entry mp_short_init
- ireg=256*ichar('2')+ichar('1')
- do j=1,4
- if (creg(j).eq.'1') ii1=j
- if (creg(j).eq.'2') ii2=j
- enddo
- return
-
- entry mp_short_add(w,u,n,iv)
- ireg=256*iv
- do j=n,1,-1
- ireg=ichar(u(j))+ichar(creg(ii2))
- w(j+1)=creg(ii1)
- enddo
- w(1)=creg(ii2)
- return
-
- entry mp_short_mult(w,u,n,iv)
- ireg=0
- do j=n,1,-1
- ireg=ichar(u(j))*iv+ichar(creg(ii2))
- w(j+1)=creg(ii1)
- enddo
- w(1)=creg(ii2)
- return
-
- entry mp_short_div(w,u,n,iv,ir)
- ir=0
- do j=1,n
- i=256*ir+ichar(u(j))
- w(j)=char(i/iv)
- ir=mod(i,iv)
- enddo
- return
-
- return
-end subroutine mp_short_opsvar
-
-subroutine add_call_to_recent_callsvar(callsign,nthr)
-
- character*13 callsign
- logical ladd
- integer, intent(in) :: nthr
-
-! only add if the callsign is not already on the list
- ladd=.true.
- do i=1,MAXRECENT-1 ! if callsign is at the end of the list add it again
- if(recent_calls(i).eq.callsign) ladd=.false.
- enddo
-
- if(ladd) then
- do i=MAXRECENT,2,-1
- recent_calls(i)=recent_calls(i-1)
- enddo
- recent_calls(1)=callsign
- endif
-
-! Make sure that callsign is hashed
- call save_hash_callvar(callsign,nthr)
-
- return
-end subroutine add_call_to_recent_callsvar
-
-subroutine to_grid4var(n,grid4,ok)
- character*4 grid4
- logical ok
-
- ok=.false.
- j1=n/(18*10*10)
- if (j1.lt.0.or.j1.gt.17) goto 900
- n=n-j1*18*10*10
- j2=n/(10*10)
- if (j2.lt.0.or.j2.gt.17) goto 900
- n=n-j2*10*10
- j3=n/10
- if (j3.lt.0.or.j3.gt.9) goto 900
- j4=n-j3*10
- if (j4.lt.0.or.j4.gt.9) goto 900
- grid4(1:1)=char(j1+ichar('A'))
- grid4(2:2)=char(j2+ichar('A'))
- grid4(3:3)=char(j3+ichar('0'))
- grid4(4:4)=char(j4+ichar('0'))
- ok=.true.
-
-900 return
-end subroutine to_grid4var
-
-subroutine to_grid6var(n,grid6,ok)
- character*6 grid6
- logical ok
-
- ok=.false.
- j1=n/(18*10*10*24*24)
- if (j1.lt.0.or.j1.gt.17) goto 900
- n=n-j1*18*10*10*24*24
- j2=n/(10*10*24*24)
- if (j2.lt.0.or.j2.gt.17) goto 900
- n=n-j2*10*10*24*24
- j3=n/(10*24*24)
- if (j3.lt.0.or.j3.gt.9) goto 900
- n=n-j3*10*24*24
- j4=n/(24*24)
- if (j4.lt.0.or.j4.gt.9) goto 900
- n=n-j4*24*24
- j5=n/24
- if (j5.lt.0.or.j5.gt.23) goto 900
- j6=n-j5*24
- if (j6.lt.0.or.j6.gt.23) goto 900
- grid6(1:1)=char(j1+ichar('A'))
- grid6(2:2)=char(j2+ichar('A'))
- grid6(3:3)=char(j3+ichar('0'))
- grid6(4:4)=char(j4+ichar('0'))
- grid6(5:5)=char(j5+ichar('A'))
- grid6(6:6)=char(j6+ichar('A'))
- ok=.true.
-
-900 return
-end subroutine to_grid6var
-
-subroutine to_gridvar(n,grid6,ok)
- ! 4-, or 6-character grid
- character*6 grid6
- logical ok
-
- ok=.false.
- j1=n/(18*10*10*25*25)
- if (j1.lt.0.or.j1.gt.17) goto 900
- n=n-j1*18*10*10*25*25
- j2=n/(10*10*25*25)
- if (j2.lt.0.or.j2.gt.17) goto 900
- n=n-j2*10*10*25*25
- j3=n/(10*25*25)
- if (j3.lt.0.or.j3.gt.9) goto 900
- n=n-j3*10*25*25
- j4=n/(25*25)
- if (j4.lt.0.or.j4.gt.9) goto 900
- n=n-j4*25*25
- j5=n/25
- if (j5.lt.0.or.j5.gt.24) goto 900
- j6=n-j5*25
- if (j6.lt.0.or.j6.gt.24) goto 900
- grid6=''
- grid6(1:1)=char(j1+ichar('A'))
- grid6(2:2)=char(j2+ichar('A'))
- grid6(3:3)=char(j3+ichar('0'))
- grid6(4:4)=char(j4+ichar('0'))
- if (j5.ne.24.or.j6.ne.24) then
- grid6(5:5)=char(j5+ichar('A'))
- grid6(6:6)=char(j6+ichar('A'))
- endif
- ok=.true.
-
-900 return
-end subroutine to_gridvar
-
-end module packjt77var
diff --git a/lib/ft8var/partint.f90 b/lib/ft8var/partint.f90 index 66395d11..312bfbfa 100755..100644 --- a/lib/ft8var/partint.f90 +++ b/lib/ft8var/partint.f90 @@ -1,18 +1,18 @@ -
-subroutine partint(ndelay,nutc)
-
- use jt65_mod6
- real rnd
-
- numsamp=ndelay*1200
- dd(numsamp+1:624000)=dd(1:(624000-numsamp))
- do i=1,numsamp
- call random_number(rnd)
- dd(i)=10.0*rnd-5.
- enddo
- write(*,2) nutc,'partial loss of data','d'
-2 format(i4.4,2x,a20,21x,a1)
- call flush(6)
-
- return
+ +subroutine partint(ndelay,nutc) + + use jt65_mod6 + real rnd + + numsamp=ndelay*1200 + dd(numsamp+1:624000)=dd(1:(624000-numsamp)) + do i=1,numsamp + call random_number(rnd) + dd(i)=10.0*rnd-5. + enddo + write(*,2) nutc,'partial loss of data','d' +2 format(i4.4,2x,a20,21x,a1) + call flush(6) + + return end subroutine partint
\ No newline at end of file diff --git a/lib/ft8var/partintft8.f90 b/lib/ft8var/partintft8.f90 index be2f7006..6b696bad 100755..100644 --- a/lib/ft8var/partintft8.f90 +++ b/lib/ft8var/partintft8.f90 @@ -1,18 +1,18 @@ -subroutine partintft8(ndelay,nutc)
-
- use ft8_mod1, only : dd8
- real rnd
-
- if(ndelay.gt.120) ndelay=120
- numsamp=nint(float(ndelay)*1200)
- dd8(numsamp+1:180000)=dd8(1:(180000-numsamp))
- do i=1,numsamp
- call random_number(rnd)
- dd8(i)=10.0*rnd-5.
- enddo
- write(*,2) nutc,'partial loss of data','d'
-2 format(i6.6,2x,a20,21x,a1)
- call flush(6)
-
- return
+subroutine partintft8(ndelay,nutc) + + use ft8_mod1, only : dd8 + real rnd + + if(ndelay.gt.120) ndelay=120 + numsamp=nint(float(ndelay)*1200) + dd8(numsamp+1:180000)=dd8(1:(180000-numsamp)) + do i=1,numsamp + call random_number(rnd) + dd8(i)=10.0*rnd-5. + enddo + write(*,2) nutc,'partial loss of data','d' +2 format(i6.6,2x,a20,21x,a1) + call flush(6) + + return end subroutine partintft8
\ No newline at end of file diff --git a/lib/ft8var/rms_augapvar.f90 b/lib/ft8var/rms_augapvar.f90 index c845900f..1b9cb0ba 100755..100644 --- a/lib/ft8var/rms_augapvar.f90 +++ b/lib/ft8var/rms_augapvar.f90 @@ -1,42 +1,42 @@ -
-subroutine rms_augapvar(nutc,lowrms)
-
- use jt65_mod6, only : dd
-
- logical lowrms,baddatavar
-
- rms1=sqrt(dot_product(dd(100000:100099),dd(100000:100099))/100.0)
- rms2=sqrt(dot_product(dd(200000:200099),dd(200000:200099))/100.0)
- rms3=sqrt(dot_product(dd(300000:300099),dd(300000:300099))/100.0)
- rms4=sqrt(dot_product(dd(400000:400099),dd(400000:400099))/100.0)
- rms5=sqrt(dot_product(dd(500000:500099),dd(500000:500099))/100.0)
- rms=(rms1+rms2+rms3+rms4+rms5)/5.0
- if(rms.lt.2.0) then
- write(*,1016) nutc,'input signal low rms','d'
-1016 format(i4.4,2x,a20,19x,a1)
- call flush(6)
- lowrms=.true.
- return
- endif
-
- if(baddatavar()) then
- write(*,1017) nutc,'audio gap detected','d'
-1017 format(i4.4,2x,a18,21x,a1)
- call flush(6)
-
- j=0
- do i=1,490
- sq=0.
- do n=1,1200,60
- j=j+60
- x=dd(j)
- sq=sq + abs(x)
- enddo
- if(sq.lt.1.0) then
- dd(j)=1.0; dd(j-600)=1.0
- endif
- enddo
- endif
-
- return
+ +subroutine rms_augapvar(nutc,lowrms) + + use jt65_mod6, only : dd + + logical lowrms,baddatavar + + rms1=sqrt(dot_product(dd(100000:100099),dd(100000:100099))/100.0) + rms2=sqrt(dot_product(dd(200000:200099),dd(200000:200099))/100.0) + rms3=sqrt(dot_product(dd(300000:300099),dd(300000:300099))/100.0) + rms4=sqrt(dot_product(dd(400000:400099),dd(400000:400099))/100.0) + rms5=sqrt(dot_product(dd(500000:500099),dd(500000:500099))/100.0) + rms=(rms1+rms2+rms3+rms4+rms5)/5.0 + if(rms.lt.2.0) then + write(*,1016) nutc,'input signal low rms','d' +1016 format(i4.4,2x,a20,19x,a1) + call flush(6) + lowrms=.true. + return + endif + + if(baddatavar()) then + write(*,1017) nutc,'audio gap detected','d' +1017 format(i4.4,2x,a18,21x,a1) + call flush(6) + + j=0 + do i=1,490 + sq=0. + do n=1,1200,60 + j=j+60 + x=dd(j) + sq=sq + abs(x) + enddo + if(sq.lt.1.0) then + dd(j)=1.0; dd(j-600)=1.0 + endif + enddo + endif + + return end subroutine rms_augapvar
\ No newline at end of file diff --git a/lib/ft8var/searchcallsvar.f90 b/lib/ft8var/searchcallsvar.f90 index 37a1c323..1d986407 100755..100644 --- a/lib/ft8var/searchcallsvar.f90 +++ b/lib/ft8var/searchcallsvar.f90 @@ -1,83 +1,83 @@ -
-subroutine searchcallsvar(callsign1,callsign2,lfound)
-
- use jt65_mod9, only : ncall0c,ncalld,ncallef,ncallgh,ncalli,ncallj,ncallk,ncalllm,ncalln,ncallo,ncallpq,ncallr, &
- ncallst,ncalluv,ncallw,ncallxz,call0c,calld,callef,callgh,calli,callj,callk,calllm,calln,callo, &
- callpq,callr,callst,calluv,callw,callxz,ldbvalid ! callsign DB in memory
- character*12 callsign0,callsign1,callsign2
- logical(1) lfound
-
- if(.not.ldbvalid) then; lfound=.true.; return; endif ! bail out
-
- nlencall1=len_trim(callsign1); nlencall2=len_trim(callsign2)
- if(nlencall1.gt.7 .and. callsign2.eq." ") then; lfound=.true.; return; endif
- if(nlencall2.gt.7) callsign2=" " ! we can not put in ALLCALL all special callsign0s in advance
- ncycles=2; if(callsign2.eq." ") ncycles=1
- do j=1,ncycles
- if(j.eq.1) then; callsign0=callsign1; else; callsign0=callsign2; endif
- if(callsign0.eq."TU;") cycle
- if(callsign0(1:1).lt."N") then
- if(callsign0(1:1).lt."I") then
- if(callsign0(1:1).lt."E") then
- if(callsign0(1:1).lt."D") then
- do i=1,ncall0c; if(call0c(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncalld; if(calld(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- else
- if(callsign0(1:1).lt."G") then
- do i=1,ncallef; if(callef(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncallgh; if(callgh(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- endif
- else
- if(callsign0(1:1).lt."K") then
- if(callsign0(1:1).lt."J") then
- do i=1,ncalli; if(calli(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncallj; if(callj(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- else
- if(callsign0(1:1).lt."L") then
- do i=1,ncallk; if(callk(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncalllm; if(calllm(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- endif
- endif
- else
- if(callsign0(1:1).lt."S") then
- if(callsign0(1:1).lt."P") then
- if(callsign0(1:1).lt."O") then
- do i=1,ncalln; if(calln(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncallo; if(callo(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- else
- if(callsign0(1:1).lt."R") then
- do i=1,ncallpq; if(callpq(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncallr; if(callr(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- endif
- else
- if(callsign0(1:1).lt."W") then
- if(callsign0(1:1).lt."U") then
- do i=1,ncallst; if(callst(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncalluv; if(calluv(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- else
- if(callsign0(1:1).lt."X") then
- do i=1,ncallw; if(callw(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- else
- do i=1,ncallxz; if(callxz(i).eq.callsign0) then; lfound=.true.; return; endif; enddo
- endif
- endif
- endif
- endif
- enddo
-! print *,"blocked ",callsign1,callsign2
- return
-end subroutine searchcallsvar
+ +subroutine searchcallsvar(callsign1,callsign2,lfound) + + use jt65_mod9, only : ncall0c,ncalld,ncallef,ncallgh,ncalli,ncallj,ncallk,ncalllm,ncalln,ncallo,ncallpq,ncallr, & + ncallst,ncalluv,ncallw,ncallxz,call0c,calld,callef,callgh,calli,callj,callk,calllm,calln,callo, & + callpq,callr,callst,calluv,callw,callxz,ldbvalid ! callsign DB in memory + character*12 callsign0,callsign1,callsign2 + logical(1) lfound + + if(.not.ldbvalid) then; lfound=.true.; return; endif ! bail out + + nlencall1=len_trim(callsign1); nlencall2=len_trim(callsign2) + if(nlencall1.gt.7 .and. callsign2.eq." ") then; lfound=.true.; return; endif + if(nlencall2.gt.7) callsign2=" " ! we can not put in ALLCALL all special callsign0s in advance + ncycles=2; if(callsign2.eq." ") ncycles=1 + do j=1,ncycles + if(j.eq.1) then; callsign0=callsign1; else; callsign0=callsign2; endif + if(callsign0.eq."TU;") cycle + if(callsign0(1:1).lt."N") then + if(callsign0(1:1).lt."I") then + if(callsign0(1:1).lt."E") then + if(callsign0(1:1).lt."D") then + do i=1,ncall0c; if(call0c(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncalld; if(calld(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + else + if(callsign0(1:1).lt."G") then + do i=1,ncallef; if(callef(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncallgh; if(callgh(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + endif + else + if(callsign0(1:1).lt."K") then + if(callsign0(1:1).lt."J") then + do i=1,ncalli; if(calli(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncallj; if(callj(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + else + if(callsign0(1:1).lt."L") then + do i=1,ncallk; if(callk(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncalllm; if(calllm(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + endif + endif + else + if(callsign0(1:1).lt."S") then + if(callsign0(1:1).lt."P") then + if(callsign0(1:1).lt."O") then + do i=1,ncalln; if(calln(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncallo; if(callo(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + else + if(callsign0(1:1).lt."R") then + do i=1,ncallpq; if(callpq(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncallr; if(callr(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + endif + else + if(callsign0(1:1).lt."W") then + if(callsign0(1:1).lt."U") then + do i=1,ncallst; if(callst(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncalluv; if(calluv(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + else + if(callsign0(1:1).lt."X") then + do i=1,ncallw; if(callw(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + else + do i=1,ncallxz; if(callxz(i).eq.callsign0) then; lfound=.true.; return; endif; enddo + endif + endif + endif + endif + enddo +! print *,"blocked ",callsign1,callsign2 + return +end subroutine searchcallsvar diff --git a/lib/ft8var/subtractft8var.f90 b/lib/ft8var/subtractft8var.f90 index 5c7ba211..a15f9bfa 100755..100644 --- a/lib/ft8var/subtractft8var.f90 +++ b/lib/ft8var/subtractft8var.f90 @@ -1,41 +1,41 @@ -subroutine subtractft8var(itone,f0,dt)
-
-! Subtract an ft8 signal
-!
-! Measured signal : dd(t) = a(t)cos(2*pi*f0*t+theta(t))
-! Reference signal : cref(t) = exp( j*(2*pi*f0*t+phi(t)) )
-! Complex amp : cfilt(t) = LPF[ dd(t)*CONJG(cref(t)) ]
-! Subtract : dd(t) = dd(t) - 2*REAL{cref*cfilt}
-
- use ft8_mod1, only : dd8,cw,NFILT1,NFILT2,endcorr
-! NMAX=15*12000,NFFT=15*12000,NFRAME=1920*79
- parameter (NFFT=180000,NMAX=180000,NFRAME=151680)
- complex cref(nframe),cfilt(nmax)
- integer itone(79)
- save cfilt
- !$omp threadprivate(cfilt)
-
- nstart=dt*12000+1
- call gen_ft8wavevar(itone,79,1920,2.0,12000.0,f0,cref,xjunk,1,NFRAME)
- do i=1,nframe
- id=nstart-1+i
- if(id.ge.1.and.id.le.NMAX) then
- cfilt(i)=dd8(id)*conjg(cref(i))
- else
- cfilt(i)=0.0
- endif
- enddo
- cfilt(nframe+1:)=0.0
- call four2avar(cfilt,nfft,1,-1,1)
- cfilt(1:nfft)=cfilt(1:nfft)*cw(1:nfft)
- call four2avar(cfilt,nfft,1,1,1)
- cfilt(1:NFILT1/2+1)=cfilt(1:NFILT1/2+1)*endcorr
- cfilt(nframe:nframe-NFILT1/2:-1)=cfilt(nframe:nframe-NFILT1/2:-1)*endcorr
- do i=1,nframe
- j=nstart+i-1
- if(j.ge.1 .and. j.le.NMAX) dd8(j)=dd8(j)-2*REAL(cfilt(i)*cref(i))
- enddo
-!!!$omp flush(dd8) ! makes no difference in number of decoded messages
-
- return
-end subroutine subtractft8var
+subroutine subtractft8var(itone,f0,dt) + +! Subtract an ft8 signal +! +! Measured signal : dd(t) = a(t)cos(2*pi*f0*t+theta(t)) +! Reference signal : cref(t) = exp( j*(2*pi*f0*t+phi(t)) ) +! Complex amp : cfilt(t) = LPF[ dd(t)*CONJG(cref(t)) ] +! Subtract : dd(t) = dd(t) - 2*REAL{cref*cfilt} + + use ft8_mod1, only : dd8,cw,NFILT1,NFILT2,endcorr +! NMAX=15*12000,NFFT=15*12000,NFRAME=1920*79 + parameter (NFFT=180000,NMAX=180000,NFRAME=151680) + complex cref(nframe),cfilt(nmax) + integer itone(79) + save cfilt + !$omp threadprivate(cfilt) + + nstart=dt*12000+1 + call gen_ft8wavevar(itone,79,1920,2.0,12000.0,f0,cref,xjunk,1,NFRAME) + do i=1,nframe + id=nstart-1+i + if(id.ge.1.and.id.le.NMAX) then + cfilt(i)=dd8(id)*conjg(cref(i)) + else + cfilt(i)=0.0 + endif + enddo + cfilt(nframe+1:)=0.0 + call four2avar(cfilt,nfft,1,-1,1) + cfilt(1:nfft)=cfilt(1:nfft)*cw(1:nfft) + call four2avar(cfilt,nfft,1,1,1) + cfilt(1:NFILT1/2+1)=cfilt(1:NFILT1/2+1)*endcorr + cfilt(nframe:nframe-NFILT1/2:-1)=cfilt(nframe:nframe-NFILT1/2:-1)*endcorr + do i=1,nframe + j=nstart+i-1 + if(j.ge.1 .and. j.le.NMAX) dd8(j)=dd8(j)-2*REAL(cfilt(i)*cref(i)) + enddo +!!!$omp flush(dd8) ! makes no difference in number of decoded messages + + return +end subroutine subtractft8var diff --git a/lib/ft8var/sync8dvar.f90 b/lib/ft8var/sync8dvar.f90 index 19e8e35a..34874679 100755..100644 --- a/lib/ft8var/sync8dvar.f90 +++ b/lib/ft8var/sync8dvar.f90 @@ -1,123 +1,123 @@ -subroutine sync8dvar(cd0,i0,ctwk,itwk,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand)
-
-! Compute sync power for a complex, downsampled FT8 signal.
- use ft8_mod1, only : csync,csynce,csyncsd,csyncsdcq,csynccq
-
- complex, intent(in) :: cd0(-800:4000),ctwk(32)
- complex csync1(0:18,32),csync2(32),z1,z2,z3,z4,zt1(0:6),zt2(0:6),zt3(0:6),zt4(0:7),zt5(0:18), &
- z11(224),z22(224),z33(224)
- real sync1(0:20)!,sync2(0:20)
- integer, intent(in) :: i0,ipass,iqso
- logical(1), intent(in) :: lcq,lcallsstd,lcqcand
- logical(1) lastsync
-
- sync=0.; sync1=0.; zt1=0.; zt2=0.; zt3=0.; z11=0.; z22=0.; z33=0.!; sync2=0.
- k=1
- do i=0,6 ! Sum over 7 Costas frequencies and three Costas arrays
- i1=i0+i*32; i2=i1+1152; i3=i1+2304 ! +36*32, +72*32
- csync2=csync(i,1:32)
- if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency
- z11(k:k+31)=cd0(i1:i1+31)*conjg(csync2); z22(k:k+31)=cd0(i2:i2+31)*conjg(csync2)
- z33(k:k+31)=cd0(i3:i3+31)*conjg(csync2)
- zt1(i)=sum(z11(k:k+31)); zt2(i)=sum(z22(k:k+31)); zt3(i)=sum(z33(k:k+31))
- k=k+32
- enddo
- if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then
- if(.not.lastsync) then
- do i=0,6
- sync1(i) = SQRT(real(zt1(i))**2 + aimag(zt1(i))**2)
- sync1(i+7) = SQRT(real(zt2(i))**2 + aimag(zt2(i))**2)
- sync1(i+14) = SQRT(real(zt3(i))**2 + aimag(zt3(i))**2)
- enddo
- sync=sum(sync1)
- else
- do i=0,6
- sync = sync + real(zt1(i))**2 + aimag(zt1(i))**2 + real(zt2(i))**2 + aimag(zt2(i))**2 + real(zt3(i))**2 + &
- aimag(zt3(i))**2
- enddo
- endif
- else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then
- if(.not.lastsync) then
- do i=0,6
- sync1(i) = real(zt1(i))**2 + aimag(zt1(i))**2
- sync1(i+7) = real(zt2(i))**2 + aimag(zt2(i))**2
- sync1(i+14) = real(zt3(i))**2 + aimag(zt3(i))**2
- enddo
- sync=sum(sync1)
- else
- do i=0,6
- sync = sync + real(zt1(i))**2 + aimag(zt1(i))**2 + real(zt2(i))**2 + aimag(zt2(i))**2 + real(zt3(i))**2 + &
- aimag(zt3(i))**2
- enddo
- endif
- else ! if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then
- do i=0,6
- if(i.lt.6) then
- z1=(zt1(i)+zt1(i+1))/2; z2=(zt2(i)+zt2(i+1))/2; z3=(zt3(i)+zt3(i+1))/2 ! use i=5 z values for i=6
- endif
- if(.not.lastsync) then
- sync = sync + abs(real(z1)) + abs(aimag(z1)) + abs(real(z2)) + abs(aimag(z2)) + abs(real(z3)) + abs(aimag(z3))
- else
- sync = sync + real(z1)**2 + aimag(z1)**2 + real(z2)**2 + aimag(z2)**2 + real(z3)**2 + aimag(z3)**2
- endif
- enddo
- endif
-
- if(itwk.eq.1 .and. lcqcand .and. iqso.eq.1) then
- zt4=0.
- do i=0,7
- csync2=csynccq(i,1:32); csync2=ctwk*csync2 !Tweak the frequency
- i4=i0+(i+7)*32; zt4(i)=sum(cd0(i4:i4+31)*conjg(csync2))
- enddo
- do i=0,7
- if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then
- if(i.lt.7) z4=(zt4(i)+zt4(i+1))/2 ! use i=6 z4 value for i=7
- else
- z4=zt4(i)
- endif
- if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then; sync = sync + SQRT(real(z4)**2 + aimag(z4)**2)
- else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then; sync = sync + real(z4)**2 + aimag(z4)**2
- else if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then; sync = sync + abs(real(z4)) + abs(aimag(z4))
- endif
- enddo
- endif
-
- if(.not.lastsync) then
- if(iqso.gt.1 .and. iqso.lt.4 .and. lcallsstd) csync1=csynce; if(iqso.eq.4 .and. .not.lcq) csync1=csyncsd
-
- if((iqso.eq.4 .and. .not.lcq) .or. ((iqso.eq.2 .or. iqso.eq.3) .and. lcallsstd)) then
- zt5=0.
- do i=0,18
- csync2=csync1(i,1:32)
- if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency
- i4=i0+(i+7)*32; zt5(i)=sum(cd0(i4:i4+31)*conjg(csync2))
- enddo
- do i=0,18
- if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then
- if(i.lt.18) z4=(zt5(i)+zt5(i+1))/2 ! use i=17 z4 value for i=18
- else
- z4=zt5(i)
- endif
- if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then; sync = sync + SQRT(real(z4)**2 + aimag(z4)**2)
- else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then; sync = sync + real(z4)**2 + aimag(z4)**2
- else if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then; sync = sync + abs(real(z4)) + abs(aimag(z4))
- endif
- enddo
- endif
-
- if(iqso.eq.4 .and. lcq) then
- do i=0,57
- csync2=csyncsdcq(i,1:32)
- if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency
- z4=0.; if(i.lt.29) then; k=i+7; else; k=i+14; endif
- i4=i0+k*32; z4=sum(cd0(i4:i4+31)*conjg(csync2))
- if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then; sync = sync + SQRT(real(z4)**2 + aimag(z4)**2)
- else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then; sync = sync + real(z4)**2 + aimag(z4)**2
- else if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then; sync = sync + abs(real(z4)) + abs(aimag(z4))
- endif
- enddo
- endif
- endif
-
- return
-end subroutine sync8dvar
+subroutine sync8dvar(cd0,i0,ctwk,itwk,sync,ipass,lastsync,iqso,lcq,lcallsstd,lcqcand) + +! Compute sync power for a complex, downsampled FT8 signal. + use ft8_mod1, only : csync,csynce,csyncsd,csyncsdcq,csynccq + + complex, intent(in) :: cd0(-800:4000),ctwk(32) + complex csync1(0:18,32),csync2(32),z1,z2,z3,z4,zt1(0:6),zt2(0:6),zt3(0:6),zt4(0:7),zt5(0:18), & + z11(224),z22(224),z33(224) + real sync1(0:20)!,sync2(0:20) + integer, intent(in) :: i0,ipass,iqso + logical(1), intent(in) :: lcq,lcallsstd,lcqcand + logical(1) lastsync + + sync=0.; sync1=0.; zt1=0.; zt2=0.; zt3=0.; z11=0.; z22=0.; z33=0.!; sync2=0. + k=1 + do i=0,6 ! Sum over 7 Costas frequencies and three Costas arrays + i1=i0+i*32; i2=i1+1152; i3=i1+2304 ! +36*32, +72*32 + csync2=csync(i,1:32) + if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency + z11(k:k+31)=cd0(i1:i1+31)*conjg(csync2); z22(k:k+31)=cd0(i2:i2+31)*conjg(csync2) + z33(k:k+31)=cd0(i3:i3+31)*conjg(csync2) + zt1(i)=sum(z11(k:k+31)); zt2(i)=sum(z22(k:k+31)); zt3(i)=sum(z33(k:k+31)) + k=k+32 + enddo + if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then + if(.not.lastsync) then + do i=0,6 + sync1(i) = SQRT(real(zt1(i))**2 + aimag(zt1(i))**2) + sync1(i+7) = SQRT(real(zt2(i))**2 + aimag(zt2(i))**2) + sync1(i+14) = SQRT(real(zt3(i))**2 + aimag(zt3(i))**2) + enddo + sync=sum(sync1) + else + do i=0,6 + sync = sync + real(zt1(i))**2 + aimag(zt1(i))**2 + real(zt2(i))**2 + aimag(zt2(i))**2 + real(zt3(i))**2 + & + aimag(zt3(i))**2 + enddo + endif + else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then + if(.not.lastsync) then + do i=0,6 + sync1(i) = real(zt1(i))**2 + aimag(zt1(i))**2 + sync1(i+7) = real(zt2(i))**2 + aimag(zt2(i))**2 + sync1(i+14) = real(zt3(i))**2 + aimag(zt3(i))**2 + enddo + sync=sum(sync1) + else + do i=0,6 + sync = sync + real(zt1(i))**2 + aimag(zt1(i))**2 + real(zt2(i))**2 + aimag(zt2(i))**2 + real(zt3(i))**2 + & + aimag(zt3(i))**2 + enddo + endif + else ! if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then + do i=0,6 + if(i.lt.6) then + z1=(zt1(i)+zt1(i+1))/2; z2=(zt2(i)+zt2(i+1))/2; z3=(zt3(i)+zt3(i+1))/2 ! use i=5 z values for i=6 + endif + if(.not.lastsync) then + sync = sync + abs(real(z1)) + abs(aimag(z1)) + abs(real(z2)) + abs(aimag(z2)) + abs(real(z3)) + abs(aimag(z3)) + else + sync = sync + real(z1)**2 + aimag(z1)**2 + real(z2)**2 + aimag(z2)**2 + real(z3)**2 + aimag(z3)**2 + endif + enddo + endif + + if(itwk.eq.1 .and. lcqcand .and. iqso.eq.1) then + zt4=0. + do i=0,7 + csync2=csynccq(i,1:32); csync2=ctwk*csync2 !Tweak the frequency + i4=i0+(i+7)*32; zt4(i)=sum(cd0(i4:i4+31)*conjg(csync2)) + enddo + do i=0,7 + if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then + if(i.lt.7) z4=(zt4(i)+zt4(i+1))/2 ! use i=6 z4 value for i=7 + else + z4=zt4(i) + endif + if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then; sync = sync + SQRT(real(z4)**2 + aimag(z4)**2) + else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then; sync = sync + real(z4)**2 + aimag(z4)**2 + else if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then; sync = sync + abs(real(z4)) + abs(aimag(z4)) + endif + enddo + endif + + if(.not.lastsync) then + if(iqso.gt.1 .and. iqso.lt.4 .and. lcallsstd) csync1=csynce; if(iqso.eq.4 .and. .not.lcq) csync1=csyncsd + + if((iqso.eq.4 .and. .not.lcq) .or. ((iqso.eq.2 .or. iqso.eq.3) .and. lcallsstd)) then + zt5=0. + do i=0,18 + csync2=csync1(i,1:32) + if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency + i4=i0+(i+7)*32; zt5(i)=sum(cd0(i4:i4+31)*conjg(csync2)) + enddo + do i=0,18 + if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then + if(i.lt.18) z4=(zt5(i)+zt5(i+1))/2 ! use i=17 z4 value for i=18 + else + z4=zt5(i) + endif + if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then; sync = sync + SQRT(real(z4)**2 + aimag(z4)**2) + else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then; sync = sync + real(z4)**2 + aimag(z4)**2 + else if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then; sync = sync + abs(real(z4)) + abs(aimag(z4)) + endif + enddo + endif + + if(iqso.eq.4 .and. lcq) then + do i=0,57 + csync2=csyncsdcq(i,1:32) + if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency + z4=0.; if(i.lt.29) then; k=i+7; else; k=i+14; endif + i4=i0+k*32; z4=sum(cd0(i4:i4+31)*conjg(csync2)) + if(ipass.eq.1 .or. ipass.eq.5 .or. ipass.eq.9) then; sync = sync + SQRT(real(z4)**2 + aimag(z4)**2) + else if(ipass.eq.2 .or. ipass.eq.6 .or. ipass.eq.7) then; sync = sync + real(z4)**2 + aimag(z4)**2 + else if(ipass.eq.3 .or. ipass.eq.4 .or. ipass.eq.8) then; sync = sync + abs(real(z4)) + abs(aimag(z4)) + endif + enddo + endif + endif + + return +end subroutine sync8dvar diff --git a/lib/ft8var/sync8var.f90 b/lib/ft8var/sync8var.f90 index f145c2e6..6540d766 100755..100644 --- a/lib/ft8var/sync8var.f90 +++ b/lib/ft8var/sync8var.f90 @@ -1,285 +1,285 @@ -subroutine sync8var(nfa,nfb,syncmin,nfqso,candidate,ncand,jzb,jzt,ipass,lqsothread,ncandthin,ndtcenter)
-
- use ft8_mod1, only : dd8,windowx,facx,icos7,lagcc,lagccbail,nfawide,nfbwide
- include 'ft8_params.f90'
- complex cx(0:NH1)
- real s(NH1,NHSYM),x(NFFT1),sync2d(NH1,jzb:jzt),red(NH1),candidate0(5,450),candidate(4,460),tall(30),freq,rcandthin,dtcenter
- integer jpeak(NH1),indx(NH1),ii(1)
- integer, intent(in) :: nfa,nfb,nfqso,jzb,jzt,ipass,ncandthin,ndtcenter
- logical(1) syncq(NH1,jzb:jzt),redcq(NH1),lcq,lcq2,lpass1,lpass2
- logical(1), intent(in) :: lqsothread
- equivalence (x,cx)
-
-! Compute symbol spectra, stepping by NSTEP steps.
- tstep=0.04 ! NSTEP/12000.0
- df=3.125 ! 12000.0/NFFT1 , Hz
- syncq=.false.; redcq=.false.; candidate(4,:)=0.
- rcandthin=ncandthin/100.;
- dtcenter=ndtcenter/100.
-
- if(ipass.eq.1 .or. ipass.eq.4 .or. ipass.eq.7) then
- do j=1,NHSYM
- ia=(j-1)*NSTEP + 1
- ib=ia+NSPS-1
- x(1:759)=0.
- if(j.ne.1) then; x(760:960)=dd8(ia-201:ia-1)*windowx(200:0:-1); else; x(760:960)=0.; endif
- x(961:2880)=facx*dd8(ia:ib); x(961)=x(961)*1.9; x(2880)=x(2880)*1.9
- if(j.ne.NHSYM) then; x(2881:3081)=dd8(ib+1:ib+201)*windowx; else; x(2881:3081)=0.; endif
- x(3082:)=0.
- call four2avar(cx,NFFT1,1,-1,0) !r2c FFT
- do i=1,NH1
- s(i,j)=SQRT(real(cx(i))**2 + aimag(cx(i))**2)
- enddo
- enddo
- endif
- if(ipass.eq.2 .or. ipass.eq.5 .or. ipass.eq.8) then
- do j=1,NHSYM
- ia=(j-1)*NSTEP + 1
- ib=ia+NSPS-1
- x(1:759)=0.
- if(j.ne.1) then; x(760:960)=dd8(ia-201:ia-1)*windowx(200:0:-1); else; x(760:960)=0.; endif
- x(961:2880)=facx*dd8(ia:ib); x(961)=x(961)*1.9; x(2880)=x(2880)*1.9
- if(j.ne.NHSYM) then; x(2881:3081)=dd8(ib+1:ib+201)*windowx; else; x(2881:3081)=0.; endif
- x(3082:)=0.
- call four2avar(cx,NFFT1,1,-1,0) !r2c FFT
- do i=1,NH1
- s(i,j)=real(cx(i))**2 + aimag(cx(i))**2
- enddo
- enddo
- endif
- if(ipass.eq.3 .or. ipass.eq.6 .or. ipass.eq.9) then
- do j=1,NHSYM
- ia=(j-1)*NSTEP + 1
- ib=ia+NSPS-1
- x(1:759)=0.
- if(j.ne.1) then; x(760:960)=dd8(ia-201:ia-1)*windowx(200:0:-1); else; x(760:960)=0.; endif
- x(961:2880)=facx*dd8(ia:ib); x(961)=x(961)*1.9; x(2880)=x(2880)*1.9
- if(j.ne.NHSYM) then; x(2881:3081)=dd8(ib+1:ib+201)*windowx; else; x(2881:3081)=0.; endif
- x(3082:)=0.
- call four2avar(cx,NFFT1,1,-1,0) !r2c FFT
- do i=1,NH1
- s(i,j)=abs(real(cx(i))) + abs(aimag(cx(i)))
- enddo
- enddo
- endif
-
- ia=max(1,nint(nfa/df)); ib=max(1,nint(nfb/df)); iaw=max(1,nint(nfawide/df)); ibw=max(1,nint(nfbwide/df))
- nssy=4 ! NSPS/NSTEP ! # steps per symbol
- nssy36=144 ! nssy*36
- nssy72=288 ! nssy*72
- nfos=2 ! NFFT1/NSPS ! # frequency bin oversampling factor
- jstrt=12.5 ! 0.5/tstep
-
- if(lagcc .and. .not.lagccbail) then
- nfos6=12 ! nfos*6
- do j=jzb,jzt
- do i=iaw,ibw
- ta=0.; tb=0.; tc=0.
- do n=0,6
- k=j+jstrt+nssy*n
- if(k.gt.0) then
- ta=s(i+nfos*icos7(n),k)
- if(ta.gt.1e-9) then; tall(n+1)=ta*6.0/(sum(s(i:i+nfos6:nfos,k))-ta); else; tall(n+1)=0.; endif
- endif
- k36=k+nssy36
- if(k36.gt.0 .and. k36.le.NHSYM) then
- tb=s(i+nfos*icos7(n),k36)
- if(tb.gt.1e-9) then; tall(n+17)=tb*6.0/(sum(s(i:i+nfos6:nfos,k36))-tb); else; tall(n+17)=0.; endif
- endif
- k72=k+nssy72
- if(k72.le.NHSYM) then
- tc=s(i+nfos*icos7(n),k72)
- if(tc.gt.1e-9) then; tall(n+24)=tc*6.0/(sum(s(i:i+nfos6:nfos,k72))-tc); else; tall(n+24)=0.; endif
- endif
- enddo
- lcq=.false.
- if(ipass.gt.1) then
- do n=7,15
- k=j+jstrt+nssy*n
- if(k.gt.0) then
- if(n.lt.15) then
- tall(n+1)=s(i,k)*6.0/(sum(s(i:i+nfos6:nfos,k))-s(i,k))
- else
- tall(n+1)=s(i+2,k)*6.0/(sum(s(i:i+nfos6:nfos,k))-s(i+2,k))
- endif
- endif
- enddo
- sya=sum(tall(1:7)); sycq=sum(tall(8:16)); sybc=sum(tall(17:30))
- sy1=(sya+sycq+sybc)/30.; sy2=(sya+sybc)/21.; sync_abc=max(sy1,sy2)
- sy1=(sycq+sybc)/23.; sy2=(sybc)/14.; sync_bc=max(sy1,sy2); if(sy1.gt.sy2) lcq=.true.
- else
- sybc=sum(tall(17:30)); sync_abc=sum(tall(1:7))+sybc; sync_bc=sybc/14.; sync_abc=sync_abc/21.
- endif
- sync2d(i,j)=max(sync_abc,sync_bc); if(lcq) syncq(i,j)=.true.
- enddo
- enddo
- else
-! nfos6=15 ! 16i spec bw -1
- nfos6=16
- do j=jzb,jzt
- do i=iaw,ibw
- ta=0.; tb=0.; tc=0.; tcq=0.; t0a=0.; t0b=0.; t0c=0.; t0cq=0.
- do n=0,6
- k=j+jstrt+nssy*n
- if(k.gt.0) then; ta=ta + s(i+nfos*icos7(n),k); t0a=t0a + sum(s(i:i+nfos6,k)) - s(i+nfos*icos7(n)+1,k); endif
- k36=k+nssy36
- if(k36.gt.0 .and. k36.le.NHSYM) then
- tb=tb + s(i+nfos*icos7(n),k36); t0b=t0b + sum(s(i:i+nfos6,k36)) - s(i+nfos*icos7(n)+1,k36)
- endif
- k72=k+nssy72
- if(k72.le.NHSYM) then
- tc=tc + s(i+nfos*icos7(n),k72)
- t0c=t0c + sum(s(i:i+nfos6,k72)) - s(i+nfos*icos7(n)+1,k72)
- endif
- enddo
- do n=7,15
- k=j+jstrt+nssy*n
- if(k.ge.1) then
- if(n.lt.15) then; tcq=tcq + s(i,k); t0cq=t0cq + sum(s(i:i+nfos6,k)) - s(i,k+1)
- else; tcq=tcq + s(i+2,k); t0cq=t0cq + sum(s(i:i+nfos6,k)) - s(i,k+3)
- endif
- endif
- enddo
- t1=ta+tb+tc; t01=t0a+t0b+t0c; t2=t1+tcq; t02=t01+t0cq
- t01=(t01-t1*2)/42.0; if(t01.lt.1e-8) t01=1.0; t02=(t02-t2*2)/60.0; if(t02.lt.1e-8) t02=1.0 ! safe division
- sync01=t1/(7.0*t01); sync02=(t1/7.0 + tcq/9.0)/t02; syncf=max(sync01,sync02)
- lcq=.false.; if(sync02.gt.sync01) lcq=.true.
- t1=tb+tc; t01=t0b+t0c; t2=t1+tcq; t02=t01+t0cq
- t01=(t01-t1*2)/28.0; if(t01.lt.1e-8) t01=1.0; t02=(t02-t2*2)/46.0; if(t02.lt.1e-8) t02=1.0 ! safe division
- sync01=t1/(7.0*t01); sync02=(t1/7.0 + tcq/9.0)/t02; syncs=max(sync01,sync02)
- lcq2=.false.; if(sync02.gt.sync01) lcq2=.true.
- sync2d(i,j)=max(syncf,syncs)
- if(syncf.gt.syncs) then; if(lcq) syncq(i,j)=.true.; else; if(lcq2) syncq(i,j)=.true.; endif
- enddo
- enddo
- endif
-
- red=0.
- do i=iaw,ibw
- ii=maxloc(sync2d(i,jzb:jzt)) - 1 + jzb
- j0=ii(1)
- jpeak(i)=j0
- red(i)=sync2d(i,j0); if(syncq(i,j0)) redcq(i)=.true.
-! write(52,3052) i*df,red(i),db(red(i))
-!3052 format(3f12.3)
- enddo
-
- iz=ibw-iaw+1
- call indexx(red(iaw:ibw),iz,indx)
- ibase=indx(max(1,nint(0.40*iz))) - 1 + iaw ! max is workaround to prevent indx getting out of bounds
- base=red(ibase)
- if(base.lt.1e-8) base=1.0 ! safe division
- red=red/base
-
- candidate0=0.; k=0; iz=ib-ia+1; lpass1=.false.; lpass2=.false.
- if(rcandthin.lt.0.99) then
- if(ipass.eq.1 .or. ipass.eq.4 .or. ipass.eq.7) then; lpass1=.true.
- else if(ipass.eq.2 .or. ipass.eq.5 .or. ipass.eq.8) then; lpass2=.true.
- endif
- endif
- call indexx(red(ia:ib),iz,indx)
- do i=1,iz
- n=ia + indx(iz+1-i) - 1
- freq=n*df
- if(abs(freq-nfqso).gt.3.0) then
- if (red(n).lt.syncmin) cycle
- else
- if (red(n).lt.1.1) cycle
- endif
- if(jpeak(n).lt.-49 .or. jpeak(n).gt.76) cycle
- if(k.lt.450) then; k=k+1; else; exit; endif
-! being sorted by sync
- candidate0(1,k)=freq
- candidate0(2,k)=(jpeak(n)-1)*tstep
- candidate0(3,k)=red(n)
- if(rcandthin.lt.0.99) then ! candidate thinning option
- if(lpass2) then
- candidate0(5,k)=candidate0(3,k)/(abs(candidate0(2,k)-dtcenter)+1.0)**2
- else
- candidate0(5,k)=candidate0(3,k)/(abs(candidate0(2,k)-dtcenter)+1.0)
- endif
- endif
- if(redcq(n)) candidate0(4,k)=2.
- enddo
- ncand=k
-
- fdif0=4.0;
- xdtdelta=0.0
-! save sync only to the best of near-dupe freqs
- do i=1,ncand
- if(i.ge.2) then
- do j=1,i-1
- fdiff=abs(candidate0(1,i)-candidate0(1,j))
- xdtdelta=abs(candidate0(2,i)-candidate0(2,j))
- if(fdiff.lt.fdif0 .and. abs(candidate0(1,i)-nfqso).gt.3.0) then
- if(xdtdelta.lt.0.1) then
- if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0.
- if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0.
- endif
- endif
- enddo
-! write(*,3001) i,candidate0(1,i-1),candidate0(1,i),candidate0(3,i-1), &
-! candidate0(3,i)
-!3001 format(i2,4f8.1)
- endif
- enddo
-
-! Sort by sync
-! call indexx(candidate0(3,1:ncand),ncand,indx)
- if(rcandthin.gt.0.99) then; call indexx(candidate0(3,1:ncand),ncand,indx)
-! sort by sync value with DT weight
- else; call indexx(candidate0(5,1:ncand),ncand,indx)
- endif
-! Sort by frequency
-! call indexx(candidate0(1,1:ncand),ncand,indx)
-
- k=1; ncandfqso=0
-!Put nfqso at top of list and apply lowest sync threshold for nfqso
- fprev=5004.
- do i=ncand,1,-1
- j=indx(i)
- if(abs(candidate0(1,j)-nfqso).le.3.0 .and. candidate0(3,j).ge.1.1 .and. abs(candidate0(1,j)-fprev).gt.3.0) then
- candidate(1,k)=candidate0(1,j); candidate(2,k)=candidate0(2,j)
- candidate(3,k)=candidate0(3,j); candidate(4,k)=candidate0(4,j)
- fprev=candidate0(1,j)
- k=k+1; ncandfqso=ncandfqso+1
- endif
- enddo
-
-!put virtual candidates for FT8Svar decoder
- if(lqsothread) then
- candidate(1,k)=float(nfqso)
- candidate(2,k)=5.0 ! xdt
- candidate(3,k)=0.0 ! sync
- k=k+1; ncandfqso=ncandfqso+1
- candidate(1,k)=float(nfqso)
- candidate(2,k)=-5.0
- candidate(3,k)=0.0
- k=k+1; ncandfqso=ncandfqso+1
- endif
-
- do i=ncand,1,-1
- j=indx(i)
- if(abs(candidate0(1,j)-nfqso).gt.3.0) then; syncmin1=syncmin; else; syncmin1=1.1; endif
- if(candidate0(3,j) .ge. syncmin1) then
- candidate(1,k)=candidate0(1,j); candidate(2,k)=candidate0(2,j)
- candidate(3,k)=candidate0(3,j); candidate(4,k)=candidate0(4,j)
- k=k+1
- if(k.gt.460) exit
- endif
- enddo
- ncand=k-1
- if(ncand-ncandfqso.gt.1 .and. rcandthin.lt.0.99) then
-! applying decoding pass weight factor, derived from number of candidates in each pass
- if(lpass1) then; rcandthin=min(rcandthin*1.27,1.0)
- else if(lpass2) then
- if(rcandthin.gt.0.79) then; rcandthin=rcandthin**2
- else; rcandthin=rcandthin*0.79
- endif
- else; rcandthin=min(rcandthin*5.0,1.0) ! ipass 3,6,9
- endif
- ncand=ncandfqso+nint((ncand-ncandfqso)*rcandthin)
- endif
-
- return
-end subroutine sync8var
+subroutine sync8var(nfa,nfb,syncmin,nfqso,candidate,ncand,jzb,jzt,ipass,lqsothread,ncandthin,ndtcenter) + + use ft8_mod1, only : dd8,windowx,facx,icos7,lagcc,lagccbail,nfawide,nfbwide + include 'ft8_params.f90' + complex cx(0:NH1) + real s(NH1,NHSYM),x(NFFT1),sync2d(NH1,jzb:jzt),red(NH1),candidate0(5,450),candidate(4,460),tall(30),freq,rcandthin,dtcenter + integer jpeak(NH1),indx(NH1),ii(1) + integer, intent(in) :: nfa,nfb,nfqso,jzb,jzt,ipass,ncandthin,ndtcenter + logical(1) syncq(NH1,jzb:jzt),redcq(NH1),lcq,lcq2,lpass1,lpass2 + logical(1), intent(in) :: lqsothread + equivalence (x,cx) + +! Compute symbol spectra, stepping by NSTEP steps. + tstep=0.04 ! NSTEP/12000.0 + df=3.125 ! 12000.0/NFFT1 , Hz + syncq=.false.; redcq=.false.; candidate(4,:)=0. + rcandthin=ncandthin/100.; + dtcenter=ndtcenter/100. + + if(ipass.eq.1 .or. ipass.eq.4 .or. ipass.eq.7) then + do j=1,NHSYM + ia=(j-1)*NSTEP + 1 + ib=ia+NSPS-1 + x(1:759)=0. + if(j.ne.1) then; x(760:960)=dd8(ia-201:ia-1)*windowx(200:0:-1); else; x(760:960)=0.; endif + x(961:2880)=facx*dd8(ia:ib); x(961)=x(961)*1.9; x(2880)=x(2880)*1.9 + if(j.ne.NHSYM) then; x(2881:3081)=dd8(ib+1:ib+201)*windowx; else; x(2881:3081)=0.; endif + x(3082:)=0. + call four2avar(cx,NFFT1,1,-1,0) !r2c FFT + do i=1,NH1 + s(i,j)=SQRT(real(cx(i))**2 + aimag(cx(i))**2) + enddo + enddo + endif + if(ipass.eq.2 .or. ipass.eq.5 .or. ipass.eq.8) then + do j=1,NHSYM + ia=(j-1)*NSTEP + 1 + ib=ia+NSPS-1 + x(1:759)=0. + if(j.ne.1) then; x(760:960)=dd8(ia-201:ia-1)*windowx(200:0:-1); else; x(760:960)=0.; endif + x(961:2880)=facx*dd8(ia:ib); x(961)=x(961)*1.9; x(2880)=x(2880)*1.9 + if(j.ne.NHSYM) then; x(2881:3081)=dd8(ib+1:ib+201)*windowx; else; x(2881:3081)=0.; endif + x(3082:)=0. + call four2avar(cx,NFFT1,1,-1,0) !r2c FFT + do i=1,NH1 + s(i,j)=real(cx(i))**2 + aimag(cx(i))**2 + enddo + enddo + endif + if(ipass.eq.3 .or. ipass.eq.6 .or. ipass.eq.9) then + do j=1,NHSYM + ia=(j-1)*NSTEP + 1 + ib=ia+NSPS-1 + x(1:759)=0. + if(j.ne.1) then; x(760:960)=dd8(ia-201:ia-1)*windowx(200:0:-1); else; x(760:960)=0.; endif + x(961:2880)=facx*dd8(ia:ib); x(961)=x(961)*1.9; x(2880)=x(2880)*1.9 + if(j.ne.NHSYM) then; x(2881:3081)=dd8(ib+1:ib+201)*windowx; else; x(2881:3081)=0.; endif + x(3082:)=0. + call four2avar(cx,NFFT1,1,-1,0) !r2c FFT + do i=1,NH1 + s(i,j)=abs(real(cx(i))) + abs(aimag(cx(i))) + enddo + enddo + endif + + ia=max(1,nint(nfa/df)); ib=max(1,nint(nfb/df)); iaw=max(1,nint(nfawide/df)); ibw=max(1,nint(nfbwide/df)) + nssy=4 ! NSPS/NSTEP ! # steps per symbol + nssy36=144 ! nssy*36 + nssy72=288 ! nssy*72 + nfos=2 ! NFFT1/NSPS ! # frequency bin oversampling factor + jstrt=12.5 ! 0.5/tstep + + if(lagcc .and. .not.lagccbail) then + nfos6=12 ! nfos*6 + do j=jzb,jzt + do i=iaw,ibw + ta=0.; tb=0.; tc=0. + do n=0,6 + k=j+jstrt+nssy*n + if(k.gt.0) then + ta=s(i+nfos*icos7(n),k) + if(ta.gt.1e-9) then; tall(n+1)=ta*6.0/(sum(s(i:i+nfos6:nfos,k))-ta); else; tall(n+1)=0.; endif + endif + k36=k+nssy36 + if(k36.gt.0 .and. k36.le.NHSYM) then + tb=s(i+nfos*icos7(n),k36) + if(tb.gt.1e-9) then; tall(n+17)=tb*6.0/(sum(s(i:i+nfos6:nfos,k36))-tb); else; tall(n+17)=0.; endif + endif + k72=k+nssy72 + if(k72.le.NHSYM) then + tc=s(i+nfos*icos7(n),k72) + if(tc.gt.1e-9) then; tall(n+24)=tc*6.0/(sum(s(i:i+nfos6:nfos,k72))-tc); else; tall(n+24)=0.; endif + endif + enddo + lcq=.false. + if(ipass.gt.1) then + do n=7,15 + k=j+jstrt+nssy*n + if(k.gt.0) then + if(n.lt.15) then + tall(n+1)=s(i,k)*6.0/(sum(s(i:i+nfos6:nfos,k))-s(i,k)) + else + tall(n+1)=s(i+2,k)*6.0/(sum(s(i:i+nfos6:nfos,k))-s(i+2,k)) + endif + endif + enddo + sya=sum(tall(1:7)); sycq=sum(tall(8:16)); sybc=sum(tall(17:30)) + sy1=(sya+sycq+sybc)/30.; sy2=(sya+sybc)/21.; sync_abc=max(sy1,sy2) + sy1=(sycq+sybc)/23.; sy2=(sybc)/14.; sync_bc=max(sy1,sy2); if(sy1.gt.sy2) lcq=.true. + else + sybc=sum(tall(17:30)); sync_abc=sum(tall(1:7))+sybc; sync_bc=sybc/14.; sync_abc=sync_abc/21. + endif + sync2d(i,j)=max(sync_abc,sync_bc); if(lcq) syncq(i,j)=.true. + enddo + enddo + else +! nfos6=15 ! 16i spec bw -1 + nfos6=16 + do j=jzb,jzt + do i=iaw,ibw + ta=0.; tb=0.; tc=0.; tcq=0.; t0a=0.; t0b=0.; t0c=0.; t0cq=0. + do n=0,6 + k=j+jstrt+nssy*n + if(k.gt.0) then; ta=ta + s(i+nfos*icos7(n),k); t0a=t0a + sum(s(i:i+nfos6,k)) - s(i+nfos*icos7(n)+1,k); endif + k36=k+nssy36 + if(k36.gt.0 .and. k36.le.NHSYM) then + tb=tb + s(i+nfos*icos7(n),k36); t0b=t0b + sum(s(i:i+nfos6,k36)) - s(i+nfos*icos7(n)+1,k36) + endif + k72=k+nssy72 + if(k72.le.NHSYM) then + tc=tc + s(i+nfos*icos7(n),k72) + t0c=t0c + sum(s(i:i+nfos6,k72)) - s(i+nfos*icos7(n)+1,k72) + endif + enddo + do n=7,15 + k=j+jstrt+nssy*n + if(k.ge.1) then + if(n.lt.15) then; tcq=tcq + s(i,k); t0cq=t0cq + sum(s(i:i+nfos6,k)) - s(i,k+1) + else; tcq=tcq + s(i+2,k); t0cq=t0cq + sum(s(i:i+nfos6,k)) - s(i,k+3) + endif + endif + enddo + t1=ta+tb+tc; t01=t0a+t0b+t0c; t2=t1+tcq; t02=t01+t0cq + t01=(t01-t1*2)/42.0; if(t01.lt.1e-8) t01=1.0; t02=(t02-t2*2)/60.0; if(t02.lt.1e-8) t02=1.0 ! safe division + sync01=t1/(7.0*t01); sync02=(t1/7.0 + tcq/9.0)/t02; syncf=max(sync01,sync02) + lcq=.false.; if(sync02.gt.sync01) lcq=.true. + t1=tb+tc; t01=t0b+t0c; t2=t1+tcq; t02=t01+t0cq + t01=(t01-t1*2)/28.0; if(t01.lt.1e-8) t01=1.0; t02=(t02-t2*2)/46.0; if(t02.lt.1e-8) t02=1.0 ! safe division + sync01=t1/(7.0*t01); sync02=(t1/7.0 + tcq/9.0)/t02; syncs=max(sync01,sync02) + lcq2=.false.; if(sync02.gt.sync01) lcq2=.true. + sync2d(i,j)=max(syncf,syncs) + if(syncf.gt.syncs) then; if(lcq) syncq(i,j)=.true.; else; if(lcq2) syncq(i,j)=.true.; endif + enddo + enddo + endif + + red=0. + do i=iaw,ibw + ii=maxloc(sync2d(i,jzb:jzt)) - 1 + jzb + j0=ii(1) + jpeak(i)=j0 + red(i)=sync2d(i,j0); if(syncq(i,j0)) redcq(i)=.true. +! write(52,3052) i*df,red(i),db(red(i)) +!3052 format(3f12.3) + enddo + + iz=ibw-iaw+1 + call indexx(red(iaw:ibw),iz,indx) + ibase=indx(max(1,nint(0.40*iz))) - 1 + iaw ! max is workaround to prevent indx getting out of bounds + base=red(ibase) + if(base.lt.1e-8) base=1.0 ! safe division + red=red/base + + candidate0=0.; k=0; iz=ib-ia+1; lpass1=.false.; lpass2=.false. + if(rcandthin.lt.0.99) then + if(ipass.eq.1 .or. ipass.eq.4 .or. ipass.eq.7) then; lpass1=.true. + else if(ipass.eq.2 .or. ipass.eq.5 .or. ipass.eq.8) then; lpass2=.true. + endif + endif + call indexx(red(ia:ib),iz,indx) + do i=1,iz + n=ia + indx(iz+1-i) - 1 + freq=n*df + if(abs(freq-nfqso).gt.3.0) then + if (red(n).lt.syncmin) cycle + else + if (red(n).lt.1.1) cycle + endif + if(jpeak(n).lt.-49 .or. jpeak(n).gt.76) cycle + if(k.lt.450) then; k=k+1; else; exit; endif +! being sorted by sync + candidate0(1,k)=freq + candidate0(2,k)=(jpeak(n)-1)*tstep + candidate0(3,k)=red(n) + if(rcandthin.lt.0.99) then ! candidate thinning option + if(lpass2) then + candidate0(5,k)=candidate0(3,k)/(abs(candidate0(2,k)-dtcenter)+1.0)**2 + else + candidate0(5,k)=candidate0(3,k)/(abs(candidate0(2,k)-dtcenter)+1.0) + endif + endif + if(redcq(n)) candidate0(4,k)=2. + enddo + ncand=k + + fdif0=4.0; + xdtdelta=0.0 +! save sync only to the best of near-dupe freqs + do i=1,ncand + if(i.ge.2) then + do j=1,i-1 + fdiff=abs(candidate0(1,i)-candidate0(1,j)) + xdtdelta=abs(candidate0(2,i)-candidate0(2,j)) + if(fdiff.lt.fdif0 .and. abs(candidate0(1,i)-nfqso).gt.3.0) then + if(xdtdelta.lt.0.1) then + if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0. + if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0. + endif + endif + enddo +! write(*,3001) i,candidate0(1,i-1),candidate0(1,i),candidate0(3,i-1), & +! candidate0(3,i) +!3001 format(i2,4f8.1) + endif + enddo + +! Sort by sync +! call indexx(candidate0(3,1:ncand),ncand,indx) + if(rcandthin.gt.0.99) then; call indexx(candidate0(3,1:ncand),ncand,indx) +! sort by sync value with DT weight + else; call indexx(candidate0(5,1:ncand),ncand,indx) + endif +! Sort by frequency +! call indexx(candidate0(1,1:ncand),ncand,indx) + + k=1; ncandfqso=0 +!Put nfqso at top of list and apply lowest sync threshold for nfqso + fprev=5004. + do i=ncand,1,-1 + j=indx(i) + if(abs(candidate0(1,j)-nfqso).le.3.0 .and. candidate0(3,j).ge.1.1 .and. abs(candidate0(1,j)-fprev).gt.3.0) then + candidate(1,k)=candidate0(1,j); candidate(2,k)=candidate0(2,j) + candidate(3,k)=candidate0(3,j); candidate(4,k)=candidate0(4,j) + fprev=candidate0(1,j) + k=k+1; ncandfqso=ncandfqso+1 + endif + enddo + +!put virtual candidates for FT8Svar decoder + if(lqsothread) then + candidate(1,k)=float(nfqso) + candidate(2,k)=5.0 ! xdt + candidate(3,k)=0.0 ! sync + k=k+1; ncandfqso=ncandfqso+1 + candidate(1,k)=float(nfqso) + candidate(2,k)=-5.0 + candidate(3,k)=0.0 + k=k+1; ncandfqso=ncandfqso+1 + endif + + do i=ncand,1,-1 + j=indx(i) + if(abs(candidate0(1,j)-nfqso).gt.3.0) then; syncmin1=syncmin; else; syncmin1=1.1; endif + if(candidate0(3,j) .ge. syncmin1) then + candidate(1,k)=candidate0(1,j); candidate(2,k)=candidate0(2,j) + candidate(3,k)=candidate0(3,j); candidate(4,k)=candidate0(4,j) + k=k+1 + if(k.gt.460) exit + endif + enddo + ncand=k-1 + if(ncand-ncandfqso.gt.1 .and. rcandthin.lt.0.99) then +! applying decoding pass weight factor, derived from number of candidates in each pass + if(lpass1) then; rcandthin=min(rcandthin*1.27,1.0) + else if(lpass2) then + if(rcandthin.gt.0.79) then; rcandthin=rcandthin**2 + else; rcandthin=rcandthin*0.79 + endif + else; rcandthin=min(rcandthin*5.0,1.0) ! ipass 3,6,9 + endif + ncand=ncandfqso+nint((ncand-ncandfqso)*rcandthin) + endif + + return +end subroutine sync8var diff --git a/lib/ft8var/syncdist.f90 b/lib/ft8var/syncdist.f90 index ff40754b..68bf814b 100755..100644 --- a/lib/ft8var/syncdist.f90 +++ b/lib/ft8var/syncdist.f90 @@ -1,37 +1,37 @@ -ip=maxloc(s81)
-if(icos7(k-1).eq.(ip(1)-1)) then
- nsmax(1)=nsmax(1)+1
-else
- s81(ip(1)-1)=0.; ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- nsmax(2)=nsmax(2)+1
- else
- s81(ip(1)-1)=0.; ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- nsmax(3)=nsmax(3)+1
- else
- s81(ip(1)-1)=0.; ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- nsmax(4)=nsmax(4)+1
- else
- s81(ip(1)-1)=0.; ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- nsmax(5)=nsmax(5)+1
- else
- s81(ip(1)-1)=0.; ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- nsmax(6)=nsmax(6)+1
- else
- s81(ip(1)-1)=0.; ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) then
- nsmax(7)=nsmax(7)+1
- else
- s81(ip(1)-1)=0.; ip=maxloc(s81)
- if(icos7(k-1).eq.(ip(1)-1)) nsmax(8)=nsmax(8)+1
- endif
- endif
- endif
- endif
- endif
- endif
-endif
+ip=maxloc(s81) +if(icos7(k-1).eq.(ip(1)-1)) then + nsmax(1)=nsmax(1)+1 +else + s81(ip(1)-1)=0.; ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + nsmax(2)=nsmax(2)+1 + else + s81(ip(1)-1)=0.; ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + nsmax(3)=nsmax(3)+1 + else + s81(ip(1)-1)=0.; ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + nsmax(4)=nsmax(4)+1 + else + s81(ip(1)-1)=0.; ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + nsmax(5)=nsmax(5)+1 + else + s81(ip(1)-1)=0.; ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + nsmax(6)=nsmax(6)+1 + else + s81(ip(1)-1)=0.; ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) then + nsmax(7)=nsmax(7)+1 + else + s81(ip(1)-1)=0.; ip=maxloc(s81) + if(icos7(k-1).eq.(ip(1)-1)) nsmax(8)=nsmax(8)+1 + endif + endif + endif + endif + endif + endif +endif diff --git a/lib/ft8var/tone8.f90 b/lib/ft8var/tone8.f90 index 92e5589a..d5a95761 100755..100644 --- a/lib/ft8var/tone8.f90 +++ b/lib/ft8var/tone8.f90 @@ -1,140 +1,140 @@ -subroutine tone8(lmycallstd,lhiscallstd)
-
- use ft8_mod1, only : itone56,idtone56,msg,csynce,mycall,hiscall,idtonecqdxcns,idtonedxcns73,mybcall,hisbcall,lhound, &
- idtonefox73,idtonespec
- complex csig0(151680)
- character msg37*37,msgsent37*37,mycall14*14,hiscall14*14
- character*4 rpt(56)
- integer itone(79),itone1(79)
- integer*1 msgbits(77)
- logical(1), intent(in) :: lmycallstd,lhiscallstd
-
- data rpt/'-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', &
- '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ', &
- '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R-01','R-02','R-03','R-04', &
- 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14', &
- 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24', &
- 'R-25','R-26','AA00','RRR ','RR73','73 '/
-
-! taken from ft8_mod1
-! integer itone56(56,79),idtone56(56,58)
-! character*37 msg(56)
-
- if(lhound .and. len_trim(mybcall).gt.2 .and. len_trim(hisbcall).gt.2) then
- msg37=''; msg37=trim(mybcall)//' '//trim(hisbcall)//' RR73'
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtonefox73(1:29)=itone(8:36)
- idtonefox73(30:58)=itone(44:72)
- msg37=''; msg37=trim(mybcall)//' RR73; '//trim(mybcall)//' <'//trim(hiscall)//'> -12'
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtonespec(1:29)=itone(8:36)
- idtonespec(30:58)=itone(44:72)
- endif
-
- if(.not.lhiscallstd .and. len(trim(hiscall)).gt.2) then
- msg37=''; msg37='CQ '//trim(hiscall)
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtonecqdxcns(1:29)=itone(8:36)
- idtonecqdxcns(30:58)=itone(44:72)
- msg37=''; msg37='<AA1AAA> '//trim(hiscall)//' 73'
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtonedxcns73(1:29)=itone(8:36)
- idtonedxcns73(30:58)=itone(44:72)
- endif
-
- if(.not.lhiscallstd .and. .not.lmycallstd) return ! we do not support such message in FT8v2
- if(.not.lhiscallstd .or. .not.lmycallstd) then
- mycall14=' '; mycall14='<'//trim(mycall)//'>'
- hiscall14=' '; hiscall14='<'//trim(hiscall)//'>'
- endif
-
- if(lhiscallstd .and. lmycallstd) then
- do i=1,56
- msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
- msg(i)=msg37
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- if(i.eq.1) itone1=itone
- idtone56(i,1:29)=itone(8:36)
- idtone56(i,30:58)=itone(44:72)
- itone56(i,1:79)=itone(1:79)
- enddo
- go to 2
- endif
-
- if(.not.lhiscallstd .and. lmycallstd) then
- do i=1,52
- msg37=''; msg37=trim(mycall)//' '//trim(hiscall14)//' '//trim(rpt(i))
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- if(i.eq.1) itone1=itone
- idtone56(i,1:29)=itone(8:36)
- idtone56(i,30:58)=itone(44:72)
- itone56(i,1:79)=itone(1:79)
- msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
- msg(i)=msg37
- enddo
- do i=54,56
- msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)//' '//trim(rpt(i))
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtone56(i,1:29)=itone(8:36)
- idtone56(i,30:58)=itone(44:72)
- itone56(i,1:79)=itone(1:79)
- msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
- msg(i)=msg37
- enddo
- msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)
- msg(53)=msg37
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtone56(53,1:29)=itone(8:36)
- idtone56(53,30:58)=itone(44:72)
- itone56(53,1:79)=itone(1:79)
- go to 2
- endif
-
- if(lhiscallstd .and. .not.lmycallstd) then
- do i=1,52
- msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)//' '//trim(rpt(i))
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- if(i.eq.1) itone1=itone
- idtone56(i,1:29)=itone(8:36)
- idtone56(i,30:58)=itone(44:72)
- itone56(i,1:79)=itone(1:79)
- msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
- msg(i)=msg37
- enddo
- do i=54,56
- msg37=''; msg37=trim(mycall)//' '//trim(hiscall14)//' '//trim(rpt(i))
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtone56(i,1:29)=itone(8:36)
- idtone56(i,30:58)=itone(44:72)
- itone56(i,1:79)=itone(1:79)
- msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
- msg(i)=msg37
- enddo
- msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)
- msg(53)=msg37
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtone56(53,1:29)=itone(8:36)
- idtone56(53,30:58)=itone(44:72)
- itone56(53,1:79)=itone(1:79)
- go to 2
- endif
-
-2 m=13441 ! 7*1920+1
- call gen_ft8wavevar(itone1,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680)
- do j=0,18
- do k=1,32; csynce(j,k)=csig0(m); m=m+60; enddo
- enddo
-
- return
-end subroutine tone8
+subroutine tone8(lmycallstd,lhiscallstd) + + use ft8_mod1, only : itone56,idtone56,msg,csynce,mycall,hiscall,idtonecqdxcns,idtonedxcns73,mybcall,hisbcall,lhound, & + idtonefox73,idtonespec + complex csig0(151680) + character msg37*37,msgsent37*37,mycall14*14,hiscall14*14 + character*4 rpt(56) + integer itone(79),itone1(79) + integer*1 msgbits(77) + logical(1), intent(in) :: lmycallstd,lhiscallstd + + data rpt/'-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', & + '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ', & + '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R-01','R-02','R-03','R-04', & + 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14', & + 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24', & + 'R-25','R-26','AA00','RRR ','RR73','73 '/ + +! taken from ft8_mod1 +! integer itone56(56,79),idtone56(56,58) +! character*37 msg(56) + + if(lhound .and. len_trim(mybcall).gt.2 .and. len_trim(hisbcall).gt.2) then + msg37=''; msg37=trim(mybcall)//' '//trim(hisbcall)//' RR73' + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtonefox73(1:29)=itone(8:36) + idtonefox73(30:58)=itone(44:72) + msg37=''; msg37=trim(mybcall)//' RR73; '//trim(mybcall)//' <'//trim(hiscall)//'> -12' + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtonespec(1:29)=itone(8:36) + idtonespec(30:58)=itone(44:72) + endif + + if(.not.lhiscallstd .and. len(trim(hiscall)).gt.2) then + msg37=''; msg37='CQ '//trim(hiscall) + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtonecqdxcns(1:29)=itone(8:36) + idtonecqdxcns(30:58)=itone(44:72) + msg37=''; msg37='<AA1AAA> '//trim(hiscall)//' 73' + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtonedxcns73(1:29)=itone(8:36) + idtonedxcns73(30:58)=itone(44:72) + endif + + if(.not.lhiscallstd .and. .not.lmycallstd) return ! we do not support such message in FT8v2 + if(.not.lhiscallstd .or. .not.lmycallstd) then + mycall14=' '; mycall14='<'//trim(mycall)//'>' + hiscall14=' '; hiscall14='<'//trim(hiscall)//'>' + endif + + if(lhiscallstd .and. lmycallstd) then + do i=1,56 + msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i)) + msg(i)=msg37 + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + if(i.eq.1) itone1=itone + idtone56(i,1:29)=itone(8:36) + idtone56(i,30:58)=itone(44:72) + itone56(i,1:79)=itone(1:79) + enddo + go to 2 + endif + + if(.not.lhiscallstd .and. lmycallstd) then + do i=1,52 + msg37=''; msg37=trim(mycall)//' '//trim(hiscall14)//' '//trim(rpt(i)) + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + if(i.eq.1) itone1=itone + idtone56(i,1:29)=itone(8:36) + idtone56(i,30:58)=itone(44:72) + itone56(i,1:79)=itone(1:79) + msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i)) + msg(i)=msg37 + enddo + do i=54,56 + msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)//' '//trim(rpt(i)) + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtone56(i,1:29)=itone(8:36) + idtone56(i,30:58)=itone(44:72) + itone56(i,1:79)=itone(1:79) + msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i)) + msg(i)=msg37 + enddo + msg37=''; msg37=trim(mycall14)//' '//trim(hiscall) + msg(53)=msg37 + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtone56(53,1:29)=itone(8:36) + idtone56(53,30:58)=itone(44:72) + itone56(53,1:79)=itone(1:79) + go to 2 + endif + + if(lhiscallstd .and. .not.lmycallstd) then + do i=1,52 + msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)//' '//trim(rpt(i)) + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + if(i.eq.1) itone1=itone + idtone56(i,1:29)=itone(8:36) + idtone56(i,30:58)=itone(44:72) + itone56(i,1:79)=itone(1:79) + msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i)) + msg(i)=msg37 + enddo + do i=54,56 + msg37=''; msg37=trim(mycall)//' '//trim(hiscall14)//' '//trim(rpt(i)) + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtone56(i,1:29)=itone(8:36) + idtone56(i,30:58)=itone(44:72) + itone56(i,1:79)=itone(1:79) + msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i)) + msg(i)=msg37 + enddo + msg37=''; msg37=trim(mycall14)//' '//trim(hiscall) + msg(53)=msg37 + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtone56(53,1:29)=itone(8:36) + idtone56(53,30:58)=itone(44:72) + itone56(53,1:79)=itone(1:79) + go to 2 + endif + +2 m=13441 ! 7*1920+1 + call gen_ft8wavevar(itone1,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680) + do j=0,18 + do k=1,32; csynce(j,k)=csig0(m); m=m+60; enddo + enddo + + return +end subroutine tone8 diff --git a/lib/ft8var/tone8myc.f90 b/lib/ft8var/tone8myc.f90 index 3efbe748..83f05568 100755..100644 --- a/lib/ft8var/tone8myc.f90 +++ b/lib/ft8var/tone8myc.f90 @@ -1,14 +1,14 @@ -subroutine tone8myc()
-
- use ft8_mod1, only : idtonemyc,mycall
- character msg37*37,msgsent37*37
- integer itone(79)
- integer*1 msgbits(77)
-
- msg37=''; msg37=trim(mycall)//' AA1AAA FN25'
- i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
- idtonemyc(1:29)=itone(8:36); idtonemyc(30:58)=itone(44:72)
-
- return
-end subroutine tone8myc
+subroutine tone8myc() + + use ft8_mod1, only : idtonemyc,mycall + character msg37*37,msgsent37*37 + integer itone(79) + integer*1 msgbits(77) + + msg37=''; msg37=trim(mycall)//' AA1AAA FN25' + i3=-1; n3=-1 + call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone) + idtonemyc(1:29)=itone(8:36); idtonemyc(30:58)=itone(44:72) + + return +end subroutine tone8myc diff --git a/lib/ft8var/tonesdvar.f90 b/lib/ft8var/tonesdvar.f90 index 8a8dc207..b973ca77 100755..100644 --- a/lib/ft8var/tonesdvar.f90 +++ b/lib/ft8var/tonesdvar.f90 @@ -1,81 +1,81 @@ -subroutine tonesdvar(msgd,lcq)
-
- use ft8_mod1, only : csyncsd,csyncsdcq,itone76,idtone76,msgsd76
- complex csig0(151680)
- character, intent(in) :: msgd*37
- character msg37*37,msgsent37*37,c1*12,c2*12,grid*6
- character*4 rpt(75)
- integer itone(79),itone1(79)
- integer*1 msgbits(77)
- logical(1), intent(in) :: lcq
- logical(1) lgrid,lr73
-
- data rpt/'+09 ','+08 ','+07 ','+06 ','+05 ','+04 ','+03 ','+02 ','+01 ','+00 ', &
- '-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', &
- '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ', &
- '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R+09','R+08','R+07','R+06', &
- 'R+05','R+04','R+03','R+02','R+01','R+00','R-01','R-02','R-03','R-04', &
- 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14', &
- 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24', &
- 'R-25','R-26','RRR ','RR73','73 '/
-
-! taken from ft8_mod1
-! integer itone76(76,79),idtone76(76,58)
-! character*37 msgsd76(76)
-! complex csyncsd(0:18,32),csyncsdcq(0:71,32)
-
- lgrid=.false.; lr73=.false.
-
- if(lcq) then
- msg37=msgd
- i3=-1; n3=-1
- call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone)
- else
- c1=' '; c2=' '
- ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1; ispc3=index(msgd((ispc2+1):),' ')+ispc2;
- if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then
- c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1)
- endif
- if(index(msgd,' RR73').gt.0 .or. index(msgd,' 73').gt.0) lr73=.true.
- if(.not.lr73 .and. (ispc3-ispc2).eq.5 .and. msgd(ispc2+1:ispc2+2).ne.'R+' .and. msgd(ispc2+1:ispc2+2).ne.'R-') &
- lgrid=.true.
- if(lgrid) then; grid=msgd(ispc2+1:ispc3-1); if(len_trim(grid).ne.4) grid='AA00'
- else; grid='AA00'
- endif
- do i=1,75
- msg37=' '
- msg37=trim(c1)//' '//trim(c2)//' '//trim(rpt(i))
- msgsd76(i)=msg37
- i3=-1; n3=-1
- call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone)
- if(i.eq.1) itone1=itone
- idtone76(i,1:29)=itone(8:36)
- idtone76(i,30:58)=itone(44:72)
- itone76(i,1:79)=itone(1:79)
- enddo
- msg37=' '
- msg37=trim(c1)//' '//trim(c2)//' '//trim(grid)
- msgsd76(76)=msg37
- i3=-1; n3=-1
- call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone)
- idtone76(76,1:29)=itone(8:36)
- idtone76(76,30:58)=itone(44:72)
- itone76(76,1:79)=itone(1:79)
- endif
-
- m=13441 ! 7*1920+1
- if(lcq) then
- call gen_ft8wavevar(itone,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680)
- do i=0,57
- if(i.eq.29) m=m+13440
- do j=1,32; csyncsdcq(i,j)=csig0(m); m=m+60; enddo
- enddo
- else
- call gen_ft8wavevar(itone1,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680)
- do i=0,18
- do j=1,32; csyncsd(i,j)=csig0(m); m=m+60; enddo
- enddo
- endif
-
- return
-end subroutine tonesdvar
+subroutine tonesdvar(msgd,lcq) + + use ft8_mod1, only : csyncsd,csyncsdcq,itone76,idtone76,msgsd76 + complex csig0(151680) + character, intent(in) :: msgd*37 + character msg37*37,msgsent37*37,c1*12,c2*12,grid*6 + character*4 rpt(75) + integer itone(79),itone1(79) + integer*1 msgbits(77) + logical(1), intent(in) :: lcq + logical(1) lgrid,lr73 + + data rpt/'+09 ','+08 ','+07 ','+06 ','+05 ','+04 ','+03 ','+02 ','+01 ','+00 ', & + '-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', & + '-11 ','-12 ','-13 ','-14 ','-15 ','-16 ','-17 ','-18 ','-19 ','-20 ', & + '-21 ','-22 ','-23 ','-24 ','-25 ','-26 ','R+09','R+08','R+07','R+06', & + 'R+05','R+04','R+03','R+02','R+01','R+00','R-01','R-02','R-03','R-04', & + 'R-05','R-06','R-07','R-08','R-09','R-10','R-11','R-12','R-13','R-14', & + 'R-15','R-16','R-17','R-18','R-19','R-20','R-21','R-22','R-23','R-24', & + 'R-25','R-26','RRR ','RR73','73 '/ + +! taken from ft8_mod1 +! integer itone76(76,79),idtone76(76,58) +! character*37 msgsd76(76) +! complex csyncsd(0:18,32),csyncsdcq(0:71,32) + + lgrid=.false.; lr73=.false. + + if(lcq) then + msg37=msgd + i3=-1; n3=-1 + call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone) + else + c1=' '; c2=' ' + ispc1=index(msgd,' '); ispc2=index(msgd((ispc1+1):),' ')+ispc1; ispc3=index(msgd((ispc2+1):),' ')+ispc2; + if(len(msgd(1:ispc1-1)).le.12 .and. len(msgd(ispc1+1:ispc2-1)).le.12) then + c1=msgd(1:ispc1-1); c2=msgd(ispc1+1:ispc2-1) + endif + if(index(msgd,' RR73').gt.0 .or. index(msgd,' 73').gt.0) lr73=.true. + if(.not.lr73 .and. (ispc3-ispc2).eq.5 .and. msgd(ispc2+1:ispc2+2).ne.'R+' .and. msgd(ispc2+1:ispc2+2).ne.'R-') & + lgrid=.true. + if(lgrid) then; grid=msgd(ispc2+1:ispc3-1); if(len_trim(grid).ne.4) grid='AA00' + else; grid='AA00' + endif + do i=1,75 + msg37=' ' + msg37=trim(c1)//' '//trim(c2)//' '//trim(rpt(i)) + msgsd76(i)=msg37 + i3=-1; n3=-1 + call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone) + if(i.eq.1) itone1=itone + idtone76(i,1:29)=itone(8:36) + idtone76(i,30:58)=itone(44:72) + itone76(i,1:79)=itone(1:79) + enddo + msg37=' ' + msg37=trim(c1)//' '//trim(c2)//' '//trim(grid) + msgsd76(76)=msg37 + i3=-1; n3=-1 + call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone) + idtone76(76,1:29)=itone(8:36) + idtone76(76,30:58)=itone(44:72) + itone76(76,1:79)=itone(1:79) + endif + + m=13441 ! 7*1920+1 + if(lcq) then + call gen_ft8wavevar(itone,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680) + do i=0,57 + if(i.eq.29) m=m+13440 + do j=1,32; csyncsdcq(i,j)=csig0(m); m=m+60; enddo + enddo + else + call gen_ft8wavevar(itone1,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680) + do i=0,18 + do j=1,32; csyncsd(i,j)=csig0(m); m=m+60; enddo + enddo + endif + + return +end subroutine tonesdvar diff --git a/lib/ft8var/twkfreq1var.f90 b/lib/ft8var/twkfreq1var.f90 index f4a8be1e..823bf5cb 100755..100644 --- a/lib/ft8var/twkfreq1var.f90 +++ b/lib/ft8var/twkfreq1var.f90 @@ -1,26 +1,26 @@ -subroutine twkfreq1var(ca,nbot,npts,ntop,fsample,a,cb)
-
- use ft8_mod1, only : twopi
- complex, intent(in) :: ca(nbot:ntop)
- complex, intent(out) :: cb(nbot:ntop)
- complex w,wstep
- real a(5)
-
-! Mix the complex signal
- w=1.0; wstep=1.0
-!! x0=0.5*(npts+1)
-!! s=2.0/npts
- do i=0,npts
-!! x=s*(i-x0) ! valid for 'do i=1,npts'
-!! p2=1.5*x*x - 0.5
-!! p3=2.5*(x**3) - 1.5*x
-!! p4=4.375*(x**4) - 3.75*(x**2) + 0.375
-!! dphi=(a(1) + x*a(2) + p2*a(3) + p3*a(4) + p4*a(5)) * (twopi/fsample)
- dphi=a(1) * (twopi/fsample)
- wstep=cmplx(cos(dphi),sin(dphi))
- w=w*wstep
- cb(i)=w*ca(i)
- enddo
-
- return
-end subroutine twkfreq1var
+subroutine twkfreq1var(ca,nbot,npts,ntop,fsample,a,cb) + + use ft8_mod1, only : twopi + complex, intent(in) :: ca(nbot:ntop) + complex, intent(out) :: cb(nbot:ntop) + complex w,wstep + real a(5) + +! Mix the complex signal + w=1.0; wstep=1.0 +!! x0=0.5*(npts+1) +!! s=2.0/npts + do i=0,npts +!! x=s*(i-x0) ! valid for 'do i=1,npts' +!! p2=1.5*x*x - 0.5 +!! p3=2.5*(x**3) - 1.5*x +!! p4=4.375*(x**4) - 3.75*(x**2) + 0.375 +!! dphi=(a(1) + x*a(2) + p2*a(3) + p3*a(4) + p4*a(5)) * (twopi/fsample) + dphi=a(1) * (twopi/fsample) + wstep=cmplx(cos(dphi),sin(dphi)) + w=w*wstep + cb(i)=w*ca(i) + enddo + + return +end subroutine twkfreq1var |
