A Tale Of Two Assemblers by Rudy Velthuis

  • Автор темы emailx45
  • 56
  • Обновлено
  • 15, May 2020
  • #3

Скрытая информация :: Авторизуйтесь для просмотра »
PTR.

But if the compiler can deduce from the other operand what you are storing, you can omit the size specification, e.g. MOV [.D+Decimal.Sign],AL does not require a BYTE specification.


The syntax BYTE PTR, WORD PTR, etc.

is not allowed in NASM.

You must use BYTE, WORD, etc.

That is why I put the empty define PTR in delphi.mac.

Now you can use BYTE PTR, etc.

just like in your BASM code.

Note that PTR is not required in BASM either, so if you want to make (new) code compatible, don’t use it.

Comments are different.

In NASM, there are only single line comments that start with a semicolon ( and end at the end of the line.

The Delphi syntax // is regarded a numerical operator in NASM.

To make new code more easily convertible to NASM, you can use the combination ;// to start a comment in both syntaxes.

In Delphi, this is seen as a statement separator ; followed by a comment //, while in NASM it is simply seen as a comment ;.

Case sensitivity for labels/variables is the default.

You can use the preprocessor commands %idefine and %ixdefine to define case insensitive labels/variables, but the NASM pseudo-instruction EQU seems to be case sensitive.

EQU has the advantage that you really define a constant (which can not be inadvertently redefined) and not just some preprocessor text.

Note that instructions, like MOV EAX,EDX are not case sensitive. So if you are used to writing those in lower case, or mixed case, there is no need to convert that to upper case. Only variables/labels are generally case sensitive.

Instructions are single line by default too. If you want them to spill into the next source line, you must use the \ continuation character. This applies to the preprocessor too.


 

emailx45


Рег
05 May, 2008

Тем
607

Постов
1273

Баллов
7343
Тем
49554
Комментарии
57426
Опыт
552966

Интересно