//MACRO EndStack SaveReg[]= [], SaveFReg[]= [], //-------------------------------------------------------------------------------------------------- // // @ 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 stack label // var stackLabel= DVASM.dropJSGlobal("__arch_currStackLabel"); if (stackLabel == null) return DVASM.putError("Preceding STACK macro is missing"); var lbl= stackLabel + "."; // // Get the right word length // eval(DVASM.getEnv()[4]); var wrd= abiWID + "WRD"; var fwrd= (abiNoFRegs == 0 ? null : abiFWID + "WRD"); var wl= abiWLen; // // Register save area // for (var i= 0; i < SaveReg.length; i++) DVASM.formatLine(stackLabel + "." + SaveReg[i], wrd, "0", ""); // // Float register save area // if (SaveFReg.length > 0 && fwrd == null) return DVASM.putError("Save list for floating registers specified but ABI does not suppowrd floating registers"); for (var i= 0; i < SaveFReg.length; i++) DVASM.formatLine(stackLabel + "." + SaveFReg[i], fwrd, "0", ""); // // Save area for float callee saved registers // if (abiNoFRegs > 0) { for (var i= 11; i >= 0; i--) DVASM.formatLine(lbl + "fs" + i, "FREGSAVE", "fs" + i, ""); } // // Save area for callee saved registers // for (var i= (abiNoRegs <= 16 ? 1 : 11); i >= 0; i--) DVASM.formatLine(lbl + "s" +i, "REGSAVE", "s" + i, ""); // // Area to save sp and ra registers // DVASM.formatLine("", "WRD_" + (wl*2), "0[0]", "// Force abi stack alignment"); DVASM.formatLine(lbl + "sp", wrd, "0", ""); DVASM.formatLine(lbl + "ra", wrd, "0", ""); // // Mark end of stack and compute length // var endLabel= DVASM.getNewLabel(); DVASM.formatLine(endLabel, "WRD_" + (wl*2), "0[0]", ""); DVASM.formatLine(stackLabel + ".StackLen", "EQU", endLabel + "-" + stackLabel,"");