[fpc-pascal]Minimum size of parameters
Aitor Santamaria Merino
aitor.sm at wanadoo.es
Thu Dec 6 16:47:14 CET 2001
I explain the problem, then my solution, then my questions:
(Platform: GO32V2, although I think it could be independent)
Problem: if I have a record like this:
then I would like to make a Call procedure to interpretate this all. The
parameters of the procedures and the record containing args specify both
in the same order.
My solution (briefly):
(a) typecast the RecordContainingArgs to an ARRAY OF WORD (using
pointers, etc.)(why? because it seems that I can only PUSH words!)
(b) push that array REVERSING the order
(c) ASM_CALL the procedure
I noted that I typecasted to words because inline ASM did only allow me
to push WORDs.
I have also discovered the following "funny" behaviour of calls when I
have to use BYTES:
Par1, Par2: word;
Par1 := 1;
Par2 := 2;
Where P is a PROCEDURE (a,b: BYTE);
ATTENTION: I push WORDS and P "pops" BYTES!
For which kind of basic bytes should I expect such behaviour?
How are STRINGS popped? will this trick of reversing parameter data work?
If the answer to the previous was NO, then do you have another idea to
solve my initial problem, execute this:
More information about the fpc-pascal