Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!mit-eddie!bacchus!husc6!bu-cs!bucsb.bu.edu!madd From: madd@bucsb.bu.edu.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Funtion 4BH of interruption 21H Message-ID: <717@bucsb.bu.edu.UUCP> Date: Wed, 4-Feb-87 19:44:31 EST Article-I.D.: bucsb.717 Posted: Wed Feb 4 19:44:31 1987 Date-Received: Sat, 7-Feb-87 10:04:13 EST References: <1379@imag.UUCP> Reply-To: madd@bucsb.bu.edu.UUCP (Jim "Jack" Frost) Distribution: world Organization: ODO (Organization for the Disorganization of Organization) Lines: 46 In article <1379@imag.UUCP> serge@imag.UUCP (Serge ROUVEYROL de la ROUVETIERE) writes: >We have got a problem with the function 4BH of interruption 21H (load only) > >We don't understand : > > -if the PSP is created or not ? No. It assumes that your program that issued the load command already has a psp. Which of course it does, since that was created when it was exec'ed. The Tech Ref manual specifically states that it does not. > -if we must allocate the memory ourselves or if the INT 21H do it for us You must load into memory that is already allocated. This is not specifically stated, but you can pull this info out by reading between the lines. They say that it was intended for memory overlays in programs. Therefore, they expect you to be overlaying stuff you already had there. Therefore, you must have already allocated the memory. > -How to calculate the start segment ? > Is it the segment address obtained by memory allocation? You have to calculate the start segment on your own. If you have a large code segment (large enough to need overlays) then it can be assumed that you needed to create a transient section -- a section that you load in a function when it's needed. This would be the start segment. Remember that the code you are loading in must expect itself to be loaded in at that offset from the beginning of the program (C Segment) or everything will be screwed up. You can use the segment obtained by memory allocation, but remember that your cs register still points to the original code segment. Since you don't know where new memory might be allocated, it's not really a wise idea to go allocating memory then throwing code into it and calling it. Most likely you'll crash everything (unless you are tricky and set the cs value for the loaded section, storing the original value somewhere. But this in itself is pretty hairy and not really a good idea). Again, the load function was intended to be used in OVERLAYS. If you think of it in terms of overlays, the way it works makes sense. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - Jim Frost * The Madd Hacker - UUCP: ..!harvard!bu-cs!bucsb!madd | ARPANET: madd@bucsb.bu.edu CSNET: madd%bucsb@bu-cs | BITNET: cscc71c@bostonu -------------------------------+---+------------------------------------ "Oh beer, oh beer." -- Me | [=(BEER) <- Bud the Beer (cheers!)