Date: Thu, 23 Dec 1999 11:53:19 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: "mus.bouayad" cc: djgpp AT delorie DOT com Subject: Re: Djgpp and Nasm In-Reply-To: <01bf4e8c$665fb700$33e58aa4@kalashnikow> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 23 Dec 1999, mus.bouayad wrote: > Hello,I have still problems with using nasm with DJGPP. > Here is the code : > [...] > _CLVga: push ebp > mov ebp,esp > > push dword[VideoRAM] > pop es > xor di,di > xor eax,eax > mov cx,0x3E80 > rep stosd See section 17.4 of the DJGPP FAQ list. You must save and restore all registers except EAX, ECX, and EDX, otherwise bad things will happen. Specifically, your code clobbers ES (which absolutely MUST be preserved, since GCC-generated code assumes DS=SS=ES) and EDI. In addition, there might be a much more serious problem here: if VideoRAM stores a real-mode segment of the video memory, this will crash in protected mode, because in protected mode you cannot load segment registers such as ES with arbitrary values, only with valid selectors. In this case, you need to use the _dos_ds selector and compute the offset as 16*VideoRAM. (It might be much easier to simply use provided library functions _farpokel or dosmemput.)