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;
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;
Sysop: | Nelgin |
---|---|
Location: | Plano, TX |
Users: | 577 |
Nodes: | 10 (1 / 9) |
Uptime: | 57:06:24 |
Calls: | 9,294 |
Calls today: | 2 |
Files: | 16,016 |
Messages: | 1,046,599 |