Subj : TP 7.0 pointer passing convension
To : Anton Shepelev
From : Anton Shepelev
Date : Sun Feb 16 2020 10:12 pm
I wrote:
> Here is a fixed version, without redundant opera-
> tions and with single-byte write:
>
> procedure AtoB(a: byte; var b: byte);
> begin asm
> MOV ES, [BP+2] { store segment of b in ES }
> MOV DI, [BP+4] { store offset of b in DI }
> MOV AX, [BP+8] { store a in AX }
> MOV [DI], AL { assign AX to a }
> end end;
Problem solved. Here is the correct code in TP as-
sembly:
procedure AtoBRef(a: byte; var b: byte);
begin asm
MOV DI, [BP+4] { store offset of b in DI }
MOV ES, [BP+6] { store segment of b in ES }
MOV AX, [BP+8] { store a in AX }
MOV [ES:DI], AL { assign AX to a }
end end;
It works as advertised.
---
* Origin: nntps://fidonews.mine.nu - Lake Ylo - Finland (2:221/360.0)