📄 gpsfuncs.asm
字号:
; /*
; READ THE INPUT DATA FILE(s)
; */
; status=cold_start; // for initialization, if we have enough data we
;
?debug L 807
mov ax,seg _status
mov es,ax
mov word ptr es:_status,0
;
; read_ion_utc(); // will switch to warm or hot start
;
?debug L 808
call far ptr @read_ion_utc$qv
;
; thetime=time(NULL);
;
?debug L 809
push large 0
call far ptr _time
add sp,4
mov bx,seg _thetime
mov es,bx
mov word ptr es:_thetime+2,dx
mov word ptr es:_thetime,ax
;
; read_almanac();
;
?debug L 810
call far ptr @read_almanac$qv
;
; dummy=satfind(0);
;
?debug L 811
push 0
push ss
lea ax,word ptr [bp-24]
push ax
push cs
call near ptr @satfind$qc
add sp,6
;
; }
;
?debug L 812
pop di
pop si
leave
ret
?debug C E60564756D6D791B02E8FF000002696404040200+
?debug C 00
?debug E
?debug E
@read_initial_data$qv endp
assume cs:GPSFUNCS_TEXT,ds:DGROUP
@receiver_loc$qv proc far
;
; llh receiver_loc(void)
;
?debug L 829
?debug B
push bp
mov bp,sp
sub sp,46
push si
push di
?debug B
cmp word ptr __stklen,sp
ja short @5@3
call far ptr F_OVERFLOW@
@5@3:
;
; {
; float latitude,longitude,height;
; char text[10];
; llh result;
; result.lat=0.0;
;
?debug L 834
fldz
fstp qword ptr [bp-46]
;
; result.lon=0.0;
;
?debug L 835
fldz
fstp qword ptr [bp-38]
;
; result.hae=0.0;
;
?debug L 836
fldz
fstp qword ptr [bp-30]
;
; /*
; READ THE CURRENT LOCATION DATA FILE
; */
; if ((in = fopen("CURLOC.DAT", "rt")) == NULL)
;
?debug L 840
push ds
push offset DGROUP:s@+111
push ds
push offset DGROUP:s@+100
fwait
call far ptr _fopen
add sp,8
mov bx,seg _in
mov es,bx
mov word ptr es:_in+2,dx
mov word ptr es:_in,ax
or ax,dx
jne short @5@5
;
; {
; printf("Cannot open curloc.dat file.\n");
;
?debug L 842
push ds
push offset DGROUP:s@+114
call far ptr _printf
add sp,4
;
; status=cold_start;
;
?debug L 843
mov ax,seg _status
mov es,ax
mov word ptr es:_status,0
;
; }
;
?debug L 844
jmp @5@6
@5@5:
;
; else
; {
; fscanf(in,"%10s",text);
;
?debug L 847
push ss
lea ax,word ptr [bp-22]
push ax
push ds
push offset DGROUP:s@+144
mov ax,seg _in
mov es,ax
push dword ptr es:_in
call far ptr _fscanf
add sp,12
;
; fscanf(in,"%f",&latitude);
;
?debug L 848
push ss
lea ax,word ptr [bp-4]
push ax
push ds
push offset DGROUP:s@+149
mov ax,seg _in
mov es,ax
push dword ptr es:_in
call far ptr _fscanf
add sp,12
;
; fscanf(in,"%10s",text);
;
?debug L 849
push ss
lea ax,word ptr [bp-22]
push ax
push ds
push offset DGROUP:s@+152
mov ax,seg _in
mov es,ax
push dword ptr es:_in
call far ptr _fscanf
add sp,12
;
; fscanf(in,"%f",&longitude);
;
?debug L 850
push ss
lea ax,word ptr [bp-8]
push ax
push ds
push offset DGROUP:s@+157
mov ax,seg _in
mov es,ax
push dword ptr es:_in
call far ptr _fscanf
add sp,12
;
; fscanf(in,"%10s",text);
;
?debug L 851
push ss
lea ax,word ptr [bp-22]
push ax
push ds
push offset DGROUP:s@+160
mov ax,seg _in
mov es,ax
push dword ptr es:_in
call far ptr _fscanf
add sp,12
;
; fscanf(in,"%f",&height);
;
?debug L 852
push ss
lea ax,word ptr [bp-12]
push ax
push ds
push offset DGROUP:s@+165
mov ax,seg _in
mov es,ax
push dword ptr es:_in
call far ptr _fscanf
add sp,12
;
; result.lat=latitude/57.296;
;
?debug L 853
fld dword ptr [bp-4]
fdiv qword ptr DGROUP:s@+168
fstp qword ptr [bp-46]
;
; result.lon=longitude/57.296;
;
?debug L 854
fld dword ptr [bp-8]
fdiv qword ptr DGROUP:s@+168
fstp qword ptr [bp-38]
;
; result.hae=height;
;
?debug L 855
fld dword ptr [bp-12]
fstp qword ptr [bp-30]
fwait
@5@6:
;
; }
; fclose(in);
;
?debug L 857
mov ax,seg _in
mov es,ax
push dword ptr es:_in
call far ptr _fclose
add sp,4
;
; return(result);
;
?debug L 858
lea si,word ptr [bp-46]
mov ax,ss
les di,dword ptr [bp+6]
push ds
mov ds,ax
mov cx,12
rep movsw
pop ds
mov dx,word ptr [bp+8]
mov ax,word ptr [bp+6]
;
; }
;
?debug L 859
pop di
pop si
leave
ret
?debug C E320036C6C6818001E1D
?debug C E321000A001A02
?debug C E322000400162000
?debug C E606726573756C742002D2FF0000047465787421+
?debug C 02EAFF0000066865696768740E02F4FF0000096C+
?debug C 6F6E6769747564650E02F8FF0000086C61746974+
?debug C 7564650E02FCFF00000672657475726E220A0600+
?debug C 0000
?debug E
?debug E
@receiver_loc$qv endp
assume cs:GPSFUNCS_TEXT,ds:DGROUP
@navmess$qcc proc far
;
; void navmess(char prn,char ch)
;
?debug L 876
?debug B
push bp
mov bp,sp
sub sp,228
push si
push di
?debug C E6026368020A080000000370726E020A06000000
?debug B
cmp word ptr __stklen,sp
ja short @6@3
call far ptr F_OVERFLOW@
@6@3:
;
; {
; int i,j,k;
; unsigned long isqra,ie;
; long iaf0,iomegadot,iomega0;
; char itgd,iaf2;
; // int icapl2;
; int iweek,iura,ihealth,iodc,iaf1;
; unsigned int itoe,itoc;
; // int fif;
; int iode,icrs,idn,icuc,icus,icic,iomegad;
; int icis,icrc,idoe,idot;
; unsigned int iae,iatoa;
; // static int i4page,i5page;
; int i4data,i5data,isv,iaomegad;
; long iaaf0,iaaf1,iadeli,iaomega0,im0,inc0,iw;
; unsigned long iasqr;
; long iaw,iam0,scale,ia0,ia1;
; char ial0,ial1,ial2,ial3,ibt0,ibt1,ibt2,ibt3;
; int itot,iWNt,idtls,iWNlsf,iDN,idtlsf;//WNa
; int sfr,word,i4p,i5p;
; double r_sqra,r_inc0,r_ety;
; float d_toe;
; //
; // assemble the 1500 data bits into subframes and words
; //
; // gotoxy(1,24);
; // printf("->navmess prn %d ch %d",prn,ch);
; d_toe=clock_tow-gps_eph[prn].toe;
;
?debug L 904
mov al,byte ptr [bp+6]
cbw
imul ax,ax,196
mov dx,seg _gps_eph
mov bx,ax
mov es,dx
fld qword ptr es:_gps_eph[bx+28]
mov ax,seg _clock_tow
mov es,ax
mov eax,dword ptr es:_clock_tow
mov dword ptr [bp-180],eax
mov word ptr [bp-176],0
mov word ptr [bp-174],0
fild qword ptr [bp-180]
fsubr
fstp dword ptr [bp-172]
;
; if (d_toe>302400.0) d_toe=d_toe-604800.0;
;
?debug L 905
fld dword ptr [bp-172]
fcomp dword ptr DGROUP:s@+60
fstsw ax
sahf
jbe short @6@5
fld dword ptr [bp-172]
fsub dword ptr DGROUP:s@+64
jmp short @6@7
@6@5:
;
; else if (d_toe<-302400.0)d_toe=d_toe+604800.0;
;
?debug L 906
fld dword ptr [bp-172]
fcomp qword ptr DGROUP:s@+68
fstsw ax
sahf
jae short @6@8
fld dword ptr [bp-172]
fadd dword ptr DGROUP:s@+64
@6@7:
fstp dword ptr [bp-172]
fwait
@6@8:
;
; j=0;
;
?debug L 907
mov word ptr [bp-2],0
;
; for (sfr=1;sfr<=5;sfr++)
;
?debug L 908
mov word ptr [bp-142],1
jmp @6@21
@6@9:
;
; {
; for (word=1;word<=10;word++)
;
?debug L 910
mov word ptr [bp-144],1
mov word ptr [bp-182],4
jmp @6@19
@6@11:
;
; {
; scale=536870912L;
;
?debug L 912
mov dword ptr [bp-116],large 020000000h
;
; sf[sfr][word]=0;
;
?debug L 913
mov bx,word ptr [bp-142]
imul bx,bx,44
add bx,word ptr [bp-182]
mov ax,seg _sf
mov es,ax
mov dword ptr es:_sf[bx],large 0
;
; for (i=0;i<=29;i++)
;
?debug L 914
xor cx,cx
jmp short @6@16
@6@12:
;
; {
; if (chan[ch].message[(j+chan[ch].offset)%1500]==1)
;
?debug L 916
mov al,byte ptr [bp+8]
cbw
imul ax,ax,1738
mov dx,seg _chan
mov bx,ax
mov es,dx
mov ax,word ptr es:_chan[bx+1536]
add ax,word ptr [bp-2]
mov bx,1500
cwd
idiv bx
mov al,byte ptr [bp+8]
cbw
imul ax,ax,1738
add dx,ax
mov ax,seg _chan
mov bx,dx
mov es,ax
mov al,byte ptr es:_chan[bx+18]
cbw
cmp ax,1
jne short @6@14
;
; sf[sfr][word]+=scale;
;
?debug L 917
mov bx,word ptr [bp-142]
imul bx,bx,44
add bx,word ptr [bp-182]
mov ax,seg _sf
mov edx,dword ptr [bp-116]
mov es,ax
add dword ptr es:_sf[bx],edx
@6@14:
;
; scale=scale>>1;
;
?debug L 918
mov eax,dword ptr [bp-116]
sar eax,1
mov dword ptr [bp-116],eax
;
; j++;
;
?debug L 919
inc word ptr [bp-2]
?debug L 914
inc cx
@6@16:
cmp cx,29
jle short @6@12
?debug L 910
add word ptr [bp-182],4
inc word ptr [bp-144]
@6@19:
cmp word ptr [bp-144],10
jle @6@11
?debug L 908
inc word ptr [bp-142]
@6@21:
cmp word ptr [bp-142],5
jle @6@9
;
; }
; }
; }
; parity_check(); // check the parity of the 1500 bit message
;
?debug L 923
call far ptr @parity_check$qv
;
; chan[ch].word_error[0]=p_error[1];
;
?debug L 924
mov al,byte ptr [bp+8]
cbw
imul ax,ax,1738
mov dx,seg _chan
mov bx,seg _p_error
mov es,bx
mov bx,word ptr es:_p_error+2
mov es,dx
xchg bx,ax
mov word ptr es:_chan[bx+1522],ax
;
; chan[ch].word_error[1]=p_error[2];
;
?debug L 925
mov al,byte ptr [bp+8]
cbw
imul ax,ax,1738
mov dx,seg _chan
mov bx,seg _p_error
mov es,bx
mov bx,word ptr es:_p_error+4
mov es,dx
xchg bx,ax
mov word ptr es:_chan[bx+1524],ax
;
; chan[ch].word_error[2]=p_error[3];
;
?debug L 926
mov al,byte ptr [bp+8]
cbw
imul ax,ax,1738
mov dx,seg _chan
mov bx,seg _p_error
mov es,bx
mov bx,word ptr es:_p_error+6
mov es,dx
xchg bx,ax
mov word ptr es:_chan[bx+1526],ax
;
; chan[ch].word_error[3]=p_error[4];
;
?debug L 927
mov al,byte ptr [bp+8]
cbw
imul ax,ax,1738
mov dx,seg _chan
mov bx,seg _p_error
mov es,bx
mov bx,word ptr es:_p_error+8
mov es,dx
xchg bx,ax
mov word ptr es:_chan[bx+1528],ax
;
; chan[ch].word_error[4]=p_error[5];
;
?debug L 928
mov al,byte ptr [bp+8]
cbw
imul ax,ax,1738
mov dx,seg _chan
mov bx,seg _p_error
mov es,bx
mov bx,word ptr es:_p_error+10
mov es,dx
xchg bx,ax
mov word ptr es:_chan[bx+1530],ax
;
; //
; // EPHEMERIS DECODE subframes 1, 2, 3
; //
; // subframe 1
; //
; // check parity of first 3 subframes, since it is a circular register
; // we may have over written the first few bits so allow for word 1 of
; // subframe 1 to have a problem
; //
;
; if ((p_error[1]==0 || p_error[1]==0x200) && p_error[2]==0 && p_error[3]==0)
;
?debug L 939
mov ax,seg _p_error
mov es,ax
cmp word ptr es:_p_error+2,0
je short @6@24
mov ax,seg _p_error
mov es,ax
cmp word ptr es:_p_error+2,512
jne @6@46
@6@24:
mov ax,seg _p_error
mov es,ax
cmp word ptr es:_p_error+4,0
jne @6@46
mov ax,seg _p_error
mov es,ax
cmp word ptr es:_p_error+6,0
jne @6@46
;
; {
; iodc=int(((sf[1][3] & 0x3) <<8 ) | ((sf[1][8] & 0xFF0000L) >>16));
;
?debug L 941
mov ax,seg _sf
mov es,ax
mov eax,dword ptr es:_sf+76
and eax,large 000FF0000h
shr eax,16
mov dx,seg _sf
mov es,dx
mov dx,word ptr es:_sf+56
and dx,3
shl dx,8
or ax,dx
mov word ptr [bp-34],ax
;
; iode=int(sf[2][3] >> 16);
;
?debug L 942
mov ax,seg _sf
mov es,ax
mov eax,dword ptr es:_sf+100
shr eax,16
mov word ptr [bp-42],ax
;
; idoe=int(sf[3][10] >> 16);
;
?debug L 943
mov ax,seg _sf
mov es,ax
mov eax,dword ptr es:_sf+172
shr eax,16
mov word ptr [bp-60],ax
;
; // fprintf(kalm,"prn=%d iodc=%d, iode=%d,idoe=%d\n",prn,iodc,iode,idoe);
; // fprintf(kalm," eph.iode=%d, eph.iodc=%d\n",gps_eph[prn].iode,gps_eph[prn].iodc);
; // if both copies of iode agree and we have a new iode or new iodc then process the ephemeris
; if (iode==idoe && ((iode!=gps_eph[prn].iode) || (iodc!=gps_eph[prn].iodc)))
;
?debug L 947
mov ax,word ptr [bp-42]
cmp ax,word ptr [bp-60]
jne @6@46
mov al,byte ptr [bp+6]
cbw
imul ax,ax,196
mov dx,seg _gps_eph
mov bx,ax
mov es,dx
mov ax,word ptr es:_gps_eph[bx]
cmp ax,word ptr [bp-42]
jne short @6@29
mov al,byte ptr [bp+6]
cbw
imul ax,ax,196
mov dx,seg _gps_eph
mov bx,ax
mov es,dx
mov ax,word ptr es:_gps_eph[bx+2]
cmp ax,word ptr [bp-34]
je @6@46
@6@29:
;
; {
;
; iweek= int(sf[1][3] >> 14);
;
?debug L 950
mov ax,seg _sf
mov es,ax
mov eax,dword ptr es:_sf+56
mov dword ptr [bp-188],eax
shr eax,14
mov word ptr [bp-28],ax
;
; // icapl2=( sf[1][3] & 0x3000 ) >> 12;
; iura=int(( sf[1][3] & 0xF00 ) >> 8);
;
?debug L 952
mov eax,dword ptr [bp-188]
a
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -