📄 play.asm
字号:
.INCLUDE PLAYSUB.ASM
_PlaySound:
PUSH R1 TO [SP]
CALL TxPlay
R1=[_Statu]
TEST R1, DynamicBit
JNE PlaySound_
CALL DTNormalPlayStatu
PlaySound_:
R1=[_BookMark]
TEST R1, XYDBookBit
JE PlayDSLSound
PC=PlayXYDSound
PlayDSLSound:
POP R1 FROM [SP]
R5=R1
R1=R1 LSR 4
R1=R1 LSR 4
R2=0x38
MR=R1*R2
R1=R5
R1-=R3
PUSH R1 TO [SP]
R1=R1 LSL 2
R3=[_SIAddr]
R4=[_SIAddrB]
CALL NandAddrAdd
R5=4
R2=_NandBuf
CALL ReadNandByteBuf
R1=[_NandBuf+1]
R1=R1 LSL 4
R3=R1 LSL 4
R3|=[_NandBuf+0]
R1=[_NandBuf+3]
R1=R1 LSL 4
R4=R1 LSL 4
R4|=[_NandBuf+2]
R1=[_SIAddr]
R3+=R1
[_PlayStartAddr]=R3
JCC PlayForNandBase_
R4+=1
PlayForNandBase_:
R1=[_SIAddrB]
R4+=R1
[_PlayStartBank]=R4
R5=8
R2=_NandBuf
CALL ReadNandByteBuf
BP=SP
R1=[BP+1]
CMP R1, [_HowManyNormalSound]
JCC PlayNormal
CMP R1, [_HowManySound]
JCC PlayMS01
PlayNot:
R1=' '
CALL TxByte
R1='E'
CALL TxByte
R1='r'
CALL TxByte
R1='r'
CALL TxByte
PlayA20:
PlayS480:
PlayS720:
PlayMS02:
PlayS200:
Play_Invalid:
R1 = SACM_IDLE
[_SacmStatus] = R1
CALL ClrPlayCE
PC = Play_End
PlayMS01:
R1=SOUND_MS01
[_PlayType]=R1
CALL RampUpDAC
CALL F_SACM_MS01_Initial
R1 = [_SoundVolume]
CALL F_SACM_MS01_Volume
R1 = -1
R2 = 0x03
R3 = 0x03
CALL F_SACM_MS01_Play
PC=Play_Init_End
PlayNormal:
// R1=[_NandBuf+0]
// CMP R1, 0x41
// JNE PlayNot
R1=[_NandBuf+3]
R1=R1 LSL 4
R1=R1 LSL 4
R1|=[_NandBuf+2]
R2=[_NandBuf+5]
R2=R2 LSL 4
R2=R2 LSL 4
R2|=[_NandBuf+4]
R1+=[_PlayLengthL]
R2+=[_PlayLengthH], Carry
[_PlayLengthL]=R1
[_PlayLengthH]=R2
R3=[_PlayStartAddr]
R4=[_PlayStartBank]
R1=2
CALL NandAddrAdd
[_PlayStartAddr]=R3
[_PlayStartBank]=R4
R1=0x01
[_PlayFrq]=R1
PlayA1600:
R1=SOUND_A1600
[_PlayType]=R1
R1=1
[_A1600Type]=R1
CALL RampUpDAC
R1 = DVR1600_1600
[_DVR_OR_1600] = R1
CALL F_SACM_DVR1600_Initial
R1 = [_SoundVolume]
CALL F_SACM_DVR1600_Volume
R1=[_SoundSpeed]
JE PlayA1600_
PUSH R1 TO [SP]
CALL _SACM_DVR1600_Speed
POP R1 FROM [SP]
PlayA1600_:
R1 = -1
R2 = 0x03
R3 = 0x03
CALL F_SACM_DVR1600_Play
JMP Play_Init_End
PlayS530:
.ifdef MOUDLE_530
CALL RampUpDAC
CALL F_SACM_S530_Initial
R1 = [_SoundVolume]
CALL F_SACM_S530_Volume
R1 = -1
R2 = 0x03
R3 = 0x03
CALL F_SACM_S530_Play
R1=[_SoundSpeed]
JE PlayS530_
PUSH R1 TO [SP]
CALL F_SACM_S530_Speed
POP R1 FROM [SP]
PlayS530_:
.endif
Play_Init_End:
R1 = SACM_PLAY
[_SacmStatus] = R1
CALL _ServiceLoop
Play_End:
POP R1 FROM [SP]
RETF
PlayXYDSound:
BP=SP
R3=[_SIAddr]
R4=[_SIAddrB]
R1=[BP+1]
R1-=0x100
R2=R1 LSL 1
R1+=R2
CALL NandAddrAdd
R5=6
R2=_NandBuf
CALL ReadNandByteBuf
PlayForNandBase__:
R1=[_NandBuf+1]
R1=R1 LSL 4
R3=R1 LSL 4
R3|=[_NandBuf+0]
R4=[_NandBuf+2]
CALL AddrChg
CALL AddBookAddr
[_PlayStartAddr]=R3
[_PlayStartBank]=R4
R1=[_NandBuf+5]
CMP R1, [_NandBuf+2]
JNE Play_NotEmpty
R1=[_NandBuf+4]
CMP R1, [_NandBuf+1]
JNE Play_NotEmpty
R1=[_NandBuf+3]
CMP R1, [_NandBuf+0]
JNE Play_NotEmpty
R1 = SACM_IDLE
[_SacmStatus] = R1
PC = Play_End
Play_NotEmpty:
R3=[_PlayStartAddr]
R4=[_PlayStartBank]
CALL ReadNandByte
[_PlayType] = R1 //Play Type
CALL NandAddrInc
[_PlayStartAddr]=R3
[_PlayStartBank]=R4
R1 = [_PlayType]
R2=R1 LSR 4
[_PlayFrq]=R2
R1 = [_PlayType]
R1&=0x07
[_PlayType]=R1
R1 += Play_Branch
PC = [R1]
Play_Branch:
.DW PlayA20
.DW PlayS480
.DW PlayS720
.DW PlayMS01
.DW PlayA1600
.DW PlayMS02
.DW PlayS200
.DW PlayS530
NormalRecord:
R1=0x06
[P_DAC_Ctrl]=R1
CALL DTRecStatu
R3=[_EndAddr]
R4=[_EndBank]
[_RecOrgAddr]=R3
[_RecOrgBank]=R4
R4+=1
R1=0x200
CALL NandAddrSub
CMP R4, [_NandMaxBank]
JCC NormalRecord_
R3=0xfe00
R4=0x1ff
NormalRecord_:
[_RecEndAddr]=R3
[_RecEndBank]=R4
R3=[_EndAddr]
R4=[_EndBank]
CALL EraseCurrentAddrBlock
R1=0x4000
CALL NandAddrAdd
CMP R4, [_NandMaxBank]
JCS _RecStart
CALL EraseCurrentAddrBlock
R1=0x4000
CALL NandAddrAdd
CMP R4, [_NandMaxBank]
JCS _RecStart
CALL EraseCurrentAddrBlock
R1=0x4000
CALL NandAddrAdd
CMP R4, [_NandMaxBank]
JCS _RecStart
CALL EraseCurrentAddrBlock
_RecStart:
CALL PrintRec
CALL F_SACM_Stop
R1 = DVR1600_DVR
[_DVR_OR_1600] = R1
CALL F_SACM_DVR1600_Initial
R1 = RceMonitorOff
R2 = 0x00
R3 = BIT_RATE_16K
CALL F_SACM_DVR1600_Rec
R3=[_RecOrgAddr]
R4=[_RecOrgBank]
R1=4
CALL NandAddrAdd
[_RecStartAddr]=R3
[_RecStartBank]=R4
R1 = SACM_RECORD
[_SacmStatus] = R1
RETF
_RecPlay:
CALL F_SACM_Stop
CALL RampUpDAC
R1=0
[_A1600Type]=R1
R1 = DVR1600_1600
[_DVR_OR_1600] = R1
CALL F_SACM_DVR1600_Initial
R1 = 0
[_TmpReg] = R1
CALL F_SACM_DVR1600_Volume
R1 = SACM_PLAYBACK
[_SacmStatus] = R1
R1 = -1
R2 = 0x03
R3 = 0x03
CALL F_SACM_DVR1600_Play
RecPlay_Delay:
R1 = [_TmpReg]
CMP R1, [_SoundVolume]
JE RecPlay_Delay_End
CALL F_SACM_DVR1600_Volume
R1=[_TmpReg]
R1+=1
[_TmpReg]=R1
CALL Delay1ms
CALL _ServiceLoop
JMP RecPlay_Delay
RecPlay_Delay_End:
RETF
_ServiceLoop:
R1 = [_SacmStatus]
R1&=0x03
R1 += ServiceLoopBranch
PC = [R1]
ServiceLoopBranch:
.dw ServiceLoopEnd
.dw ServiceLoopPlay
.dw ServiceLoopPlayback //play back record
.dw ServiceLoopRecord
ServiceLoopPlay:
R1 = [_PlayType]
R1&=0x07
R1 += ServiceLoopPlayBranch
PC = [R1]
ServiceLoopPlayBranch:
.dw ServiceLoopA2000
.dw ServiceLoopS480
.dw ServiceLoopS720
.dw ServiceLoopMS01
.dw ServiceLoopA1600
.dw ServiceLoopMS02
.dw ServiceLoopS200
.dw ServiceLoopS530
ServiceLoopA2000:
ServiceLoopMS02:
ServiceLoopS200:
ServiceLoopS480:
ServiceLoopS720:
ServiceLoopEnd:
RETF
ServiceLoopMS01:
.ifdef MOUDLE_MS01
CALL F_SACM_MS01_Status
TEST R1, 0x01
JZ ServiceLoopStop
CALL F_SACM_MS01_ServiceLoop
RETF
.endif
ServiceLoopS530:
.ifdef MOUDLE_S530
CALL F_SACM_S530_Status
TEST R1, 0x01
JZ ServiceLoopStop
CALL F_SACM_S530_ServiceLoop
RETF
.endif
ServiceLoopA1600:
ServiceLoopPlayback:
CALL F_SACM_DVR1600_Status
TEST R1, 0x01
JZ ServiceLoopStop
CALL F_SACM_DVR1600_ServiceLoop
RETF
ServiceLoopStop:
CALL F_SACM_Stop
R1 = [_SysFlagA]
R1 &= WholeSoundBit_
[_SysFlagA] = R1
R1 &= SysErrBit
JE ServiceLoopStop_
CALL UnitOff
ServiceLoopStop_:
RETF
ServiceLoopRecord:
R1=[_RecStartBank]
CMP R1, [_RecEndBank]
JB ServiceLoopRecord_
JA ServiceLoopRecStop
R1=[_RecStartAddr]
CMP R1, [_RecEndAddr]
JAE ServiceLoopRecStop
ServiceLoopRecord_:
CALL F_SACM_DVR1600_ServiceLoop
RETF
ServiceLoopRecStop:
R1 = SACM_IDLE
[_SacmStatus] = R1
CALL F_SACM_DVR1600_Stop
CALL F_USER_DVR1600_EndRecord
R1 = [P_INT_Mask]
R1 &= ~C_FIQ_TMB
[R_InterruptStatus] = R1
[P_INT_Ctrl] = R1
CALL CloseADC
RETF
.ifdef MOUDLE_MS01
F_SP_SACM_MS01_Init_:
R2= C_MS01_Timer_Setting; // TimerB setting
PC=InitSacm
.endif
.ifdef MOUDLE_S530
F_SP_SACM_S530_Init_:
FIR_MOV OFF
CALL GetTimer
PC=InitSacm
.endif
.ifdef MOUDLE_DVR1600
F_SP_SACM_DVR1600_Init_:
FIR_MOV OFF
R1 = 0x0000
[P_TimerB_Ctrl] = R1
R1 = [_DVR_OR_1600]
CMP R1, DVR1600_1600
JZ InitA1600Normal
InitA1600Record:
R1 = C_DVR_Rec_Timer_Setting // $32K
[P_TimerB_Data] = R1
R1=0x0000 // mic input
[P_ADC_MUX_Ctrl] = R1
R1 = 0x154;
[P_DAC_Ctrl] = R1; // enable ADC
R1 = 0x0035;
[P_ADC_Ctrl] = R1; // enable ADC
JMP InitSacmEnd_
InitA1600Normal:
R2=C_A1600_Timer_Setting
R1=[_A1600Type]
JE InitA1600NormalEnd
CALL GetTimer
InitA1600NormalEnd:
JMP InitSacmEnd
.endif
InitSacm:
FIR_MOV OFF;
R1 = 0x0000; // TimerB CKC=Fosc/2 Tout:off
[P_TimerB_Ctrl] = R1;
InitSacmEnd:
[P_TimerB_Data]=R2
R1=0x144
[P_DAC_Ctrl] = R1
InitSacmEnd_:
R1 = 0xffff
[P_INT_Clear] = R1
R1=[P_INT_Mask]
R1|=C_FIQ_TMB
[R_InterruptStatus] = R1
[P_INT_Ctrl] = R1
RETF
_SacmStop:
F_SACM_Stop:
R2 = [_SacmStatus]
R1 = SACM_IDLE
[_SacmStatus] = R1
CMP R2, SACM_PLAY
JZ F_SACM_StopPlay
CMP R2, SACM_PLAYBACK
JZ F_SACM_StopPlayback
CMP R2, SACM_RECORD
JZ F_SACM_StopRecord
JMP F_SACM_StopEnd
F_SACM_StopPlay:
R1 = [_PlayType]
R1&=0x07
R1 += SacmStop_Branch
PC = [R1]
SacmStop_Branch:
.dw F_SACM_StopA20
.dw F_SACM_StopS480
.dw F_SACM_StopS720
.dw F_SACM_StopMS01
.dw F_SACM_StopA1600
.dw F_SACM_StopMS02
.dw F_SACM_StopS200
.dw F_SACM_StopS530
F_SACM_StopMS01:
F_SACM_StopS200:
F_SACM_StopS480:
F_SACM_StopS720:
F_SACM_StopMS02:
F_SACM_StopA20:
JMP F_SACM_StopEnd
F_SACM_StopS530:
.ifdef MOUDLE_S530
CALL F_SACM_S530_Stop
.endif
JMP F_SACM_StopEnd
F_SACM_StopPlayback:
F_SACM_StopA1600:
CALL F_SACM_DVR1600_Stop
JMP F_SACM_StopEnd
F_SACM_StopRecord:
CALL F_SACM_DVR1600_Stop
CALL F_USER_DVR1600_EndRecord
JMP F_SACM_StopEnd
F_SACM_StopEnd:
R1 = [P_INT_Mask]
R1 &= ~C_FIQ_TMB
[R_InterruptStatus] = R1
[P_INT_Ctrl] = R1
CALL CloseADC
RETF
F_USER_DVR1600_EndRecord: //Get file length R1:Low,R2:High
R1=[_RecStartAddr]
R2=[_RecStartBank]
R1-=[_RecOrgAddr]
JCS EndRecord
R2-=1
JCC EndRecordNoRecord
EndRecord:
R2-=[_RecOrgBank]
JCC EndRecordNoRecord
R3 = [_SysFlagA]
TEST R3, KeyCutRecBit
JNE EndRecord2
EndRecord1:
R1-=0x04
JMP EndRecord3
EndRecord2:
R1-=KeyRecCutTime
EndRecord3:
JCS EndRecord_
R2-=1
JCS EndRecord_
EndRecordNoRecord:
R1=0
R2=0
EndRecord_:
[_NandBuf]=R1
[_NandBuf+1]=R2
R3=[_RecOrgAddr]
R4=[_RecOrgBank]
R2=_NandBuf
R5=2
CALL WriteNandWordBuf
R1=[_SysFlagA]
R1&= KeyCutRecBit_
[_SysFlagA] = R1
RETF
//Start Adr:R1; Length:R2
F_USER_DVR1600_WriteData:
R4 = [_RecStartBank]
R3 = [_RecStartAddr]
PUSH R2 TO [SP]
R5 = R2
R2 = R1
CALL WriteNandWordBuf
R4 = [_RecStartBank]
R3 = [_RecStartAddr]
BP=SP
R1=[BP+1]
R1=R1 LSL 1
CALL NandAddrAdd
[_RecStartBank]=R4
[_RecStartAddr]=R3
POP R2 FROM [SP]
RETF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -