//MACRO Sll.find Anchor, CompToken, Node, CompMacro, NullLbl, WReg[1-32], FieldDispl= 0, Remove{boolean}= no //-------------------------------------------------------------------------------------------------- // // @ CopyRight Roberti & Parau Enterprises, Inc. 2021-2023 // // This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/ // or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. // //-------------------------------------------------------------------------------------------------- // // // Get the right load and store MIs // eval(DVASM.getEnv()[4]); var wrd= abiWID + "WRD"; var ld= "L" + abiWID; var st= "S" + abiWID; var wl= abiWLen; var nextField= FieldDispl; var matchLabel= DVASM.getNewLabel(); // // Get working registers list // if (WReg.length < 2 && Remove) return DVASM.putError("Number of work registers is [" + WReg.length + "] - it must be at least 2 when Remove option is used"); if (Remove) { var next= WReg[0]; var prev= WReg[1]; var compareWReg= "[" + WReg.slice(2) + "]"; } else var compareWReg= "[" + WReg + "]"; // // Generate code // \#Label #ld #Node, #Anchor // Load first node in list if (Remove) \ LI #prev, 0 // Set prev node addr to null \ WHILE \ IF ( #Node == 0 ), GOTO, ID= #NullLbl // Done - node not found \ #CompMacro #CompToken, #Node, #matchLabel, #compareWReg // Check if match and process node if so if (Remove) \ MV #prev, #Node // Save node addr for remove processing \ #ld #Node, #nextField[#Node] // Get next node \ ENDWHILE \#matchLabel BYTE 0[0] // // Remove node if requested // if (Remove) { \ #ld #next, #nextField[#Node] // Get next node addr \ IF ( #prev == 0 ), THEN // Check if found node is first \ #st #next, #Anchor // Set header to next node \