Forum > General

Free Pascal and Intel Core 64-bit assembly language

(1/5) > >>

Rick314:
What do I need to do to use Intel Core 64-bit assembly language statements within a Free Pascal program? I read about assembly language in the Programmers Guide, but it only mentions 80x86.  So my answer may be "it can't be done" but I'd like to get that from someone that is sure there is no way to do it.

Specifically, I am running Free Pascal Compiler 2.6.4 (fpc-2.6.4.i386-win32.exe) under Windows 7 on my Dell XPS 8300 PC with Intel Core i7-2600 CPU.  The attached program compiles at the Command Prompt using "fpc -dASSY -Rintel div_test4.txt" and runs as expected.  The 80386 assembly language "div" instruction inside it does "uint64/uint32 = uint32 quotient and uint32 remainder" (Notation: "uint64" means unsigned integer, 64-bit.)  I want to extend the program to do "uint128/uint64 = uint64 quotient and uint64 remainder" using the DIV instruction described on PDF page 304 of the Intel Instruction Set Reference. That instruction does "Unsigned divide RDX:RAX by r/m64, with result stored in RAX (Quotient) and RDX (Remainder)".  Do I have to install fpc-2.6.4.x86_64-win64.exe (that I found under the "Win32" download directory)? How do I get the CPU into 64-bit mode? What other problems am I likely to run into?

Cyrax:
First, your OS must be 64-bit. Second, you will need full blown FPC 2.6.4 for 64-bit. If I remember correctly, that fpc-2.6.4.x86_64-win64.exe package contains only crosscompiler for Win64-bit target.

Rick314:

--- Quote from: Cyrax on March 14, 2015, 10:52:46 pm ---First, your OS must be 64-bit. Second, you will need full blown FPC 2.6.4 for 64-bit. If I remember correctly, that fpc-2.6.4.x86_64-win64.exe package contains only crosscompiler for Win64-bit target.

--- End quote ---

Thank you for your reply.  My OS is 64-bit (Windows 7 Control Panel, System, System Type = "64-bit Operating System"). What is "full blown FPC 2.6.4 for 64-bit" and what do I need to do to install it? What does it have that is more than "only crosscompiler for Win64-bit target" that I need? Most important, if I follow your instructions, are you sure that then I will then be able to do what I need?

Cyrax:
Like I said, full blown FPC 64-bit environment only includes 64-bit executables, namely the compiler, the text mode IDE, the GNU GDB debugger for Win64, all RTL and package units compiled for 64-bit environment  and few utilities (some are 32-bit, thought).

You need to check yourself if that cross-compiler package suits for you. I myself build my own FPC environments, currently 2.6.4 (release) , 2.6.5 (fixes) and 3.1.1 (development version from SVN trunk).

Rick314:
Thanks Cyrax -- I understand what you mean now. Can anyone else answer the questions posed in the original post? I hope to get a definitive "it isn't possible" or "it is possible and here's what you need to do".

Navigation

[0] Message Index

[#] Next page

Go to full version