Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assignment directive not assigning new value to a symbol in emu8086

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
like image 355
Ahtisham Avatar asked Nov 28 '17 15:11

Ahtisham


1 Answers

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.

like image 198
Michael Petch Avatar answered Nov 09 '22 18:11

Michael Petch