• Please review our updated Terms and Rules here

PC BIOS function int 21, 48

it was specific to the original post which was not built with large memory model, AFAIR. obviously far is not needed in a large memory model as all pointers are then far by default.
Ok, I see what happened now.

I interpreted "you need to declare it as a far pointer, regardless of the memory model your using" as "regardless of which memory model you are using - even large - you MUST declare pointers as far and do a far cast in order to convert from an integer type".

Whereas you meant "you can overcome that problem simply by using a far pointer, and that works no matter what memory model you are using - even e.g. small".
 
Reading some old posts about using this dos int, I found why it is failing in my code.
If you use this int 21,48 function, you can't use any malloc, calloc or any other related function which uses malloc internaly in the code, because most malloc implementations will delete (or not see ) the blocks allocated with this function.
This is interesting as I have been trying to get my own allocation fuction running, was facing similar problem and could not find anything on it. For me it behaved a little differently, the memory got allocated by using function 48h, but then any malloc call would fail. Not delete or not see the allocated block, just return NULL every time. It did work the other way around, use malloc then my function. But it still prevents me from using it, especially as I did not realize fopen, fread... etc. also use malloc internally.
Its a disappointment as I wanted to make my TSR program small but using as little of the libraries as possible, using only the file fuctions, which I dont really feel like rewriting.
 
Back
Top