Quote:
Originally Posted by RyDeR`
"getArg" is finally done!
pawn Код:
stock getArg(iArg, iIdx) { #emit LOAD.S.PRI iArg // Load parameter address #emit SHL.C.PRI 2 // Convert that value from cells to bytes #emit ADD.C 12 // Add 12 to skip the function header #emit LOAD.S.ALT 0 // Get previous function's frame #emit ADD // Add to pri #emit LOAD.I // Load address #emit LOAD.S.ALT iIdx // Load parameter address #emit SHL.C.ALT 2 // Convert that value from cells to bytes #emit ADD // Add to pri #emit LOAD.I // Load address #emit RETN // Return value return 0; // Random return to ignore compiler warning }
I want to thank ****** for all his help and making things easier to understand.
Here's also a "setArg" function based of "getArg":
pawn Код:
stock setArg(iArg, iIdx, iValue) { new iAddr ; #emit LOAD.S.PRI iArg // Load parameter address #emit SHL.C.PRI 2 // Convert that value from cells to bytes #emit ADD.C 12 // Add 12 to skip the function header #emit LOAD.S.ALT 0 // Get previous function's frame #emit ADD // Add to pri #emit LOAD.I // Load address #emit LOAD.S.ALT iIdx // Load parameter address #emit SHL.C.ALT 2 // Convert that value from cells to bytes #emit ADD // Add to pri #emit STOR.S.PRI iAddr // Store pri to iAddr #emit LOAD.S.ALT iValue // Load parameter address #emit SREF.S.ALT iAddr // Store value to reference parameters return 1; }
|
I don't understand. Why can't we just use getarg and setarg, Nor how is this an usefull function.