>What's wrong with this (it is perfectly legal and works with WASM):
> movsx ax,al
> There is no need to specify size when the source is a register.
> This is different though:
> movsx eax,[bx]
You made a good point. It seems that registers really
should never need "? ptr" syntax which was my point
to begin with. The size is implied in the register name
itself. And when you do an indirection such as [bx]
then the source operand is indeed in memory so the
syntax makes sense since [bx] is a pointer and the
size specifier is sometimes needed as you indicated.
Unfortunately, wasm permits:
movsx ax,byte ptr al
and interprets al as a register and not a label. That is
the problem because the programmer can't access
a variable named al. But since you never need to write
"? ptr" prefix before a register name (as you have
demonstrated), why would it be bad to alter the
assembler so that, when "? ptr" is encountered prior
to a label that happened to be the same as a register
name then the assembler would then recognize it as
a memory address instead of a register. However,
wasm doesn't allow you to create a public label in
memory such as ax and flags an error. Apparently,
register names are reserved words and can't be used as
variable or other label names. If I write:
ax: db "This is a test",0
...then wasm complains about the colon. For
_ax: db "This is a test",0
...there is no error. And when you write:
ax db "This is a test",0
...wasm does not complain. Looks like I can create
a label with a register name as long as I don't use a
colon. However, I can't access it because the following
generates an operand error complaint by wasm:
lea eax,byte ptr ax
Looks like there are inconsistencies in wasm and
in x86 assembly language beyond just Watcom.