Page 1 of 1

What is meaning about INITSEG in file bootsect.s?

Posted: Tue Feb 19, 2013 3:19 am
by leetow2003
I read the file bootsect.s,I think the INITSEG is constant,
Look:

Code: Select all

.text
BOOTSEG  = 0x07c0			
INITSEG  = 0x9000
...
entry start
start:
	mov	ax,#BOOTSEG
	mov	ds,ax
	mov	ax,#INITSEG
	mov	es,ax
...
        jmpi	go,INITSEG
...
if
mov ax,INITSEG
means "Go to the memory location 0x9000, get the value stored there, and put that value into the A register."
and
jmpi go,INITSEG
means "jump immediate under all conditions to the far address go + 0x9000 and continue execution there."

so I am puzzled,why I can't realize:
jmpi go,INITSEG
it mean:"jump to the memory location 0x9000,get the value stored there, then to the far address go + the value , and continue execution there."?

Re: What is meaning about INITSEG in file bootsect.s?

Posted: Tue Feb 19, 2013 3:40 am
by Antti
You did not understand correctly. This looks like early Linux source code.

Code: Select all

.text
BOOTSEG  = 0x07c0
INITSEG  = 0x9000
   ...

entry start
start:
   mov   ax,#BOOTSEG           ; Register ax has value 0x07c0
   mov   ds,ax                 ; Segment register ds has value 0x07c0
   mov   ax,#INITSEG           ; Register ax has value 0x9000
   mov   es,ax                 ; Segment register es has value 0x9000

   ...

   jmpi   go,INITSEG           ; Far jump

go:
   nop                         ; Code is executing at 0x9000:go
                               ; Register cs has value 0x9000 and
                               ; register ip has value of "go" label.

Re: What is meaning about INITSEG in file bootsect.s?

Posted: Tue Feb 19, 2013 4:50 am
by leetow2003
Antti wrote:You did not understand correctly. This looks like early Linux source code.

Code: Select all

.text
BOOTSEG  = 0x07c0
INITSEG  = 0x9000
   ...

entry start
start:
   mov   ax,#BOOTSEG           ; Register ax has value 0x07c0
   mov   ds,ax                 ; Segment register ds has value 0x07c0
   mov   ax,#INITSEG           ; Register ax has value 0x9000
   mov   es,ax                 ; Segment register es has value 0x9000

   ...

   jmpi   go,INITSEG           ; Far jump

go:
   nop                         ; Code is executing at 0x9000:go
                               ; Register cs has value 0x9000 and
                               ; register ip has value of "go" label.
I want to know: jmpi go,INITSEG,just now INITSEG is equal to 0x9000,
and mov ax,#INITSEG,just now #INITSEG is also equal to 0x9000,
INITSEG is equal to #INITSEG?
but
mov ax,#INITSEG
mov ax,INITSEG
they are not the same meaning.
How to realize #INITSEG and INITSEG?

Re: What is meaning about INITSEG in file bootsect.s?

Posted: Tue Feb 19, 2013 3:19 pm
by dozniak
leetow2003 wrote: jmpi go,INITSEG ; Far jump

INITSEG is equal to #INITSEG?
The interpretation of the values for far jump is different. jmpi could not read a value at address INITSEG, because this is segment number specification, so it is interpreted literally as "jmp far 0x9000:go"