I'm working in x86 assembly in 16bits. I have three files that need to share 'variables between them' - basically, the data segment. When I compile them, as in the following:
ml file1.asm,file2.asm,file3.asm io.lib
They cannot access each other's variables How do I share a data segment, and thus variables between the files? Thank you!
Just about like in C, you create a header (usually given the extension ".inc") that contains external declarations for what's contained in another file, as in:
;file def_data.asm:
.586P
.model flat, c
.data
myword dd ?
end
; file def_data.inc:
externdef myword:dword
; file use_data.asm:
.586P
.model flat, c
include def_data.inc
.code
myproc proc
mov eax, myword
myproc endp
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With