Date: Fri, 29 Aug 1997 18:20:44 -0700 (PDT) Message-Id: <199708300120.SAA04558@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Mike Darrett , djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: software interrupts Precedence: bulk At 01:11 8/29/1997 -0700, Mike Darrett wrote: >it goes like this, but the colors are the WRONG ONES. I know it has >something to do with the way I'm issuing a software interrupt from >the 32-bit code, but I tried everything, from __dpmi_int() to int86() for >the int 10 function (this function takes a pointer in ES:DX pointing to >palette data and updates the video palette). The FAQ's DJ wrote said just >use int86() and forget about ES, ... But only for certain INT 21h functions. You have to put your palette into conventional memory in order to get a real-mode pointer to it. (Incidentally, DJ didn't write the FAQ's all by himself. Eli Zaretskii is the maintainer, and there's a long list of contributors, of whom DJ is one.) >point palette[256]; >void SetPalette(void) >{ > union REGS r; > int i; > > r.x.dx = r.x.di = (unsigned long)palette; > r.x.ax = 0x1012; > r.x.bx = 0; > r.x.cx = 256; > int86( 0x10, &r, &r ); >} Try this instead. It uses the transfer buffer for simplicity. #include #include #include void SetPalette(void) { __dpmi_regs r; dosmemput(palette,sizeof(palette),__tb); /* __tb is the transfer buffer */ /* I assume the transfer buffer is big enough; it's normally 4K */ r.x.es = __tb >> 4; /* the segment part */ r.x.dx = r.x.di = __tb & ~0x0f; /* the offset part */ r.x.ax = 0x1012 r.x.bx = 0; r.x.cx = 256; __dpmi_int(0x10,&r); } I haven't tested this but I suspect it'll work. Also: You might check to see whether the compiler is keeping your `palette' array packed appropriately. Sometimes it pads it, which I think is not the right thing here. If sizeof(point) == 3, you should be fine. Nate Eldredge eldredge AT ap DOT net