Just a sample of the Echomail archive
[ << oldest | < older | list | newer > | newest >> ]
|  Message 324  |
|  Anton Shepelev to All  |
|  TP 7.0 pointer passing convension  |
|  15 Feb 20 20:33:48  |
 
MSGID: 2:221/360.0 5e483984
PID: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
CHRS: IBMPC 2
TZUTC: 0200
Hello, all
The Language Guide for Turbo Pascal 7.0 says:
Variable parameters (var parameters) are always
passed by reference--a pointer that points to the
actual storage location.
[...]
A pointer-type parameter is passed as two words
(a double word). The segment part is pushed
before the offset part so that the offset part
ends up at the lowest address.
I have written the following proceudre that adds its
first argument to the second:
procedure AtoB(a: byte; var b: byte);
begin asm
PUSH AX { store AX }
MOV DI, [BP+4] { store offset of b in DI }
MOV ES, [BP+2] { store segment of b in ES }
MOV AX, [BP+8] { store a in AX }
MOV [DI], AX { assign AX to a }
POP AX { restore AX }
end end;
Does not it show that the TP documentation is in er-
ror, and pointers are put on stack backwards?
---
* Origin: nntps://fidonews.mine.nu - Lake Ylo - Finland (2:221/360.0)
SEEN-BY: 1/123 90/1 103/705 154/10 203/0 221/1 6 242 360 226/16 227/114
SEEN-BY: 229/426 452 616 1014 240/5832 249/206 317 400 280/464 5003
SEEN-BY: 317/3 322/757 342/200 396/45 423/81 120 633/280
PATH: 221/1 280/464 229/426
|
[ << oldest | < older | list | newer > | newest >> ]