Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

MASM 5.10 (Announce)

posted by Japheth Homepage, Germany (South), 16.10.2007, 14:06

> In fact, MASM 5.10 silently translates in the object file the above
> instruction to
>
>     btr word ptr 0x4a[bx],bx

Yes, MASM "silently " generates the opcode which is expected ... not that surprisingly, since an opcode which uses a 8bit register as second operand simply doesn't exist.

On another occasion, however, MASM v5.1 "silently" generates code which most likely isn't exactly what was expected:

125E  33 DB                    I_Term: xor     bx,bx                   ;Zero BX-reg. for below.
 1260  80 7F 0A 20                      cmp     [bx+DvrNam-@].lb,' '    ;Is driver "name" valid?
 1264  75 0A                            jne s   I_SetN                  ;Yes, eliminate any spaces.
 1266  C7 47 0A 4455                    mov     [bx+DvrNam-@],"DVDU"    ;Set our default "name".
 126B  C7 47 0E 2031                    mov     [bx+DvrNam+4-@],"   1"
 1270  BE 0F79                  I_SetN: mov     si,(TTLName+8-@)        ;Set driver "name" in title.


Here the opcodes at 1266 and 126B will move a WORD, but I bet it is expected that a DWORD is moved instead.

I detected this issue because I tried to assemble UIDE.ASM with Open Watcom's WASM. Although WASM is far away from MASM v6 compatibility, it should - almost - work with v5.1 sources. With UIDE source, WASM has 2 problems:

1. A label followed by a DB pseudo-code in the very same line (EndIO):

        pop     ax              ;Reload returned I-O error code.
        stc                     ;Set carry again to denote error.
EndIO:  db      0EAh            ;Return to driver "exit" logic.
        dw      (Exit-@)
@RtnSeg dw      0               ;(Driver segment address, Init set).
        db      0               ;(Unused alignment "filler").


is perfectly legal with MASM v5.1, but v6.x complains and WASM generates a wrong opcde. Since it doesn't cost much, one might consider to separate such lines:

        pop     ax              ;Reload returned I-O error code.
        stc                     ;Set carry again to denote error.
EndIO:
        db      0EAh            ;Return to driver "exit" logic.
        dw      (Exit-@)
@RtnSeg dw      0               ;(Driver segment address, Init set).
        db      0               ;(Unused alignment "filler").


2. WASM doesnt like the brackets around "short":

s equ     <short>           ;Default conditional jumps to "short".

This is a WASM bug. Adding a comment for WASM users might be useful.


After these "trivial" adjustments, WASM/WLINK generated a perfectly valid UIDE.SYS.

---
MS-DOS forever!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 266 users online (0 registered, 266 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum