Home > other >  Real mode, assembly code is run, cs is how to determine the ds ss address?
Real mode, assembly code is run, cs is how to determine the ds ss address?

Time:04-13

As follows, to run after, cs ds ss three register will automatically appear memory address, the address is how to determine the excuse me? I didn't write in the code,

 
Assume cs: code, ds: data, ss: stack

The data segment
XXXXXXXXXXXXXXXXXXXXXX
The data ends

Ss segment
XXXXXXXXXXXXXXXXXXXXXX
Ss ends

Code segment
XXXXXXXXXXXXXXXXXXXXXX
Code ends

End

CodePudding user response:

The loader is done, you can refer to here:
https://zhidao.baidu.com/question/215505232.html

CodePudding user response:

Cs is designated by the end start start label when loaded into memory segment segment address, if you here behind the end statement didn't specify the program where to start, when the link should be alarm but will still be generated exe files, cs will point to the beginning of the program effective content, here is the data segments and in fact is wrong, so it should be end start to specify where to start program;
Ds is refers to the PSP program, should be directed to the data segment, procedures should be carried out their assignment;
Ss look at the situation, as the code SSS segment without stack modifiers to indicate it is a stack segment, the first paragraph is pointing to the program, sp=0000, once the pressure of stack will wrap to the end; Specifies if the SSS segment stack, is pointing to the SSS segment (ss is segment registers, reserved words, cannot do the section name), at the end of the sp is SSS; No mention of stack section, a link will call the police, but for ordinary simple program, there is no problem, can be ignored; Dosbox handling of ss seems to have different, it's no use in the stack when specified, the default set to move forward than DOS is smaller than the DOS 1, don't know there is a bug or any other consideration,
  • Related