The CPU provides many registers, but in the Delphi Process and function, only the eax ECx edX three registers can be used freely;
If other registers are changed, the process and function should be restored before the end.
Remember that the
Return type
Storage location
Char, byte
Al register
Smallint, word
Ax register
Integer, longword, ansistring, pointer, Class
Eax register
Real48
The eax register is a pointer to the
// Delphi function delphifun (X: integer): integer; begin result: = x * 2; end; // assembler function, function asmfun (X: integer): integer; ASM add eax, eax {eax can obtain the first parameter and return the value of the function, so it can be so
// Prepare the function delphifun (X, Y: integer): integer; begin result: = x + y; end; // compile the function asmfun: integer; ASM mov eax, 1 {eax corresponds to the first parameter of the function. Here we assign the first parameter 1} mov edX, 2
// The functions of the following three functions are the same, but the efficiency is different {fun1 needs to read constant 0, slowest} function fun1: integer; ASM mov eax, 0end; {fun2 and fun3 are only the registers that operate the CPU, which are
Category
Name
Function
Function
Dispatchcommand
Call the click method of a menu item
Dispatchpopup
Simulate the pop-up menu
Finditem
Find menu items
Gethelpcontext
Get
// Declaration: getdiskfreespace (lprootpathname: pchar; {disk root path} var l1_ctorspercluster: DWORD; {number of sectors in a cluster} var lpbytespersector: DWORD; {number of bytes in a sector} var lpnumberoffreeclusters: DWORD; {number of
// Declaration: getcharwidth (DC: HDC; {Device environment handle} firstchar, lastchar: uint; {The first and last character values in the range} const widths {an integer array that accepts the width of each character}): bool; getcharwidth32 (DC: HDC;
// Declaration: polyline (DC: HDC; {Device environment handle} var points; {point array} count: INTEGER {Number of array elements}): bool; {polyline and polygon have the same parameters, but polygon can be automatically closed}
// Draw a
In this example, run:
// Example Code : Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, classes, extctrls, grids; Type tform1 = Class (tform) stringgrid1: tstringgrid; panel1:
Besides byte, word, Cardinal, and integer, the integer types of Delphi include:
Longint, longword, shortint, smallint, int64
Among them, longint is equivalent to integer; longword is equivalent to Cardinal. There are three types as follows:
// The static method is default. If it is not a virtual method or pure virtual method, it is a static method.
// The class method is the unit unit1 method that can be accessed through the class name; interfaceuses windows, messages, sysutils,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service