Programming against 16-bit segmented memory models may be educational and fun, and perhaps even slightly useful if you want to do retro-computing work, but for the most part if you want to learn modern assembly language it's a total waste of time.
i think it can be useful even so. Since i don't know asm well yet, it would be nice to start with something not so complicated. Other reason is that i'll have to use api calls for some of my demands, since windows runs in protected mode. Can i be wrong?
What's your end goal with learning ASM?
hmm, actually i haven't ever thought about it. Maybe it's just my interest?
So, there are a few things here:
1. For learning modern assembly, or even embedded assembly, 16 bit DOS is not the way to go. If you really want to learn some embedded assembly, pickup an arduino/propeller/arm educational board and get started there. If your goal is to learn modern assembly, then you're in for a rocky road, but you should get started on the x64 end of things, as it gives you significantly more registers to play with.
thanks for your answer, i hope i'll made it to x64 mode eventually, but i want to know any basics of asm.
2. Regarding int21h/48h: Depending on how the exe/com file is built, you may need to first free all the memory your application is not using (depending on header flags, etc. DOS can allocate the entire remaining free chunk to you already). As for how DOS does its allocations, it has a lot of tools available to it, one simple way would be a linked list or similar behavior as your typical heap allocator. Another would be to use a bitmask, etc. Microsoft doesn't specify, mainly because it is not an important implementation detail to know about.
well, but how does dos search free mem block? Does it allocate whole segment to mem block? I mean, why is mem block located at AX:0000?
Edited by devdber, 03 October 2013 - 12:55 PM.