//MACRO ElseIf Condition, PreCode[]= [], WReg= !"", Far{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 nest stack and check parameters // var nestStack= DVASM.getJSGlobal("__arch_condNestBlockStack"); if (nestStack == null) nestStack= []; // // Check if inner nesting is IF, ANDIF, ELSEIF, ELSE // var n= nestStack.length-1; if (n < 0) DVASM.putError("No nest block is current to match [ELSE]"); if (! ["IF", "ANDIF", "ELSEIF"].includes(nestStack[n][0])) return DVASM.putError("Inner nest block is [" + nestStack[n][0] + "] and cannot be ended by [ELSE]"); // // ELSEIF continuation of IF // DVASM.formatLine("", "INDENTOUT", "", ""); if (Label !== "") DVASM.formatLine(Label, "BYTE", "0[0]", ""); var endBlockLabel= DVASM.getNewLabel(); DVASM.formatLine("", "JAL", nestStack[n][3], ""); DVASM.formatLine(nestStack[n][2], "BYTE", "0[0]", ""); for (var i= 0; i < PreCode.length; i++) DVASM.formatLine("", PreCode[i].trim(), "", ""); DVASM.formatLine("", "__CondGen", Condition + ", true, " + DVASM.getNewLabel() + ", " + endBlockLabel + ", WReg= " + WReg + ", " + Far, ""); DVASM.formatLine("", "INDENTIN", "", ""); nestStack[n][1]= nestStack[n][2]; nestStack[n][2]= endBlockLabel; nestStack[n][0]= "ELSEIF"; DVASM.putJSGlobal("__arch_condNestBlockStack", nestStack);