Легенда:
новое сообщение
закрытая нитка
новое сообщение
в закрытой нитке
старое сообщение
|
- Напоминаю, что масса вопросов по функционированию форума снимается после прочтения его описания.
- Новичкам также крайне полезно ознакомиться с данным документом.
Да ты прав... 12.12.01 16:34 Число просмотров: 1031
Автор: Heromantor Статус: Незарегистрированный пользователь
|
Мда старею,забываю....
Since an EXE file may be loaded on any segment, all absolute segment
references (such as FAR CALLs, long address pointers, and references such
as MOV AX,data_seg) must be adjusted to work for the memory location in
which they are loaded. Here are the steps used by the DOS program loader
(fn 4bH ) to load an EXE file:
1. Create a PSP via DOS Fn 26H.
2. Read 1cH bytes of the EXE file (the formatted portion of the EXE
header) into a local memory area.
3. Determine the load module size:
size=((wPageCnt*512)-(wHdrSize*16))-wPartPage
4. Determine file offset of load module = (wHdrSize * 16)
5. Select a segment addr, START_SEG, for loading (usually PSP+10H)
6. Allocate enough memory to hold the load module, honoring the
settings in wMaxMem and wMinMem.
7. Read the load module into memory starting at START_SEG:0000
8. LSEEK to the start of the relocation table (wTablOff)
9. For each relocation item (wReloCnt):
a. read the item as two 16-bit words (I_OFF,I_SEG)
b. add RELO_SEG=START_SEG+I_SEG (find the address of
relocation ref)
c. fetch the word at RELO_SEG:I_OFF (read current value)
d. add START_SEG to that word (perform the segment fixup)
e. store the sum back at its original address (RELO_SEG:I_OFF)
10. Allocate memory for the program according to wMaxMem and wMinMem
11. Initialize registers and execute the program:
a. ES = DS = PSP
b. Set AX to indicate the validity of drive IDs in command line
c. SS = START_SEG+ReloSS, SP = ExeSP
d. CS = START_SEG+ReloCS, IP = ExeIP
|
- Куча - TROi 11.12.01 21:51 [569] [штраф:10]
|
|
|