Recent

Author Topic: [SOLVED]Built-in assembler  (Read 995 times)

avk

  • Hero Member
  • *****
  • Posts: 752
[SOLVED]Built-in assembler
« on: November 07, 2019, 08:04:21 am »
It looks like a bug, attempt to compile this code:
Code: Pascal  [Select][+][-]
  1. {$asmmode intel}
  2. procedure doasm;
  3. begin
  4.   asm
  5.     test rax, $8000000000000000
  6.   end;
  7. end;
  8.  
reports an error:
Code: Text  [Select][+][-]
  1. ... Error: Asm: signed dword value exceeds bounds -9223372036854775808
  2.  
« Last Edit: November 07, 2019, 09:08:01 am by avk »

zamronypj

  • Full Member
  • ***
  • Posts: 133
    • Fano Framework, Free Pascal web application framework
Re: Built-in assembler
« Reply #1 on: November 07, 2019, 08:33:39 am »
According to TEST instruction documentation

https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf

TEST RAX, imm32

So it accepts immediate value 32 bit operand. To test with 64 bit immediate value, CMIIW, I think you need to copy 64bit immediate value to 64bit register first


Code: ASM  [Select][+][-]
  1. mov rcx, $8000000000000000
  2. test rax, rcx
« Last Edit: November 07, 2019, 08:37:30 am by zamronypj »
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Apache module executes Pascal program like scripting language https://zamronypj.github.io/mod_pascal/
Github https://github.com/zamronypj

avk

  • Hero Member
  • *****
  • Posts: 752
Re: Built-in assembler
« Reply #2 on: November 07, 2019, 08:49:27 am »
Thank you very much.

 

TinyPortal © 2005-2018