Subversion Repositories SvarDOS

Rev

Rev 949 | Rev 963 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 949 Rev 957
Line 226... Line 226...
226
  }
226
  }
227
}
227
}
228
 
228
 
229
 
229
 
230
/* allocates bytes of far memory, flags it as belonging to rmod
230
/* allocates bytes of far memory, flags it as belonging to rmod
231
 * the new block can be optionally flagged as 'ident' (if not null)
231
 * the new block can be optionally flagged as 'ident' (if not null) and zero
-
 
232
 * out the newly allocated memory.
232
 * returns a far ptr to the allocated block, or NULL on error */
233
 * returns a far ptr to the allocated block, or NULL on error */
233
void far *rmod_fmalloc(unsigned short bytes, unsigned short rmod_seg, char *ident) {
234
void far *rmod_fcalloc(unsigned short bytes, unsigned short rmod_seg, char *ident) {
234
  unsigned short far *owner;
235
  unsigned short far *owner;
235
  unsigned short newseg = 0;
236
  unsigned short newseg = 0;
236
 
237
 
237
  /* ask DOS for a memory block (as high as possible) */
238
  /* ask DOS for a memory block (as high as possible) */
238
  _asm {
239
  _asm {
Line 287... Line 288...
287
    for (i = 0; (i < 8) && (ident[i] != 0); i++) { /* field's length is limited to 8 bytes max */
288
    for (i = 0; (i < 8) && (ident[i] != 0); i++) { /* field's length is limited to 8 bytes max */
288
      mcbdesc[i] = ident[i];
289
      mcbdesc[i] = ident[i];
289
    }
290
    }
290
  }
291
  }
291
 
292
 
-
 
293
  /* zero out the memory before handing it out */
-
 
294
  _fmemset(MK_FP(newseg, 0), 0, bytes);
-
 
295
 
292
  return(MK_FP(newseg, 0));
296
  return(MK_FP(newseg, 0));
293
}
297
}
294
 
298
 
295
 
299
 
296
/* free memory previously allocated by rmod_ffmalloc() */
300
/* free memory previously allocated by rmod_fcalloc() */
297
void rmod_ffree(void far *ptr) {
301
void rmod_ffree(void far *ptr) {
298
  unsigned short ptrseg;
302
  unsigned short ptrseg;
299
  unsigned short myseg = 0;
303
  unsigned short myseg = 0;
300
  unsigned short far *owner;
304
  unsigned short far *owner;
301
  if (ptr == NULL) return;
305
  if (ptr == NULL) return;