The assignment directive does not assign a new value to a character in emu8086

Why the following code does not assign a new value to a character Xusing the 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
+6
source share
1 answer

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

Integers defined with the = directive can be overridden with a different value in the source code, but those defined using EQU cannot.

If you compile it using MASM or TASM, the code should work as you expect, showing 6instead 8.

EMU8086 , , . , , .

EMU8086, ; ; BIOS DOS Int 21h . 32- 64- , , , . EMU8086 - , - .

+4

All Articles