.include "240x.h"
.global _c_int0
;
ST0.set0
ST1.set1
.bss TEMP,1
.bss SET_F,1
.bss F_OMEGA,1
.bss SET_V,1
.bss MAX_V,1
.bss T_SAMPLE,1
.bss THETA_H,1
.bss THETA_L,1
.bss THETA_R,1
.bss THETA_M,1
.bss THETA_I,1
.bss SS,1
.bss SC,1
.bss SIN_INDX,1
.bss SIN_ENTRY,1
.bss SIN_END,1
.bss SIN_THETA,1
.bss COS_THETA,1
.bss UA,1
.bss UB,1
.bss THETA_S,1
.bss SECTOR,1
.bss THETA_90,1
.bss THETA_180,1
.bss THETA_270,1
.bss THETA_360,1
.bss DEC_MS,24
.bss T1_PERIODS,1
.bss CMP_1,1
.bss CMP_2,1
.bss SVPAT,1
.bss ACCH,1
.bss ACCL,1
.bss AR0_SAVE,1
.bss P_H1,1
.bss P_LO,1
;
ST0_SAVE .usect ".context",1
ST1_SAVE .usect ".context",1
;
.sect ".vectors"
RESET B _C_INT0
INT1 B PHANTOM
INT2 B PHANTOM
INT3 B PHANTOM
INT4 B PHANTOM
INT5 B PHANTOM
INT6 B PHANTOM
RESERVED B PHANTOM
SW_INT8 B PHANTOM
SW_INT9 B PHANTOM
SW_INT10 B PHANTOM
SW_INT11 B PHANTOM
SW_INT12 B PHANTOM
SW_INT13 B PHANTOM
SW_INT14 B PHANTOM
SW_INT15 B PHANTOM
SW_INT16 B PHANTOM
TRAP B PHANTOM
NMI B PHANTOM
EMU_TRAP B PHANTOM
SW_INT20 B PHANTOM
SW_INT21 B PHANTOM
SW_INT22 B PHANTOM
SW_INT23 B PHANTOM
SW_INT24 B PHANTOM
SW_INT25 B PHANTOM
SW_INT26 B PHANTOM
SW_INT27 B PHANTOM
SW_INT28 B PHANTOM
SW_INT28 B PHANTOM
SW_INT29 B PHANTOM
SW_INT30 B PHANTOM
SW_INT31 B PHANTOM
;
.sect ".pvecs"
PVECTORS B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B T1UF_ISR
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
B PHANTOM
;
.text
;
_C_INT0
SETC INTM
CLRC CNF
LDP #224
SPLK #0000001000000100B,SCSR1
SPLK #68H,WDCR
LDP #225
LACC MCRA
OR #0FC0H
SACL MCRA
;
LDP #0
SPLK #0FFH,1FR
SPLK #00000010B,1MR
LDP #232
SPLK #0FFFH,EVAIFRA
SPLK #0FH,EVAIFRC
SPLK #0200H,EVAIMRA
SPLK #0,EVAIMRB
SPLK #0,EVAIMRC
;
SPLK #500,T1PR
SPLK #500,CMPR1
SPLK #500,CMPR2
SPLK #500,CMPR3
SPLK #0000011001100110B,ACTRA
SPLK #01F4H,DBTCONA
SPLK #1001001000000000B,COMCONA
SPLK #1000100000000010B,T1CON
;
LDP #6
SPLK #0347H,T_SAMPLE
SPLK #16000,T1_PERIODS
SPLK #11585,MAX_V
SPLK #0,SET_F
SPLK #10053,F_OMEGA
SPLK #0,THETA_L
SPLK #0,THETA_H
LAR AR0,#THETA_90
LAR AR1,#(28-1)
LACC #ANGLES_
LARP AR0
INIT_TBL
TBLR *+,AR1
ADD #1
BANZ INIT_TBL,AR0
SPLK #29335,THETA_I
SPLK #31291,THETA_S
SPLK #SIN_ENTRY_,SIN_ENTRY_
SPLK #(SIN_ENTRY_+90),SIN_END
.LDP #232
SPLK #0000100001000010B,T1CON
CLRC INTM
;
MAIN_LOOP
LDP #6
LT SET_F
MPYU F_OMEGA
PAC
SACH OMEGA
LT SET_F
MPYU MAX_V
PAC
SACH SET_V
B MAIN_LOOP
;
PHANTOM
CLRC INTM
RET
;
_C_INT2
SST #ST0,ST0_SAVE
SST #ST1,ST1_SAVE
LDP #6
SACH ACCH
SACL ACCL
SPH P_HI
SPL P_LO
MPY #1
SPL T_SAVE
SAR AR0,AR0_SAVE
CLRC SXM
LDP #224
LACC PIVR
SUB #029H
BCND T1UF_ISR,EQ
REST
LDP #6
LAR AR0,AR0_SAVE
LT P_LO
MPY #1
LPH P_H1
LT T_SAVA
LACC ACCH,16
ADDS ACCL
LDP #0
LST #ST1,ST1_SAVA
LST #ST0,ST0_SAVE
CLRC INTM
RET
T1UF_ISR
LDP #232
SPLK #0FFFH,EVAIFRA
LDP #6
LT OMEGA
MPY T_SAMPLE
PAC
SFR
ADD THETA_H,16
ADDS THETA_L
SACH THETA_H
SACL THETA_L
BCND CHK_UPLIM,GEQ
ADD THETA_360,16
SACH THETA_H
B RND_THETA
CHK_UPLIM
SUB THETA_360,16
BCND REST_THETA,LEQ
SACH THETA_H
B RND_THETA
REST_THETA
ADD THETA_360,16
RND_TNETA
ADD #1,15
SACH THETA_R
LACC #1
SACL SS
SACL SC
LACC THETA_R
SACL THETA_M
SUB THETA_90
BCND E_Q,LEQ
SPLK #-1,SC
LACC THETA_180
SUB THETA_R
SACL THETA_M
BCND E_Q,GEQ
SPLK #-1,SS
LACC THETA_R
SUB THETA_180
SACL THETA_M
LACC THETA_270
SUB THETA_R
BCND E_Q,GEQ
SPLK #1,SC
LACC THETA_360
SUB THETA_R
SACL THETA_M
E_Q
LT THETA_M
MPYU THETA_I
PAC
SACH SIN_INDX
LACC AIN_INDX,11
SACH SIN_INDX
LACC SIN_ENTRY
ADD SIN_INDX
TBLR SIN_THETA
LACC SIN_END
SUB SIN_INDX
TBLR COS_THETA
LT SS
MPY SIN_THETA
PAC
SACL SIN_THETA
LT SC
MPY COS_THETA
PAC
SACL COS_THETA
LT SET_V
MPY COS_THETA
PAC
SACH UA
MPY SIN_THETA
PAC
SACH UB
LT THETA_R
MPY THETA_S
PAC
SACH SECTOR
LACC SECTOR,5
SACH SECTOR
LACC #DEC_MS
ADD SECTOR,2
SACL TEMP
LAR AR0,TEMP
LT UA
MPY *+
PAC
LT UB
MPY *+
APAC
BCND CMP1BIG0,GEQ
LACC #0
CMP1BIG0
SACH TEMP
LT TEMP
MPY T1_PERIODS
PAC
ADD #1,15
SACH CMP_1,1
LT UA
MPY *+
PAC
LT UB
MPY *+
APAC
BCND CMP2BIG0,GEQ
LACC #0
CMP2BIG0
SACH TEMP
LT TEMP
MPY T1_PERIODS
PAC
ADD #1,15
SACH CMP_2,1
LACC #CCKWISE_
ADD SECTOR
TBLR SVPAT
LAR AR0,#ACTRA
LACC *
AND #0FFFH
OR SVPAT
SACL *
LAR AR0,#CMPR1
LACC CMP_1
SACL *+
ADD CMP_2
SACL *
SUB #500
BCND IN_LMT,LEQ
SPLK #500,*
IN_LMT
B REST
.data
;
ANGLES_
.word 01922H
.word 03244H
.word 04B66H
.word 06488H
.word 20066
.word -11585
.word 0
.word 23170
.word 20066
.word 11585
.word -20066
.word 11585
.word 0
.word 23170
.word -20066
.word -11585
.word -20066
.word 11585
.word 0
.word -23170
.word -20066
.word -11585
.word 20066
.word -11585
.word 0
.word -23170
.word 20066
.word 11585
CCKWISE_
.word 0001000000000000B
.word 0011000000000000B
.word 0010000000000000B
.word 0110000000000000B
.word 0100000000000000B
.word 0101000000000000B
SIN_ENTRY_
.word 0
.word 286,572,857,1143,1428
.word 1713,1997,2280,2563,2845
.word 3126,3406,3686,3964,4240
.word 4516,4790,5063,5334,5604
.word 5872,6138,6402,6664,6924
.word 7182,7438,7692,7943,8193
.word 8438,8682,8923,9126,9397
.word 9630,9860,10087,10311,10531
.word 10749,10963,11174,11381,11585
.word 11786,11982,12176,12365,12551
.word 12733,12911,13085,13255,13421
.word 13583,13741,13894,14044,14189
.word 14330,14466,14598,14726,14849
.word 14968,15082,15191,15296,15396
.word 15491,15582,15668,15749,15826
.word 15897,15964,16026,16083,16235
.word 16182,16225,16262,16294,16322
.word 16344,16362,16374,16382,16384
.end
评论0