[comp.os.msdos.programmer] Need help with overlays

krist@stsci.EDU (John Krist) (10/03/90)

  Greetings:

     I have been having some problems developing overlays and hope someone
  out there in NetLand can help me.

     I'm writing graphics device drivers which are loaded in as overlays
  using the DOS 21h interupt EXEC overlay function.  I'm using Turbo C
  (actually Turbo C++), but I am not using their (Borland's) overlays.
  I set aside memory with the allocmem function and load in the overlay
  using an intdosx call.  The overlay is of the form:

  	CSEG  blah blah blah 'code'

	initov  proc  far
	    (Returns the offsets of the other routines, calling program
	     sets up the segment)
        initov  endp

	firstproc proc far
	    blah blah blah
	firstproc endp

	  ...
        
	lastproc proc far
	    blah blah blah
	lastproc endp

	CSEG  ends
	END

  Standard type of stuff.  It works fine, until I added just one more 
  procedure.  After I did that, any routine in the overlay would execute
  properly, but would hang the system when it returned.  I tossed out
  various procedures, and it would still hang as long as there were a certain
  number of procedures (or the code was above a certain size, perhaps).
  The exe size of the working code is about 2000, and the non-working code is
  about 2500 bytes.  There is plenty of memory and stack allocated for the 
  thing to use.

  This is driving me nuts.  Any help would be appreciated.

  John Krist
  krist@stsci.edu
  Space Telescope Science Institute
  Baltimore, Md