02.10.2011, 23:02
"getArg" is finally done!
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 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
}
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;
}