LATEST POSTS - page 4


x86-64 TUTORIAL: FACTORIAL WITH RECURSION

The calculation of a factorial of a number can be done using recursion. Below is the algorithm:

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: CONDITIONAL OPERATIONS WITHOUT BRANCHING

The regular JMP and conditional Jcc jump instructions change the course of working code, the latter based on the runtime status of certain bits in the RFLAGS register. The x86 and x86-64 processors implement pipelining of instructions where they prefetch a certain number of instructions and evaluate them before time. The number of instructions prefetched is dependent on the prefetch input queue (PIQ).

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: BIT SHIFTING OPERATIONS

Logical shifts are operations in which the bits of a register or memory location are moved to the right or left by a certain number or a value in the CL register. They are also a very quick way to multiply or divide by 2 or powers of 2 as it involves just a shift of bits. There are 4 shift bit instructions, 4 rotate bit instructions and 2 double precision shift bit instructions for general purpose registers.

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: FIND PRIME NUMBERS

Below is a code snippet that prints a list of prime numbers, one on each line, based on a limit entered by the user. It uses both while loops and conditional branch if - else statements. We shall convert this to an assembly program to demonstrate implementation of these control flow structures in x86-64 assembly.

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: MULTIPLICATION & DIVISION

In the Hello World sample program we had used the instructions REPNZ and SCASB to calculate the length of the string being printed at runtime. In this program we use NASM’s equ directive to calculate the length during assembly time as opposed to at runtime. The variable promptlen gives an example.

Read More
Posted on by Vikas N. Kumar.

Pages: Newer  |  2  |  3  |  4  |  5  |  6  |  Older
SUPPORT THIS SITE
Donate DOGECOIN to DBevjMg3fd8C5oxZbV8sFpAffo6Tas1s8Q. DBevjMg3fd8C5oxZbV8sFpAffo6Tas1s8Q Donate BITCOIN to 19hrWWw1dPvBE1wVPfCnH8LqnUwsT3NsHW. 19hrWWw1dPvBE1wVPfCnH8LqnUwsT3NsHW
As an Amazon Associate I earn from qualifying purchases.