Delphi assembler constant 'eof'

后端 未结 1 1344
夕颜
夕颜 2021-02-20 15:01

There seems to be an undocumented constant eof in asm block context. This was tested using Delphi 7.

program TestEof;
{$APPTYPE CONSOLE}
var
  examp         


        
相关标签:
1条回答
  • 2021-02-20 15:58

    Eof is in fact a function defined in the System unit.

    In the implementations of Delphi that I have at hand, Delphi 6 and XE2, Eof is implemented as an intrinsic routine that results in a call to one of the following functions, as appropriate:

    function _EofFile(var f: TFileRec): Boolean;
    function _EofText(var t: TTextRec): Boolean;
    

    I have no idea why your assembler code is turned into mov [...],$0000000e. You point out in a comment that the System unit itself makes use of eof in asm code, for example in TextOpen. The same code in XE2 is now pure Pascal and searches for a value of $1A instead of $0E. This would very much appear to be an implementation detail. If you want to understand why this is so then I think you will need to reverse engineer the code in the System unit, or see if the engineers at Embarcadero will explain the implementation to you.

    0 讨论(0)
提交回复
热议问题