6

Why doesn't the following code assign new value to a symbol X using Assignment Directive ( = ) in emu8086:

.model small
.data

        X = 8

.code
.startup

       mov ax, @data
       mov ds, ax

       mov bx, X

       X = 6      

       mov bx, X 

       mov ah, 02h
       mov dx, bx   
       add dx, 48
       int 21h     ; It should display 6 but instead it display 8. 

       mov ah, 04ch
       int 21h

end
Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Ahtisham
  • 9,170
  • 4
  • 43
  • 57
  • 2
    Appears to be a bug or deficiency in EMU8086. With MASM and TASM you are allowed to redefine a constant value that has been defined with `=` . Seems EMU8086 takes the original value and ignores subsequent changes – Michael Petch Nov 28 '17 at 15:37
  • Yes i check it in **GUI TURBO ASSEMBLER** and there it worked. Should i report it ? – Ahtisham Nov 28 '17 at 15:55
  • I have no idea if EMU8086 is still maintained. I couldn't find an email address or other mechanism to report on bugs. – Michael Petch Nov 28 '17 at 15:58
  • emu8086 is full of bugs :( i found two of them ( including this one ) – Ahtisham Nov 28 '17 at 16:06
  • 2
    I'm happy to upvote anything pointing out reasons not to use emu8086, including bugs. – Peter Cordes Nov 28 '17 at 16:16

1 Answers1

4

EMU8086 has a bug/deficiency. Your interpretation of how the = directive works is correct:

Integers defined with the = directive can be redefined with another value in your source code, but those defined with EQU cannot.

If you compile this with MASM or TASM the code should work as you expect by displaying 6 instead of 8.

EMU8086 hasn't been updated in years and I do not believe it is currently being maintained. It doesn't appear there is a bug reporting system or bug related email address associated with the product.

If you are looking for a reason not to use EMU8086 then the lack of maintenance; known bugs; and limited BIOS and DOS Int 21h compatibility should be reasons to find other tools to do the job. Writing 32-bit and 64-bit code native to the OS you are on is a more ideal approach. EMU8086 is a good instructional tool, but shouldn't be used for any serious work.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • 1
    Well i am just learning assembly 8086 i am not planing to write serious code in it but if i do then i would prefer TASM for the same. btw thanks for the answer appreciated – Ahtisham Nov 29 '17 at 04:05
  • 1
    btw i did not learnd the difference between `EQU` & `=` directives on the net instead i learnd it on a book namely **The 8088 and 8086 Microprocessors** – Ahtisham Nov 29 '17 at 04:12