28.06.2013 Views

ISO Pascal reference manual

ISO Pascal reference manual

ISO Pascal reference manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6<br />

END;<br />

6.2.3 Parameters<br />

I a 32-bit real number I<br />

*MOVLF_r,res; IMOVe Long (64-bit) to Floating (32-bit)]<br />

Real320fReal := res<br />

Parameters to a <strong>Pascal</strong> procedure are evaluated left-to-right, but are pushed<br />

on the stack (using the 32000 TOS mechanism) in the order defined by the<br />

Calling Standard, i.e. right-to-left. The following details govern the<br />

individual parameter mechanisms:<br />

VAR parameters<br />

For all parameter types except conformant arrays, the address of the object<br />

concerned is pushed as a 32-bit unsigned pointer; for (non- conformant)<br />

arrays this is the address of the first element of the array.<br />

A conformant array is passed as a VAR parameter by means of a number of<br />

32-bit items, pushed on the stack in the following order:<br />

1. The address of element [0] (or [0,0] etc) of the actual array parameter.<br />

This is defined even if there is no such element in the array; for<br />

instance the address of the 0 element of an array specified as 'ARRAY<br />

[2..5] OF Char' is 2 bytes less than the address of the first actual<br />

element. Where the bounds are of an enumerated type, the ordinal<br />

value of the lower bound is used for this calculation.<br />

2. For each dimension of the array, working from the right-most index to<br />

the left-most, 3 items are pushed:<br />

a. the ordinal value of the lower bound of this dimension of the actual<br />

array parameter;<br />

b. the ordinal value of the upper bound;<br />

c. the size in bytes of this dimension of the array: this is determined<br />

by considering the array in the form:<br />

36 <strong>Pascal</strong> Issue 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!