MASM has been king in the BIOS world for a while. For Phoenix, MASM 6 was a big step forward because it added some higher level constructs and the support for strong/weak externals, on which the entire build system is based. But we've been stuck on MASM 6.11 for a while. Why? Beacuse starting in MASM 6.12, Microsoft started making changes which weren't backward compatible with earlier versions. Strong/weaks worked differently. EXTERNDEF worked differently. So we've been stuck in a time warp. New features have been added. The product was discontinued. In fact, recently, the only place to get MASM 6.11 these days was from the copy included with an assembly-language programming tutorial.
But not any more. Actually, starting with TrustedCore SP3a, we've been testing against MASM 8.0, which is shipped as part of Visual Studio 2005. We worked closely with Microsoft engineers to smooth out the support of 16-bit both in the assembler and the linker.
One of the great things about MASM 8.0 (other than faster compile times) is the stricter type checking. Initially, this caused us a little grief, since new errors started popping up in our code. For example:
xlat cs:[bx]
works fine with MASM 6.11, but in MASM 8.0 it generates "error A2023: instruction operand must have size" MASM 8 requires the size to be explicitly specified:
xlat BYTE PTR cs:[bx]
In one case, it actually caught a latent bug in our code:
test ax, 10000300h
MASM 6.11 would let this slide by. But MASM 8 realizes that "10000300h" has a significant bit set in bit 28, which can't possibly fit in the ax register. Result: "error A2022: instruction operands must be the same size"
Here's another problem statement:
PAUSE MACRO
DB 0F3h, 090h
ENDM
This generates "error A2008: syntax error : MACRO" with MASM 8.0. Why? Well, since MASM 8.0 supports the latest processor instructions, PAUSE is now a reserved word. Since we'd been using MASM 6.11, we'd created a macro for the instruction. Since the same code needed to work on both MASM 6.11 and MASM 8.0, we added:
IF @Version LE 700
There are other little quirks, like not allowing numbers as the first letter in labels or '$' now having an explicit size (32 or 64-bits). Probably the most disappointing part of MASM 8 is that Microsoft decided to split the assembler: one for 32-bit and one for 64-bit. And the 64-bit version is missing a lot of the polish of its older brother. It doesn't support many of the higher level constructs or calling conventions. So no .IF, .WHILE or automatic declaration of function parameters. Minor nits include no support for C++ function name decoration and no support for register-based calling conventions (such as __fastcall). These just make it trickier when you have to integrate 32-bit and 64-bit assembly code with C & C++.
I'm downloading Visual Studio 2005 SP1 (release 16 December 2006) as I type this and it may have an upgraded version of MASM. If so, I'll let you know how it works.
Tim


