| RTL reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link To |
| Learning Assembler with Delphi | |||||||||||||||||||||
| Page 2: Basic Assembler Operations, Special cases, multiply and divide, Labels and Jumps, Controlling the flow | |||||||||||||||||||||
Basic Assembler Operations
reg1, reg2,... refer to any of the general 32bit registers eax, ebx, ecx and edx.
mem1, mem2,... refers to any memory expression either explicit [1536], implicit [edx]
or pascal pointer Count. The brackets refer to the contents of the value, so [edx] is the memory location at address edx. The compiler knows a pascal pointer is a memory expression so brackets aren't required.
exp1, exp2... explicit values such as 10 in decimal, 0Ah in hex.
dest refers to the parameter into which the result of the operation will be stored.
src refers to the source of any extra data required by the operation.
For each operation at least one of dest and src must be a register or an implicit memory address, ie a memory address dependant on the value of a specified register.
And now to the operations:
add dest,src and dest,src dec dest inc dest mov dest,src not dest or dest,src shl dest,src shr dest,src sub dest,src
reg1,reg2 xor dest,src Special cases, multiply and divide div src idiv src mul src imul src Labels and Jumps Note that the declaration of a delphi label starts with '@' and ends with ':'. The reference of a label does not include the ':'.
Controlling the flow
cmp dest,src Whilst the jump operations are equivalent to a goto statement, the call and its associated ret operation form the basis of procedural programming. It is common to see assembler routines of the following form
Furthermore, conditional calls can be constructed thus
Using a combination of compare's, conditional jump's and procedural call's all of the elements of structured programming maybe implemented.
Next page > A proper example - using asm instructions > Page 1, 2, 3, 4, 5
|
|||||||||||||||||||||
All graphics (if any) in this feature created by Zarko Gajic.
| More Delphi |
|
· Learn another routine every day - RTL Quick Reference. · Download free source code applications and components. · Talk about Delphi Programming, real time. · Link to the Delphi Programming site from your Web pages. · Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC. |
|
· NEXT ARTICLE:
Searching for data - DB/9. Chapter nine of the free Delphi Database Course for beginners. Walking through various methods of data seeking and locating while developing ADO based Delphi database applications. |
| Stay informed with all new and interesting things about Delphi (for free). |
|
|
| Got some code to share? Got a question? Need some help? |

