Board index » delphi » HELP!! TP 6.0/7.0 and Assembly

HELP!! TP 6.0/7.0 and Assembly

Quote
da...@portal.ca (David Gipson) wrote:
>I was just wondering... I have knowledge of Turbo Pascal and Asemble and I
>know how to write assemble code in TP but I am not sure as to how to pass
>variables from TP into a register and vice versa....  Please help-I'm
>desperate.  Please give details if time permits you.

It depends on the type of variable and where it's stored.  Local
variables are easy; you can often just use MOV, and TP will work out
the right BP-relative addressing.  Take a look in the Built-In
Assembler chapter of the Language Guide (Chap 24 in BP 7) for details,
or post a specific example.

The thing to remember is that in BASM, variable names generally stand
for 16 bit addresses.  If you're dealing with something where near
addressing won't work, you need to handle the segment loads yourself,
and be sure to restore DS if you change it.

For example, the code below loads all the args/variables into AX or
AL:

  procedure MyProc(w:word; var ref:word);
  var
    i : integer;
    b : byte;
  begin
     asm
        mov ax,w
        les di,ref
        es: mov ax, [di]
        mov ax,i
        mov al,b
     end;
  end;

As you see, it's all pretty easy.

Duncan Murdoch
Duncan Murdoch

 

Re:HELP!! TP 6.0/7.0 and Assembly


I was just wondering... I have knowledge of Turbo Pascal and Asemble and I
know how to write assemble code in TP but I am not sure as to how to pass
variables from TP into a register and vice versa....  Please help-I'm
desperate.  Please give details if time permits you.
                                Dave

Other Threads