VOGONS


First post, by erisk

User metadata

Hello,
I've a little problem executing the following code in DosBOX:

        
mov ah, 48h
mov bx, 0xFFFF
int 21h

That to try to find the biggest block of memory available.
I obtain as result "error code 8" (expected in that case) but with 'bx' set to zero (!) available memory blocks (instead of a reasonable number, for example 0x1000 😁 )
Something different happens if i start my program after execution of loadfix.com. Always, also in this case, the result is always low (typical 0x81 16-bytes blocks that is 2064 bytes)
I've looked for here and on the Internet but I've not found any useful clue.
Can someone help me?
The version of dosbox is 0.63 under Windows 2000.

bYe
ErIsK

Reply 1 of 4, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

you are probably running it from a .com file
those get maximum memory by default.

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 4, by Guest

User metadata

Thanks for the immediate answer! 😊 .
Anyway I would point out that it is not a .COM file but a relocatable .exe instead. It's only an excerpt of a program, obviously.

The same code execute as I expect if I run it under pure dos.
Furthermore, if it were a .COM, then also after use of "loadfix" I shouldn't find any free memory, do I?.

bYe
ErIsK

Reply 3 of 4, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

yeah the loadfix thing had me puzzled as well.

you could register on this forum so you can attach the file.
This way It's easier to check as in principle we return the amount of freeblocks in bx. I don't know why it doesn't in your case. so it's probably related to the whole of the program.

Water flows down the stream
How to ask questions the smart way!

Reply 4 of 4, by Guest

User metadata

Ok, as usual, it's a programmer' mistake! 😢
The assembler I had used for the dosbox version of my test program (FASM) had built a PSP section with bytes 0Ah, 0Bh set to "0xFFFF", so all memory was allocated to the program itself (like a .COM do).
The "pure" DOS version I had tested was builded with an older version of MASM (maybe buggy(?)).
The right way is to shrink the allocated memory (using int 21h, 4A) to a more reasonable size than "all".

Thanks for your advice anyway. Your first think about COM files was really worth!

bYe
ErIsK