From: "R.G. Morgan" Newsgroups: comp.os.msdos.djgpp Subject: Trying to write to the Code Segment Date: 21 Nov 1996 09:03:39 GMT Organization: University of Newcastle upon Tyne, UK Lines: 34 Sender: n6368757 AT glen7 DOT ncl DOT ac DOT uk (R.G. Morgan) Distribution: world Message-ID: <5715tb$s6f@whitbeck.ncl.ac.uk> NNTP-Posting-Host: glen7.ncl.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I'm trying to add some 32-bit code on to the end of my code segment, and wondered if this is the right way of doing it: 1) Get segment limit of code segment 2) Increase segment limit of code by about 4k 3) Get an alias selector for the selector in cs 4) Use __dpmi_get_descriptor to get descriptor, edit type field to data/read-write 5) Use __dpmi_set_descriptor on alias to get writable data segment at same addresses as the code segment. 6) Copy the code from the data segment (it's in a buffer) to the new selector, which I've put in es. Up until 6), nothing's complained, and I assumme it has worked - so, does this sound reasonable? It crashes just before beginning to copy with a general protection error, but the error print-out gives ds and es as having the selector 0xA7, whereas mine is 0x1A4 (or something). Does this mean that the selector hasn't loaded, or that the exception code has replaced my selectors with it's own. (although the CS limit has been changed) PS this is for the protected mode interface of the VBE2 specification, if you were wondering. PPS do the asm constraints "esi" (foo), "edi" (bar) work? I seem to get errors if I try and use them. --- Richard Morgan R DOT G DOT Morgan AT ncl DOT ac DOT uk