⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asm

📁 完整的方案
💻 ASM
📖 第 1 页 / 共 3 页
字号:
FileSerious:  .EQU   _Tmp1
FileSeriousL: .EQU   _Tmp2
FileSeriousH: .EQU   _Tmp3
FileFlag:     .EQU   _Tmp4
IndexTmp:     .EQU   _Tmp5

Condition2:   .EQU   _Tmp6
Condition3:   .EQU   _Tmp7
Condition0:   .EQU   FileSeriousL
Condition1:   .EQU   FileSeriousH

GetPlayIndex:
         R1=0
         [_FileOk]=R1
GetPlayIndexIn:        
         R4=[_PlayBank]
         R3=[_PlayAddr]
         R1=[_FileIndex]
         R2=R1 LSL 1
         R1+=R2
         CALL NandAddrAdd
         [_NandAddrL]=R3
         [_NandAddrH]=R4
         R5=R3|0xfe00
         CALL SetSearchingAddr
         R3=[_FileIndex]
         CMP R3,[_FileNumber]
         JB GetPlayIndex2
         PC=GetPlayIndexFinish
FSNo:
SoundNoStruct:
GetPlayIndex0:
         R3=[_FileIndex]
         CMP R3,[_FileNumber]
         JB GetPlayIndex1
         PC=GetPlayIndexFinish
GetPlayIndex1:
         R5+=1
         JCC GetPlayIndex2
         CALL ChgSearchingAddr
GetPlayIndex2:
         RBYTE_
         [FileFlag]=R1
         R5+=1
         JCC GetPlayIndex3
         CALL ChgSearchingAddr
GetPlayIndex3:
         RBYTE_
         [FileSeriousL]=R1
         R5+=1
         JCC GetPlayIndex4
         CALL ChgSearchingAddr
GetPlayIndex4:
         RBYTE_
         [FileSeriousH]=R1
         R1=R1 LSL 4
         R1=R1 LSL 4
         R1|=[FileSeriousL]
         [FileSerious]=R1
         R1=[FileFlag]
         TEST R1, Bit7
         JE GetPlayIndexNormal
GetPlayIndexSpecial:
         R1=[_FileIndex]
         R1+=1
         [_FileIndex]=R1
         R1=[FileFlag]
         R1&=0x7f
         R1+=SpecialFunctionEntTab
         PC=[R1]

GetPlayIndexNormal:
         R1=[_FileOk]
         CMP R1,0
         JNE GetPlayIndexOk
         R1=[_FileIndex]
         R1+=1
         [_FileIndex]=R1
         CALL BlockAttrib
         R1=[FileFlag]
         TEST R1, Bit6
         JNE GetPlayIndexNormal2
         R1=[FileFlag]
         TEST R1,0x0f
         JE GetPlayIndexNormal2
         R2=R1&0x0f
         CMP R2,[_PlayMode]
         JE GetPlayIndexNormal2
         PC=GetPlayIndex0
GetPlayIndexNormal2:
         [_FlagBak]=R1
         R1 = R1 LSR 4
         [_SoundMode]=R1
         R1=[FileSerious]
         [_Index]=R1
         R1=1
         [_FileOk]=R1
         R1=[_FileOk]
         CMP R1,0
         PC=GetPlayIndex0
GetPlayIndexFinish:
         R1=0
         [_InPlayBlock]=R1
         R1=[_FileOk]
         CMP R1,0
         JNE GetPlayIndexOk_
         R1=[_SysFlagA]
         R1&=ReadyPlayBit_
         [_SysFlagA]=R1
         DATAOUT
         R1=0
         RETF

GetPlayIndexOk:
         DATAOUT
         R1=[_Index]
         R2=[_SoundMode]
         TEST R2, Bit2
         JE GetPlayIndexOk_
GetPlayIndexJMP:
         [FileSerious]=R1
         R1=0
         [_FileOk]=R1
         R1=[_FlagBak]
         TEST R1, Bit4
         JNE GetPlayIndexJMPBankOut
GetPlayIndexJMPBankIn:
         R1=[_PlayBank]
         PC=FSLink2Addr_
GetPlayIndexJMPBankOut:
         R1&=0x0f
         [_PlayBank]=R1
         PC=FSLink2Addr_

GetPlayIndexOk_:
         R1=[_PrevDelayTime]
         JNE GetPlayIndexIndirectSound
         R1=[_SoundMode]
         JNE GetPlayIndexIndirectSound
GetPlayIndexDirectSound:
         R1=[_SysFlagA]
         R1&=ReadyPlayBit_
         [_SysFlagA]=R1
         R1=1
         RETF
GetPlayIndexIndirectSound:
         R1=[_SysFlagA]
         R1|=ReadyPlayBit
         [_SysFlagA]=R1
         R1=0
         RETF



/////////////// 0x80 ////////////////////
FSUnitOff:
         R1=[_FileOk]
         CMP R1,0
         JE FSTurnOffUnit
         R1=[_FileIndex]
         R1-=1
         [_FileIndex]=R1
         PC=GetPlayIndexOk
FSTurnOffUnit:         
         PC=UnitOff
/////////////// 0x81 ////////////////////
FSStop:
FSVolumeSet:
FSVolumeInc:
FSVolumeDec:
FSBookChg:
FSPageChg:
FSModeChg:
FSSetScore:
FSBeginScore:
FSScoreCondition:
FSScoreValueEnd2:
FSScoreValue:
FSScoreBlockEngine:
         PC=GetPlayIndex0

/////////////// 0x85 ////////////////////
FSPrevDelay:
         R1=[_FileOk]
         CMP R1,0
         JE FSPrevDelayEnd
         R1=[FileSeriousL]
         [_PrevDelayTime]=R1
FSPrevDelayEnd:
         PC=GetPlayIndex0

/////////////// 0x86 ////////////////////
FSPrevCondition:
         R1=[FileSeriousL]
         CMP R1,[_PrevCondition]
         JNA FSPrevConditionEn
         R1=0
         [_FileOk]=R1
FSPrevConditionEn:
         PC=GetPlayIndex0

/////////////// 0x8a ////////////////////
FSSeriousPlay:
         R1=[FileSeriousL]
         R1&=0x7f
         R2=[_SeriousCount]
         CALL GetMod
         R1+=1
         CMP R1, [FileSeriousH]
         JE FSSeriousPlayEn
         R1=0
         [_FileOk]=R1
FSSeriousPlayEn:
         PC=GetPlayIndex0

/////////////// 0x98 ////////////////////
FSRandomSelection:
         R1=[FileSeriousL]
         CALL GetRandomData
         R1+=[FileSeriousH]
         [FileSeriousL]=R1
         R1=0
         [FileSeriousH]=R1

/////////////// 0x8b ////////////////////
FSSelectionQuestion:                   // Selection Question
         R1=[_SeriousFlag]
         R2=[_BlockFlag]
         TEST R1,SeriousSelectionBit
         JE FSSelectionQuestion_
         TEST R2,AnswerIrrelevantBit
         JNE FSSelectionQuestionEnd
         TEST R2,AnswerRelevantBit
         JNE FSSelectionQuestionEnd
FSSelectionQuestion_:
         R1|=SeriousSelectionBit
         [_SeriousFlag]=R1
         R1=[FileSeriousL]
         [_SelectionSerious]=R1
         R1=[FileSeriousH]
         [_SelectionNumber]=R1
         R1=0
         [_SelectionBitAnswer]=R1
         [_ErrRetTime]=R1
         R2|=HaveSelectionQuestionBit
         R2&=SelectionMaskBit_
         [_BlockFlag]=R2
FSSelectionQuestionEnd:
         PC=GetPlayIndex0              // no question

/////////////// 0x8c ////////////////////
FSSelectionCorrectAnswer:
         R1=[_SeriousFlag]
         TEST R1,SeriousSelectionBit
         JE FSSelectionCorrectAnswerEnd      // no question
         R2=[_BlockFlag]
         TEST R2,AnswerRelevantBit
         JNE FSSelectionCorrectAnswerEnd     // had judje
         R1=[FileSeriousL]
         CMP R1, 0
         JE FSSelectionCorrectAnswer2
         CMP R1, [_SelectionSerious]
         JE FSSelectionCorrectAnswer2
         PC=FSSelectionIrrelevant            // Irrelevant
FSSelectionCorrectAnswer2:
         R2=[_BlockFlag]
         TEST R2,AnswerIrrelevantBit
         JE FSSelectionCorrectAnswer3
         R3=[_ErrRetTime]
         JE FSSelectionCorrectAnswer3
         R3-=1
         [_ErrRetTime]=R3
FSSelectionCorrectAnswer3:
         R2&=AnswerIrrelevantBit_
         R2|=AnswerRelevantBit
         R2|=AnswerCorrectBit
         [_BlockFlag]=R2
         R1=[FileSeriousH]
         JE FSSelectionCorrectAnswerOk
         R1+=DataBitTab_1
         R2=[R1]
         R1=[_SelectionBitAnswer]
         R2|=R1
         [_SelectionBitAnswer]=R2
         CALL GetBitNum
         CMP R1,[_SelectionNumber]
         JB FSSelectionCorrectAnswerEnd
FSSelectionCorrectAnswerOk:
         R2=[_BlockFlag]
         R2|=AnswerSuccessfulBit
         [_BlockFlag]=R2
FSSelectionCorrectAnswerEnd:
         PC=GetPlayIndex0

/////////////// 0x8d ////////////////////
FSSelectionErrorAnswer:
         R1=[_SeriousFlag]
         TEST R1,SeriousSelectionBit
         JE FSSelectionErrorAnswerEnd        // no question
         R2=[_BlockFlag]
         TEST R2,AnswerRelevantBit
         JNE FSSelectionErrorAnswerEnd       // had judje
         R1=[FileSeriousL]
         JE FSSelectionErrorAnswer2
         CMP R1, [_SelectionSerious]
         JE FSSelectionErrorAnswer2
         PC=FSSelectionIrrelevant
FSSelectionErrorAnswer2:
         R2=[_BlockFlag]
         TEST R2,AnswerIrrelevantBit
         JE FSSelectionErrorAnswer3
         R2&=AnswerIrrelevantBit_
         R2|=AnswerRelevantBit
         [_BlockFlag]=R2
         JMP FSSelectionErrorAnswerEnd
FSSelectionErrorAnswer3:
         R2|=AnswerRelevantBit
         [_BlockFlag]=R2
         R1=[_ErrRetTime]
         R1+=1
         [_ErrRetTime]=R1
FSSelectionErrorAnswerEnd:
         PC=GetPlayIndex0

/////////////// 0x8e ////////////////////
FSSelectionAnswer:
         R1=[_SeriousFlag]
         TEST R1,SeriousSelectionBit
         JE FSSelectionAnswerEnd       // no question
         R2=[_BlockFlag]
         TEST R2,AnswerRelevantBit
         JNE FSSelectionAnswerEnd      // had judge
         R1=[_SelectionSerious]
         CMP R1,17
         JNB FSSelectionIrrelevant     // question>16
         R3=R2
         R1=[FileSerious]
         R2=R1
         R3=[_SelectionSerious]
         R3+=DataBitTab_1
         R1=[R3]
         R1&=R2
         JNE FSSelectionAnswerCorrect
FSSelectionAnswerError:
         PC=FSSelectionErrorAnswer2
FSSelectionAnswerCorrect:
         R1=0
         [FileSeriousH]=R1
         PC=FSSelectionCorrectAnswer2

FSSelectionIrrelevant:
         R2=[_BlockFlag]
         TEST R2,AnswerIrrelevantBit
         JNE FSSelectionIrrelevantEnd
         TEST R2,AnswerRelevantBit
         JNE FSSelectionIrrelevantEnd
         R1=[_ErrRetTime]
         R1+=1
         [_ErrRetTime]=R1
         R2|=AnswerIrrelevantBit
         [_BlockFlag]=R2
FSSelectionAnswerEnd:
FSSelectionIrrelevantEnd:
         PC=GetPlayIndex0

/////////////// 0x8f ////////////////////
FSSelectionErrorRet:
         R1=[_SeriousFlag]
         TEST R1,SeriousSelectionBit
         JE FSSelectionErrorRetEnd
         R1=[_BlockFlag]
         TEST R1,AnswerRelevantBit
         JE FSSelectionErrorRet_
         TEST R1,AnswerCorrectBit
         JNE FSSelectionErrorRetEnd
FSSelectionErrorRet_:
         R1|=AnswerErrRetBit
         [_BlockFlag]=R1
FSSelectionErrorRetEnd:
         PC=GetPlayIndex0

/////////////// 0x90 ////////////////////
FSBeginLink:
         R1=[_SeriousFlag]
         R1|=SeriousInLinkBit
         [_SeriousFlag]=R1
         R1=[_BlockFlag]
         R1|=BlockInLinkBit
         R1&=BlockErrLinkBit_
         R1&=BlockEndLinkBit_
         [_BlockFlag]=R1
         R1=0
         [_NearLinkBlock1]=R1
         [_NearLinkBlock2]=R1
         [_NearLinkBlock3]=R1
         PC=GetPlayIndex0

/////////////// 0x91 ////////////////////
FSTerminateLink:
         R1=[_SeriousFlag]
         TEST R1,SeriousInLinkBit
         JNE FSTerminateLink_
         PC=GetPlayIndex0
FSTerminateLink_:
         R1=[FileSeriousH]
         JE FSTerminateLinkEnd
         CALL BlockLinkTest
         CMP R1, 0
         JNE FSTerminateLinkEnd
         R1=[_BlockFlag]
         R1|=BlockInLinkBit
         [_BlockFlag]=R1
         PC=FSInLinkErr
FSTerminateLinkEnd:
         R1=[_BlockFlag]
         R1|=BlockInLinkBit
         R1|=BlockEndLinkBit
         [_BlockFlag]=R1
         JMP FSInLink__

/////////////// 0x92 ////////////////////
FSInLink:
         R1=[_SeriousFlag]
         TEST R1,SeriousInLinkBit
         JNE FSInLink_
         PC=GetPlayIndex0
FSInLink_:
         R1=[_BlockFlag]
         R1|=BlockInLinkBit
         TEST R1,BlockEndLinkBit
         JNE FSInLink__
         R1&=BlockEndLinkBit_
FSInLink__:
         [_BlockFlag]=R1
         CALL BlockLinkTest
         CMP R1, 0
         JNE FSInLinkOk
FSInLinkErr:
         R1=[_BlockFlag]
         R1|=BlockErrLinkBit
         [_BlockFlag]=R1
         R2=[_PageModeAttrib]
         TEST R2,PMLinkErrRetBit
         JNE FSInLinkErrNoRet
FSInLinkErrRet:
         R1|=BlockEndLinkBit
         [_BlockFlag]=R1
         R1=0
         [_NearLinkBlock1]=R1
         [_NearLinkBlock2]=R1
         [_NearLinkBlock3]=R1
FSInLinkErrNoRet:
         PC=GetPlayIndex0

FSInLinkOk:
         [_CurrentLinkBlock]=R1
         R1=[_BlockFlag]
         R1&=BlockErrLinkBit_
         [_BlockFlag]=R1
         R1=0
         [_NearLinkBlock1]=R1
         [_NearLinkBlock2]=R1
         [_NearLinkBlock3]=R1
         PC=GetPlayIndex0

/////////////// 0x93 ////////////////////
FSNearLink:
         R1=[_SeriousFlag]
         TEST R1,SeriousInLinkBit
         JE FSNearLinkEnd
         R1=[_BlockFlag]
         TEST R1,BlockInLinkBit
         JE FSNearLinkEnd
         TEST R1,BlockEndLinkBit
         JNE FSNearLinkEnd
         TEST R1, BlockErrLinkBit
         JNE FSNearLinkEnd

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -