예제 #1
0
METHODDEF void
write_ems_store(j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count)
{
	EMScontext      ctx;
	EMSspec         spec;

	spec.length = byte_count;
	SRC_TYPE(spec) = 0;
	SRC_HANDLE(spec) = 0;
	SRC_PTR(spec) = buffer_address;
	DST_TYPE(spec) = 1;
	DST_HANDLE(spec) = info->handle.ems_handle;
	DST_PAGE(spec) = (unsigned short)(file_offset / EMSPAGESIZE);
	DST_OFFSET(spec) = (unsigned short)(file_offset % EMSPAGESIZE);

	ctx.ds_si = (void far *)&spec;
	ctx.ax = 0x5700;			/* move memory region */
	jems_calldriver((EMScontext far *) & ctx);
	if(HIBYTE(ctx.ax) != 0)
		ERREXIT(cinfo, JERR_EMS_WRITE);
}
METHODDEF void
read_ems_store (backing_store_ptr info, void FAR * buffer_address,
		long file_offset, long byte_count)
{
  EMScontext ctx;
  EMSspec spec;

  spec.length = byte_count;
  SRC_TYPE(spec) = 1;
  SRC_HANDLE(spec) = info->handle.ems_handle;
  SRC_PAGE(spec)   = (unsigned short) (file_offset / EMSPAGESIZE);
  SRC_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE);
  DST_TYPE(spec) = 0;
  DST_HANDLE(spec) = 0;
  DST_PTR(spec)    = buffer_address;
  
  ctx.ds_si = (void far *) & spec;
  ctx.ax = 0x5700;		/* move memory region */
  jems_calldriver((EMScontext far *) & ctx);
  if (HIBYTE(ctx.ax) != 0)
    ERREXIT(methods, "read from expanded memory failed");
}