News:

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

can this works mov al,[ebx+ecx*edx]

Started by keersun, January 22, 2005, 10:29:03 AM

Previous topic - Next topic

Ghirai

mov al, byte ptr[ebx+ecx*edx] should work.
MASM32 Project/RadASM mirror - http://ghirai.com/hutch/mmi.html

lifewire

no, it shouldn't work for 100% sure. you can only multiply (read: shift to left) with these immediates: 1 2 4 and 8

ghirai: the byte ptr is redundant, as al is an 8 bit register the assembler knows for sure that you want to use 8 bits, there can be no confusion.


hutch--

Just to tidy up some of the comments here, MASM is normally written in a form of shorthand which means in most instances that you don't need to specifiy the SIZE of the data in complex memory addressing mode if the assembler already has a way of determining the size. Where this shorthand cannot be used is when there is no way for the assembler to determine the data size.


mov [eax+ecx*4+64], 1    ; error

This is because the complex addressing mode is a memory operand and "1" is an immediate value and neither operand tells thew assembler what SIZE is used. In this context you use the data SIZE specifier to tell the assembler the size.


mov WORD PTR [eax+ecx*4+64], 1


It is the ambiguity that produces the problem and the corresponding requirement to specify the size.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php