mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-04 23:14:57 -04:00
Convert ft8code to 77bit messages.
This commit is contained in:
+43
-80
@@ -1,31 +1,28 @@
|
||||
program ft8code
|
||||
|
||||
! Provides examples of message packing, LDPC(144,87) encoding, bit and
|
||||
! Provides examples of message packing, LDPC(174,91) encoding, bit and
|
||||
! symbol ordering, and other details of the FT8 protocol.
|
||||
|
||||
use packjt
|
||||
use crc
|
||||
use packjt77
|
||||
include 'ft8_params.f90' !Set various constants
|
||||
include 'ft8_testmsg.f90'
|
||||
parameter (NWAVE=NN*NSPS)
|
||||
|
||||
character*40 msg,msgchk
|
||||
character*37 msg37
|
||||
character*6 c1,c2
|
||||
|
||||
character*77 c77
|
||||
character*37 msg,msgsent
|
||||
character*9 comment
|
||||
character*22 msgsent,message
|
||||
character bad*1,msgtype*10
|
||||
character*87 cbits
|
||||
character bad*1,msgtype*16
|
||||
character*91 cbits
|
||||
integer itone(NN)
|
||||
integer dgen(12)
|
||||
integer*1 msgbits(KK),decoded(KK),decoded0(KK)
|
||||
integer*1 msgbits(77)
|
||||
logical unpk77_success
|
||||
|
||||
! Get command-line argument(s)
|
||||
nargs=iargc()
|
||||
if(nargs.ne.1 .and. nargs.ne.3) then
|
||||
print*
|
||||
print*,'Program ft8code: Provides examples of message packing, ', &
|
||||
'LDPC(174,87) encoding,'
|
||||
'LDPC(174,91) encoding,'
|
||||
print*,'bit and symbol ordering, and other details of the FT8 protocol.'
|
||||
print*
|
||||
print*,'Usage: ft8code [-c grid] "message" # Results for specified message'
|
||||
@@ -35,89 +32,55 @@ program ft8code
|
||||
|
||||
call getarg(1,msg) !Message to be transmitted
|
||||
if(len(trim(msg)).eq.2 .and. msg(1:2).eq.'-t') then
|
||||
testmsg(NTEST+1)='KA1ABC RR73; WB9XYZ <KH1/KH7Z> -11'
|
||||
nmsg=NTEST+1
|
||||
nmsg=NTEST
|
||||
else
|
||||
msgchk=msg
|
||||
call fmtmsg(msgchk,iz) !To upper case; collapse multiple blanks
|
||||
call fmtmsg(msg,iz) !To upper case; collapse multiple blanks
|
||||
nmsg=1
|
||||
endif
|
||||
|
||||
write(*,1010)
|
||||
1010 format(" Message Decoded Err? Type"/76("-"))
|
||||
1010 format(4x,'Message',31x,'Decoded',29x,'Err i3.n3'/100('-'))
|
||||
|
||||
do imsg=1,nmsg
|
||||
if(nmsg.gt.1) msg=testmsg(imsg)
|
||||
call fmtmsg(msg,iz) !To upper case, collapse multiple blanks
|
||||
msgchk=msg
|
||||
|
||||
! Generate msgsent, msgbits, and itone
|
||||
if(index(msg,';').le.0) then
|
||||
call packmsg(msg(1:22),dgen,itype)
|
||||
msgtype=""
|
||||
if(itype.eq.1) msgtype="Std Msg"
|
||||
if(itype.eq.2) msgtype="Type 1 pfx"
|
||||
if(itype.eq.3) msgtype="Type 1 sfx"
|
||||
if(itype.eq.4) msgtype="Type 2 pfx"
|
||||
if(itype.eq.5) msgtype="Type 2 sfx"
|
||||
if(itype.eq.6) msgtype="Free text"
|
||||
i3bit=0
|
||||
call genft8(msg(1:22),i3bit,msgsent,msgbits,itone)
|
||||
i3=-1
|
||||
n3=-1
|
||||
call genft8_174_91(msg,i3,n3,msgsent,msgbits,itone)
|
||||
msgtype=""
|
||||
if(i3.eq.0) then
|
||||
if(n3.eq.0) msgtype="Free text"
|
||||
if(n3.eq.1) msgtype="DXpedition mode"
|
||||
if(n3.eq.2) msgtype="EU VHF Contest"
|
||||
if(n3.eq.3) msgtype="ARRL Field Day"
|
||||
if(n3.eq.4) msgtype="ARRL Field Day"
|
||||
if(n3.eq.5) msgtype="Telemetry"
|
||||
if(n3.ge.6) msgtype="Undefined type"
|
||||
endif
|
||||
if(i3.eq.1) msgtype="Standard msg"
|
||||
if(i3.eq.2) msgtype="EU VHF Contest"
|
||||
if(i3.eq.3) msgtype="ARRL RTTY Roundup"
|
||||
if(i3.eq.4) msgtype="Nonstandard calls"
|
||||
if(i3.ge.5) msgtype="Undefined msg type"
|
||||
if(i3.ge.1) n3=-1
|
||||
bad=" "
|
||||
comment=' '
|
||||
if(msg.ne.msgsent) bad="*"
|
||||
if(n3.ge.0) then
|
||||
write(*,1020) imsg,msg,msgsent,bad,i3,n3,msgtype,comment
|
||||
1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a16,1x,a9)
|
||||
else
|
||||
call foxgen_wrap(msg,msgbits,itone)
|
||||
i3bit=1
|
||||
write(*,1022) imsg,msg,msgsent,bad,i3,msgtype,comment
|
||||
1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a16,1x,a9)
|
||||
endif
|
||||
decoded=msgbits
|
||||
i3bit=4*decoded(73) + 2*decoded(74) + decoded(75)
|
||||
iFreeText=decoded(57)
|
||||
decoded0=decoded
|
||||
if(i3bit.eq.1) decoded(57:)=0
|
||||
call extractmessage174(decoded,message,ncrcflag)
|
||||
decoded=decoded0
|
||||
|
||||
if(i3bit.eq.0) then
|
||||
bad=" "
|
||||
comment=' '
|
||||
if(itype.ne.6 .and. message.ne.msgchk) bad="*"
|
||||
if(itype.eq.6 .and. message(1:13).ne.msgchk(1:13)) bad="*"
|
||||
if(itype.eq.6 .and. len(trim(msgchk)).gt.13) comment='truncated'
|
||||
write(*,1020) imsg,msgchk,message,bad,i3bit,itype,msgtype,comment
|
||||
1020 format(i2,'.',1x,a22,1x,a22,1x,a1,2i2,1x,a10,1x,a9)
|
||||
else
|
||||
write(cbits,1001) decoded
|
||||
1001 format(87i1)
|
||||
read(cbits,1002) nrpt
|
||||
1002 format(66x,b6)
|
||||
irpt=nrpt-30
|
||||
i1=index(message,' ')
|
||||
i2=index(message(i1+1:),' ') + i1
|
||||
c1=message(1:i1)//' '
|
||||
c2=message(i1+1:i2)//' '
|
||||
msg37=c1//' RR73; '//c2//' <...> '
|
||||
write(msg37(35:37),1003) irpt
|
||||
1003 format(i3.2)
|
||||
if(msg37(35:35).ne.'-') msg37(35:35)='+'
|
||||
iz=len(trim(msg37))
|
||||
do iter=1,10 !Collapse multiple blanks into one
|
||||
ib2=index(msg37(1:iz),' ')
|
||||
if(ib2.lt.1) exit
|
||||
msg37=msg37(1:ib2)//msg37(ib2+2:)
|
||||
iz=iz-1
|
||||
enddo
|
||||
|
||||
write(*,1021) imsg,msgchk,msg37
|
||||
1021 format(i2,'.',1x,a40,1x,a37)
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
if(nmsg.eq.1) then
|
||||
write(*,1030) msgbits(1:56)
|
||||
1030 format(/'Call1: ',28i1,' Call2: ',28i1)
|
||||
write(*,1032) msgbits(57:72),msgbits(73:75),msgbits(76:87)
|
||||
1032 format('Grid: ',16i1,' 3Bit: ',3i1,' CRC12: ',12i1)
|
||||
write(*,1030) msgbits
|
||||
1030 format(/'Message bits: ',/77i1)
|
||||
write(*,1034) itone
|
||||
1034 format(/'Channel symbols:'/79i1)
|
||||
1034 format(/'Channel symbols (tones):'/79i1)
|
||||
endif
|
||||
|
||||
999 end program ft8code
|
||||
|
||||
Reference in New Issue
Block a user