I have known a value assignment instruction (mov) of an Assembly and an addition instruction (ADD), so I can give an example.
For example: Add ax, BX; this is equivalent to ax: = AX + bx in Delphi;
In addition, a list is provided in advance-Delphi can use assembler to manage the following registers:
32-bit register: eax EBX ECx edX ESP EBP ESI EDI
16-bit register: ax bx cx dx sp bp Si Di
8-bit register: Al BL Cl DL Ah BH ch DH
16-bit register: cs ds ss es and coprocessor register stack: St
Unit unit1; interfaceuses windows, messages, extensions, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} // use the function add (X, Y: integer) of the Assembly function: integer; var count: integer; begin ASM mov eax, X {put the X value into the register eax} mov ECx, y {put the Y value into the register ECx} Add eax, ECx {put the value of eax + ECx into eax} mov count, eax {returns the eax value to the variable count} end; Result: = count; {return value} {each statement in ASM can be divided into sentences by line feed. No need to add it here.} end; // Test Procedure tform1.button1click (Sender: tobject); var I: integer; begin I: = add (2, 4); showmessage (inttostr (I); {6} end; end.
Supplemented comments and clauses embedded in the Assembly:
1. Comments are the same as those in Delphi.
2. You can use semicolons (;) to separate sentences.
3. Use line breaks
4. You can even use comments to separate sentences.