News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

upper case to lower case

Started by scooter4483, March 02, 2006, 09:26:36 PM

Previous topic - Next topic

Mark Jones

If someone's gonna make this into a help file, please include TenKey's info:

Quote from: Ten-Key, old MASM forum Dec 01, 2004
The bracket notation is a legacy from the original Intel assemblers for the 8086 processors.

The brackets are used for only one purpose - to indicate that a register is being used for addressing. Everything else inside the brackets is used as-is, without any form of adjustments or indirection.

The whole thing would make a lot more sense if you were restricted to writing address operands in these forms only:

mov eax,address_expression
mov eax,address_expression[ecx]
mov eax,address_expression[ecx*4]
mov eax,address_expression[ecx+edx]
mov eax,address_expression[ecx+edx*4]
mov eax,constant_expression[ecx]
mov eax,constant_expression[ecx*4]
mov eax,constant_expression[ecx+edx]
mov eax,constant_expression[ecx+edx*4]
mov eax,[ecx]
mov eax,[ecx*4]
mov eax,[ecx+edx]
mov eax,[ecx+edx*4]

That should cover all possible addressing modes. *4 can be replaced by *1, *2, or *8. You can replace ECX and EDX with any other register. Exceptions: ESP cannot be multiplied, ESP cannot be added to ESP.

The assembler can handle these forms of address_expression:

segment_register:constant_expression
label_name
$
address_expression + constant_expression
address_expression - constant_expression
address_expression.field_name
address_expression.struct_name.field_name

(MASM 6 changed operator precedence - earlier versions allowed -5[EBP], but MASM 6 wants (-5)[EBP] or [EBP-5].)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08