NASM Forum > Programming with NASM

How to sum 2 numbers (in Gnu/linux assembly x80_64 & Nasm)?

<< < (3/3)

Ferran:
@federicopissarra

I have a question .Why is not needed in


--- Code: --- mov   [rsi],dl      ; store it on the buffer.

--- End code ---

to add 48 to dl like an ASCII code ?

fredericopissarra:

--- Quote from: Ferran on September 08, 2020, 03:06:31 PM ---I have a question .Why is not needed in


--- Code: --- mov   [rsi],dl      ; store it on the buffer.

--- End code ---

to add 48 to dl like an ASCII code ?

--- End quote ---
You really did't study the code, did ya?
Look at previous instruction. And read the comments.

Ferran:
You don't said that '0' represents the ascii code directly, but i thought you should add a 48 in decimal, or a 30h in hexadecimal, or octal or elsewhere, because adding 48 in decimal it let forward 48 positions in the ascii table to locate the equivalent sign in ascii code, so it will be readable. If it is possible do it adding with a '0' it's allright.

I see you are a bit negative with me. Never miind,  I just have to thank you for all your help.

fredericopissarra:

--- Quote from: Ferran on September 09, 2020, 04:02:20 PM ---You don't said that '0' represents the ascii code directly
--- End quote ---
Why should I?


--- Quote from: Ferran ---but i thought you should add a 48 in decimal, or a 30h in hexadecimal, or octal or elsewhere, because adding 48 in decimal it let forward 48 positions in the ascii table to locate the equivalent sign in ascii code, so it will be readable. If it is possible do it adding with a '0' it's allright.
--- End quote ---
You do know '0' is the same thing as 48 or 0x30 or 060 or 0b00110000, don't ya?

Navigation

[0] Message Index

[*] Previous page

Go to full version