Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi What's incorrect here (https://www.delphipraxis.net/136113-whats-incorrect-here.html)

mohfa 23. Jun 2009 19:38


What's incorrect here
 
Hi , Could someone correct me this Code :
I get the Compiler Error : Operand Size Mismatch in : LDS SI,Path

Delphi-Quellcode:
var
LFNError: word;

function ASCIZToString (ASCIZ: array of Char): String;
begin
ASCIZToString := StrPas (@ASCIZ);
end;
/////
function FindFirst (Path: String; Attr: word; var F: FindData): word;assembler;
asm
  mov    LFNError, 0
  push   ds
  LDS    SI,Path // ----> Operand Size Mismatch
  mov    dx, si
  inc    dx
  mov    cl, [si]

@@StringToPChar:
  inc    si
  dec    cl
  jnz    @@StringToPChar

  inc    si
  mov    byte ptr [si], 0

  les    di, F // ----> Operand Size Mismatch

  mov    cx, Attr
  mov    ax, 714Eh
  mov    si, 1

  int    21h                  
  pop    ds
  jnc    @@NoCarry

  mov    LFNError, ax
  jmp    @@Exit

@@NoCarry:
cmp    ax, 7100h
  jne    @@Exit

  mov    LFNError, ax

@@Exit:
end;

procedure FindNext (var F: FindData; FileFindHandle: word); assembler;
asm
  mov    LFNError, 0
  mov    ax, 714Fh
  mov    si, 1
  mov    bx, FileFindHandle
  les    di, F// ----> Operand Size Mismatch

  int    21h

  jnc    @@NoCarry

  mov    LFNError, ax
  jmp    @@Exit

@@NoCarry:
cmp    ax, 7100h
  jne    @@Exit

  mov    LFNError, ax

@@Exit:
end;

procedure FindClose (FileFindHandle: word); assembler;
asm
  mov    LFNError, 0

  mov    ax, 71A1h
  mov    bx, FileFindHandle

  int    21h

  jnc    @@NoCarry

  mov    LFNError, ax
  jmp    @@Exit

@@NoCarry:
cmp    ax, 7100h
  jne    @@Exit

  mov    LFNError, ax

@@Exit:
end;
and just wondering is this fast than using the Delphi TSearchRec ....

many thanks

Apollonius 23. Jun 2009 19:46

Re: What's incorrect here
 
Very funny indeed. This code is probably designed for DOS as it directly uses interrupts and assumes a 16-bit processor (there have been 64-bit processors out there for quite a while now).

himitsu 23. Jun 2009 19:48

Re: What's incorrect here
 
Delphi 7 creates 32-bit-Code and this ASM-Codes are 16 bit.


And INT 21 is under WinNT also not easily possible.

mohfa 23. Jun 2009 19:58

Re: What's incorrect here
 
So ,Should i forget to use it with Delphi7 ??
and no possiblity to correct it ?

Apollonius 23. Jun 2009 20:02

Re: What's incorrect here
 
Forget it. This code won't lead to anything on Windows with Delphi.

mohfa 23. Jun 2009 20:08

Re: What's incorrect here
 
Zitat:

Zitat von Apollonius
Forget it. This code won't lead to anything on Windows with Delphi.

MANY THANKS Apollonius and for all of you

[Closed]


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:57 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz