summaryrefslogtreecommitdiff
path: root/lib/setup65.f90
diff options
context:
space:
mode:
authorIain R. Learmonth <irl@debian.org>2015-10-18 17:55:15 +0100
committerIain R. Learmonth <irl@debian.org>2015-10-18 17:55:15 +0100
commitc720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (patch)
treeecf89ef5fb2aa173119808e84e6d2e4cc15b962c /lib/setup65.f90
Imported Upstream version 1.1.r3496upstream/1.1.r3496
Diffstat (limited to 'lib/setup65.f90')
-rw-r--r--lib/setup65.f9096
1 files changed, 96 insertions, 0 deletions
diff --git a/lib/setup65.f90 b/lib/setup65.f90
new file mode 100644
index 00000000..608b41b9
--- /dev/null
+++ b/lib/setup65.f90
@@ -0,0 +1,96 @@
+subroutine setup65
+
+! Defines arrays related to the JT65 pseudo-random synchronizing pattern.
+! Executed at program start.
+
+ integer nprc(126)
+ common/prcom/pr(126),mdat(126),mref(126,2),mdat2(126),mref2(126,2)
+
+! JT65
+ data nprc/ &
+ 1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
+ 0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
+ 0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
+ 0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
+ 1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
+ 0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
+ 1,1,1,1,1,1/
+ data mr2/0/ !Silence compiler warning
+
+! Put the appropriate pseudo-random sequence into pr
+ nsym=126
+ do i=1,nsym
+ pr(i)=2*nprc(i)-1
+ enddo
+
+! Determine locations of data and reference symbols
+ k=0
+ mr1=0
+ do i=1,nsym
+ if(pr(i).lt.0.0) then
+ k=k+1
+ mdat(k)=i
+ else
+ mr2=i
+ if(mr1.eq.0) mr1=i
+ endif
+ enddo
+ nsig=k
+
+! Determine the reference symbols for each data symbol.
+ do k=1,nsig
+ m=mdat(k)
+ mref(k,1)=mr1
+ do n=1,10 !Get ref symbol before data
+ if((m-n).gt.0) then
+ if (pr(m-n).gt.0.0) go to 10
+ endif
+ enddo
+ go to 12
+10 mref(k,1)=m-n
+12 mref(k,2)=mr2
+ do n=1,10 !Get ref symbol after data
+ if((m+n).le.nsym) then
+ if (pr(m+n).gt.0.0) go to 20
+ endif
+ enddo
+ cycle
+20 mref(k,2)=m+n
+ enddo
+
+! Now do it all again, using opposite logic on pr(i)
+ k=0
+ mr1=0
+ do i=1,nsym
+ if(pr(i).gt.0.0) then
+ k=k+1
+ mdat2(k)=i
+ else
+ mr2=i
+ if(mr1.eq.0) mr1=i
+ endif
+ enddo
+ nsig=k
+
+ do k=1,nsig
+ m=mdat2(k)
+ mref2(k,1)=mr1
+ do n=1,10
+ if((m-n).gt.0) then
+ if (pr(m-n).lt.0.0) go to 110
+ endif
+ enddo
+ go to 112
+110 mref2(k,1)=m-n
+112 mref2(k,2)=mr2
+ do n=1,10
+ if((m+n).le.nsym) then
+ if (pr(m+n).lt.0.0) go to 120
+ endif
+ enddo
+ cycle
+120 mref2(k,2)=m+n
+ enddo
+
+ return
+end subroutine setup65