Date: Tue, 14 Mar 2000 09:53:35 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Alistair_P SHILTON cc: djgpp AT delorie DOT com Subject: Re: self-mod code and DJGPP - writable code segment? In-Reply-To: <8ak78h$dsd$1@mulga.cs.mu.OZ.AU> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 14 Mar 2000, Alistair_P SHILTON wrote: > I was wondering if it is possible to link self-modifying assembler > code to DJGPP. When I try, I get an error message. So I checked > the documentation, which says that the code segment is not writable. > Is there some way around this? Yes, put the assembly code into a data variable. This will allow to modify it using the DS selector, but also to execute it using the CS selector, since DJGPP runtime is set up so that both CS and DS have the same base address and the same limit. (Translation: they both reference the same memory area.)