I think this will solve your problem. Dos, when loading a .com file, sets cs = ds = es . Not so, when loading the .exe cs format is indicated on your code, of course, but ds (and es ?) Are indicated on your PSP (program segment prefix), which is usually not located where your data lives ... You must configure ds (and es if you are going to use it).
"Why study the 16-bit build?" this is a good question. "Why study at a meeting at all?" this is another good question. Most likely, you will never write anything “serious” with him. But this allows you to find out what is happening “under the hood” in such a way that the HLL will not, and 16-bit allows you to understand the segmented memory model. 32-bit code is also segmented, but while the segments are “different,” they usually point to the same memory, and you can generally ignore “em” - the OS takes care of all this for you.
Also, some of us are crazy enough to think it's fun!
source share