Add directory 77bit and its contents.

This commit is contained in:
Joe Taylor 2018-06-21 10:51:19 -04:00
parent 2e947f4f2b
commit 96f3fa5810
10 changed files with 1497 additions and 0 deletions

40
lib/77bit/77bit.txt Normal file
View File

@ -0,0 +1,40 @@
Proposed new message types have 77-bit payload: 74 information bits
and 3 bits for "message type". Note that Type 0 (as defined by i3)
uses only 71 information bits, so it allows another 3 bits (here
called n3) to be used for 8 sub-types.
----------------------------------------------------------------------------------
i3 Example message Bits n3 Total Purpose
----------------------------------------------------------------------------------
0 FREE TEXT MSG 71 0 71
0 K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 1 71 DXpedition Mode
0 PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 2 70 EU VHF contest
0 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 3 71 ARRL Field Day
0 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 4 71 ARRL Field Day
1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg
2 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest
3 PA3XYZ/P GM4ABC/P R JO22 28 1 28 1 1 15 74 EU VHF contest
4 <WA9XYZ> PJ4/KA1ABC R-11 13 53 1 1 6 74 Nonstandard calls
5 ...
6
7
----------------------------------------------------------------------------------
Notes:
0. Free text message.
1. 74-bit standard message: two 28-bit callsigns, each with an extra
bit to indicate "/R" Rover status; one bit for "R" preceding the grid
or report; 15 bits for grid or report.
2. Type 2 is for the annual ARRL RTTY Roundup. Optional "TU;" uses
1 bit; then two 28-bit callsigns, optional "R" (1 bit), a 3-bit
report, and finally 13 bits for US state, Canadian province, or DX
serial number.
3. For European VHF+ contests. Like Type 1, but /P instead of /R.
4. For European VHF+ contests. Transfers serial QSO number (12 bits)
and 6-digit grid locator (25 bits).

83
lib/77bit/arrl_sec.txt Normal file
View File

@ -0,0 +1,83 @@
AB
AK
AL
AR
AZ
BC
CO
CT
DE
EB
EMA
ENY
EPA
EWA
GA
GTA
IA
ID
IL
IN
KS
KY
LA
LAX
MAR
MB
MDC
ME
MI
MN
MO
MS
MT
NC
ND
NE
NFL
NH
NL
NLI
NM
NNJ
NNY
NT
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

20
lib/77bit/fmtmsg77.f90 Normal file
View File

@ -0,0 +1,20 @@
subroutine fmtmsg77(msg)
character*37 msg
! Convert all letters to upper case
iz=len(trim(msg))
do i=1,iz
if(msg(i:i).ge.'a' .and. msg(i:i).le.'z') &
msg(i:i)= char(ichar(msg(i:i))+ichar('A')-ichar('a'))
enddo
do iter=1,10 !Collapse multiple blanks into one
ib2=index(msg(1:iz),' ')
if(ib2.lt.1) go to 900
msg=msg(1:ib2)//msg(ib2+2:)
iz=iz-1
enddo
900 return
end subroutine fmtmsg77

23
lib/77bit/msgtypes.txt Normal file
View File

@ -0,0 +1,23 @@
i3 n3
--------------------------------------------------------------------------------------
0 0 FREE TEXT MSG 71 0 71
0 1 K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 1 71 DXpedition Mode
0 2 PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 2 70 EU VHF contest (2)
0 3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 3 71 ARRL Field Day
0 4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 4 71 ARRL Field Day
1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg
2 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest
3 <WA9XYZ> PJ4/KA1ABC R-11 13 53 1 1 6 74 Nonstandard calls
4 PA3XYZ/P GM4ABC/P R IO91 28 1 28 1 1 15 74 EU VHF contest
0 0 HELLO WORLD 1
0 0 hello world 2
0 1 K1ABC RR73; W9XYZ <VP2E/KA1ABC> -11
0 2 PA3XYZ 590003 IO91NP
0 3 WA9XYZ KA1ABC 16A EMA
0 4 WA9XYZ KA1ABC 32A EMA
1 WA9XYZ/R KA1ABC/R R FN42
2 W9XYZ K1ABC 579 MA
3 PJ4/KA1ABC <WA9XYZ> -11
4 PA3XYZ/P GM4ABC/P R IO91

11
lib/77bit/msgtypes.txt.0 Normal file
View File

@ -0,0 +1,11 @@
i3 n3
--------------------------------------------------------------------------------------
0 0 FREE TEXT MSG 71 0 71
0 1 K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 1 71 DXpedition Mode
0 2 PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 2 70 EU VHF contest
0 3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 3 71 ARRL Field Day
0 4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 4 71 ARRL Field Day
1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg
2 TU; W9XYZ K1ABC R 579 MA 1 28 28 1 3 13 74 ARRL RTTY contest
3 <WA9XYZ> PJ4/KA1ABC R-11 13 53 1 1 6 74 Nonstandard calls
4 PA3XYZ/P GM4ABC/P R IO91 28 1 28 1 1 15 74 EU VHF contest

1037
lib/77bit/packjt.f90 Normal file

File diff suppressed because it is too large Load Diff

178
lib/77bit/parse77.f90 Normal file
View File

@ -0,0 +1,178 @@
subroutine parse77(msg,i3,n3)
parameter (NSEC=83) !Number of ARRL Sections
parameter (NUSCAN=65) !Number of US states and Canadian provinces/territories
character msg*37
character*13 w(19),c13
character*13 call_1,call_2
character*6 bcall_1,bcall_2,grid6
character*4 grid4
character crpt*3,crrpt*4
character*1 c,c0
character*3 csec(NSEC),cmult(NUSCAN),section,mult
logical ok1,ok2
logical is_grid4,is_grid6
data csec/ &
"AB ","AK ","AL ","AR ","AZ ","BC ","CO ","CT ","DE ","EB ", &
"EMA","ENY","EPA","EWA","GA ","GTA","IA ","ID ","IL ","IN ", &
"KS ","KY ","LA ","LAX","MAR","MB ","MDC","ME ","MI ","MN ", &
"MO ","MS ","MT ","NC ","ND ","NE ","NFL","NH ","NL ","NLI", &
"NM ","NNJ","NNY","NT ","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 "/
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 ","VT ","PEI","DC "/
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 .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'
iz=len(trim(msg))
! Convert to upper case; parse into words.
j=0
k=0
n=0
c0=' '
w=' '
do i=1,iz
c=msg(i:i) !Single character
if(c.eq.' ' .and. c0.eq.' ') cycle !Skip over leading or 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
msg(j:j)=c
if(c.ge.'a' .and. c.le.'z') msg(j:j)=char(ichar(c)-32) !Force upper case
w(k)(n:n)=c !Copy character c into word
c0=c
enddo
iz=j !Message length
nw=k !Number of words in msg
msg(iz+1:)=' '
! Check 0.1 (DXpedition mode)
i3=0
n3=0
i0=index(msg," RR73; ")
call chkcall(w(1)(1:12),bcall_1,ok1)
call chkcall(w(3)(1:12),bcall_2,ok2)
if(i0.ge.4 .and. i0.le.7 .and. nw.eq.5 .and. ok1 .and. ok2) then
i0=0
n3=1 !Type 0.1: DXpedition mode
go to 900
endif
! Check 0.2 (EU VHF contest exchange)
if(nw.eq.3 .or. nw.eq.4) then
n=-1
if(nw.ge.2) read(w(nw-1),*,err=2) n
2 if(ok1 .and. n.ge.520001 .and. n.le.594095 .and. is_grid6(w(nw)(1:6))) then
i3=0
n3=2 !Type 0.2: EU VHF+ Contest
go to 900
endif
endif
call chkcall(w(2)(1:12),bcall_2,ok2)
! Check 0.3 and 0.4 (ARRL Field Day exchange)
if(nw.eq.4 .or. nw.eq.5) then
n=-1
j=len(trim(w(nw-1)))-1
if(j.ge.2) read(w(nw-1)(1:j),*,err=4) n !Number of transmitters
4 m=len(trim(w(nw))) !Length of section abbreviation
if(ok1 .and. ok2 .and. n.ge.1 .and. n.le.32 .and. (m.eq.2 .or. m.eq.3)) then
section=' '
do i=1,NSEC
if(csec(i).eq.w(nw)) then
section=csec(i)
exit
endif
enddo
if(section.ne.' ') then
i3=0
if(n.ge.1 .and. n.le.16) n3=3 !Type 0.3 ARRL Field Day
if(n.ge.17 .and. n.le.32) n3=4 !Type 0.4 ARRL Field Day
go to 900
endif
endif
endif
n3=0
! Check Type 1 (Standard 77-bit message) and Type 4 (ditto, with a "/P" call)
if(nw.eq.3 .or. nw.eq.4) then
if(ok1 .and. ok2 .and. is_grid4(w(nw)(1:4))) then
if(nw.eq.3 .or. (nw.eq.4 .and. w(3)(1:2).eq.'R ')) then
i3=1 !Type 1: Standard message
if(index(w(1),'/P').ge.4 .or. index(w(2),'/P').ge.4) i3=4
go to 900
endif
endif
endif
! Check Type 2 (ARRL RTTY contest exchange)
if(nw.eq.4 .or. nw.eq.5 .or. nw.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)
crpt=w(nw-1)(1:3)
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
i3=2
n3=0
go to 900
endif
endif
! Check Type 3 (One nonstandard call and one hashed call)
if(nw.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)
crrpt=w(nw)(1:4)
i1=1
if(crrpt(1:1).eq.'R') i1=2
n=-99
read(crrpt(i1:),*,err=6) n
6 if(ok1 .and. ok2 .and. n.ne.-99) then
i3=3
n3=0
go to 900
endif
endif
! It's free text
i3=0
n3=0
msg(iz+1:)=' '
900 continue
return
end subroutine parse77

54
lib/77bit/t1.f90 Normal file
View File

@ -0,0 +1,54 @@
program t1
real x(13)
real(KIND=16) :: dlong,dlong0
character wd*13,w*13,error*5
character c*44 !NB: 44^13 = 2^(70.973)
data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?@$'/
nargs=iargc()
if(nargs.ne.1) then
print*,'Usage: t1 "FreeText13"'
print*,' t1 <iters>'
go to 999
endif
call getarg(1,w)
iters=1
read(w,*,err=10) iters
10 continue
do iter=1,iters
if(iters.gt.1) then
! Create a random free-text word
call random_number(x)
do i=1,13
j=44*x(i) + 1
w(i:i)=c(j:j)
enddo
endif
! Encode a 13-character free-text message into a 71-bit integer.
dlong=0.d0
do i=1,13
n=index(c,w(i:i))-1
dlong=44.d0*dlong + n
enddo
dlong0=dlong
! Decode a a 71-bit integer into a 13-character free-text message.
do i=13,1,-1
j=mod(dlong,44.d0)+1.d0
wd(i:i)=c(j:j)
dlong=dlong/44.d0
enddo
error=' '
if(wd.ne.w) then
error='ERROR'
write(*,1010) w,dlong0,wd,error
1010 format('"',a13,'"',f25.1,2x,'"',a13'"',2x,a5)
endif
if(mod(iter,1000).eq.0) print*,iter
enddo
999 end program t1

26
lib/77bit/t2.f90 Normal file
View File

@ -0,0 +1,26 @@
program t2
character msg*37,msg0*37,cerr*1
open(10,file='msgtypes.txt',status='old')
! Skip over first two lines
read(10,1001) cerr
read(10,1001) cerr
1001 format(a1)
do iline=1,999
read(10,1002,end=999) i3,n3,msg
1002 format(i1,i4,1x,a37)
msg0=msg
call parse77(msg,i3a,n3a)
cerr=' '
if(i3a.ne.i3 .or. n3a.ne.n3 .or. msg.ne.msg0) cerr='*'
write(*,1004) i3,n3,i3a,n3a,cerr,msg
1004 format(i1,3i3,2x,a1,2x,a37)
enddo
999 end program t2
include 'parse77.f90'
include '../chkcall.f90'

25
lib/77bit/t3.f90 Normal file
View File

@ -0,0 +1,25 @@
program t3
character*3 csec
character*70 line
logical eof
eof=.false.
j=1
do i=1,83
read(*,1001,end=1) csec
1001 format(a3)
go to 2
1 eof=.true.
2 line(j:j+5)='"'//csec//'",'
j=j+6
if(j.gt.60 .or. i.eq.83 .or.eof) then
line(j:j+2)=' &'
line(j+3:)=' '
write(*,1010) line
1010 format(a70)
j=1
endif
if(eof) go to 999
enddo
999 end program t3