Date: Thu, 2 Feb 1995 15:37:28 +0500 From: ld AT netrix DOT com To: DJGPP AT sun DOT soe DOT clarkson DOT edu, CZIWKGA AT vmsfe DOT ulcc DOT ac DOT uk Subject: Re: Request for advice with djgpp, ASPI manager and them _go32_dpmi* functions > From djgpp-bounces AT sun DOT soe DOT clarkson DOT edu Thu Feb 2 12:30 EST 1995 > Date: Thu, 2 Feb 95 11:18 GMT > From: "Kevin Ashley, Systems Development, ULCC" > To: DJGPP > Subject: Request for advice with djgpp, ASPI manager and them _go32_dpmi* > functions > My comments begin with +++: > I'm hoping someone can shed some advice which might get me started and then > hopefully I can make more progress on my own. [A lot of code snipped.] > ************* > void ( *aspi)(void *) = (void *) 0; > > void aspiinit() > { > int h,i; > long l; > #ifdef __GO32__ > #include > _go32_dpmi_registers inregs; > _go32_dpmi_seginfo dosmem1,dosmem2; > #else > union REGS inregs; > union REGS outregs; > #endif > char *getenv(), *tapeid; > > if ( (h=open("SCSIMGR$",0)) == -1 ) { > perror("Opening ASPI Manager"); > exit(1); > } > > /* > * This is an ioctl(READ) to the "SCSIMGR$". > * It returns the entrypoint of the aspi-module (far pointer) > * in the 4 bytes, pointed to by the dx register. > */ > > inregs.x.ax = 0x4402; > inregs.x.cx = 4; > inregs.x.bx = h; > #ifdef __GO32__ > dosmem1.size = 1; +++ dosmem1.size = (sizeof (aspi) + 15) / 16; > inregs.x.ss = inregs.x.sp = inregs.x.flags = 0; > if(_go32_dpmi_allocate_dos_memory(&dosmem1)) { > printf("Unable to allocate DOS memory\n"); > exit(1); > } > printf("Alloc DOS mem returns RS: %x RO: %x size: %d\n", > dosmem1.rm_segment,dosmem1.rm_offset,dosmem1.size); > inregs.x.dx = dosmem1.rm_segment*16; +++ inregs.x.dx = dosmem1.rm_offset; +++ inregs.x.ds = dosmem1.rm_segment; > i = dosmem1.rm_segment*16; > > dosmemget(dosmem1.rm_segment*16,sizeof(int),&aspi); +++ dosmemget(dosmem1.rm_segment*16 + dosmem1.rm-offset, ...); > printf("Aspi entry before int is %x\n",(int) aspi); > i = _go32_dpmi_simulate_int(0x21,&inregs); > printf("File was %d, int returns %d\n",h,i); > dosmemget(dosmem1.rm_segment*16,sizeof(int),&aspi); +++ dosmemget(dosmem1.rm_segment*16 + rm_offset, ...) > _go32_dpmi_free_dos_memory(&dosmem1); > printf("Aspi entry is %x\n",(int) aspi); > exit(1); > ********** Hope that helps, Long.