summaryrefslogtreecommitdiff
path: root/lib/ft8/genft8.f90
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /lib/ft8/genft8.f90
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'lib/ft8/genft8.f90')
-rw-r--r--lib/ft8/genft8.f9066
1 files changed, 28 insertions, 38 deletions
diff --git a/lib/ft8/genft8.f90 b/lib/ft8/genft8.f90
index dcb249d3..bf3116b8 100644
--- a/lib/ft8/genft8.f90
+++ b/lib/ft8/genft8.f90
@@ -1,44 +1,33 @@
-subroutine genft8(msg,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
+subroutine genft8(msg,i3,n3,msgsent,msgbits,itone)
! Encode an FT8 message, producing array itone().
- use crc
- use packjt
+ use packjt77
include 'ft8_params.f90'
- character*22 msg,msgsent
- character*6 mygrid
- character*87 cbits
- logical bcontest,checksumok
- integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
- integer*1 msgbits(KK),codeword(3*ND)
- integer*1, target:: i1Msg8BitBytes(11)
- integer itone(NN)
+ character msg*37,msgsent*37
+ character*77 c77
+ integer*1 msgbits(77),codeword(174)
+ integer itone(79)
integer icos7(0:6)
- data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
-
- call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
- call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
-
- write(cbits,1000) i4Msg6BitWords,32*i3bit
-1000 format(12b6.6,b8.8)
- read(cbits,1001) i1Msg8BitBytes(1:10)
-1001 format(10b8)
- i1Msg8BitBytes(10)=iand(i1Msg8BitBytes(10),128+64+32)
- i1Msg8BitBytes(11)=0
- icrc12=crc12(c_loc(i1Msg8BitBytes),11)
-
-! For reference, here's how to check the CRC
-! i1Msg8BitBytes(10)=icrc12/256
-! i1Msg8BitBytes(11)=iand (icrc12,255)
-! checksumok = crc12_check(c_loc (i1Msg8BitBytes), 11)
-! if( checksumok ) write(*,*) 'Good checksum'
-
- write(cbits,1003) i4Msg6BitWords,i3bit,icrc12
-1003 format(12b6.6,b3.3,b12.12)
- read(cbits,1004) msgbits
-1004 format(87i1)
-
- call encode174(msgbits,codeword) !Encode the test message
+ integer graymap(0:7)
+ logical unpk77_success
+ data icos7/3,1,4,0,6,5,2/ !Costas 7x7 tone pattern
+ data graymap/0,1,3,2,5,6,4,7/
+
+ i3=-1
+ n3=-1
+ call pack77(msg,i3,n3,c77)
+ call unpack77(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
+
+entry get_tones_from_77bits(msgbits,itone)
+
+2 call encode174_91(msgbits,codeword) !Encode the test message
! Message structure: S7 D29 S7 D29 S7
itone(1:7)=icos7
@@ -49,8 +38,9 @@ subroutine genft8(msg,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
i=3*j -2
k=k+1
if(j.eq.30) k=k+7
- itone(k)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
+ indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
+ itone(k)=graymap(indx)
enddo
- return
+900 return
end subroutine genft8